/* =========================================================
   AhoVNdict Note – v1.7
   - Force scroll list (no shrinking/packing cards)
   - Upgrade modal inside drawer
   - Very high z-index so it appears over Ahobook fullscreen
   ========================================================= */

:root{
  --note-blue: #2563eb;
  --note-blue2:#1d4ed8;
  --note-bg: #ffffff;
  --note-text:#0f172a;
  --note-muted:#64748b;
  --note-border: rgba(226,232,240,.9);
  --note-shadow: 0 20px 60px rgba(2,6,23,.22);
}

#ahfc-toggle{ z-index: 250000 !important; }
#ahfc-drawer{ z-index: 250001 !important; }

#ahfc-toggle{
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,.25);
  background: rgba(255,255,255,.92);
  color: var(--note-blue2);
  box-shadow: 0 14px 34px rgba(2,6,23,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}
#ahfc-toggle:hover,
#ahfc-toggle:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 18px 42px rgba(2,6,23,.22);
  outline:none;
}
#ahfc-toggle:active{ transform: translateY(-50%) scale(.985); }
#ahfc-toggle svg{ width: 22px; height: 22px; }

#ahfc-badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background:#ef4444;
  color:#fff;
  font-size:11px;
  font-weight:900;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 22px rgba(239,68,68,.40);
}

#ahfc-drawer{
  position: fixed;
  top: 12px;
  bottom: 12px;
  right: -460px;
  width: 420px;
  max-width: calc(100vw - 24px);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(226,232,240,.9);
  box-shadow: var(--note-shadow);
  display:flex;
  flex-direction:column;
  overflow: hidden;
  transition: right .26s cubic-bezier(.4,0,.2,1);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
  color: var(--note-text);
  min-height: 0;
}
#ahfc-drawer.ahfc-open{ right: 12px; }

#ahfc-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px 12px;
  color:#fff;
  background: linear-gradient(90deg, var(--note-blue), var(--note-blue2));
  flex: 0 0 auto;
}

#ahfc-title{
  font-weight: 900;
  font-size: 15px;
  letter-spacing:.02em;
}

#ahfc-close{
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 20px;
  cursor:pointer;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
}

#ahfc-list{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 14px;

  background:
    radial-gradient(900px 300px at 20% -20%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(900px 300px at 90% 0%, rgba(34,197,94,.08), transparent 55%),
    #ffffff;
}

.ahfc-empty{
  color: var(--note-muted);
  text-align:center;
  margin-top: 48px;
  font-weight: 700;
}

.ahfc-card{
  flex: 0 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--note-border);
  box-shadow: 0 12px 26px rgba(2,6,23,.08);
}

.ahfc-tap{
  padding: 16px 16px 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ahfc-front{
  padding: 18px 16px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(37,99,235,.06));
  border: 1px solid rgba(191,219,254,.9);
}

.ahfc-back{
  padding: 16px 16px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(34,197,94,.05));
  border: 1px solid rgba(187,247,208,.95);
  display:none;
}

.ahfc-card.ahfc-flipped .ahfc-front{ display:none; }
.ahfc-card.ahfc-flipped .ahfc-back{ display:block; animation: noteIn .18s ease; }

@keyframes noteIn{
  from{ opacity:0; transform: translateY(-4px) scale(.99); }
  to  { opacity:1; transform: translateY(0) scale(1); }
}

.ahfc-kanji{
  font-size: 30px;
  font-weight: 950;
  color: #1e40af;
  text-align:center;
  letter-spacing:.3px;
  line-height: 1.2;
  word-break: break-word;
}

.ahfc-reading{
  font-size: 14px;
  color: #166534;
  font-weight: 900;
  margin-bottom: 6px;
  word-break: break-word;
}

.ahfc-meaning{
  font-size: 13px;
  color: var(--note-text);
  margin-bottom: 10px;
  line-height: 1.6;
  word-break: break-word;
}

.ahfc-example{
  font-size: 12px;
  color: var(--note-muted);
  font-style: italic;
  border-top: 1px dashed rgba(22,163,74,.35);
  padding-top: 10px;
  line-height: 1.6;
  word-break: break-word;
}

.ahfc-subhint{
  margin-top: 10px;
  text-align:center;
  font-size: 11px;
  color: rgba(100,116,139,.9);
  font-weight: 800;
}

.ahfc-card-actions{
  display:flex;
  align-items:center;
  padding: 10px 12px 12px;
  gap: 10px;
}

.ahfc-btn-del{
  margin-left:auto;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.9);
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.ahfc-btn-del:hover{ background:#f1f5f9; }

/* ---------------------------
   Upgrade modal (inside drawer)
---------------------------- */
#ahfc-modal{
  position: absolute;
  inset: 0;
  display: none;
}

#ahfc-modal.ahfc-show{
  display: block;
}

.ahfc-modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(2,6,23,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ahfc-modal-card{
  position:absolute;
  left: 12px;
  right: 12px;
  top: 80px;
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 22px 60px rgba(2,6,23,.30);
  overflow:hidden;
}

.ahfc-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 12px;
  background: linear-gradient(90deg, #ef4444, #f97316);
  color:#fff;
}

.ahfc-modal-title{
  font-weight: 950;
  font-size: 14px;
  letter-spacing: .02em;
}

.ahfc-modal-x{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.14);
  color:#fff;
  font-size: 20px;
  cursor:pointer;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
}

.ahfc-modal-body{
  padding: 14px 12px 6px;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.6;
}

.ahfc-modal-actions{
  padding: 10px 12px 12px;
  display:flex;
  justify-content:flex-end;
}

.ahfc-modal-btn{
  border: 1px solid rgba(2,6,23,.12);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  font-weight: 900;
  font-size: 13px;
}

@media (max-width: 480px){
  #ahfc-drawer{
    top: 8px; bottom: 8px;
    right: -100vw;
    width: calc(100vw - 16px);
    border-radius: 18px;
  }
  #ahfc-drawer.ahfc-open{ right: 8px; }
  #ahfc-toggle{ right: 10px; width: 50px; height: 50px; }
  .ahfc-modal-card{ top: 70px; }
}