    :root {
      --bg:           #13131a;
      --surface:      #1c1c26;
      --card:         #23232f;
      --card-hover:   #2a2a38;
      --purple:       #9d6fff;
      --purple-bright:#b490ff;
      --purple-glow:  rgba(157,111,255,0.12);
      --purple-dim:   rgba(157,111,255,0.22);
      --text:         #f0f0f8;
      --text-muted:   #7f7fa0;
      --text-faint:   #44445a;
      --border:       #2c2c3e;
      --success:      #4ade80;
      --error:        #f87171;
      --sidebar-w:    264px;
      --ease:         cubic-bezier(0.4,0,0.2,1);

      /* Shared content bounds — every internal view reads these so a
         widescreen monitor never gets a lonely 600px column. */
      --content-max:    900px;
      --content-gutter: 32px;
    }
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html {
      scroll-behavior: smooth;
      overflow-x: hidden;
      height: 100%;
    }

    body {
      font-family: 'Inter', sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      height: 100%;
      overflow-x: hidden;
      -webkit-font-smoothing: antialiased;
    }

    /* ─── SCROLLBAR ─────────────────────────────── */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    /* ─── UTILITY ───────────────────────────────── */
    .hidden { display: none !important; }

    /* ─── GLOBAL VIEW TRANSITION ────────────────── */
    /* Shared by every screen swap: landing → app, onboarding steps, the
       Homework Helper, the Study Mentor and the deck tabs. */
    @keyframes fadeInUp {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: none; }
    }
    .view-anim { animation: fadeInUp 0.25s ease-out both; }

    @media (prefers-reduced-motion: reduce) {
      .view-anim { animation: none; }
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
      }
    }

    /* ══════════════════════════════════════════════
       PROFILE / ONBOARDING SCREEN
    ══════════════════════════════════════════════ */
    #profile-screen {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      padding: 24px;
      background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(157,111,255,0.08) 0%, transparent 70%);
    }

    .onboard-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 28px;
      padding: 52px 44px;
      width: 100%;
      max-width: 420px;
      text-align: center;
      box-shadow: 0 32px 80px rgba(0,0,0,0.45);
    }

    .brand {
      font-size: 30px;
      font-weight: 800;
      letter-spacing: -0.8px;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
    }
    .brand em { font-style: normal; color: var(--purple); }

    /* ─── BRAND LOGO (image) ─────────────────────── */
    .brand-logo {
      width: 44px;
      height: 44px;
      flex-shrink: 0;
      display: block;
      object-fit: contain;
      border-radius: 12px;
    }
    .brand-logo-sm {
      width: 32px;
      height: 32px;
      border-radius: 9px;
    }

    /* ─── LARGE LOGO (upload screen) ───────────── */
    .brand-logo-lg {
      width: 72px;
      height: 72px;
      flex-shrink: 0;
      display: block;
      object-fit: contain;
      border-radius: 18px;
      margin: 0 auto 22px;
    }

    .onboard-card > p {
      color: var(--text-muted);
      font-size: 14px;
      line-height: 1.65;
      margin-bottom: 36px;
    }

    .field {
      text-align: left;
      margin-bottom: 16px;
    }
    .field label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 7px;
    }
    .field input {
      width: 100%;
      padding: 13px 15px;
      background: var(--card);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color 0.18s, box-shadow 0.18s;
    }
    .field input:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple-glow);
    }
    .field input::placeholder { color: var(--text-faint); }

    .btn-cta {
      width: 100%;
      margin-top: 8px;
      padding: 14px 20px;
      background: var(--purple);
      color: #fff;
      border: none;
      border-radius: 12px;
      font-family: 'Inter', sans-serif;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
      letter-spacing: 0.01em;
    }
    .btn-cta:hover {
      background: var(--purple-bright);
      transform: translateY(-1px);
      box-shadow: 0 8px 28px rgba(157,111,255,0.35);
    }
    .btn-cta:active { transform: translateY(0); }
    .btn-cta:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    /* ══════════════════════════════════════════════
       APP SHELL
    ══════════════════════════════════════════════ */
    #app,
    .app-container {
      display: flex;
      height: 100vh;
      overflow: hidden;
      overflow-x: hidden;
      position: relative;
    }

    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.55);
      z-index: 90;
    }
    .overlay.show { display: block; }

    .sidebar {
      width: var(--sidebar-w);
      height: 100vh;
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      flex-shrink: 0;
      align-self: flex-start;
      z-index: 100;
      transition: transform 0.3s var(--ease);
    }

    .sb-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 18px 16px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .sb-brand {
      font-size: 18px;
      font-weight: 800;
      letter-spacing: -0.4px;
      color: var(--text);
    }
    .sb-brand em { font-style: normal; color: var(--purple); }
    .sb-close {
      display: none;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 16px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
    }
    .sb-close:hover { background: var(--card); color: var(--text); }

    .sb-profile {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 14px 16px;
      margin: 12px 12px 4px;
      border-radius: 14px;
      cursor: pointer;
      transition: background 0.15s;
      border: 1px solid transparent;
    }
    .sb-profile:hover {
      background: var(--card);
      border-color: var(--border);
    }
    .sb-avatar {
      width: 38px; height: 38px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--purple), #6d28d9);
      color: #fff;
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .sb-info { flex: 1; min-width: 0; }
    .sb-name {
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sb-sub {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 1px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sb-settings-hint {
      font-size: 13px;
      color: var(--text-faint);
      opacity: 0;
      transition: opacity 0.15s;
    }
    .sb-profile:hover .sb-settings-hint { opacity: 1; }

    .sb-section-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-faint);
      padding: 16px 20px 8px;
    }

    .sb-decks {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 0 10px 10px;
    }
    .sb-empty {
      font-size: 12px;
      color: var(--text-faint);
      text-align: center;
      padding: 24px 12px;
      line-height: 1.55;
    }

    .deck-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 10px;
      border-radius: 12px;
      cursor: pointer;
      transition: background 0.15s;
      margin-bottom: 2px;
      border: 1px solid transparent;
    }
    .deck-row:hover { background: var(--card); }
    .deck-row.active {
      background: var(--purple-glow);
      border-color: var(--purple-dim);
    }
    .deck-emoji {
      width: 32px; height: 32px;
      border-radius: 9px;
      background: var(--card);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      flex-shrink: 0;
    }
    .deck-row-info { flex: 1; min-width: 0; }
    .deck-row-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .deck-row-meta {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 1px;
    }

    .sb-foot {
      padding: 12px;
      border-top: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex-shrink: 0;
    }

    .btn-mentor {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 11px 14px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }
    .btn-mentor:hover {
      background: var(--purple-glow);
      border-color: var(--purple-dim);
      color: var(--purple-bright);
    }
    .btn-mentor-icon { font-size: 14px; }

    .btn-new-deck {
      width: 100%;
      padding: 12px 14px;
      background: var(--purple);
      border: none;
      border-radius: 12px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    }
    .btn-new-deck:hover {
      background: var(--purple-bright);
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(157,111,255,0.35);
    }

    /* ─── MAIN ──────────────────────────────────── */
    .main,
    .main-content {
      /* Views that need more room widen this; the topbar tracks it so the
         greeting always sits on the content column's left edge. */
      --view-max: var(--content-max);
      flex: 1;
      height: 100vh;
      overflow-y: auto;
      overflow-x: hidden;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }
    .main.view-wide { --view-max: 1000px; }

    .topbar {
      border-bottom: 1px solid var(--border);
      background: rgba(19,19,26,0.85);
      backdrop-filter: blur(12px);
      position: sticky;
      top: 0;
      z-index: 50;
    }
    /* Mirrors .content's box exactly, so the greeting and the view below it
       share one left edge at every viewport width. */
    .topbar-inner {
      display: flex;
      align-items: center;
      gap: 14px;
      min-height: 62px;
      padding: 14px var(--content-gutter);
      max-width: calc(var(--view-max) + var(--content-gutter) * 2);
      width: 100%;
      margin: 0 auto;
    }
    .hamburger {
      display: none;
      background: none;
      border: none;
      color: var(--text);
      font-size: 20px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
    }
    .hamburger:hover { background: var(--card); }
    .topbar-title {
      flex: 1;
      min-width: 0;
      text-align: left;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.2px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    /* Every internal view shares one content width so widescreen
       monitors get the same balanced gutters on every screen. */
    .content {
      flex: 1;
      padding: 32px var(--content-gutter) 56px;
      max-width: calc(var(--view-max) + var(--content-gutter) * 2);
      width: 100%;
      margin: 0 auto;
    }

    /* ─── UPLOAD / NEW STUDY DECK ───────────────── */
    #upload-screen {
      display: flex;
      flex-direction: column;
      padding: 8px 0 32px;
    }
    .upload-intro {
      text-align: center;
      margin-bottom: 28px;
    }
    #upload-screen h2 {
      font-size: 26px;
      font-weight: 800;
      letter-spacing: -0.5px;
      margin-bottom: 10px;
    }
    #upload-screen .upload-intro p {
      color: var(--text-muted);
      font-size: 14px;
      line-height: 1.65;
      max-width: 520px;
      margin: 0 auto;
    }
    #upload-screen .brand-logo-lg {
      width: 56px;
      height: 56px;
      border-radius: 14px;
      margin: 0 auto 16px;
    }

    /* Two-column workspace: dropzone left, deck customization right */
    .upload-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
      gap: 20px;
      align-items: stretch;
    }
    @media (max-width: 820px) {
      .upload-grid { grid-template-columns: 1fr; }
    }

    .upload-col { display: flex; flex-direction: column; }

    .upload-col-label {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 12px;
    }

    .dropzone {
      position: relative;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      min-height: 300px;
      border: 2px dashed var(--border);
      border-radius: 20px;
      background: var(--surface);
      padding: 40px 28px;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    }

    /* Deck customization panel */
    .deck-config {
      flex: 1;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 22px 22px 24px;
    }
    .deck-config-row { margin-bottom: 20px; }
    .deck-config-row:last-child { margin-bottom: 0; }
    .deck-config-row > label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 4px;
    }
    .deck-config-hint {
      display: block;
      font-size: 11.5px;
      color: var(--text-muted);
      line-height: 1.5;
      margin-bottom: 10px;
    }
    .deck-config-row input[type="text"] {
      width: 100%;
      padding: 11px 13px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 13.5px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .deck-config-row input[type="text"]:focus {
      outline: none;
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple-glow);
    }

    .deck-config-choices {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 7px;
    }
    .deck-choice {
      padding: 9px 6px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text-muted);
      font-family: 'Inter', sans-serif;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s, border-color 0.2s, color 0.2s;
    }
    .deck-choice:hover {
      color: var(--text);
      border-color: var(--purple-dim);
      background: var(--purple-glow);
    }
    .deck-choice:focus-visible {
      outline: 2px solid var(--purple);
      outline-offset: 2px;
    }
    .deck-choice.active {
      background: var(--purple-glow);
      border-color: var(--purple);
      color: var(--purple-bright);
    }

    .deck-config-note {
      margin-top: 20px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
      font-size: 11.5px;
      color: var(--text-faint);
      line-height: 1.55;
    }
    .dropzone:hover,
    .dropzone.over {
      border-color: var(--purple);
      background: var(--purple-glow);
      box-shadow: 0 0 0 4px rgba(157,111,255,0.08);
    }
    .dropzone input[type="file"] {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
      width: 100%;
      height: 100%;
    }
    .dropzone-inner {
      pointer-events: none;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }
    .dropzone-icon {
      color: var(--purple-bright);
      margin-bottom: 4px;
    }
    .dropzone-inner strong {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
    }
    .dropzone-inner > span {
      font-size: 13px;
      color: var(--text-muted);
    }
    .dropzone-formats {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
      justify-content: center;
    }
    .fmt-badge {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding: 4px 10px;
      border-radius: 8px;
      background: var(--card);
      border: 1px solid var(--border);
      color: var(--text-muted);
    }

    /* ─── PROCESSING ────────────────────────────── */
    #processing-screen {
      display: none;
      flex-direction: column;
      align-items: center;
      text-align: center;
      padding: 60px 20px;
    }
    .spin-ring {
      width: 52px; height: 52px;
      border: 3px solid var(--border);
      border-top-color: var(--purple);
      border-radius: 50%;
      margin: 0 auto 24px;
      animation: spin 0.8s linear infinite;
    }
    #processing-screen h3 {
      font-size: 20px;
      font-weight: 800;
      margin-bottom: 8px;
    }
    #processing-screen > p {
      color: var(--text-muted);
      font-size: 14px;
      margin-bottom: 28px;
    }
    .steps-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 280px;
      margin: 0 auto;
      text-align: left;
    }
    .step-item {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 13px;
      color: var(--text-faint);
      transition: color 0.2s;
    }
    .step-item.active { color: var(--purple-bright); font-weight: 600; }
    .step-item.done { color: var(--success); }
    .step-dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      background: var(--border);
      flex-shrink: 0;
      transition: background 0.2s, box-shadow 0.2s;
    }
    .step-item.active .step-dot {
      background: var(--purple);
      box-shadow: 0 0 0 4px var(--purple-glow);
    }
    .step-item.done .step-dot { background: var(--success); }

    /* ─── DECK ──────────────────────────────────── */
    #deck-screen { display: none; }

    .deck-head { margin-bottom: 22px; }
    .deck-head h2 {
      font-size: 24px;
      font-weight: 800;
      letter-spacing: -0.4px;
      margin-bottom: 4px;
    }
    .deck-head p {
      font-size: 13px;
      color: var(--text-muted);
    }

    .tab-bar {
      position: relative;
      display: flex;
      gap: 6px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 5px;
      margin-bottom: 24px;
    }
    /* Sliding pill that tracks the active tab — sized and positioned by
       moveTabIndicator() so it can animate between tabs of unequal width. */
    .tab-indicator {
      position: absolute;
      left: 0;
      top: 0;
      width: 0;
      height: 0;
      border-radius: 10px;
      background: var(--purple);
      box-shadow: 0 4px 14px rgba(157,111,255,0.3);
      pointer-events: none;
      z-index: 0;
      transition: transform 0.3s ease, width 0.3s ease;
    }
    .tab-indicator.no-anim { transition: none; }
    .tab-btn {
      position: relative;
      z-index: 1;
      flex: 1;
      padding: 10px 12px;
      background: transparent;
      border: none;
      border-radius: 10px;
      color: var(--text-muted);
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: color 0.2s var(--ease);
      white-space: nowrap;
    }
    .tab-btn:hover:not(.active) { color: var(--text); }
    .tab-btn:focus-visible {
      outline: 2px solid var(--purple-bright);
      outline-offset: 2px;
    }
    .tab-btn.active { color: #fff; }

    /* Lesson */
    .lesson-wrap { display: flex; flex-direction: column; gap: 16px; }
    .lesson-section {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 20px 22px;
    }
    .ls-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--purple-bright);
      margin-bottom: 12px;
    }
    .bullet-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .bullet-list li {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      font-size: 14px;
      line-height: 1.55;
      color: var(--text-muted);
    }
    .bullet-list .dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      background: var(--purple);
      margin-top: 7px;
      flex-shrink: 0;
    }

    /* Flashcards */
    .fc-header {
      display: flex;
      justify-content: center;
      margin-bottom: 16px;
    }
    .fc-counter {
      font-size: 13px;
      color: var(--text-muted);
      font-weight: 500;
    }
    .fc-counter strong { color: var(--text); }

    .fc-wrap {
      perspective: 1200px;
      max-width: 560px;
      margin: 0 auto;
      cursor: pointer;
    }
    .fc {
      position: relative;
      width: 100%;
      min-height: 260px;
      transform-style: preserve-3d;
      transition: transform 0.55s var(--ease);
    }
    .fc.flipped { transform: rotateY(180deg); }
    .fc-face {
      position: absolute;
      inset: 0;
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 28px 28px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    }
    .fc-back { transform: rotateY(180deg); }
    .fc-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 14px;
    }
    .fc-term {
      font-size: 26px;
      font-weight: 800;
      letter-spacing: -0.4px;
      line-height: 1.25;
    }
    .fc-def {
      font-size: 16px;
      line-height: 1.65;
      color: var(--text-muted);
      font-weight: 500;
    }
    .fc-hint {
      margin-top: 20px;
      font-size: 12px;
      color: var(--text-faint);
    }

    .fc-nav {
      display: flex;
      align-items: center;
      gap: 14px;
      max-width: 560px;
      margin: 20px auto 0;
    }
    .btn-arrow {
      width: 42px; height: 42px;
      border-radius: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 18px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
      flex-shrink: 0;
    }
    .btn-arrow:hover {
      background: var(--purple-glow);
      border-color: var(--purple-dim);
    }
    .prog-track {
      flex: 1;
      height: 5px;
      background: var(--border);
      border-radius: 3px;
      overflow: hidden;
    }
    .prog-fill {
      height: 100%;
      width: 0%;
      background: var(--purple);
      border-radius: 3px;
      transition: width 0.3s var(--ease);
    }

    /* Quiz */
    .quiz-wrap { max-width: 660px; margin: 0 auto; }
    .quiz-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 14px;
      gap: 12px;
      flex-wrap: wrap;
    }
    .q-counter {
      font-size: 13px;
      color: var(--text-muted);
      font-weight: 500;
    }
    .score-pill {
      font-size: 12px;
      font-weight: 700;
      color: var(--purple-bright);
      background: var(--purple-glow);
      border: 1px solid var(--purple-dim);
      padding: 5px 12px;
      border-radius: 100px;
    }
    .quiz-timer-pill {
      display: none;
      align-items: center;
      gap: 5px;
      font-size: 12px;
      font-weight: 700;
      color: var(--text-muted);
      background: var(--card);
      border: 1px solid var(--border);
      padding: 5px 10px;
      border-radius: 100px;
    }
    .quiz-timer-pill.visible { display: inline-flex; }
    .quiz-timer-pill.urgent {
      color: var(--error);
      border-color: rgba(248,113,113,0.35);
      background: rgba(248,113,113,0.1);
    }
    .quiz-timer-pill .timer-icon { font-size: 13px; }

    .quiz-timer-bar {
      display: none;
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      overflow: hidden;
      margin-bottom: 18px;
    }
    .quiz-timer-bar.visible { display: block; }
    .quiz-timer-fill {
      height: 100%;
      width: 100%;
      background: var(--purple);
      transform-origin: left;
      transition: width 0.1s linear;
    }

    .q-text {
      font-size: 18px;
      font-weight: 700;
      line-height: 1.45;
      margin-bottom: 18px;
      letter-spacing: -0.2px;
    }
    .q-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .q-opt {
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
      text-align: left;
      padding: 14px 16px;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 14px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s, transform 0.12s;
    }
    .q-opt:hover {
      border-color: var(--purple-dim);
      background: var(--card);
      transform: translateY(-1px);
    }
    .q-opt.correct {
      border-color: rgba(74,222,128,0.45);
      background: rgba(74,222,128,0.1);
    }
    .q-opt.wrong {
      border-color: rgba(248,113,113,0.45);
      background: rgba(248,113,113,0.1);
    }
    .opt-letter {
      width: 28px; height: 28px;
      border-radius: 8px;
      background: var(--card);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 800;
      color: var(--purple-bright);
      flex-shrink: 0;
    }
    .q-feedback {
      margin-top: 14px;
      font-size: 14px;
      font-weight: 600;
      min-height: 22px;
    }
    .q-feedback.correct { color: var(--success); }
    .q-feedback.wrong { color: var(--error); }

    .btn-next {
      margin-top: 18px;
      padding: 12px 22px;
      background: var(--purple);
      color: #fff;
      border: none;
      border-radius: 12px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      display: none;
      transition: background 0.15s, transform 0.15s;
    }
    .btn-next:hover {
      background: var(--purple-bright);
      transform: translateY(-1px);
    }

    .quiz-results {
      display: none;
      text-align: center;
      padding: 28px 12px;
    }
    .quiz-results.show { display: block; }
    .result-pct {
      font-size: 56px;
      font-weight: 800;
      letter-spacing: -2px;
      color: var(--purple-bright);
      line-height: 1;
      margin-bottom: 10px;
    }
    .result-label {
      font-size: 22px;
      font-weight: 800;
      margin-bottom: 6px;
    }
    .result-sub {
      font-size: 14px;
      color: var(--text-muted);
      margin-bottom: 22px;
    }
    .btn-retry {
      padding: 12px 22px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      margin-right: 8px;
      transition: background 0.15s, border-color 0.15s;
    }
    .btn-retry:hover {
      background: var(--card);
      border-color: var(--purple-dim);
    }

    /* ─── SETTINGS ──────────────────────────────── */
    .settings-header {
      margin-bottom: 24px;
    }
    .settings-header h2 {
      font-size: 24px;
      font-weight: 800;
      letter-spacing: -0.4px;
      margin-bottom: 6px;
    }
    .settings-header p {
      font-size: 14px;
      color: var(--text-muted);
      line-height: 1.55;
    }

    .settings-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 24px 24px;
      margin-bottom: 16px;
    }
    .settings-card-title {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 18px;
    }
    .settings-card-title .s-icon {
      width: 28px; height: 28px;
      border-radius: 8px;
      background: var(--purple-glow);
      border: 1px solid var(--purple-dim);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }

    .settings-row {
      margin-bottom: 14px;
      text-align: left;
    }
    .settings-row label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 7px;
    }
    .settings-row input[type="text"],
    .settings-row input[type="password"],
    .settings-row input[type="email"] {
      width: 100%;
      padding: 12px 14px;
      background: var(--card);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color 0.18s, box-shadow 0.18s;
    }
    .settings-row input:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple-glow);
    }

    .settings-two-col {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
    }
    @media (max-width: 640px) {
      .settings-two-col { grid-template-columns: 1fr; }

      /* Responsive card padding: tighter gutters on phones (≈ px-4),
         roomier from small tablets up (≈ sm:px-6) */
      :root { --content-gutter: 16px; }
      .settings-card { padding: 18px 16px; }
      .hw-card { padding: 20px 16px 22px; }
      .review-item { padding: 14px 16px; }

      /* Let dense header/action rows wrap instead of overflowing */
      .quiz-meta,
      .fc-header,
      .hw-actions-row,
      .settings-header { flex-wrap: wrap; }
      .q-options { min-width: 0; }
    }

    .btn-settings-save {
      padding: 11px 20px;
      background: var(--purple);
      border: none;
      border-radius: 12px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.15s, transform 0.15s;
    }
    .btn-settings-save:hover {
      background: var(--purple-bright);
      transform: translateY(-1px);
    }

    .btn-settings-upgrade {
      /* mostly styled inline; keep base */
      font-family: 'Inter', sans-serif;
    }

    .toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
    }
    .toggle-row:last-of-type { border-bottom: none; }
    .toggle-info { flex: 1; min-width: 0; }
    .toggle-label {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 3px;
    }
    .toggle-desc {
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.5;
    }
    .toggle-switch {
      position: relative;
      width: 46px;
      height: 26px;
      flex-shrink: 0;
      cursor: pointer;
    }
    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
      position: absolute;
    }
    .toggle-track {
      position: absolute;
      inset: 0;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 100px;
      transition: background 0.2s, border-color 0.2s;
    }
    .toggle-track::after {
      content: '';
      position: absolute;
      top: 3px; left: 3px;
      width: 18px; height: 18px;
      border-radius: 50%;
      background: var(--text-muted);
      transition: transform 0.22s var(--ease), background 0.2s;
    }
    .toggle-switch input:checked + .toggle-track {
      background: var(--purple);
      border-color: var(--purple);
    }
    .toggle-switch input:checked + .toggle-track::after {
      transform: translateX(20px);
      background: #fff;
    }

    /* ─── HOMEWORK ──────────────────────────────── */
    .hw-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 28px 30px 30px;
      margin-bottom: 20px;
    }
    .hw-card-title {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 16px;
    }
    .hw-card-title .s-icon {
      width: 28px; height: 28px;
      border-radius: 8px;
      background: var(--purple-glow);
      border: 1px solid var(--purple-dim);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }
    .hw-premium-badge {
      margin-left: auto;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding: 3px 10px;
      border-radius: 100px;
      background: linear-gradient(90deg, rgba(157,111,255,0.25), rgba(180,144,255,0.15));
      color: var(--purple-bright);
      border: 1px solid var(--purple);
    }

    .hw-textarea {
      width: 100%;
      min-height: 200px;
      padding: 18px 20px;
      background: var(--card);
      border: 1.5px solid var(--border);
      border-radius: 14px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 15.5px;
      line-height: 1.7;
      resize: vertical;
      outline: none;
      transition: border-color 0.18s, box-shadow 0.18s;
    }
    .hw-textarea:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple-glow);
    }
    .hw-textarea::placeholder { color: var(--text-faint); }

    /* ─── Homework file dropzone ─────────────────── */
    .hw-dropzone {
      position: relative;
      margin: 14px 0 4px;
      padding: 34px 24px;
      border: 2px dashed var(--border);
      border-radius: 14px;
      background: transparent;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s;
    }
    .hw-dropzone:hover,
    .hw-dropzone.dragover {
      border-color: var(--purple);
      background: var(--purple-glow);
    }
    .hw-dropzone-icon { font-size: 1.8rem; }
    .hw-dropzone-label {
      margin: 10px 0 4px;
      font-size: 0.95rem;
      color: var(--text-muted);
    }
    .hw-dropzone-label .hw-browse { color: var(--purple); font-weight: 600; }
    .hw-dropzone-hint { font-size: 0.8rem; color: var(--text-faint); }
    .hw-file-preview {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }
    .hw-file-name {
      max-width: 260px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 0.9rem;
      color: var(--text);
    }
    .hw-file-clear {
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 1rem;
      line-height: 1;
      padding: 0 2px;
      transition: color 0.15s;
    }
    .hw-file-clear:hover { color: var(--error); }

    .hw-actions-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-top: 18px;
      flex-wrap: wrap;
    }
    .hw-tokens-hint {
      font-size: 13px;
      color: var(--text-muted);
      font-weight: 500;
    }
    .btn-hw-submit {
      padding: 14px 28px;
      background: var(--purple);
      border: none;
      border-radius: 12px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    }
    .btn-hw-submit:hover {
      background: var(--purple-bright);
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(157,111,255,0.35);
    }
    .btn-hw-submit:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .hw-upgrade-banner {
      display: none;
      align-items: center;
      gap: 14px;
      margin-top: 16px;
      padding: 16px;
      background: rgba(157,111,255,0.08);
      border: 1px solid var(--purple-dim);
      border-radius: 14px;
      flex-wrap: wrap;
    }
    .hw-upgrade-banner.show { display: flex; }
    .hw-upgrade-icon { font-size: 24px; }
    .hw-upgrade-copy {
      flex: 1;
      min-width: 180px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .hw-upgrade-copy strong {
      font-size: 14px;
      color: var(--text);
    }
    .hw-upgrade-copy span {
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.45;
    }
    .btn-hw-upgrade {
      padding: 10px 16px;
      background: var(--purple);
      border: none;
      border-radius: 10px;
      color: #fff;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
    }
    .btn-hw-upgrade:hover { background: var(--purple-bright); }

    .hw-response-card {
      display: none;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 22px 24px;
      margin-bottom: 16px;
    }
    .hw-response-card.show { display: block; }
    .hw-response-label {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 14px;
    }
    .hw-response-close {
      margin-left: auto;
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 14px;
      padding: 4px 6px;
      border-radius: 6px;
    }
    .hw-response-close:hover { background: var(--card); color: var(--text); }
    .hw-response-body {
      font-size: 14px;
      line-height: 1.7;
      color: var(--text-muted);
    }
    .hw-response-body.loading {
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--text-faint);
      font-style: italic;
    }
    .hw-spin {
      display: inline-block;
      width: 14px; height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--purple);
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      vertical-align: middle;
    }
    .hw-response-body h1,
    .hw-response-body h2,
    .hw-response-body h3 {
      color: var(--text);
      margin: 16px 0 8px;
      font-weight: 700;
    }
    .hw-response-body p { margin-bottom: 10px; }
    .hw-response-body ul,
    .hw-response-body ol {
      margin: 8px 0 12px 20px;
    }
    .hw-response-body code {
      background: var(--card);
      padding: 1px 6px;
      border-radius: 5px;
      font-size: 13px;
    }
    .hw-response-body pre {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 14px;
      overflow-x: auto;
      margin: 12px 0;
    }

    /* ─── MENTOR PANEL ──────────────────────────── */
    #mentor-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 49;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s var(--ease);
    }
    #mentor-backdrop.open {
      opacity: 1;
      pointer-events: all;
    }

    #mentor-panel {
      position: fixed;
      top: 0;
      right: 0;
      width: 400px;
      max-width: calc(100vw - 24px);
      height: 100vh;
      height: 100dvh; /* tracks the mobile keyboard / dynamic toolbar */
      background: var(--surface);
      border-left: 1px solid var(--border);
      z-index: 50;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.35s var(--ease);
      box-shadow: -16px 0 48px rgba(0,0,0,0.35);
    }
    #mentor-panel.open { transform: translateX(0); }

    .mentor-panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 18px 20px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .mentor-panel-title {
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .mentor-panel-title em { font-style: normal; color: var(--purple); }
    .mentor-close {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 16px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
    }
    .mentor-close:hover { background: var(--card); color: var(--text); }

    .mentor-messages {
      flex: 1;
      min-height: 0; /* lets the list shrink so the input row never gets pushed off-screen */
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 18px 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .mentor-bubble {
      max-width: 92%;
      padding: 12px 14px;
      border-radius: 14px;
      font-size: 13.5px;
      line-height: 1.55;
    }
    .mentor-bubble.mentor {
      align-self: flex-start;
      background: var(--card);
      border: 1px solid var(--border);
      color: var(--text-muted);
      border-bottom-left-radius: 4px;
    }
    .mentor-bubble.user {
      align-self: flex-end;
      background: var(--purple);
      color: #fff;
      border-bottom-right-radius: 4px;
    }

    .mentor-input-row {
      display: flex;
      gap: 10px;
      padding: 14px 16px;
      /* stay clear of the iOS home indicator / gesture bar */
      padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
      border-top: 1px solid var(--border);
      align-items: flex-end;
      flex-shrink: 0; /* locked to the bottom — always visible above mobile keyboards */
    }
    .mentor-input {
      flex: 1;
      min-height: 42px;
      max-height: 120px;
      padding: 11px 14px;
      background: var(--card);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 13.5px;
      resize: none;
      outline: none;
      line-height: 1.45;
    }
    .mentor-input:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple-glow);
    }
    .mentor-send {
      width: 42px; height: 42px;
      border-radius: 12px;
      background: var(--purple);
      border: none;
      color: #fff;
      font-size: 16px;
      cursor: pointer;
      flex-shrink: 0;
      transition: background 0.15s;
    }
    .mentor-send:hover { background: var(--purple-bright); }
    .mentor-send:disabled { opacity: 0.5; cursor: not-allowed; }

    /* ─── TOAST ─────────────────────────────────── */
    .toast {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px 18px;
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13.5px;
      font-weight: 600;
      color: var(--text);
      box-shadow: 0 16px 48px rgba(0,0,0,0.45);
      z-index: 9999;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s, transform 0.25s var(--ease);
      max-width: calc(100vw - 32px);
    }
    .toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
      pointer-events: all;
    }
    .toast.success { border-color: rgba(74,222,128,0.35); }
    .toast.error { border-color: rgba(248,113,113,0.35); }
    .toast.info { border-color: var(--purple-dim); }

    /* ─── DEEP WORK MODE ─────────────────────────
       The exit control lives in the topbar's normal flow and keeps its
       slot reserved when inactive, so entering or leaving Deep Work
       never reflows the topbar or the content column beneath it.
       Everything Deep Work removes is hidden with `visibility` (never
       `display`) for the same reason: the geometry stays identical,
       only the ink disappears.
    ───────────────────────────────────────────── */
    .deep-work-exit {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      padding: 7px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 100px;
      color: var(--text);
      font-family: 'Inter', sans-serif;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.02em;
      white-space: nowrap;
      cursor: pointer;
      transition: background 0.2s var(--ease), border-color 0.2s var(--ease);

      /* Inactive: invisible but still occupying its slot */
      visibility: hidden;
      pointer-events: none;
    }
    .deep-work-exit:hover {
      border-color: var(--purple-dim);
      background: var(--card);
    }
    .deep-work-exit:focus-visible {
      outline: 2px solid var(--purple);
      outline-offset: 2px;
    }

    #app.deep-work-mode .deep-work-exit {
      visibility: visible;
      pointer-events: auto;
      border-color: var(--purple-dim);
      color: var(--purple-bright);
    }

    #app.deep-work-mode .score-pill,
    #app.deep-work-mode .q-counter,
    #app.deep-work-mode .fc-counter,
    #app.deep-work-mode .prog-track,
    #app.deep-work-mode .fc-autoadvance,
    #app.deep-work-mode .sb-streak,
    #app.deep-work-mode #sb-xp-pill,
    #app.deep-work-mode #deck-meta {
      visibility: hidden;
    }

    /* ─── DELETE CONFIRM MODAL ──────────────────── */
    #delete-confirm-overlay {
      position: fixed;
      inset: 0;
      z-index: 9500;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(10, 10, 16, 0.88);
      backdrop-filter: blur(14px);
    }
    #delete-confirm-overlay.open { display: flex; }

    #delete-confirm-modal {
      width: 100%;
      max-width: 420px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 22px;
      padding: 32px 28px;
      text-align: center;
      box-shadow: 0 32px 80px rgba(0,0,0,0.55);
    }
    .dcm-icon {
      font-size: 36px;
      margin-bottom: 12px;
    }
    .dcm-title {
      font-size: 20px;
      font-weight: 800;
      margin-bottom: 10px;
      letter-spacing: -0.3px;
    }
    .dcm-body {
      font-size: 14px;
      color: var(--text-muted);
      line-height: 1.6;
      margin-bottom: 14px;
    }
    .dcm-warning {
      font-size: 12px;
      font-weight: 600;
      color: var(--error);
      background: rgba(248,113,113,0.08);
      border: 1px solid rgba(248,113,113,0.25);
      border-radius: 10px;
      padding: 10px 12px;
      margin-bottom: 22px;
    }
    .dcm-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
      flex-wrap: wrap;
    }
    .dcm-btn-cancel,
    .dcm-btn-delete {
      padding: 11px 20px;
      border-radius: 12px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.15s, transform 0.15s;
    }
    .dcm-btn-cancel {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-muted);
    }
    .dcm-btn-cancel:hover {
      background: var(--card);
      color: var(--text);
    }
    .dcm-btn-delete {
      background: var(--error);
      border: none;
      color: #fff;
    }
    .dcm-btn-delete:hover {
      filter: brightness(1.08);
      transform: translateY(-1px);
    }

    /* ─── RESPONSIVE ────────────────────────────── */
    @media (max-width: 900px) {
      /* Slide-out drawer: fixed to the viewport edge, hidden off-canvas
         until the top-bar hamburger toggles .open */
      .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        box-shadow: 16px 0 48px rgba(0,0,0,0.35);
      }
      .sidebar.open { transform: translateX(0); }
      .sb-close { display: block; }
      .hamburger { display: block; }
      /* Keep the footer's buttons above the iOS home indicator and make
         the drawer itself scrollable as a fallback for very short screens */
      .sb-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
      .sidebar {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
      }
      /* Tightens the shared gutter for .content and .topbar together */
      :root { --content-gutter: 18px; }
      .content { padding-top: 24px; padding-bottom: 40px; }
    }

    @media (max-width: 480px) {
      .topbar-title { font-size: 15px; }
      .deck-head h2 { font-size: 18px; }
      .tab-btn { font-size: 12px; padding: 9px 8px; }
      .fc-term { font-size: 22px; }
      .onboard-card,
      .inbox-card { padding: 36px 22px; }
      #mentor-panel { width: 100%; max-width: 100%; }
    }

/* ══════════════════════════════════════════════
       QUIZ REVIEW
    ══════════════════════════════════════════════ */
    .quiz-review {
      display: none;
      margin-top: 28px;
      text-align: left;
      width: 100%;
    }
    .quiz-review.show { display: block; }

    .review-heading {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 14px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
    }

    .review-item {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 18px 20px;
      margin-bottom: 10px;
      transition: border-color 0.2s;
    }
    .review-item.correct-item { border-color: rgba(74,222,128,0.22); }
    .review-item.wrong-item   { border-color: rgba(248,113,113,0.22); }

    .review-q-num {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-faint);
      margin-bottom: 5px;
    }

    .review-q-text {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 12px;
      line-height: 1.5;
    }

    .review-answer-row {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      font-size: 13px;
      margin-bottom: 6px;
      line-height: 1.45;
    }
    .review-answer-row:last-of-type { margin-bottom: 0; }

    .review-badge {
      flex-shrink: 0;
      width: 20px; height: 20px;
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 10px;
      font-weight: 800;
      margin-top: 1px;
    }
    .badge-correct { background: rgba(74,222,128,0.18); color: #4ade80; }
    .badge-wrong   { background: rgba(248,113,113,0.18); color: #f87171; }

    .review-answer-text.is-correct { color: #4ade80; font-weight: 500; }
    .review-answer-text.is-wrong   { color: #f87171; font-weight: 500; text-decoration: line-through; opacity: 0.72; }

    .review-explanation {
      margin-top: 12px;
      padding: 11px 14px;
      background: rgba(157,111,255,0.07);
      border: 1px solid var(--purple-dim);
      border-radius: 10px;
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.65;
    }
    .review-explanation strong {
      display: block;
      color: var(--purple);
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      margin-bottom: 5px;
    }
    .review-explanation.loading { opacity: 0.55; font-style: italic; }

    /* Inline AI explanation card (live quiz, below wrong answers) */
    .q-ai-explain {
      margin-top: 14px;
      padding: 14px 16px;
      background: rgba(157,111,255,0.07);
      border: 1px solid var(--purple-dim);
      border-radius: 12px;
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.65;
    }
    .q-ai-explain.hidden { display: none; }
    .q-ai-explain.loading .q-ai-explain-text { opacity: 0.65; font-style: italic; }
    .q-ai-explain strong {
      display: block;
      color: var(--purple);
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.07em;
      text-transform: uppercase;
      margin-bottom: 10px;
    }
    .q-ai-explain-answers {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 10px;
    }
    .q-ai-explain-row {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      font-size: 12.5px;
      line-height: 1.5;
    }
    .q-ai-explain-row.is-wrong  { color: #f87171; }
    .q-ai-explain-row.is-correct { color: #4ade80; font-weight: 500; }
    .q-ai-explain-badge {
      flex-shrink: 0;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 800;
    }
    .q-ai-explain-row.is-wrong .q-ai-explain-badge {
      background: rgba(248,113,113,0.18);
    }
    .q-ai-explain-row.is-correct .q-ai-explain-badge {
      background: rgba(74,222,128,0.18);
    }
    .q-ai-explain-text {
      font-size: 13px;
      color: var(--text);
      line-height: 1.65;
    }

    .btn-review-toggle {
      margin-top: 16px;
      padding: 10px 22px;
      background: transparent;
      color: var(--purple);
      border: 1px solid var(--purple-dim);
      border-radius: 10px;
      font-family: 'Inter', sans-serif;
      font-size: 13px; font-weight: 700;
      cursor: pointer;
      transition: background 0.18s, border-color 0.18s;
      display: block;
      margin-left: auto; margin-right: auto;
    }
    .btn-review-toggle:hover {
      background: var(--purple-glow);
      border-color: var(--purple);
    }

    /* ══════════════════════════════════════════════
       AUTO-ADVANCE COUNTDOWN BAR
    ══════════════════════════════════════════════ */
    .fc-autoadvance {
      max-width: 560px;
      margin: 12px auto 0;
      display: none;
      align-items: center;
      gap: 10px;
    }
    .fc-autoadvance.visible { display: flex; }

    .fc-aa-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      white-space: nowrap;
      flex-shrink: 0;
      min-width: 40px;
      text-align: right;
    }
    .fc-aa-track {
      flex: 1;
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      overflow: hidden;
    }
    .fc-aa-fill {
      height: 100%;
      width: 100%;
      background: var(--purple);
      border-radius: 2px;
      transform-origin: left;
    }
    @keyframes aaCountdown {
      from { transform: scaleX(1); }
      to   { transform: scaleX(0); }
    }

    /* ══════════════════════════════════════════════
       AI EXPLANATION PANEL (live, during quiz)
    ══════════════════════════════════════════════ */
    #ai-explain-panel {
      position: fixed;
      top: 0;
      right: -420px;
      width: 380px;
      max-width: calc(100vw - 32px);
      height: 100vh;
      background: var(--surface);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      z-index: 400;
      transition: right 0.35s var(--ease);
      box-shadow: -16px 0 48px rgba(0,0,0,0.35);
    }
    #ai-explain-panel.open { right: 0; }

    .aep-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 22px 16px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    .aep-title {
      display: flex;
      align-items: center;
      gap: 9px;
      font-size: 13px;
      font-weight: 700;
      color: var(--purple);
      letter-spacing: 0.03em;
    }
    .aep-icon {
      width: 26px; height: 26px;
      border-radius: 7px;
      background: var(--purple-glow);
      border: 1px solid var(--purple-dim);
      display: flex; align-items: center; justify-content: center;
      font-size: 13px;
    }
    .aep-close {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 16px;
      cursor: pointer;
      padding: 4px 6px;
      border-radius: 6px;
      transition: color 0.15s, background 0.15s;
      line-height: 1;
    }
    .aep-close:hover { color: var(--text); background: var(--card); }

    .aep-body {
      flex: 1;
      overflow-y: auto;
      padding: 20px 22px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .aep-question-box {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 16px;
    }
    .aep-question-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-faint);
      margin-bottom: 6px;
    }
    .aep-question-text {
      font-size: 13px;
      font-weight: 500;
      line-height: 1.55;
      color: var(--text);
    }

    .aep-answers {
      display: flex;
      flex-direction: column;
      gap: 7px;
    }
    .aep-answer-row {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 10px 12px;
      border-radius: 10px;
      font-size: 13px;
      line-height: 1.4;
    }
    .aep-answer-row.is-wrong {
      background: rgba(248,113,113,0.07);
      border: 1px solid rgba(248,113,113,0.22);
      color: var(--error);
    }
    .aep-answer-row.is-correct {
      background: rgba(74,222,128,0.07);
      border: 1px solid rgba(74,222,128,0.22);
      color: var(--success);
    }
    .aep-answer-badge {
      font-size: 12px;
      font-weight: 800;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .aep-explanation-box {
      background: rgba(157,111,255,0.07);
      border: 1px solid var(--purple-dim);
      border-radius: 12px;
      padding: 16px 18px;
    }
    .aep-expl-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--purple);
      margin-bottom: 8px;
    }
    .aep-expl-text {
      font-size: 13px;
      line-height: 1.7;
      color: var(--text-muted);
    }
    .aep-expl-text.loading {
      color: var(--text-faint);
      font-style: italic;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .aep-spinner {
      width: 14px; height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--purple);
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      flex-shrink: 0;
    }

    @media (max-width: 768px) {
      #ai-explain-panel {
        width: 100%;
        max-width: 100%;
        top: auto;
        bottom: -55vh;
        right: 0;
        height: 55vh;
        border-left: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -16px 48px rgba(0,0,0,0.35);
        transition: bottom 0.35s var(--ease);
      }
      #ai-explain-panel.open {
        bottom: 0;
      }
    }

/* ---- DECK DELETE BUTTON ----------------------------- */
.deck-row-delete {
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--ease);
  line-height: 1;
}
.deck-row:hover .deck-row-delete {
  opacity: 1;
}
.deck-row-delete:hover {
  background: rgba(248,113,113,0.15);
  color: var(--error);
  transform: scale(1.12);
}
.deck-row-delete:active {
  transform: scale(0.95);
}
.deck-row-delete svg {
  pointer-events: none;
  transition: stroke 0.18s var(--ease);
}

/* ---- PAST HOMEWORK SOLUTIONS ----------------------------- */
.hw-history-section { margin-top: 28px; }

.hw-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.hw-history-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--purple);
}
.hw-history-title .s-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--purple-glow);
  border: 1px solid var(--purple-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.hw-history-count {
  background: var(--purple-glow);
  border: 1px solid var(--purple-dim);
  color: var(--purple-bright);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
}
.hw-history-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.hw-history-refresh:hover {
  color: var(--text);
  border-color: var(--purple-dim);
  background: var(--card);
}
.hw-history-refresh:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.hw-history-empty {
  padding: 34px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

.hw-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.hw-history-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}
.hw-history-card:hover {
  background: var(--card);
  border-color: var(--purple-dim);
  transform: translateY(-2px);
}
.hw-history-card:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.hw-history-card-label {
  flex: 1 1 auto;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  /* Keeps every card's footer on the same line regardless of title length */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hw-history-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-faint);
}
.hw-history-card-date { white-space: nowrap; }
.hw-history-file {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--purple-glow);
  border: 1px solid var(--purple-dim);
  color: var(--purple-bright);
  font-weight: 600;
}
.hw-history-card .hw-history-delete { margin-left: auto; }

/* ---- HW HISTORY TRASH BUTTON ----------------------------- */
.hw-history-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--ease);
}
#hw-history-list li:hover .hw-history-delete,
#hw-history-list li:focus-within .hw-history-delete {
  opacity: 1;
}
.hw-history-delete:hover {
  background: rgba(248,113,113,0.15);
  color: var(--error);
  transform: scale(1.12);
}
.hw-history-delete:active {
  transform: scale(0.95);
}
.hw-history-delete svg {
  pointer-events: none;
  transition: stroke 0.18s var(--ease);
}

/* ---- DAILY STREAK COUNTER ----------------------------- */
.sb-streak {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 700;
    color: #ff9d3d;
    letter-spacing: 0.01em;
    line-height: 1;
}
.sb-streak-flame {
    font-size: 12px;
    filter: drop-shadow(0 0 4px rgba(255, 140, 0, 0.55));
    animation: flamePulse 2.2s ease-in-out infinite;
}
@keyframes flamePulse {
    0%, 100% { transform: scale(1);    opacity: 0.9; }
    50%      { transform: scale(1.18); opacity: 1;   }
}


  /* ══════════════════════════════════════════════
     PRICING PAYWALL MODAL
  ══════════════════════════════════════════════ */
  #pricing-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(10, 10, 16, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease);
  }
  #pricing-modal.visible {
    opacity: 1;
    pointer-events: all;
  }

  .pricing-shell {
    width: 100%;
    max-width: 760px;
    margin: auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 44px 40px 48px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(157,111,255,0.08);
    text-align: center;
    position: relative;
    animation: pricingSlideUp 0.42s cubic-bezier(0.22,1,0.36,1) both;
  }
  @keyframes pricingSlideUp {
    from { transform: translateY(32px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .pricing-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--purple-glow);
    border: 1px solid var(--purple-dim);
    color: var(--purple-bright);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 18px;
  }

  .pricing-heading {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.2;
  }
  .pricing-heading em { font-style: normal; color: var(--purple); }

  .pricing-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
  }

  /* ── Billing Toggle ── */
  .billing-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 4px;
    gap: 2px;
    margin-bottom: 32px;
    position: relative;
  }
  .billing-toggle-btn {
    position: relative;
    z-index: 1;
    padding: 8px 22px;
    border-radius: 100px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.22s var(--ease);
    white-space: nowrap;
  }
  .billing-toggle-btn.active { color: var(--text); }
  .billing-toggle-pill {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: var(--purple);
    border-radius: 100px;
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 4px 14px rgba(157,111,255,0.35);
  }
  .billing-toggle-pill.yearly { transform: translateX(100%); }

  .billing-save-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.28);
    color: #4ade80;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 100px;
    margin-left: 8px;
    vertical-align: middle;
    transition: opacity 0.2s;
  }

  /* ── Pricing Cards Grid ── */
  .pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
  }
  @media (max-width: 560px) {
    #pricing-modal { padding: 12px; }
    .pricing-cards { grid-template-columns: 1fr; gap: 14px; }
    .pricing-shell { padding: 32px 22px 28px; border-radius: 20px; }
    .pricing-heading { font-size: 22px; }
  }
  @media (max-width: 380px) {
    .pricing-shell { padding: 26px 16px 24px; }
    .pricing-card { padding: 22px 18px 20px; }
    .pricing-heading { font-size: 20px; }
    .pc-amount { font-size: 34px; }
  }

  .pricing-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px 24px;
    text-align: left;
    position: relative;
    min-width: 0;
    overflow-wrap: break-word;
    transition: border-color 0.22s, box-shadow 0.22s, transform 0.18s;
  }
  .pricing-card:hover {
    border-color: var(--purple-dim);
    box-shadow: 0 8px 32px rgba(157,111,255,0.12);
    transform: translateY(-2px);
  }
  .pricing-card.featured {
    border-color: var(--purple);
    background: linear-gradient(145deg, #211a36 0%, var(--card) 100%);
    box-shadow: 0 0 0 1px var(--purple-dim), 0 16px 40px rgba(157,111,255,0.18);
  }
  .pricing-card.featured:hover {
    border-color: var(--purple-bright);
    box-shadow: 0 0 0 1px var(--purple), 0 20px 50px rgba(157,111,255,0.28);
    transform: translateY(-2px);
  }

  .pc-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 100px;
    margin-bottom: 14px;
  }
  .pc-badge.basic-badge {
    background: var(--purple-glow);
    color: var(--purple-bright);
    border: 1px solid var(--purple-dim);
  }
  .pc-badge.premium-badge {
    background: linear-gradient(90deg, rgba(157,111,255,0.25), rgba(180,144,255,0.15));
    color: var(--purple-bright);
    border: 1px solid var(--purple);
  }

  .pc-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
  }

  .pc-price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
  }
  .pc-currency {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-top: 6px;
  }
  .pc-amount {
    font-size: 40px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1.5px;
    line-height: 1;
    transition: all 0.2s var(--ease);
  }
  .pc-period {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
  }

  .pc-billed-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 20px;
    min-height: 16px;
    transition: opacity 0.2s;
  }

  .pc-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
    opacity: 0.6;
  }

  .pc-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 24px;
  }
  .pc-features li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
  }
  .pc-features li .feat-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(74,222,128,0.15);
    color: #4ade80;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
  }
  .pricing-card.featured .pc-features li { color: var(--text); }

  .pc-trial-note {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  .pc-trial-note::before,
  .pc-trial-note::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  .btn-pricing-cta {
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.15s, box-shadow 0.18s, opacity 0.15s;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
  }
  .btn-pricing-cta.basic-cta {
    background: transparent;
    color: var(--purple);
    border: 1.5px solid var(--purple-dim);
  }
  .btn-pricing-cta.basic-cta:hover {
    background: var(--purple-glow);
    border-color: var(--purple);
    transform: translateY(-1px);
  }
  .btn-pricing-cta.premium-cta {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 6px 22px rgba(157,111,255,0.35);
  }
  .btn-pricing-cta.premium-cta:hover {
    background: var(--purple-bright);
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(157,111,255,0.45);
  }
  .btn-pricing-cta:active { transform: translateY(0); }
  .btn-pricing-cta:disabled {
    opacity: 0.55;
    pointer-events: none;
  }
  .btn-pricing-cta .cta-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
  }
  .btn-pricing-cta.basic-cta .cta-spinner {
    border-color: var(--purple-dim);
    border-top-color: var(--purple);
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .pricing-footer-note {
    font-size: 12px;
    color: var(--text-faint);
    line-height: 1.6;
  }
  .pricing-footer-note a {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .pricing-footer-note a:hover { color: var(--text); }

  /* ══════════════════════════════════════════════
     CHECK YOUR INBOX SCREEN
  ══════════════════════════════════════════════ */
  #inbox-screen {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(157,111,255,0.08) 0%, transparent 70%);
  }
  #inbox-screen.visible {
    display: flex;
  }

  .inbox-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 52px 44px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.45);
  }

  .inbox-icon-wrap {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--purple-glow);
    border: 2px solid var(--purple-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin: 0 auto 24px;
    animation: inboxPulse 3s ease-in-out infinite;
  }
  @keyframes inboxPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(157,111,255,0.3); }
    50%      { box-shadow: 0 0 0 10px rgba(157,111,255,0); }
  }

  .inbox-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 10px;
    color: var(--text);
  }

  .inbox-email-badge {
    display: inline-block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--purple-bright);
    margin-bottom: 18px;
    word-break: break-all;
  }

  .inbox-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 28px;
  }

  .inbox-steps {
    list-style: none;
    text-align: left;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .inbox-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
  }
  .inbox-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--purple-glow);
    border: 1px solid var(--purple-dim);
    color: var(--purple-bright);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
  }

  .btn-resend-email {
    width: 100%;
    padding: 13px 20px;
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
    letter-spacing: 0.01em;
    margin-bottom: 12px;
  }
  .btn-resend-email:hover {
    background: var(--purple-bright);
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(157,111,255,0.35);
  }
  .btn-resend-email:active { transform: translateY(0); }
  .btn-resend-email:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  .inbox-back-link {
    font-size: 13px;
    color: var(--text-muted);
  }
  .inbox-back-link a {
    color: var(--purple);
    text-decoration: none;
    font-weight: 600;
  }
  .inbox-back-link a:hover { text-decoration: underline; }

