/* ─── AUTH & PREMIUM STYLES ──────────────────────────────────────── */

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,8,0.85);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s var(--ease);
  pointer-events: none;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-box {
  background: rgba(255, 252, 248, 0.98);
  border: 1.5px solid rgba(212, 114, 138, 0.22);
  border-radius: var(--r-xl);
  padding: 2rem;
  max-width: 420px; width: 90%;
  box-shadow: 0 8px 40px rgba(44, 24, 16, 0.14), 0 4px 16px rgba(212, 114, 138, 0.10);
  transform: translateY(20px) scale(0.95);
  transition: transform .3s var(--ease);
  position: relative;
}
.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute; top: .75rem; right: .75rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all .2s;
}
.modal-close:hover { background: rgba(212, 114, 138, 0.12); color: var(--text); }

/* Auth inputs */
.auth-input {
  width: 100%; padding: .65rem .85rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(212, 114, 138, 0.25);
  border-radius: var(--r);
  color: var(--text); font-size: .9rem;
  font-family: 'Nunito', sans-serif;
  margin-bottom: .6rem;
  transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus {
  border-color: #D4728A;
  box-shadow: 0 0 0 3px rgba(212, 114, 138, 0.12);
  outline: 2px solid transparent;
}
.auth-input:focus-visible {
  outline: 2px solid #D4728A;
  outline-offset: 2px;
}
.auth-input::placeholder { color: var(--text-dim); }

/* Google button */
.btn-google-signin {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .7rem;
  background: rgba(255, 255, 255, 0.90);
  border: 1.5px solid rgba(212, 114, 138, 0.22);
  border-radius: var(--r);
  color: var(--text); font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: all .2s var(--ease);
  font-family: 'Nunito', sans-serif;
}
.btn-google-signin:hover {
  background: #fff;
  border-color: rgba(212, 114, 138, 0.45);
  box-shadow: 0 2px 10px rgba(44, 24, 16, 0.08);
}

/* Auth divider */
.auth-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1rem 0; color: var(--text-dim); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(212, 114, 138, 0.18);
}

/* Auth links */
.auth-link {
  background: none; border: none;
  color: #D4728A; font-size: .78rem;
  cursor: pointer; text-decoration: none;
  font-family: 'Nunito', sans-serif;
  transition: color .2s;
}
.auth-link:hover { color: #3B4A6B; text-decoration: underline; }

/* Auth messages */
.auth-error {
  background: rgba(212, 114, 138, 0.08);
  border: 1px solid rgba(212, 114, 138, 0.30);
  color: #A8526A; padding: .5rem .75rem;
  border-radius: var(--r); font-size: .82rem;
  margin-top: .75rem;
}
.auth-success {
  background: rgba(127, 168, 110, 0.10);
  border: 1px solid rgba(127, 168, 110, 0.30);
  color: #3D6B2E; padding: .5rem .75rem;
  border-radius: var(--r); font-size: .82rem;
  margin-top: .75rem;
}

/* Account menu dropdown */
.account-menu {
  position: fixed; top: 55px; right: 1rem; z-index: 9999;
  background: rgba(255, 252, 248, 0.98);
  border: 1.5px solid rgba(212, 114, 138, 0.22);
  border-radius: var(--r-lg);
  min-width: 200px;
  box-shadow: 0 8px 30px rgba(44, 24, 16, 0.12);
  animation: slideDown .2s var(--ease);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-menu-item {
  display: block; width: 100%;
  background: none; border: none;
  padding: .6rem 1rem;
  color: var(--text-muted); font-size: .85rem;
  cursor: pointer; text-align: left;
  font-family: 'Nunito', sans-serif;
  transition: all .15s;
}
.account-menu-item:hover {
  background: rgba(212, 114, 138, 0.08);
  color: var(--text);
}

/* Header auth area */
.header-auth {
  display: flex; align-items: center; gap: .5rem;
  margin-left: auto;
}
#auth-btn {
  background: rgba(212, 114, 138, 0.08);
  border: 1.5px solid rgba(212, 114, 138, 0.28);
  color: #D4728A;
  padding: .35rem .85rem;
  border-radius: 2rem;
  font-size: .78rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s var(--ease);
  white-space: nowrap;
}
#auth-btn:hover {
  border-color: #D4728A;
  background: rgba(212, 114, 138, 0.14);
  color: #C05878;
}
.auth-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }

#premium-badge {
  display: none;
  align-items: center; gap: .25rem;
  font-size: .65rem; font-family: 'Nunito', sans-serif; font-weight: 800;
  color: #C4963A;
  background: rgba(196, 150, 58, 0.10);
  border: 1.5px solid rgba(196, 150, 58, 0.30);
  padding: .15rem .5rem;
  border-radius: 1rem;
}

/* Premium modal features */
.premium-features {
  display: flex; flex-direction: column; gap: .85rem;
}
.premium-feature {
  display: flex; gap: .75rem; align-items: flex-start;
}
.premium-feature p {
  color: var(--text-muted); font-size: .78rem; margin-top: .15rem;
}
.premium-feature strong {
  font-size: .9rem; color: var(--text);
}
.premium-check {
  color: var(--gold); font-size: 1.1rem; font-weight: 700;
  min-width: 20px; text-align: center;
}

/* ─── AD SLOTS ──────────────────────────────────────────────────── */
.ad-slot {
  text-align: center;
  margin: 1.5rem auto;
  padding: .75rem;
  max-width: 728px;
  min-height: 90px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.06);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .7rem;
  font-family: 'Space Mono', monospace;
}
.ad-slot.hidden { display: none; }

/* ─── COOKIE CONSENT ────────────────────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
  background: rgba(255, 252, 248, 0.98);
  border-top: 1.5px solid rgba(212, 114, 138, 0.22);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
  animation: slideUp .4s var(--ease);
  backdrop-filter: blur(16px);
  box-shadow: 0 -4px 20px rgba(44, 24, 16, 0.08);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.cookie-banner p {
  color: var(--text-muted); font-size: .82rem; flex: 1;
}
.cookie-banner a { color: #D4728A; }
.cookie-btn {
  padding: .45rem 1.2rem;
  border-radius: var(--r);
  font-size: .8rem; font-weight: 700;
  cursor: pointer; border: none;
  font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.cookie-btn-accept {
  background: #D4728A; color: #fff;
  box-shadow: 0 2px 8px rgba(212, 114, 138, 0.30);
}
.cookie-btn-accept:hover { background: #C05878; }
.cookie-btn-decline {
  background: rgba(212, 114, 138, 0.06);
  border: 1.5px solid rgba(212, 114, 138, 0.22);
  color: var(--text-muted);
}
.cookie-btn-decline:hover {
  background: rgba(212, 114, 138, 0.10);
  color: var(--text);
}

/* ─── PREMIUM DASHBOARD CARD ───────────────────────────────────── */
.premium-cta {
  background: linear-gradient(135deg, rgba(196,150,58,0.08), rgba(212,114,138,0.06));
  border: 1.5px solid rgba(196, 150, 58, 0.30);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  cursor: pointer;
  transition: all .25s var(--ease);
  margin-bottom: 1.5rem;
}
.premium-cta:hover {
  border-color: rgba(196, 150, 58, 0.55);
  box-shadow: 0 4px 18px rgba(196, 150, 58, 0.14);
}
.premium-cta-icon { font-size: 1.8rem; }
.premium-cta-text strong { color: #C4963A; display: block; font-size: .95rem; }
.premium-cta-text span { color: var(--text-muted); font-size: .8rem; }

/* ─── SUBSCRIBE BUTTON ──────────────────────────────────────────────── */
.btn-gold {
  display: block;
  background: linear-gradient(135deg, #C4963A, #D4A84A);
  color: #fff; border: none; font-size: 1.05rem;
  padding: .85rem 2rem; border-radius: 2rem; cursor: pointer;
  font-weight: 800; width: 100%; text-align: center;
  box-shadow: 0 4px 16px rgba(196, 150, 58, 0.35);
  transition: transform .2s ease, box-shadow .2s ease;
  font-family: 'Nunito', sans-serif;
}
.btn-gold:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(196, 150, 58, 0.5); }
.btn-gold:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* ─── PER-CHARACTER ANALYTICS ───────────────────────────────────────── */
.analytics-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
  font-family: 'Space Mono', monospace;
}
.analytics-table th {
  text-align: left; padding: .4rem .6rem;
  color: var(--text-dim); font-weight: 400;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
}
.analytics-table td { padding: .45rem .6rem; vertical-align: middle; }
.analytics-table tr:hover td { background: rgba(255,255,255,0.03); }
.analytics-char { font-size: 1.3rem; font-family: 'Noto Sans JP', sans-serif; }
.analytics-romaji { color: var(--text-muted); font-size: .75rem; display: block; }
.accuracy-bar-wrap {
  width: 80px; height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle;
}
.accuracy-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.accuracy-pct { font-size: .78rem; margin-left: .4rem; vertical-align: middle; }
.analytics-gate {
  text-align: center; padding: 1.5rem;
  border: 1.5px solid rgba(196,150,58,0.3);
  border-radius: var(--r-lg); margin-top: .5rem;
}

/* ─── STREAK FREEZE BADGE ───────────────────────────────────────────── */
.freeze-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; padding: .2rem .6rem; border-radius: 1rem;
  background: rgba(100,180,255,0.1);
  border: 1px solid rgba(100,180,255,0.25);
  color: #7ab8f5; font-family: 'Space Mono', monospace;
}
.freeze-badge.used { opacity: .5; }

/* ─── AD SLOT RESPONSIVE ────────────────────────────────────────────── */
.ad-slot { overflow: hidden; }
@media (max-width: 728px) { .ad-slot { min-height: 50px; } }

/* ─── DARK MODE OVERRIDES ───────────────────────────────────────── */
html[data-theme="dark"] .modal-overlay { background: rgba(0,0,8,0.90); }
html[data-theme="dark"] .modal-box { background: linear-gradient(135deg, rgba(20,0,40,0.95), rgba(5,0,15,0.98)) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow), 0 0 60px rgba(255,0,128,0.15) !important; }
html[data-theme="dark"] .modal-close:hover { background: rgba(255,0,128,0.15) !important; }
html[data-theme="dark"] .auth-input { background: rgba(255,255,255,0.04) !important; border-color: rgba(255,255,255,0.1) !important; }
html[data-theme="dark"] .auth-input:focus { border-color: var(--red) !important; box-shadow: 0 0 12px rgba(255,0,128,0.2) !important; }
html[data-theme="dark"] .btn-google-signin { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.15) !important; }
html[data-theme="dark"] .btn-google-signin:hover { background: rgba(255,255,255,0.10) !important; border-color: rgba(255,255,255,0.25) !important; box-shadow: none !important; }
html[data-theme="dark"] .auth-divider::before, html[data-theme="dark"] .auth-divider::after { background: rgba(255,255,255,0.08) !important; }
html[data-theme="dark"] .auth-link { color: var(--sakura) !important; font-family: 'Space Mono', monospace !important; }
html[data-theme="dark"] .auth-link:hover { color: var(--text) !important; }
html[data-theme="dark"] .auth-error { background: rgba(255,0,128,0.10) !important; border-color: rgba(255,0,128,0.30) !important; color: #ff4488 !important; }
html[data-theme="dark"] .auth-success { background: rgba(57,255,20,0.08) !important; border-color: rgba(57,255,20,0.25) !important; color: var(--success) !important; }
html[data-theme="dark"] .account-menu { background: linear-gradient(135deg, rgba(20,0,40,0.97), rgba(5,0,15,0.99)) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow) !important; }
html[data-theme="dark"] .account-menu-item { font-family: 'Space Mono', monospace !important; }
html[data-theme="dark"] .account-menu-item:hover { background: rgba(255,0,128,0.08) !important; }
html[data-theme="dark"] #auth-btn { background: rgba(255,255,255,0.05) !important; border-color: var(--glass-border) !important; color: var(--text-muted) !important; font-family: 'Space Mono', monospace !important; }
html[data-theme="dark"] #auth-btn:hover { border-color: var(--red) !important; color: var(--text) !important; background: rgba(255,0,128,0.08) !important; }
html[data-theme="dark"] #premium-badge { font-family: 'Orbitron', sans-serif !important; color: var(--gold) !important; background: rgba(240,255,0,0.08) !important; border-color: rgba(240,255,0,0.25) !important; }
html[data-theme="dark"] .cookie-banner { background: linear-gradient(135deg, rgba(20,0,40,0.97), rgba(5,0,15,0.99)) !important; border-top-color: var(--glass-border) !important; box-shadow: none !important; }
html[data-theme="dark"] .cookie-banner a { color: var(--sakura) !important; }
html[data-theme="dark"] .cookie-btn { font-family: 'Space Mono', monospace !important; }
html[data-theme="dark"] .cookie-btn-accept { background: var(--red) !important; box-shadow: none !important; }
html[data-theme="dark"] .cookie-btn-accept:hover { background: var(--red-dark) !important; }
html[data-theme="dark"] .cookie-btn-decline { background: rgba(255,255,255,0.05) !important; border-color: rgba(255,255,255,0.1) !important; color: var(--text-muted) !important; }
html[data-theme="dark"] .cookie-btn-decline:hover { background: rgba(255,255,255,0.10) !important; color: var(--text) !important; }
html[data-theme="dark"] .btn-gold { box-shadow: 0 4px 20px rgba(196,150,58,0.4) !important; }
html[data-theme="dark"] .analytics-table th { border-bottom-color: rgba(255,255,255,0.06) !important; }
html[data-theme="dark"] .analytics-table tr:hover td { background: rgba(255,255,255,0.04) !important; }
html[data-theme="dark"] .accuracy-bar-wrap { background: rgba(255,255,255,0.1) !important; }
html[data-theme="dark"] .analytics-gate { border-color: rgba(196,150,58,0.25) !important; }
html[data-theme="dark"] .freeze-badge { background: rgba(100,180,255,0.08) !important; border-color: rgba(100,180,255,0.2) !important; }
