/* ============================================================================
   app.css — মুক্তিবেগ ফ্ল্যাশকার্ড WEB CLIENT DESIGN SYSTEM
   ----------------------------------------------------------------------------
   EXACT replica of the mobile app theme (src/theme/colors.ts) —
   3 modes: light (default) / dark (Gemini style) / high-contrast.
   Toggle: html[data-theme="light|dark|contrast"] — cycled by app.js.
   ============================================================================ */

/* ------------------------------ THEME TOKENS ------------------------------ */
:root, html[data-theme="light"] {
  --background: #b1d6f7;
  --surface: #fff1f1;
  --surface-highlight: #e8ecf0;
  --text-primary: #1F1F1F;
  --text-secondary: #444746;
  --text-tertiary: #8E918F;
  --primary: #0B57D0;
  --border: #E0E0E0;
  --accent-medical: #1967D2;
  --accent-hsc: #E37400;
  --accent-exam: #D93025;
  --accent-stats: #188038;
  --success: #1E8E3E;
  --error: #D93025;
  --guest-purple: #7C3AED;
  --varsity-purple: #8E44AD;
  --job-orange: #FB8C00;
  --upgrade-bg: var(--primary);
  --upgrade-fg: #FFFFFF;
  --overlay: rgba(0, 0, 0, 0.5);
  --shadow-card: 0 3px 6px rgba(0, 0, 0, 0.10);
  --shadow-float: 0 8px 16px rgba(0, 0, 0, 0.18);
  --brand-logo: url('/brand/muktibeg_logo_light.png');
  --border-width: 0px;
  --input-border-width: 1px;
}

html[data-theme="dark"] {
  --background: #131314;
  --surface: #1E1F20;
  --surface-highlight: #2D2E30;
  --text-primary: #E3E3E3;
  --text-secondary: #C4C7C5;
  --text-tertiary: #444746;
  --primary: #8AB4F8;
  --border: #444746;
  --accent-medical: #4285F4;
  --accent-hsc: #FBBC04;
  --accent-exam: #EA4335;
  --accent-stats: #34A853;
  --success: #81C995;
  --error: #F28B82;
  --upgrade-bg: #ADD8E6;
  --upgrade-fg: #000000;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-card: 0 3px 6px rgba(0, 0, 0, 0.45);
  --shadow-float: 0 8px 16px rgba(0, 0, 0, 0.6);
  --brand-logo: url('/brand/muktibeg_logo_dark.png');
  --border-width: 0px;
  --input-border-width: 1px;
}

html[data-theme="contrast"] {
  --background: #000000;
  --surface: #000000;
  --surface-highlight: #1A1A1A;
  --text-primary: #FFFFFF;
  --text-secondary: #FFFF00;
  --text-tertiary: #FFFFFF;
  --primary: #00FFFF;
  --border: #FFFFFF;
  --accent-medical: #00FFFF;
  --accent-hsc: #FFFF00;
  --accent-exam: #FF00FF;
  --accent-stats: #00FF00;
  --success: #00FF00;
  --error: #FF0000;
  --upgrade-bg: #ADD8E6;
  --upgrade-fg: #000000;
  --overlay: rgba(0, 0, 0, 0.7);
  --shadow-card: none;
  --shadow-float: none;
  --brand-logo: url('/brand/muktibeg_logo_light.png');
  --border-width: 2px;
  --input-border-width: 2px;
}

/* ------------------------------- BASE / LAYOUT ---------------------------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  /* 🔤 Bengali typography (2026-10-07 spec): Noto Serif Bengali primary,
     Noto Sans Bengali fallback (glyphs Serif misses), then system stacks. */
  font-family: 'Noto Serif Bengali', 'Noto Sans Bengali', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: var(--primary); text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

/* The phone-like app container — exact mobile app proportions */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-frame {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 40px 16px;
}

.app-content { flex: 1; padding-top: 8px; }

/* ------------------------------ BRAND HEADER ------------------------------ */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 6px 0;
  user-select: none;
}

.brand-logo {
  width: 44px;
  height: 50.5px; /* aspect 494/432 */
  background-image: var(--brand-logo);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .brand-logo--light { background-image: url('/brand/muktibeg_logo_dark.png'); }
.brand-logo--dark { background-image: url('/brand/muktibeg_logo_dark.png'); }

.brand-header .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-header .brand-name { font-size: 19px; font-weight: 800; color: var(--text-primary); }
.brand-header .brand-tagline {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Large variant — auth screens */
.brand-header--full { flex-direction: column; gap: 12px; padding: 28px 0 12px 0; }
.brand-header--full .brand-logo { width: 84px; height: 96.1px; }
.brand-header .brand-logo { width: 44px; height: 50.5px; }
.brand-header--full .brand-name { font-size: 28px; }
.brand-header--full .brand-tagline { font-size: 12px; letter-spacing: 1.5px; }

/* ------------------------------ TOP BAR ----------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border-bottom: var(--border-width) solid var(--border);
  padding: 8px 12px;
  margin: 0 -16px;
  box-shadow: var(--shadow-card);
}

.topbar .topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 20px;
}

.topbar .icon-btn:hover { background: var(--surface-highlight); }
.topbar .icon-btn svg { width: 24px; height: 24px; }

.topbar .icon-btn .badge-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  background: #D93025;
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.hamburger-btn { display: none; }

/* ------------------------------ LEFT SIDEBAR ------------------------------ */
.sidebar {
  width: 272px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: var(--border-width) solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 45;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px 16px;
}

.sidebar-head .brand-logo { width: 38px; height: 43.5px; }
.sidebar-head .brand-text { line-height: 1.15; }
.sidebar-head .brand-name { font-size: 15px; font-weight: 800; color: var(--text-primary); }
.sidebar-head .brand-tagline { font-size: 8.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.7px; }

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFF;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-profile .profile-info { flex: 1; min-width: 0; }
.sidebar-profile .profile-name { font-size: 15px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .profile-email { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .tier-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-highlight);
  color: var(--primary);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
.sidebar-profile .tier-badge.premium { background: rgba(227, 116, 0, 0.18); color: var(--accent-hsc); }

.sidebar-profile .edit-profile-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 17px;
  padding: 6px;
  border-radius: 8px;
}
.sidebar-profile .edit-profile-btn:hover { background: var(--surface-highlight); }

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 14px 18px 6px 18px;
  letter-spacing: 0.4px;
}

.sidebar-nav { padding: 0 12px; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: background 0.15s ease;
}

.sidebar-nav .nav-item:hover { background: var(--surface-highlight); }

.sidebar-nav .nav-item.active {
  background: var(--surface-highlight);
  font-weight: 700;
}

.sidebar-nav .nav-item .nav-icon-chip {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.sidebar-nav .nav-item .nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav .nav-item .chev { color: var(--text-secondary); font-size: 18px; }
.sidebar-nav .nav-item .nav-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #D93025;
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.sidebar-nav .nav-item .new-dot { width: 8px; height: 8px; border-radius: 4px; background: #E37400; margin-left: 4px; }

/* Sidebar settings — ONE LINE EACH (compact rows) */
.sidebar-settings { padding: 4px 18px 10px 18px; border-top: 1px solid var(--border); margin-top: 10px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
}

.setting-row .setting-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

.seg-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.seg-control button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-control button + button { border-left: 1px solid var(--border); }
.seg-control button.active { background: var(--surface-highlight); color: var(--primary); }
.seg-control button:hover:not(.active) { background: var(--surface-highlight); }

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 18px;
  padding: 10px;
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 8px;
  background: transparent;
  color: var(--error);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.sidebar-logout:hover { background: rgba(217, 48, 37, 0.08); }

.sidebar-version {
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 4px 0 14px 0;
}

.sidebar-backdrop { display: none; }

/* --------------------------- MOBILE: DRAWER MODE -------------------------- */
@media (max-width: 991px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: var(--shadow-float);
    z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .hamburger-btn { display: flex; }
  .app-frame { max-width: none; padding: 0 14px 40px 14px; }
}

/* ------------------------------ HOME / MENU CARDS ------------------------- */
.greeting-row { display: flex; align-items: center; margin-top: 12px; }
.greeting-text { font-size: 16px; font-weight: 500; color: var(--text-secondary); }
.user-name-text { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 2px 0 0 0; }

.section-title { font-size: 18px; font-weight: 700; color: var(--text-secondary); margin: 18px 0 14px 0; }

.menu-card {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-left: 5px solid var(--accent-medical);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-float); }
.menu-card:active { transform: scale(0.97); }
.menu-card.locked { opacity: 0.62; }

.menu-card .menu-icon-container {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-right: 16px;
  flex-shrink: 0;
}

.menu-card .menu-content { flex: 1; min-width: 0; }
.menu-card .menu-title-row { display: flex; align-items: center; gap: 6px; }
.menu-card .menu-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.menu-card .menu-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.menu-card .menu-badge { font-size: 11px; margin-top: 4px; font-weight: 600; color: var(--text-tertiary); }

.menu-card .arrow-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

/* --------------------------- MODE PICKER (MEDICAL) ------------------------ */
.mode-selection { display: flex; flex-direction: column; padding: 20px 0; }
.mode-selection .choose-mode-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 30px; color: var(--text-primary); }

.mode-card {
  display: flex;
  align-items: center;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  color: var(--text-primary);
}

.mode-card:hover { transform: translateY(-1px); }
.mode-card .mode-icon { font-size: 32px; margin-right: 15px; }
.mode-card .mode-title { font-size: 20px; font-weight: 900; }
.mode-card .mode-desc { font-size: 13px; margin-top: 4px; color: var(--text-secondary); padding-right: 10px; }

.mode-card.hot { border-left: 6px solid #FF5722; }
html[data-theme="contrast"] .mode-card.hot .mode-title { color: var(--primary); }
.mode-card.hot .mode-title { color: #D84315; text-transform: uppercase; }
html[data-theme="dark"] .mode-card.hot .mode-title { color: #FF7043; }
.mode-card.full { border-left: 6px solid #2196F3; }
.mode-card.full .mode-title { color: #1565C0; }
html[data-theme="dark"] .mode-card.full .mode-title { color: #64B5F6; }
html[data-theme="contrast"] .mode-card.full .mode-title { color: var(--primary); }

/* ----------------------------- SUBJECT GRIDS ------------------------------ */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 12px 0;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid #E91E63;
  border-radius: 12px;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 108px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  color: var(--text-primary);
  text-align: center;
  position: relative;
  transition: transform 0.15s ease;
}
html[data-theme="contrast"] .subject-card { border-width: 2px; border-top-width: 4px; }
.subject-card:hover { transform: translateY(-2px); }
.subject-card:active { transform: scale(0.97); }

.subject-card .subject-icon-chip {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.subject-card .subject-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.subject-card.coming-soon { opacity: 0.65; cursor: not-allowed; }
.subject-card .soon-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--background);
  padding: 2px 8px;
  border-radius: 4px;
}

.subject-card.bank {
  height: 100px;
  padding: 15px;
  border-top-width: 1px;
  border-top-color: var(--border);
}
.subject-card.bank .subject-name { font-size: 14px; font-weight: 600; }

/* ------------------------------ PAGE HEADERS ------------------------------ */
.page-head { padding: 14px 0 4px 0; }
.page-head .page-title { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.page-head .page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.list-head-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.list-head-bar .back-link { font-size: 16px; font-weight: 700; color: var(--primary); cursor: pointer; background: none; border: none; font-family: inherit; padding: 4px; }
.list-head-bar .list-title { font-size: 18px; font-weight: 700; color: var(--text-primary); flex: 1; }

/* ------------------------------ HSC FULL PREP ----------------------------- */
.fullprep-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-hsc);
  color: #FFF;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.fullprep-banner .fp-title { font-size: 18px; font-weight: 700; color: #FFF; }
.fullprep-banner .fp-sub { font-size: 12px; color: rgba(255, 255, 255, 0.9); margin-top: 2px; }
.fullprep-banner .fp-arrow { font-size: 24px; color: #FFF; font-weight: 700; }

.divider-line { height: 1px; background: var(--border); opacity: 0.6; margin: 20px 0; }

/* ------------------------------ DROPDOWNS --------------------------------- */
.controls-row { display: flex; gap: 10px; margin-bottom: 15px; }
.dropdown-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: var(--input-border-width) solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
}
.dropdown-btn .dd-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-btn .dd-caret { flex-shrink: 0; color: var(--text-secondary); }

/* Bottom-sheet style modal (like the mobile pickers) */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.open { display: flex; }

.sheet-card {
  width: 100%;
  max-width: 520px;
  max-height: 70vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-float);
}

.sheet-card .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-card .sheet-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.sheet-card .sheet-close { background: none; border: none; font-size: 22px; color: var(--text-secondary); cursor: pointer; padding: 4px; }
.sheet-card .sheet-list { overflow-y: auto; }
.sheet-card .sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
}
.sheet-card .sheet-item:hover { background: var(--surface-highlight); }
.sheet-card .sheet-item.selected { background: var(--surface-highlight); color: var(--primary); font-weight: 700; }
.sheet-card .sheet-item .check-mark { color: var(--primary); font-weight: 700; }

/* ------------------------------ DECK LIST --------------------------------- */
.free-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(217, 48, 37, 0.35);
  background: rgba(217, 48, 37, 0.09);
  cursor: pointer;
}
html[data-theme="dark"] .free-banner { background: rgba(234, 67, 53, 0.14); border-color: rgba(234, 67, 53, 0.4); }
html[data-theme="contrast"] .free-banner { background: rgba(255, 0, 255, 0.12); border-color: #FF00FF; }
.free-banner .fb-icon { font-size: 19px; flex-shrink: 0; }
.free-banner .fb-text { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.free-banner .fb-chevron { color: var(--accent-exam); font-size: 16px; flex-shrink: 0; }

.deck-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 30px 0; }

.deck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  color: var(--text-primary);
  transition: transform 0.15s ease;
}
.deck-item:hover { transform: translateY(-1px); }
.deck-item:active { transform: scale(0.98); }

.deck-item .deck-info { flex: 1; min-width: 0; }
.deck-item .deck-title { font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.35; }
.deck-item .deck-count { font-size: 14px; margin-top: 5px; color: var(--text-secondary); }
.deck-item .deck-count.capped { color: var(--accent-exam); font-weight: 600; }
.deck-item .deck-count.all-free { color: var(--success); font-weight: 600; }
.deck-item .crown-icon { font-size: 21px; flex-shrink: 0; }

.empty-state { text-align: center; margin-top: 50px; color: var(--text-tertiary); font-size: 16px; }

/* ------------------------------ STUDY PLAYER ------------------------------ */
.study-wrap { display: flex; flex-direction: column; gap: 10px; }

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-pill {
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-pill.active { background: var(--primary); color: #FFF; font-weight: 700; }
html[data-theme="contrast"] .filter-pill.active { color: #000; }

.custom-range-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 2px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.custom-range-row.show { display: flex; }
.custom-range-row input[type="range"] { flex: 1; accent-color: var(--primary); }

.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-counter {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.free-cap-chip {
  background: rgba(217, 48, 37, 0.13);
  color: var(--accent-exam);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 8px;
}
html[data-theme="contrast"] .free-cap-chip { background: rgba(255, 0, 255, 0.15); }

.credit-chip {
  background: var(--surface-highlight);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 3px 9px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}
.credit-chip:hover { color: var(--primary); }

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-highlight);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* MCQ card (replica of mobile CardWebView HTML) */
.card-box {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 18px 14px;
  box-shadow: var(--shadow-card);
  min-height: 300px;
}
html[data-theme="dark"] .card-box, html[data-theme="contrast"] .card-box { background: #1E1F20; }

.card-box .q-source-badge { font-size: 11px; color: #8a8a8a; text-align: center; margin-bottom: 6px; }
.card-box .q-text {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  color: #1F1F1F;
  line-height: 1.55;
  margin-bottom: 14px;
  overflow-wrap: break-word;
}
html[data-theme="dark"] .card-box .q-text, html[data-theme="contrast"] .card-box .q-text { color: #E3E3E3; }
.card-box .q-text img { max-height: 30vh; max-width: 100%; border-radius: 8px; }

.mcq-options { display: flex; flex-direction: column; gap: 9px; }

.option-row {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15.5px;
  color: #1F1F1F;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
  transition: background 0.15s ease;
  overflow-wrap: break-word;
}
html[data-theme="dark"] .option-row, html[data-theme="contrast"] .option-row { background: #2D2E30; border-color: #444746; color: #E3E3E3; }
.option-row .opt-label { font-weight: 700; min-width: 24px; flex-shrink: 0; }
.option-row:hover:not(:disabled) { border-color: var(--primary); }
.option-row:disabled { cursor: default; opacity: 0.85; }

.option-row.correct { background: #198754; border-color: #198754; color: #FFF; font-weight: 700; }
.option-row.correct .opt-label { color: #FFF; }
html[data-theme="dark"] .option-row.correct, html[data-theme="contrast"] .option-row.correct { background: #5bec90; border-color: #5bec90; color: #062b12; }
html[data-theme="dark"] .option-row.correct .opt-label, html[data-theme="contrast"] .option-row.correct .opt-label { color: #062b12; }

.option-row.wrong { background: #DC3545; border-color: #DC3545; color: #FFF; }
html[data-theme="dark"] .option-row.wrong, html[data-theme="contrast"] .option-row.wrong { background: #f09d9d; border-color: #f09d9d; color: #3d060c; }

.option-row.dimmed { opacity: 0.55; }

.mcq-feedback {
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  margin-top: 14px;
  min-height: 30px;
}
.mcq-feedback.ok { color: #094429; }
html[data-theme="dark"] .mcq-feedback.ok, html[data-theme="contrast"] .mcq-feedback.ok { color: #5bec90; }
.mcq-feedback.no { color: #842029; }
html[data-theme="dark"] .mcq-feedback.no, html[data-theme="contrast"] .mcq-feedback.no { color: #f09d9d; }

.card-stats-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 0;
}

/* Tool bar (AI / explain / report) */
.tool-bar { display: flex; gap: 10px; margin-top: 4px; }

.tool-btn {
  flex: 1;
  border: none;
  border-radius: 22px;
  padding: 11px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.tool-btn.ai-btn { background: #6C63FF; color: #FFF; }
html[data-theme="contrast"] .tool-btn.ai-btn { background: #FF00FF; }
.tool-btn.ai-btn:hover { filter: brightness(1.08); }
.tool-btn.explain-btn { background: var(--surface); color: var(--primary); border: 1px solid var(--border); }
html[data-theme="contrast"] .tool-btn.explain-btn { border-width: 2px; }
.tool-btn.report-btn {
  flex: 0 0 52px;
  background: var(--surface);
  color: var(--error);
  border: 1.5px solid var(--error);
}

/* Paywall card (free-cap end) */
.paywall-card {
  background: var(--surface);
  border: 1.5px solid rgba(227, 116, 0, 0.4);
  border-radius: 15px;
  padding: 26px 18px;
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.paywall-card .pw-icon { font-size: 44px; }
.paywall-card .pw-title { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.paywall-card .pw-body { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; }
.paywall-card .pw-btn {
  margin-top: 8px;
  border: none;
  border-radius: 24px;
  background: var(--upgrade-bg);
  color: var(--upgrade-fg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 26px;
  cursor: pointer;
}

/* Prev / Next navigation */
.nav-row {
  display: flex;
  gap: 10px;
  background: var(--surface);
  padding: 10px;
  border-radius: 14px;
  border-top: 0.5px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-top: 4px;
}

.nav-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #FFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
}
html[data-theme="contrast"] .nav-btn { color: #000; }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-btn.secondary { background: var(--surface-highlight); color: var(--text-primary); }

/* ------------------------------ ADS BANNER -------------------------------- */
.ad-banner-slot {
  margin: 18px 0 8px 0;
  text-align: center;
  min-height: 60px;
}
.ad-banner-slot .ad-placeholder {
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-tertiary);
  font-size: 11px;
  padding: 18px 8px;
  background: var(--surface);
}

/* Upgrade CTA (footer) */
.upgrade-cta {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--upgrade-bg);
  color: var(--upgrade-fg);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 16px;
  min-height: 56px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  margin-top: 10px;
}
.upgrade-cta:hover { filter: brightness(1.05); }

/* ------------------------------ AUTH SCREENS ------------------------------ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 40px 24px;
  max-width: 460px;
  margin: 0 auto;
}

.auth-lang-toggle {
  align-self: flex-end;
  margin-top: 18px;
}

.auth-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }

.auth-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
html[data-theme="dark"] .auth-card, html[data-theme="contrast"] .auth-card { background: var(--surface); border: var(--border-width) solid var(--border); }

.auth-title { font-size: 24px; font-weight: 700; color: #1F1F1F; text-align: center; margin: 0; }
html[data-theme="dark"] .auth-title, html[data-theme="contrast"] .auth-title { color: var(--text-primary); }

.input-field {
  width: 100%;
  border: var(--input-border-width) solid #cfd8dc;
  border-radius: 12px;
  padding: 13px 15px;
  font-family: inherit;
  font-size: 15px;
  color: #1F1F1F;
  background: #FFF;
  outline: none;
}
html[data-theme="dark"] .input-field, html[data-theme="contrast"] .input-field { background: var(--surface-highlight); border-color: var(--border); color: var(--text-primary); }
.input-field:focus { border-color: var(--primary); }
.input-label { font-size: 13px; font-weight: 600; color: #444746; margin-bottom: -8px; }
html[data-theme="dark"] .input-label, html[data-theme="contrast"] .input-label { color: var(--text-secondary); }

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #FFF;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  min-height: 48px;
}
html[data-theme="contrast"] .primary-btn { color: #000; }
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  color: var(--primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
  min-height: 48px;
}
.google-btn:hover { background: rgba(37, 99, 235, 0.12); }

.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-switch { text-align: center; font-size: 14px; color: var(--text-secondary); }
.auth-switch a { color: var(--primary); font-weight: 700; }

.auth-message { font-size: 13.5px; text-align: center; line-height: 1.5; border-radius: 10px; padding: 10px 12px; display: none; }
.auth-message.show { display: block; }
.auth-message.error { background: rgba(217, 48, 37, 0.1); color: var(--error); }
.auth-message.info { background: rgba(11, 87, 208, 0.08); color: var(--primary); }
html[data-theme="dark"] .auth-message.info { background: rgba(138, 180, 248, 0.12); }

.otp-inputs { display: flex; gap: 8px; justify-content: center; }
.otp-inputs input {
  width: 44px;
  height: 50px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: var(--input-border-width) solid #cfd8dc;
  border-radius: 10px;
  background: #FFF;
  color: #1F1F1F;
  font-family: inherit;
}
html[data-theme="dark"] .otp-inputs input, html[data-theme="contrast"] .otp-inputs input { background: var(--surface-highlight); border-color: var(--border); color: var(--text-primary); }
.otp-inputs input:focus { border-color: var(--primary); outline: none; }

/* ------------------------------ MODALS ------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open, .modal-overlay[style*="flex"] { display: flex; }

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  background: var(--surface);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  border: var(--border-width) solid var(--border);
}

.modal-card .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  background: var(--surface-highlight);
}

.modal-card .modal-head .mh-left { display: flex; align-items: center; gap: 10px; }
.modal-card .modal-head .mh-title { font-size: 17px; font-weight: 700; color: var(--primary); }
.modal-card .modal-head .mh-close { background: none; border: none; font-size: 21px; color: var(--text-primary); cursor: pointer; padding: 4px; line-height: 1; }

.modal-card .modal-body { padding: 18px; overflow-y: auto; font-size: 14px; line-height: 1.65; color: var(--text-primary); }

/* Services grid (mobile ServicesModal replica) */
.services-subtitle { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); padding: 12px 20px 4px 20px; }

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px 20px 20px 20px;
}

.service-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}
.service-tile:hover { transform: translateY(-2px); }
.service-tile.disabled { opacity: 0.72; cursor: not-allowed; }
.service-tile .st-icon-chip {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 8px;
}
.service-tile .st-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.service-tile .st-tag { font-size: 11px; color: var(--text-secondary); line-height: 1.3; min-height: 28px; }
.service-tile .st-soon {
  margin-top: 6px;
  background: var(--surface-highlight);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
}
.service-tile .st-open { margin-top: 6px; font-size: 13px; }

/* Upgrade modal (premium plans) */
.plan-grid { display: flex; flex-direction: column; gap: 10px; }

.plan-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-highlight);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.plan-option.selected { border-color: var(--primary); background: rgba(11, 87, 208, 0.06); }
html[data-theme="dark"] .plan-option.selected { background: rgba(138, 180, 248, 0.10); }
.plan-option .po-left { display: flex; flex-direction: column; gap: 2px; }
.plan-option .po-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.plan-option .po-desc { font-size: 12px; color: var(--text-secondary); }
.plan-option .po-price { font-size: 16px; font-weight: 800; color: var(--primary); white-space: nowrap; }

/* ------------------------------ PROGRESS PAGE ----------------------------- */
.toggle-tabs { display: flex; gap: 8px; margin: 12px 0; }
.toggle-tab {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 11px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  border: var(--border-width) solid var(--border);
}
.toggle-tab.active { background: var(--primary); color: #FFF; font-weight: 700; }
html[data-theme="contrast"] .toggle-tab.active { color: #000; }

.score-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  border: var(--border-width) solid var(--border);
  cursor: pointer;
}

.score-card .sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.score-card .sc-title { font-size: 16px; font-weight: 700; color: var(--text-primary); flex: 1; }
.score-card .sc-badge { font-size: 12px; font-weight: 700; border-radius: 10px; padding: 3px 10px; white-space: nowrap; }
.score-card .sc-badge.good { background: rgba(30, 142, 62, 0.14); color: var(--success); }
.score-card .sc-badge.mid { background: rgba(11, 87, 208, 0.10); color: var(--primary); }
html[data-theme="dark"] .score-card .sc-badge.mid { background: rgba(138, 180, 248, 0.14); }
.score-card .sc-badge.bad { background: rgba(217, 48, 37, 0.10); color: var(--error); }

.stat-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat-columns .stat-cell .stat-num { font-size: 18px; font-weight: 800; }
.stat-columns .stat-cell .stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.stat-cell.green .stat-num { color: var(--success); }
.stat-cell.red .stat-num { color: var(--error); }
.stat-cell.gray .stat-num { color: var(--text-secondary); }
.stat-cell.blue .stat-num { color: var(--primary); }

.chapter-chart { padding: 6px 0 10px 0; display: none; }
.chapter-chart.show { display: block; }
.chapter-chart .cc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chapter-chart .cc-name { flex: 0 0 34%; font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-chart .cc-bar-track { flex: 1; height: 10px; border-radius: 5px; background: var(--surface-highlight); overflow: hidden; }
.chapter-chart .cc-bar-fill { height: 100%; background: var(--primary); border-radius: 5px; }
.chapter-chart .cc-val { flex: 0 0 38px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--text-primary); }

/* ------------------------------ HISTORY / NOTIFS -------------------------- */
.history-item, .notif-item {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  border: var(--border-width) solid var(--border);
  cursor: pointer;
  color: var(--text-primary);
  display: block;
}

.history-item .hi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-item .hi-date { font-size: 12px; color: var(--text-secondary); }
.history-item .hi-title { font-size: 15px; font-weight: 600; margin-top: 6px; }
.history-item .hi-score { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.score-pill { font-size: 12px; font-weight: 800; border-radius: 10px; padding: 3px 10px; white-space: nowrap; }
.score-pill.good { background: rgba(30, 142, 62, 0.14); color: var(--success); }
.score-pill.mid { background: rgba(11, 87, 208, 0.10); color: var(--primary); }
html[data-theme="dark"] .score-pill.mid { background: rgba(138, 180, 248, 0.14); }
.score-pill.bad { background: rgba(217, 48, 37, 0.10); color: var(--error); }

.notif-item { display: flex; gap: 12px; align-items: flex-start; }
.notif-item.unread { border-left: 4px solid var(--primary); }
.notif-item .ni-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.notif-item .ni-body { flex: 1; min-width: 0; }
.notif-item .ni-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.notif-item .ni-new { background: var(--primary); color: #FFF; font-size: 9px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
html[data-theme="contrast"] .notif-item .ni-new { color: #000; }
.notif-item .ni-text { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.notif-item .ni-time { font-size: 11px; color: var(--text-tertiary); margin-top: 5px; }

/* ------------------------------ CUSTOM TEST ------------------------------- */
.ct-usage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.ct-usage-bar .usage-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-highlight); overflow: hidden; }
.ct-usage-bar .usage-fill { height: 100%; background: var(--primary); }

.subject-accordion { display: flex; flex-direction: column; gap: 10px; }
.accordion-item { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-card); border: var(--border-width) solid var(--border); overflow: hidden; }
.accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}
.accordion-head .acc-icon { font-size: 18px; }
.accordion-head .acc-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.accordion-head .acc-caret { color: var(--text-secondary); transition: transform 0.2s ease; }
.accordion-item.open .acc-caret { transform: rotate(180deg); }

.accordion-body { display: none; padding: 4px 12px 12px 12px; }
.accordion-item.open .accordion-body { display: block; }

.chapter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-primary);
}
.chapter-check:hover { background: var(--surface-highlight); }
.chapter-check input { accent-color: var(--primary); width: 16px; height: 16px; }
.chapter-check .ck-count { margin-left: auto; font-size: 11.5px; color: var(--text-tertiary); }

.select-all-row { display: flex; gap: 10px; padding: 6px 8px 10px 8px; }
.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mini-btn:hover { filter: brightness(0.97); }

.ct-inputs-row { display: flex; gap: 12px; margin: 16px 0; }
.ct-input-box { flex: 1; background: var(--surface); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-card); border: var(--border-width) solid var(--border); }
.ct-input-box label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.ct-input-box input {
  width: 100%;
  border: var(--input-border-width) solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--background);
  outline: none;
}
.ct-input-box input:focus { border-color: var(--primary); }

.remaining-note { font-size: 12.5px; color: var(--text-secondary); text-align: center; margin-bottom: 12px; }

/* Exam phase */
.exam-timer-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.exam-timer-bar .timer { font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.exam-timer-bar .timer.warn { color: var(--error); }
.exam-timer-bar .q-count { font-size: 13px; color: var(--text-secondary); font-weight: 600; }

.exam-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pal-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}
.pal-dot.answered { background: var(--primary); color: #FFF; border-color: var(--primary); }
html[data-theme="contrast"] .pal-dot.answered { color: #000; }
.pal-dot.current { outline: 2.5px solid var(--primary); outline-offset: 1px; }

.result-hero {
  background: var(--surface);
  border-radius: 18px;
  padding: 26px 18px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: var(--border-width) solid var(--border);
  margin-bottom: 16px;
}
.result-hero .rh-score { font-size: 46px; font-weight: 800; color: var(--primary); }
.result-hero .rh-label { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.result-stat { background: var(--surface); border-radius: 14px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow-card); }
.result-stat .rs-num { font-size: 22px; font-weight: 800; }
.result-stat .rs-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.result-stat.green .rs-num { color: var(--success); }
.result-stat.red .rs-num { color: var(--error); }
.result-stat.gray .rs-num { color: var(--text-secondary); }

/* ------------------------------ AI MODAL BODY ----------------------------- */
.ai-body { font-size: 14px; line-height: 1.7; color: var(--text-primary); }
.ai-thinking { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 14px; padding: 8px 0; }
.ai-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.followup-chips { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.followup-chip {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.5;
}
.followup-chip:hover { border-color: var(--primary); }

.credits-note { font-size: 11.5px; color: var(--text-tertiary); text-align: center; margin-top: 10px; }

/* ------------------------------ REPORT MODAL ------------------------------ */
.report-options { display: flex; flex-direction: column; gap: 8px; }
.report-options textarea {
  width: 100%;
  min-height: 84px;
  border: var(--input-border-width) solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--background);
  outline: none;
  resize: vertical;
}
.report-options textarea:focus { border-color: var(--primary); }

/* ------------------------------ UTILITIES --------------------------------- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}

/* KaTeX display sizing inside cards */
.card-box .katex { font-size: 1.02em; }
.card-box .katex-display { margin: 6px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* Info footer (mobile footer links) */
.info-footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.info-footer .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; font-size: 12.5px; }
.info-footer .footer-links a { color: var(--text-secondary); cursor: pointer; }
.info-footer .footer-links a:hover { color: var(--primary); text-decoration: underline; }
.info-footer .copyright { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }

/* ------------------------------ ICON CHIPS (accent tints) ------------------ */
/* Theme-aware accent chips — replace hardcoded rgba tints so dark/contrast
   modes keep working when the theme cycles on the client. */
.chip-primary { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); }
.chip-medical { background: color-mix(in srgb, var(--accent-medical) 13%, transparent); color: var(--accent-medical); }
.chip-hsc { background: color-mix(in srgb, var(--accent-hsc) 15%, transparent); color: var(--accent-hsc); }
.chip-stats { background: color-mix(in srgb, var(--accent-stats) 15%, transparent); color: var(--accent-stats); }
.chip-exam { background: color-mix(in srgb, var(--accent-exam) 13%, transparent); color: var(--accent-exam); }
.chip-error { background: color-mix(in srgb, var(--error) 13%, transparent); color: var(--error); }
.chip-varsity { background: color-mix(in srgb, #8E44AD 13%, transparent); color: #8E44AD; }
html[data-theme="dark"] .chip-varsity { color: #C58AF9; }
html[data-theme="contrast"] .chip-varsity { color: #FF00FF; }
.chip-green { background: color-mix(in srgb, #188038 13%, transparent); color: #188038; }
html[data-theme="dark"] .chip-green, html[data-theme="contrast"] .chip-green { color: #34A853; }
.chip-orange { background: color-mix(in srgb, #E37400 13%, transparent); color: #E37400; }
html[data-theme="dark"] .chip-orange, html[data-theme="contrast"] .chip-orange { color: #FBBC04; }
.chip-gray { background: color-mix(in srgb, #5F6368 13%, transparent); color: #5F6368; }
html[data-theme="dark"] .chip-gray, html[data-theme="contrast"] .chip-gray { color: #9AA0A6; }

/* sidebar upgrade button spacing */
.sidebar-upgrade { margin: 12px 18px 0 18px; width: calc(100% - 36px); font-size: 13.5px; padding: 13px 10px; }

/* subject-card icon chips (top-border accent driven inline via --sc-accent) */
.subject-card { --sc-accent: #E91E63; border-top-color: var(--sc-accent); }
.subject-card .subject-icon-chip { background: color-mix(in srgb, var(--sc-accent) 15%, transparent); }

/* --------------------- MENU CARD ACCENT VARIANTS -------------------------- */
.menu-card.mc-medical { border-left-color: var(--accent-medical); }
.menu-card.mc-medical .menu-icon-container { background: color-mix(in srgb, var(--accent-medical) 14%, transparent); }
.menu-card.mc-medical .arrow-chip { background: color-mix(in srgb, var(--accent-medical) 12%, transparent); color: var(--accent-medical); }

.menu-card.mc-primary { border-left-color: var(--primary); }
.menu-card.mc-primary .menu-icon-container { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.menu-card.mc-primary .arrow-chip { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }

.menu-card.mc-hsc { border-left-color: var(--accent-hsc); }
.menu-card.mc-hsc .menu-icon-container { background: color-mix(in srgb, var(--accent-hsc) 15%, transparent); }
.menu-card.mc-hsc .arrow-chip { background: color-mix(in srgb, var(--accent-hsc) 12%, transparent); color: var(--accent-hsc); }

.menu-card.mc-stats { border-left-color: var(--accent-stats); }
.menu-card.mc-stats .menu-icon-container { background: color-mix(in srgb, var(--accent-stats) 15%, transparent); }
.menu-card.mc-stats .arrow-chip { background: color-mix(in srgb, var(--accent-stats) 12%, transparent); color: var(--accent-stats); }

.menu-card.mc-varsity { border-left-color: #8E44AD; }
.menu-card.mc-varsity .menu-icon-container { background: rgba(142, 68, 173, 0.14); }
.menu-card.mc-varsity .arrow-chip { background: rgba(142, 68, 173, 0.12); color: #8E44AD; }
html[data-theme="dark"] .menu-card.mc-varsity { border-left-color: #C58AF9; }
html[data-theme="dark"] .menu-card.mc-varsity .arrow-chip { color: #C58AF9; }

.menu-card.mc-job { border-left-color: #FB8C00; }
.menu-card.mc-job .menu-icon-container { background: rgba(251, 140, 0, 0.15); }
.menu-card.mc-job .arrow-chip { background: rgba(251, 140, 0, 0.12); color: #FB8C00; }

/* ==========================================================================
   👤 GUEST MODE (2026-10-07) — mobile app architecture parity
   ========================================================================== */

/* ---- deck list guest banner ---- */
.free-banner.guest-banner {
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.08);
  cursor: default;
}
html[data-theme="dark"] .free-banner.guest-banner { background: rgba(124, 58, 237, 0.18); border-color: rgba(167, 139, 250, 0.45); }
html[data-theme="contrast"] .free-banner.guest-banner { background: rgba(0, 255, 255, 0.1); border-color: #00FFFF; }
.free-banner .fb-cta {
  flex-shrink: 0;
  border: none;
  border-radius: 18px;
  background: var(--primary);
  color: #FFF;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 16px;
  cursor: pointer;
  text-decoration: none;
}
html[data-theme="contrast"] .free-banner .fb-cta { color: #000; }

/* ---- dashboard guest header ---- */
.greeting-row { display: flex; align-items: center; gap: 8px; }
.guest-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.14);
  color: #7C3AED;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  letter-spacing: 0.2px;
}
html[data-theme="dark"] .guest-chip { background: rgba(167, 139, 250, 0.2); color: #C4B5FD; }
html[data-theme="contrast"] .guest-chip { background: rgba(0, 255, 255, 0.15); color: #00FFFF; }

.guest-login-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.12));
  border: 1.5px solid rgba(124, 58, 237, 0.35);
  text-decoration: none;
}
html[data-theme="dark"] .guest-login-cta { background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(6, 182, 212, 0.18)); }
.guest-login-cta .gl-icon { font-size: 22px; flex-shrink: 0; }
.guest-login-cta .gl-text { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--text-primary); line-height: 1.4; }
.guest-login-cta .gl-chevron { color: #7C3AED; font-size: 20px; font-weight: 800; }
.guest-note { margin-top: 8px; font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

.sign-in-footer {
  display: block;
  width: 100%;
  text-align: center;
  border: 1.5px solid rgba(124, 58, 237, 0.4);
  border-radius: 12px;
  background: transparent;
  color: #7C3AED;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  padding: 14px;
  min-height: 52px;
  cursor: pointer;
  margin-top: 10px;
  text-decoration: none;
  box-sizing: border-box;
}
html[data-theme="dark"] .sign-in-footer { color: #C4B5FD; border-color: rgba(167, 139, 250, 0.5); }

/* locked menu cards (dashboard + sidebar) */
.menu-card.locked { opacity: 0.75; }
.menu-card .lock-badge {
  font-size: 18px;
  flex-shrink: 0;
  margin-left: 6px;
}
.nav-item.nav-locked { opacity: 0.72; }
.nav-item.nav-locked .nav-label { font-size: 12.5px; }

/* ---- sidebar guest ---- */
.sidebar-profile .avatar-circle.guest-avatar { background: rgba(124, 58, 237, 0.16); }
.sidebar-profile .tier-badge.guest {
  background: rgba(124, 58, 237, 0.16);
  color: #7C3AED;
}
html[data-theme="dark"] .sidebar-profile .tier-badge.guest { color: #C4B5FD; }

.guest-sidebar-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED, #06B6D4);
  color: #FFF;
  text-decoration: none;
}
.guest-sidebar-cta .gs-icon { font-size: 20px; flex-shrink: 0; }
.guest-sidebar-cta .gs-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.guest-sidebar-cta .gs-title { font-size: 13.5px; font-weight: 800; line-height: 1.3; }
.guest-sidebar-cta .gs-sub { font-size: 11px; opacity: 0.92; line-height: 1.35; }
html[data-theme="contrast"] .guest-sidebar-cta { color: #000; }

.sidebar-logout.sidebar-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #7C3AED, #06B6D4);
  color: #FFF;
  text-decoration: none;
}
html[data-theme="contrast"] .sidebar-logout.sidebar-login { color: #000; }

/* ---- study guest bits ---- */
.tool-btn.locked { opacity: 0.6; }
.paywall-card .pw-btn-secondary, .paywall-card .pw-btn-tertiary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}
.paywall-card .pw-btn-secondary {
  background: transparent;
  border: 1.5px solid rgba(124, 58, 237, 0.45);
  color: #7C3AED;
}
html[data-theme="dark"] .paywall-card .pw-btn-secondary { color: #C4B5FD; border-color: rgba(167, 139, 250, 0.5); }
.paywall-card .pw-btn-tertiary {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---- guest lock modal ---- */
.modal-card.guest-lock-card {
  max-width: 340px;
  text-align: center;
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.guest-lock-card .glk-icon { font-size: 40px; }
.guest-lock-card .glk-body { font-size: 13.5px; color: var(--text-secondary); line-height: 1.65; }
.guest-lock-card .primary-btn { width: 100%; }
.ghost-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
}

/* ---- auth: guest note + SSLCommerz banner ---- */
.auth-guest-note {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.6;
  margin: -4px 0 10px 0;
}
.sslcz-banner {
  display: block;
  width: 100%;
  max-width: 430px;
  margin: 18px auto 4px auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
  background: var(--surface);
  text-decoration: none;
}
.sslcz-banner img {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========================================================================
   📢 DEMO ADS (2026-10-07) — mockups until the AdSense account is approved
   ========================================================================== */

/* demo banner (footer slot) */
.ad-demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 14px;
  position: relative;
  text-align: left;
}
.ad-demo-banner .ad-demo-icon { font-size: 22px; flex-shrink: 0; }
.ad-demo-banner .ad-demo-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ad-demo-banner .ad-demo-text b { font-size: 12.5px; color: var(--text-primary); }
.ad-demo-banner .ad-demo-text span { font-size: 11px; color: var(--text-tertiary); line-height: 1.4; }
.ad-demo-banner .ad-demo-brand { font-size: 9.5px; color: var(--text-tertiary); flex-shrink: 0; align-self: flex-end; }

/* demo interstitial / rewarded overlays */
.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.ad-overlay.hidden { display: none; }
.ad-inter-card {
  width: 100%;
  max-width: 420px;
  background: var(--background);
  border: var(--border-width) solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.ad-inter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-highlight);
  border-bottom: 0.5px solid var(--border);
}
.ad-badge {
  display: inline-block;
  border-radius: 4px;
  background: rgba(255, 193, 7, 0.22);
  color: #B45309;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
}
.ad-badge.reward { background: rgba(124, 58, 237, 0.18); color: #7C3AED; }
html[data-theme="dark"] .ad-badge { color: #FCD34D; }
html[data-theme="dark"] .ad-badge.reward { color: #C4B5FD; }
.ad-close-note { font-size: 11.5px; color: var(--text-tertiary); }
.ad-close-note b { color: var(--text-primary); font-size: 13px; }

.ad-creative {
  padding: 34px 22px 26px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ad-creative-icon { font-size: 44px; }
.ad-creative-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.ad-creative-body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; max-width: 300px; }
.ad-creative-cta {
  margin-top: 10px;
  border-radius: 24px;
  background: var(--primary);
  color: #FFF;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 30px;
}
html[data-theme="contrast"] .ad-creative-cta { color: #000; }
.ad-creative-brand { font-size: 9.5px; color: var(--text-tertiary); margin-top: 6px; }

.ad-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: none;
  border-top: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
}
.ad-close-btn:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.ad-close-btn.subtle { color: var(--text-tertiary); font-weight: 600; }

.ad-reward-progress {
  height: 5px;
  background: var(--surface-highlight);
}
.ad-reward-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7C3AED, #06B6D4);
}
