/* NAVIGATION */
.nav { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); border-bottom: 1px solid var(--border); padding: 0 20px; height: 56px; width: 100%; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; }
.nav-wordmark { font-family: 'Instrument Serif', Georgia, serif; font-size: 21px; color: var(--text); letter-spacing: -0.6px; font-weight: 700; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-pill { height: 32px; padding: 0 14px; border-radius: var(--radius-full); border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.nav-pill:hover { border-color: var(--border-hover); color: var(--text); }
.nav-pill.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* THEME TOGGLE */
.theme-toggle { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition); }
.theme-toggle:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface2); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .icon-sun { display: none; } [data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; } [data-theme="light"] .icon-moon { display: none; }

/* SHARED COMPONENTS */
.btn-fill { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-full); padding: 14px 36px; font-size: 15px; font-weight: 600; cursor: pointer; transition: opacity var(--transition), transform var(--transition); min-height: 44px; }
.btn-fill:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 13px 36px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all var(--transition); min-height: 44px; }
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

/* ONBOARDING */
.ob-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); display: flex; align-items: center; justify-content: center; margin: 0 auto 32px; animation: markBreath 4s ease-in-out infinite; }
.ob-mark svg { width: 28px; height: 28px; color: #fff; stroke: #fff; }
.ob-h1 { font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(38px, 9vw, 68px); line-height: 1.0; letter-spacing: -1.5px; color: var(--text); margin-bottom: 20px; }
.ob-h1 em { font-style: italic; color: var(--accent); }
.ob-p { font-size: 16px; color: var(--text2); max-width: 340px; margin: 0 auto 40px; line-height: 1.65; }
.ob-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 48px; }
.ob-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 8px 16px; font-size: 13px; color: var(--text2); }
.ob-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }

/* AUTH */
#screen-auth { align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 28px; width: 100%; max-width: 380px; }
.auth-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 26px; letter-spacing: -0.5px; margin-bottom: 4px; }
.auth-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.auth-tabs { display: flex; background: var(--surface2); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 8px; text-align: center; font-size: 14px; font-weight: 500; color: var(--text2); cursor: pointer; border-radius: 8px; border: none; background: none; transition: all var(--transition); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text2); display: block; margin-bottom: 6px; letter-spacing: 0.2px; }
.form-input { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; color: var(--text); outline: none; }
.form-input:focus { border-color: var(--accent); }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text3); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; transition: all var(--transition); }
.btn-google:hover { border-color: var(--border-hover); background: var(--surface); }
.btn-google:disabled { opacity: 0.5; cursor: not-allowed; }

/* HOME */
.home-body { flex: 1; padding: 28px 24px 100px; max-width: 800px; margin: 0 auto; width: 100%; }
.home-greeting { font-family: 'Instrument Serif', Georgia, serif; font-size: 28px; letter-spacing: -0.6px; margin-bottom: 6px; font-weight: 400; line-height: 1.15; color: var(--text); }
.home-greeting em { font-style: italic; color: var(--accent); }
.home-sub { color: var(--text2); font-size: 14px; margin-bottom: 24px; line-height: 1.55; }

/* Exam countdown */
.exam-countdown { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-md); padding: 11px 16px; margin-bottom: 20px; cursor: pointer; transition: all 0.15s ease; }
.exam-countdown:hover { border-color: var(--accent); }
.exam-countdown b { font-family: 'Instrument Serif', Georgia, serif; font-weight: 700; color: var(--accent); font-size: 16px; letter-spacing: -0.2px; }
.exam-countdown.empty { color: var(--text2); background: transparent; border-style: dashed; font-weight: 500; }
.exam-countdown.urgent { background: var(--danger-soft); border-color: rgba(229,72,77,0.3); }
.exam-countdown.urgent b { color: var(--danger); }
.exam-edit-hint { color: var(--accent); font-weight: 600; }

.exam-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; animation: fadeUp 0.15s ease; }
.exam-modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.exam-modal-title { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 22px; letter-spacing: -0.3px; color: var(--text); }
.exam-modal-sub { color: var(--text2); font-size: 13px; margin: 2px 0 18px; }
.exam-modal-input { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; font-size: 14px; color: var(--text); font-family: 'DM Sans', -apple-system, sans-serif; outline: none; }
.exam-modal-input:focus { border-color: var(--accent-border); }
.exam-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.exam-modal-save { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-md); padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.exam-modal-cancel { background: none; border: none; color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; padding: 9px 8px; font-family: 'DM Sans', sans-serif; }

/* Exam-date editor: one block per subject, one row per paper */
#exam-subject-rows { max-height: 46vh; overflow-y: auto; }
.exam-subject-block { margin-bottom: 16px; }
.exam-subject-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.exam-subject-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.exam-add-paper { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.exam-paper-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.exam-paper-label { flex: 1 1 auto; min-width: 0; }
.exam-paper-date { flex: 0 0 140px; }
.exam-paper-remove { flex: 0 0 auto; background: none; border: none; color: var(--text3); font-size: 15px; line-height: 1; cursor: pointer; padding: 4px 6px; }
.exam-paper-remove:hover { color: var(--danger); }

/* Dashboard: compact schedule list, shown when 2+ subjects have a date set */
.exam-schedule { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px 14px; margin: -8px 0 20px; }
.exam-schedule-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
.exam-schedule-row:last-child { border-bottom: none; }
.exam-schedule-row.past { color: var(--text3); }
.exam-schedule-days { font-weight: 600; color: var(--accent); }
.exam-schedule-row.past .exam-schedule-days { color: var(--text3); }

/* Daily goal (habit loop) */
.daily-goal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 20px; }
.daily-goal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.daily-goal-label { font-size: 12px; font-weight: 500; color: var(--text2); }
.daily-goal-count { font-size: 12px; font-weight: 600; color: var(--text); }
.daily-goal-track { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.daily-goal-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.35s ease; }
.daily-goal.met .daily-goal-fill { background: var(--success); }
.daily-goal.met .daily-goal-count { color: var(--success); }

/* ── HOME COMPOSER (redesigned) ──────────────────────────────────────── */
.composer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); margin: 20px 0 14px; overflow: hidden; transition: border-color var(--transition), box-shadow var(--transition); }
.composer:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(37,99,235,0.08), 0 8px 24px rgba(0,0,0,0.06); }
.composer-config { padding: 16px 16px 6px; display: flex; flex-direction: column; gap: 14px; }
.cfg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cfg-label { flex: 0 0 auto; width: 54px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text3); }
.cfg-row .subject-row, .cfg-row .level-row { flex: 1 1 120px; min-width: 0; margin: 0; padding-left: 0; }
.cfg-row .board-row { margin: 0; }
.cfg-row .board-label-row { flex: 0 0 auto; margin: 0; }
.manage-link { display: inline-flex; align-items: center; gap: 5px; }
.manage-link svg { flex: 0 0 auto; }
#level-cfg { display: flex; flex-direction: column; gap: 6px; }
/* Textarea + footer blend into the composer card (no nested card border). */
.composer .input-wrap { border: none; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; margin: 0; }
.composer > .injection-warning, .composer > .examiner-q-wrap { margin: 0 16px 12px; }
.input-footer { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; background: var(--surface2); }

/* Metrics strip: streak · daily usage · today's goal */
.metrics { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.metrics .streak-card, .metrics .usage-card, .metrics .daily-goal { margin: 0; }
.streak-flame { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; background: var(--warning-soft); color: var(--warning); display: flex; align-items: center; justify-content: center; }
.streak-flame svg { width: 18px; height: 18px; }
.usage-bar-track, .daily-goal-track { height: 6px; background: var(--surface2); }
@media (max-width: 600px) {
  .metrics { grid-template-columns: 1fr; }
  .cfg-label { width: 100%; }
  .cfg-row .board-label-row { flex: 1 1 100%; }
}

/* Study focus ("coach") card */
.focus-card:empty { display: none; }
.focus-recs { display: flex; flex-direction: column; gap: 10px; }
.rec { display: flex; align-items: center; gap: 14px; padding: 13px 15px; border-radius: var(--radius-md); border: 1px solid var(--border); transition: border-color var(--transition); }
.rec:hover { border-color: var(--border-hover); }
.rec.primary { background: var(--accent-soft); border-color: var(--accent-border); }
.rec-ic { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.rec-ic svg { width: 19px; height: 19px; }
.rec.primary .rec-ic { background: var(--accent); color: #fff; }
.rec.warn .rec-ic { background: var(--warning-soft); color: var(--warning); }
.rec.study .rec-ic { background: var(--surface2); color: var(--text2); }
.rec-body { flex: 1 1 auto; min-width: 0; }
.rec-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--text); }
.rec-title b { font-weight: 700; color: var(--accent); }
.rec.warn .rec-title b { color: var(--warning); }
.focus-rec-btn { flex: 0 0 auto; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-full); padding: 9px 15px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; white-space: nowrap; transition: opacity var(--transition); }
.focus-rec-btn:hover { opacity: 0.9; }
.rec.warn .focus-rec-btn, .rec.study .focus-rec-btn { background: transparent; color: var(--text); border: 1px solid var(--border-hover); }

/* Momentum strip: progress/mastery cues at the foot of the Focus-next card */
.focus-momentum { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.fm-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text2); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 6px 12px; }
.fm-chip b { color: var(--text); font-weight: 700; }
.fm-chip svg { width: 14px; height: 14px; color: var(--text3); flex: 0 0 auto; }
.fm-up { color: var(--success); font-weight: 700; }
.fm-down { color: var(--danger); font-weight: 700; }

/* Home greeting sub-line, when it carries a tappable study nudge */
.home-sub-nudge { cursor: pointer; color: var(--text); }
.home-sub-nudge:hover { color: var(--accent); }
.home-sub-nudge b { font-weight: 700; }
.level-row { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 2px; padding-left: 4px; -webkit-overflow-scrolling: touch; }
.level-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-full); padding: 6px 16px; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; background: transparent; white-space: nowrap; transition: all 0.15s cubic-bezier(0.4,0,0.2,1); letter-spacing: 0.1px; }
.level-btn.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.level-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text); background: var(--surface2); }

/* ── SIDEBAR STYLES ──────────────────────────────────────────── */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }
.sidebar { position: fixed; top: 0; left: -320px; width: 320px; height: 100%; background: var(--bg); border-right: 1px solid var(--border); z-index: 101; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column; }
.sidebar.active { transform: translateX(320px); }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sidebar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.sidebar-close { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.search-wrap { position: relative; }
.search-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px 8px 34px; font-size: 13px; color: var(--text); outline: none; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }

.filter-tabs { display: flex; background: var(--surface2); border-radius: var(--radius-sm); padding: 2px; }
.filter-tab { flex: 1; padding: 6px; text-align: center; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; border-radius: 4px; border: none; background: none; }
.filter-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.fav-btn { color: var(--text3); cursor: pointer; transition: color 0.1s ease; border: none; background: none; display: flex; align-items: center; }
.fav-btn svg { width: 20px; height: 20px; fill: currentColor; }

.history-item { position: relative; }
.history-del { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: 0; background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(229,72,77,0.2); border-radius: 4px; padding: 4px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.history-item:hover .history-del { opacity: 1; }
.history-del:hover { background: var(--danger); color: #fff; }

/* ── COMPARISON LAYOUT ───────────────────────────────────────── */
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; animation: fadeUp 0.4s ease both; }
.comp-col { display: flex; flex-direction: column; gap: 12px; }
.comp-header { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.comp-header svg { width: 14px; height: 14px; }

@media (max-width: 600px) {
  .comparison-grid { grid-template-columns: 1fr; }
}

.suggestion-banner { background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; animation: fadeUp 0.3s ease both; }
.suggestion-icon { font-size: 20px; color: var(--accent); }
.suggestion-text { flex: 1; font-size: 13px; color: var(--text); line-height: 1.5; }
.suggestion-btn { background: var(--accent); color: #fff; border: none; border-radius: 99px; padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* ── SHARE MENU ─────────────────────────────────────────────── */
.share-dropdown { position: relative; margin-top: 12px; }
.share-menu { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.12); z-index: 60; margin-bottom: 8px; display: none; overflow: hidden; animation: fadeUp 0.2s ease; }
.share-menu.show { display: block; }
.share-opt { width: 100%; padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); background: none; border: none; cursor: pointer; text-align: left; transition: background 0.2s ease; border-bottom: 1px solid var(--border); }
.share-opt:last-child { border-bottom: none; }
.share-opt:hover { background: var(--surface2); color: var(--text); }
.share-opt svg { width: 14px; height: 14px; color: var(--accent); }

/* SOCIAL MODE CAPTURE STYLES */
.social-render { padding: 40px; background: var(--bg); position: relative; width: 600px; }
.social-render .nav-wordmark { margin-bottom: 24px; display: block; }
.social-render .share-btn { display: none; }
.social-render .fav-btn { display: none; }
.social-render .compare-trigger { display: none; }

body.embed-mode .nav, 
body.embed-mode .bottom-nav, 
body.embed-mode .sidebar-overlay, 
body.embed-mode .sidebar { display: none !important; }
body.embed-mode .home-body { padding: 12px; margin: 0; width: 100%; max-width: none; }
body.embed-mode { background: transparent; }

.compare-trigger { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent); font-weight: 600; cursor: pointer; background: none; border: none; padding: 4px 8px; border-radius: 4px; transition: background 0.2s ease; margin-top: 8px; }
.compare-trigger:hover { background: var(--accent-soft); }

/* ── MODE TOGGLE ─────────────────────────────────────────────── */

/* MODE TOGGLE */
.mode-toggle { display: flex; background: var(--surface2); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 20px; gap: 2px; border: 1px solid var(--border); }
.mode-btn { flex: 1; padding: 10px 14px; text-align: center; font-size: 13px; font-weight: 500; color: var(--text3); cursor: pointer; border-radius: 6px; border: none; background: none; transition: all 0.2s cubic-bezier(0.4,0,0.2,1); letter-spacing: -0.1px; font-family: 'DM Sans', sans-serif; }
.mode-btn.active { background: var(--text); color: var(--bg); box-shadow: 0 1px 6px rgba(0,0,0,0.15); font-weight: 600; }
.mode-btn.active.examiner { background: var(--text); color: var(--bg); box-shadow: 0 1px 6px rgba(0,0,0,0.15); border: none; }
/* SUBJECT PICKER */
.subject-row { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; padding-left: 2px; -webkit-overflow-scrolling: touch; -ms-overflow-style: none; scrollbar-width: none; }
.subject-row::-webkit-scrollbar { display: none; }
.subject-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-full); padding: 6px 14px; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; background: var(--surface); white-space: nowrap; transition: all 0.15s cubic-bezier(0.4,0,0.2,1); letter-spacing: 0.1px; }
.subject-btn.active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.subject-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text); background: var(--surface2); }
/* BOARD ROW */
.board-row { display: flex; gap: 5px; margin-bottom: 20px; }
/* Personalized mode: board as a read-only label + manage link */
.board-label-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.board-label { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 6px; padding: 5px 12px; letter-spacing: 0.6px; text-transform: uppercase; }
.manage-link { margin-left: auto; background: none; border: none; color: var(--text3); font-size: 12px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: color 0.15s ease; }
.manage-link:hover { color: var(--accent); }
.board-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; font-size: 11px; font-weight: 700; color: var(--text3); cursor: pointer; background: transparent; letter-spacing: 0.6px; text-transform: uppercase; transition: all 0.15s cubic-bezier(0.4,0,0.2,1); }
.board-btn.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-border); }
.board-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text2); background: var(--surface2); }
/* EXAMINER MODE */
.examiner-hint { font-size: 12px; color: var(--text3); margin-bottom: 10px; line-height: 1.5; display: none; }
.examiner-hint.show { display: block; }
.examiner-q-wrap { margin-bottom: 12px; }
.examiner-q-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; letter-spacing: -0.1px; }
.examiner-q-input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; font-size: 14px; color: var(--text); resize: none; min-height: 56px; max-height: 200px; line-height: 1.6; font-family: 'DM Sans', -apple-system, sans-serif; outline: none; overflow-y: auto; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: border-color var(--transition), box-shadow var(--transition); }
.examiner-q-input:focus { border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.examiner-q-input::placeholder { color: var(--text3); }
.marks-row { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.marks-label { font-size: 12px; color: var(--text2); font-weight: 500; white-space: nowrap; }
.marks-input { width: 60px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; color: var(--text); outline: none; text-align: center; }
.marks-input:focus { border-color: var(--accent); }
/* EXAMINER RESULT CARDS */
.score-banner { border-radius: var(--radius-md); padding: 20px 24px; margin-bottom: 12px; display: flex; align-items: center; gap: 16px; animation: fadeUp 0.3s ease both; }
.score-banner.high { background: rgba(48,164,108,0.12); border: 1px solid rgba(48,164,108,0.25); }
.score-banner.mid { background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.25); }
.score-banner.low { background: var(--danger-soft); border: 1px solid rgba(229,72,77,0.2); }
.score-circle { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: "Instrument Serif", Georgia, serif; font-size: 20px; font-weight: 700; }
.score-banner.high .score-circle { background: rgba(48,164,108,0.2); color: var(--success); }
.score-banner.mid .score-circle { background: rgba(245,158,11,0.2); color: var(--warning); }
.score-banner.low .score-circle { background: var(--danger-soft); color: var(--danger); }
.score-info { flex: 1; }
.score-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.score-sub { font-size: 12px; color: var(--text2); }
.awarded-item { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; font-size: 14px; color: var(--text2); line-height: 1.55; }
.awarded-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.model-answer-card { background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 10px; animation: fadeUp 0.35s ease both; }

/* INPUT INJECTION WARNING */
.injection-warning { background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.25); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; font-size: 12px; color: var(--warning); display: none; align-items: center; gap: 8px; }
.injection-warning.show { display: flex; animation: screenIn 0.2s ease both; }

.input-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 14px; transition: border-color var(--transition), box-shadow var(--transition); box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.input-wrap:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px rgba(37,99,235,0.08), 0 2px 8px rgba(0,0,0,0.06); }
.input-wrap.danger { border-color: rgba(229,72,77,0.4); box-shadow: 0 0 0 3px var(--danger-soft); }
.main-textarea { width: 100%; background: transparent; border: none; outline: none; padding: 16px; font-size: 15px; color: var(--text); resize: none; min-height: 140px; max-height: 360px; line-height: 1.65; font-family: 'DM Sans', -apple-system, sans-serif; overflow-y: auto; transition: height 0.1s ease; }
.input-footer { border-top: 1px solid var(--border); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; }
.submit-btn { background: var(--accent); border: none; border-radius: var(--radius-full); padding: 8px 22px; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer; display: flex; align-items: center; gap: 6px; letter-spacing: 0.1px; transition: opacity 0.15s ease, transform 0.15s ease; min-height: 44px; }
.submit-btn:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.submit-btn:active:not(:disabled) { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.submit-btn.loading { opacity: 0.7; }
/* Examiner mode — accent submit */
body.mode-examiner .submit-btn:not(:disabled) { background: var(--accent); color: #fff; }

.usage-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.usage-label { font-size: 12px; color: var(--text3); }
.usage-count { font-size: 12px; color: var(--text2); font-weight: 500; }
.usage-track { height: 3px; background: var(--border); border-radius: var(--radius-full); margin-bottom: 24px; overflow: hidden; }
.usage-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.4s ease; }
.usage-fill.warn { background: var(--warning); }
.usage-fill.danger { background: var(--danger); }

/* STREAK + USAGE WIDGET */
.streak-usage-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 20px; }
.streak-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 18px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; transition: border-color var(--transition), background var(--transition); }
.streak-card:hover { border-color: var(--border-hover); background: var(--surface2); }
.streak-fire { font-size: 22px; line-height: 1; }
.streak-info { display: flex; flex-direction: column; }
.streak-num { font-family: 'Instrument Serif', Georgia, serif; font-size: 26px; line-height: 1; letter-spacing: -0.8px; color: var(--text); }
.streak-label { font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }
.usage-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.usage-card-top { display: flex; align-items: center; justify-content: space-between; }
.usage-card-label { font-size: 11px; color: var(--text3); font-weight: 500; }
.usage-card-count { font-size: 12px; color: var(--text2); font-weight: 600; }
.usage-bar-track { height: 4px; background: var(--border); border-radius: var(--radius-full); overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.usage-bar-fill.warn { background: var(--warning); }
.usage-upgrade-link { font-size: 11px; color: var(--accent); font-weight: 600; text-decoration: none; align-self: flex-start; }
.usage-upgrade-link:hover { text-decoration: underline; }
.usage-bar-fill.danger { background: var(--danger); }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 28px; }
@media (max-width: 600px) {
  .quick-grid { grid-template-columns: 1fr; }
}
.quick-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; cursor: pointer; text-align: left; transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease; }
.quick-card:hover { border-color: var(--border-hover); background: var(--surface2); transform: translateY(-1px); }
.quick-card:active { transform: translateY(0); }
.quick-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; letter-spacing: -0.1px; }

/* HISTORY SECTION */
.section-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; margin-top: 4px; display: flex; align-items: center; justify-content: space-between; }
.history-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.history-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-item:hover { border-color: var(--border-hover); background: var(--surface2); transform: translateY(-1px); }
.history-item:active { transform: translateY(0); }
.history-q { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; font-weight: 450; letter-spacing: -0.1px; }
.history-meta { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.history-badge { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 4px; padding: 2px 7px; flex-shrink: 0; letter-spacing: 0.1px; }
.history-empty { font-size: 13px; color: var(--text3); text-align: center; padding: 32px 20px; line-height: 1.6; }

/* BOTTOM NAV */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; border-top: 1px solid var(--border); padding: 10px 0 max(16px, env(safe-area-inset-bottom)); display: flex; justify-content: space-around; background: var(--nav-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); z-index: 40; }
.bnav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 6px 20px; border-radius: var(--radius-sm); border: none; background: none; min-width: 60px; color: var(--text3); transition: all var(--transition); }
.bnav-item.active { background: none; color: var(--text); }
.bnav-item.active .bnav-icon svg { stroke-width: 2.5; }
.bnav-item.active .bnav-label { color: var(--text); font-weight: 700; }
.bnav-item:hover:not(.active) { color: var(--text2); }
.bnav-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.75; }
.bnav-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* RESULT SCREEN */
.result-body { flex: 1; padding: 28px 24px 100px; max-width: 800px; margin: 0 auto; width: 100%; }
.back-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.back-btn { display: flex; align-items: center; gap: 6px; color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: none; transition: color var(--transition); padding: 0; }
.back-btn:hover { color: var(--text); }

/* Question box */
.result-question-box { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 14px; }
.rq-label { font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.rq-text { font-size: 13px; color: var(--text2); line-height: 1.5; }

/* Score banner — matches mock */
.score-banner { border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 14px; display: flex; align-items: center; gap: 16px; animation: fadeUp 0.3s ease both; }
.score-banner.high { background: rgba(22,163,74,0.07); border: 1px solid rgba(22,163,74,0.2); }
.score-banner.mid { background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.22); }
.score-banner.low { background: rgba(220,38,38,0.06); border: 1px solid rgba(220,38,38,0.18); }
.score-circle { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: "Instrument Serif", Georgia, serif; font-size: 17px; font-weight: 700; letter-spacing: -0.5px; }
.score-banner.high .score-circle { background: rgba(22,163,74,0.15); color: var(--success); }
.score-banner.mid .score-circle { background: rgba(245,158,11,0.15); color: var(--warning); }
.score-banner.low .score-circle { background: rgba(220,38,38,0.1); color: var(--danger); }
.score-info { flex: 1; }
.score-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 3px; letter-spacing: -0.3px; }
.score-sub { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* Side-by-side marks grid — matches mock */
.marks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.marks-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; animation: fadeUp 0.3s ease both; }
.marks-col-header { padding: 10px 14px; font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.marks-col-header.awarded { background: rgba(22,163,74,0.07); color: #15803d; border-bottom-color: rgba(22,163,74,0.15); }
.marks-col-header.missed { background: rgba(220,38,38,0.06); color: #b91c1c; border-bottom-color: rgba(220,38,38,0.12); }
.marks-col-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mark-item { font-size: 12.5px; color: var(--text2); line-height: 1.5; display: flex; gap: 7px; align-items: flex-start; }
.mark-plus { color: #16a34a; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.mark-minus { color: #dc2626; font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* Examiner's verdict, elevated into a signature "note" artifact */
.examiner-note { margin: 0 0 12px; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.examiner-note .en-text { font-size: 13.5px; line-height: 1.55; color: var(--text); font-style: italic; }
.examiner-note .en-by { display: block; margin-top: 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--accent); font-style: normal; }

/* Mark-by-mark reveal — entrance only, gated so reduced-motion users get the
   same content instantly (base state below is fully visible). */
@media (prefers-reduced-motion: no-preference) {
  .marks-reveal .score-circle { animation: scorePop 0.5s cubic-bezier(0.22,1,0.36,1) both; }
  .marks-reveal .mark-item { animation: markRise 0.42s cubic-bezier(0.22,1,0.36,1) both; }
  .examiner-note { animation: markRise 0.45s cubic-bezier(0.22,1,0.36,1) both; }
}

/* Model answer card — accent blue like mock */
.model-answer-card { background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 10px; animation: fadeUp 0.35s ease both; }
.model-answer-card .card-header { background: transparent; border-bottom: 1px solid var(--accent-border); padding: 10px 16px; }
.model-answer-card .card-title { color: var(--accent); font-size: 10px; letter-spacing: 0.6px; }
.model-answer-card .card-body { padding: 14px 16px; font-size: 13px; line-height: 1.7; color: var(--text); }

/* SHARE BUTTON */
.share-btn { width: 100%; margin-top: 16px; margin-bottom: 8px; padding: 11px 20px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all var(--transition); font-family: 'DM Sans', sans-serif; animation: fadeUp 0.3s 0.25s ease both; }
.share-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface2); }
.share-btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }

/* SHARE TOAST OVERRIDE — positioned higher on result screen */
#toast.result-toast { bottom: 24px; }

/* Improve card */
.improve-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 10px; animation: fadeUp 0.3s 0.1s ease both; }

/* Generic answer card — explain mode */
.answer-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 10px; animation: fadeUp 0.3s ease both; }
.answer-card:nth-child(2) { animation-delay: 0.05s; }
.answer-card:nth-child(3) { animation-delay: 0.1s; }
.answer-card:nth-child(4) { animation-delay: 0.15s; }
.card-header { padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.card-title { font-size: 10px; font-weight: 700; color: var(--text2); letter-spacing: 0.6px; text-transform: uppercase; }
.card-body { padding: 16px; font-size: 13.5px; line-height: 1.7; color: var(--text2); }
.step-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.step-num { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; background: var(--accent-soft); border: 1px solid var(--accent-border); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--accent); }
.mistake-item { background: var(--danger-soft); border: 1px solid rgba(229,72,77,0.15); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 7px; color: var(--text2); font-size: 13px; line-height: 1.5; display: flex; gap: 8px; }
.bullet-item { display: flex; gap: 8px; align-items: baseline; margin-bottom: 7px; color: var(--text2); font-size: 13px; }

/* Mobile: stack the marks grid */
@media (max-width: 768px) {
  .marks-grid { grid-template-columns: 1fr; }
  .marks-col { margin-bottom: 12px; }
}

/* LOADING STATES */
.loading-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 48px 24px; text-align: center; }
.loader { width: 32px; height: 32px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 14px; }
.loading-step { font-size: 12px; color: var(--text3); margin-top: 6px; height: 18px; transition: opacity 0.3s ease; }

/* RETRY BANNER */
.retry-banner { background: var(--warning-soft); border: 1px solid rgba(245,158,11,0.2); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: var(--warning); display: none; align-items: center; gap: 8px; }
.retry-banner.show { display: flex; }

/* FALLBACK CARD */
.fallback-card { background: var(--surface); border: 1px dashed var(--border-hover); border-radius: var(--radius-md); padding: 20px; margin-bottom: 10px; }
.fallback-label { font-size: 11px; font-weight: 600; color: var(--warning); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ERROR CARD */
.error-card { background: var(--surface); border: 1px solid rgba(229,72,77,0.2); border-radius: var(--radius-md); padding: 24px; text-align: center; }
.error-icon { font-size: 32px; margin-bottom: 12px; color: var(--danger); }
.error-title { font-size: 16px; font-weight: 600; color: var(--danger); margin-bottom: 6px; }
.error-msg { font-size: 13px; color: var(--text2); margin-bottom: 20px; line-height: 1.5; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-btn-retry { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-full); padding: 9px 22px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity var(--transition); }
.error-btn-retry:hover { opacity: 0.85; }
.error-btn-back { background: transparent; color: var(--text2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 9px 22px; font-size: 13px; cursor: pointer; transition: all var(--transition); }
.error-btn-back:hover { border-color: var(--border-hover); color: var(--text); }

/* RATE LIMIT CARD */
.rate-limit-card { background: var(--surface); border: 1px solid rgba(229,72,77,0.2); border-radius: var(--radius-md); padding: 28px 24px; text-align: center; }
.rate-limit-icon { font-size: 36px; margin-bottom: 14px; color: var(--text3); }
.rate-limit-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; margin-bottom: 8px; letter-spacing: -0.3px; }
.rate-limit-msg { font-size: 14px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.rate-limit-by { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--accent); margin-bottom: 24px; }
.upgrade-btn { background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; border: none; border-radius: var(--radius-full); padding: 12px 32px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* CACHED BADGE */
.cached-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 3px 10px; font-size: 11px; color: var(--text3); font-weight: 500; margin-bottom: 12px; }

/* SYLLABUS BADGE ("Spec 4.5.2: ...") */
.syllabus-badge { display: inline-block; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 3px 10px; font-size: 11px; color: var(--text3); font-weight: 500; margin-bottom: 12px; }

/* TOAST */
#toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500; opacity: 0; transition: all 0.2s ease; z-index: 999; pointer-events: none; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-error { background: var(--danger); color: #fff; }
#toast.toast-warn { background: var(--warning); color: #000; }
#toast.toast-success { background: var(--success); color: #fff; }

#toast.toast-success { background: var(--success); color: #fff; }

/* ── DASHBOARD STYLES ────────────────────────────────────────── */
.dash-body { flex: 1; padding: 28px 24px 100px; max-width: 980px; margin: 0 auto; width: 100%; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 34px; letter-spacing: -0.8px; font-weight: 400; line-height: 1.05; margin-bottom: 24px; }
.dash-head .dash-title { margin-bottom: 0; }
.dash-title em { font-style: italic; color: var(--accent); }
.dash-sub { font-size: 13.5px; color: var(--text2); margin-top: 4px; }

/* Streak chip */
.streak-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 8px 8px 8px 14px; }
.streak-chip:empty { display: none; }
.streak-chip .sc-flame { display: flex; color: var(--warning); }
.streak-chip .sc-flame svg { width: 18px; height: 18px; }
.streak-chip .sc-n { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1; }
.streak-chip .sc-l { font-size: 11px; color: var(--text2); line-height: 1.15; }
.streak-chip .sc-best { font-size: 10px; font-weight: 700; color: var(--warning); background: var(--warning-soft); padding: 5px 9px; border-radius: var(--radius-full); white-space: nowrap; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; align-items: start; }
.dash-grid .col-7 { grid-column: span 7; }
.dash-grid .col-5 { grid-column: span 5; }
.dash-grid .col-12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-link { font-size: 12.5px; font-weight: 600; color: var(--accent); background: none; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; }

/* Shared progress bar */
.bar { height: 6px; border-radius: var(--radius-full); background: var(--surface2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--radius-full); background: var(--accent); }
.bar > i.green { background: var(--success); }
.bar > i.amber { background: var(--warning); }
.bar > i.red { background: var(--danger); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 128px; transition: border-color var(--transition); }
.stat-box:hover { border-color: var(--border-hover); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.stat-ic svg { width: 17px; height: 17px; }
.stat-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: var(--radius-full); color: var(--text2); background: var(--surface2); }
.stat-delta.up { color: var(--success); background: var(--success-soft); }
.stat-delta.down { color: var(--danger); background: var(--danger-soft); }
.stat-val { font-family: 'Instrument Serif', Georgia, serif; font-size: 34px; line-height: 1; color: var(--text); letter-spacing: -1px; display: block; }
.stat-val-sm { font-size: 24px; letter-spacing: -0.5px; }
.stat-lbl { font-size: 12px; color: var(--text2); display: block; margin-top: 5px; }
.stat-spark { margin-top: auto; }
.stat-spark svg { display: block; width: 100%; height: 26px; }

/* Exam hero */
.exam-hero { display: flex; flex-direction: column; }
.exam-hero .exam-days { font-family: 'Instrument Serif', Georgia, serif; font-size: 52px; font-weight: 700; line-height: 0.9; letter-spacing: -1.5px; color: var(--accent); }
.exam-hero .exam-days-unit { font-size: 14px; color: var(--text2); font-weight: 500; margin-left: 6px; }
.exam-hero .exam-next-name { font-size: 13px; color: var(--text); font-weight: 600; margin-top: 5px; }
.exam-hero-list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.exam-hero-row { display: flex; flex-direction: column; gap: 6px; }
.exam-hero-row-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.exam-hero-row-top .subj { font-weight: 600; }
.exam-hero-row-top .d { color: var(--text2); font-variant-numeric: tabular-nums; }
.exam-hero-row-top .d b { color: var(--text); font-weight: 700; }
.exam-hero-row.past .d, .exam-hero-row.past .subj { color: var(--text3); }
.exam-hero-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--text2); font-size: 14px; cursor: pointer; }
.exam-hero-empty .eh-cal { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.exam-hero-empty .eh-cal svg { width: 20px; height: 20px; }
.exam-hero-empty .eh-copy { line-height: 1.5; }
.exam-hero-empty .eh-set { color: var(--accent); font-weight: 600; }
.exam-hero-empty:hover .eh-set { text-decoration: underline; }

/* Heatmap */
.heatmap-card { padding: 20px; }
.heatmap-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.heatmap-legend { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--text3); }
.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap-months { display: flex; gap: 3px; margin-bottom: 6px; font-size: 10.5px; color: var(--text3); }
.heatmap-cell { width: 14px; height: 14px; border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); flex: 0 0 auto; }
.heatmap-legend .heatmap-cell { width: 11px; height: 11px; }
.heatmap-cell.level-1 { background: #dbeafe; border-color: #bfdbfe; }
.heatmap-cell.level-2 { background: #93c5fd; border-color: #60a5fa; }
.heatmap-cell.level-3 { background: #3b82f6; border-color: #2563eb; }
.heatmap-cell.level-4 { background: #1d4ed8; border-color: #1e40af; }
.heatmap-grid { display: flex; gap: 3px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-foot { display: flex; gap: 24px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.hm-foot-n { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; font-weight: 700; letter-spacing: -0.4px; display: block; }
.hm-foot-l { font-size: 11.5px; color: var(--text2); }

/* Most-asked topics (ranked bars) */
.topic-list { display: flex; flex-direction: column; gap: 4px; }
.topic-item { display: grid; grid-template-columns: minmax(0,1.1fr) 1.4fr auto; align-items: center; gap: 12px; padding: 8px 0; }
.topic-name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-count { font-size: 12.5px; font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Syllabus mastery */
.spec-list { display: flex; flex-direction: column; }
.spec-item { display: flex; flex-direction: column; gap: 8px; padding: 13px 0; border-top: 1px solid var(--border); }
.spec-item:first-child { border-top: none; padding-top: 2px; }
.spec-header { display: flex; align-items: center; gap: 10px; }
.spec-code { font-size: 11px; font-weight: 700; color: var(--text2); background: var(--surface2); border: 1px solid var(--border); padding: 3px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.spec-title { font-size: 13.5px; font-weight: 600; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-stats { font-size: 12px; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.spec-bar { display: flex; align-items: center; gap: 12px; }
.spec-bar .bar { flex: 1 1 auto; }
.spec-bar .spec-stats { flex: 0 0 auto; min-width: 116px; }
.spec-indicator { padding: 4px 9px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; letter-spacing: 0.4px; white-space: nowrap; flex: 0 0 auto; }
.spec-indicator.green { color: var(--success); background: var(--success-soft); }
.spec-indicator.amber { color: var(--warning); background: var(--warning-soft); }
.spec-indicator.red { color: var(--danger); background: var(--danger-soft); }

@media (max-width: 820px) {
  .dash-grid .col-7, .dash-grid .col-5 { grid-column: span 12; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ═══════════════════════════════════════
   iPHONE / iOS MOBILE OPTIMISATIONS
   Fixes for: zoom-on-focus, safe areas,
   touch targets, layout, overflow
═══════════════════════════════════════ */

/* 1 ── Prevent iOS Safari auto-zoom on input focus.
        Safari zooms in whenever an input's font-size < 16px.
        We bump to 16px on mobile only so desktop stays as designed. */
@media (max-width: 640px) {
  .form-input,
  .main-textarea,
  .marks-input {
    font-size: 16px;
  }
}

/* 2 ── Safe-area-aware bottom padding.
        Home body must clear the bottom nav + iPhone home bar.
        Result body has no bottom nav so only needs home-bar clearance. */
@media (max-width: 640px) {
  .home-body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .result-body {
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }
}

/* 3 ── Auth screen: scrollable from top on small phones.
        Default justify-content:center cuts off the card on very short
        viewports (e.g. iPhone SE in landscape). */
@media (max-width: 640px) {
  #screen-auth {
    justify-content: flex-start;
    padding-top: max(48px, calc(env(safe-area-inset-top) + 24px));
    padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 20px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .auth-card {
    width: 100%;
    /* Let it breathe against the screen edges */
    border-radius: var(--radius-md);
  }
}

/* 4 ── Touch targets: Apple HIG recommends ≥ 44 × 44 pt.
        Enlarge tappable elements that are too small by default. */
@media (max-width: 640px) {
  .nav-pill      { height: 36px; min-width: 44px; padding: 0 16px; }
  .theme-toggle  { width: 40px;  height: 40px; }
  .auth-tab      { padding: 11px 8px; min-height: 40px; }
  .level-btn,
  .subject-btn   { padding: 8px 16px; min-height: 36px; }
  .board-btn     { padding: 6px 12px; min-height: 34px; }
  .ob-chip-btn   { padding: 9px 16px; min-height: 36px; }
  .bnav-item     { padding: 8px 16px; min-height: 48px; }
  .btn-fill      { padding: 15px 36px; }
  .history-item  { padding: 15px 16px; min-height: 52px; }
  .quick-card    { padding: 16px; min-height: 52px; }
  .submit-btn    { padding: 10px 20px; min-height: 40px; }
  .btn-google    { padding: 14px; min-height: 48px; }
}

/* 5 ── Hide keyboard shortcut hint — ⌘+↵ is meaningless on touch. */
@media (max-width: 640px) {
  #keyboard-hint { display: none; }
}

/* 6 ── Prevent horizontal overflow on any screen. */
@media (max-width: 640px) {
  .screen        { overflow-x: hidden; }
  html, body     { overflow-x: hidden; }
  /* Keep the typewriter line from wrapping awkwardly */
  .lp-tw-wrap    { justify-content: flex-start; padding: 0 20px; }
}

/* 7 ── Landing hero: tighter vertical rhythm on small screens. */
@media (max-width: 640px) {
  .lp-h1         { margin-bottom: 14px; }
  .lp-sub        { font-size: 15px; margin-bottom: 28px; }
  .lp-cta-row    { gap: 8px; margin: 0 auto; }
  .lp-eyebrow    { font-size: 11px; }
}

/* 8 ── Landing nav: ensure full-width tap area and safe top inset
        on iPhones with Dynamic Island / notch.
        The nav is sticky (not fixed) so the browser handles the top
        inset, but we add a small explicit top padding as a safety net. */
@media (max-width: 640px) {
  .lp-nav {
    padding-top: max(0px, env(safe-area-inset-top));
    height: auto;
    min-height: 56px;
  }
  .nav {
    padding-top: max(0px, env(safe-area-inset-top));
    height: auto;
    min-height: 56px;
  }
}

/* 9 ── Textarea: comfortable minimum height on mobile. */
@media (max-width: 640px) {
  .main-textarea { min-height: 104px; }
}

/* 10 ── Onboarding: more breathing room on small phones. */
@media (max-width: 640px) {
  .ob-outer {
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    justify-content: flex-start;
    padding-top: max(32px, calc(env(safe-area-inset-top) + 16px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ob-step-title { font-size: 26px; }
  .ob-option     { padding: 16px; }
}

/* 11 ── Score banner: keep it readable on the narrowest iPhones. */
@media (max-width: 400px) {
  .score-banner  { gap: 12px; padding: 14px 14px; }
  .score-circle  { width: 44px; height: 44px; font-size: 15px; }
  .score-title   { font-size: 15px; }
}

/* 12 ── Feature bento cards: a touch more padding on mobile. */
@media (max-width: 640px) {
  .lp-fc { padding: 24px 20px; }
}

/* 13 ── Marks grid on result screen: already 1-col at 500px but
         ensure it's properly spaced. */
@media (max-width: 500px) {
  .marks-grid { gap: 8px; }
  .marks-col-body { padding: 10px 12px; }
}

/* 14 ── Bottom nav: slightly taller on iPhone so the label clears
         the home indicator bar safely. */
@media (max-width: 640px) {
  .bottom-nav {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-top: 10px;
  }
}

/* ── HERO LAYOUT with mockup ─────────────────────────────────── */
.lp-hero { padding-bottom: 0 !important; }


/* ── MOCKUP WRAP & ANIMATIONS ────────────────────────────────── */
.lp-mockup-wrap { width: 100%; max-width: 820px; margin: 48px auto 0;
  position: relative; z-index: 1; }

/* Main app window — initial state handled by hero-in CSS above */
.lp-mockup { border-radius: 14px 14px 0 0; overflow: hidden;
  box-shadow: 0 -2px 4px rgba(0,0,0,0.04), 0 32px 80px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.08);
  background: var(--bg); border: 1px solid var(--border); border-bottom: none; }

/* Result card floats offset over the main window */
.lp-mock-result-float { position: absolute; bottom: -28px; right: -20px; width: 58%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.05); }
.lp-mock-result-back { font-size: 10px; color: var(--text3); margin-bottom: 10px;
  display: flex; gap: 12px; }

/* Browser chrome */
.lp-mock-chrome { background: #e8e8ea; padding: 9px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.09); }
.lp-mock-dots { display: flex; gap: 5px; }
.lp-mock-dots span { width: 10px; height: 10px; border-radius: 50%; }
.lp-mock-dots span:nth-child(1) { background: #ff5f57; }
.lp-mock-dots span:nth-child(2) { background: #febc2e; }
.lp-mock-dots span:nth-child(3) { background: #28c840; }
.lp-mock-url { flex: 1; background: #fff; border-radius: 6px; padding: 4px 10px;
  font-size: 11px; color: #999; text-align: center; border: 1px solid rgba(0,0,0,0.09);
  font-family: -apple-system, sans-serif; max-width: 280px; margin: 0 auto; }

/* App nav bar — matches real nav */
.lp-mock-appnav { height: 44px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--nav-bg); }
.lp-mock-wordmark { font-family: 'Instrument Serif', Georgia, serif; font-size: 17px;
  color: var(--text); letter-spacing: -0.3px; }
.lp-mock-navpill { font-size: 10px; font-weight: 500; color: var(--text2); padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 99px; background: transparent; }
.lp-mock-theme-btn { width: 28px; height: 28px; border: 1px solid var(--border);
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  color: var(--text2); }

/* App body */
.lp-mock-body { padding: 16px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); }
.lp-mock-greeting { font-family: 'Instrument Serif', Georgia, serif; font-size: 18px;
  letter-spacing: -0.3px; color: var(--text); }
.lp-mock-sub { font-size: 11px; color: var(--text2); margin-bottom: 4px; }

/* Mode toggle — matches .mode-toggle */
.lp-mock-mode-toggle { display: flex; background: var(--surface2); border-radius: 8px;
  padding: 2px; gap: 2px; }
.lp-mock-mode-btn { flex: 1; padding: 6px 10px; text-align: center; font-size: 11px;
  font-weight: 500; color: var(--text2); border-radius: 6px; }
.lp-mock-mode-active { background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3); }

/* Subject row — matches .subject-row */
.lp-mock-subject-row { display: flex; gap: 5px; overflow: hidden; }
.lp-mock-subj { font-size: 10px; font-weight: 500; color: var(--text2); padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 99px; white-space: nowrap; }
.lp-mock-subj-active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Board row — matches .board-row */
.lp-mock-board-row { display: flex; gap: 5px; }
.lp-mock-board { font-size: 10px; font-weight: 600; color: var(--text3); padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 6px; letter-spacing: 0.4px; text-transform: uppercase; }
.lp-mock-board-active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }

/* Hint */
.lp-mock-hint { font-size: 10px; color: var(--text3); line-height: 1.5; }

/* Input wrap — matches .input-wrap */
.lp-mock-input-wrap { background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; }
.lp-mock-textarea { padding: 12px 14px; font-size: 11px; color: var(--text2); line-height: 1.6;
  min-height: 60px; }
.lp-mock-input-footer { border-top: 1px solid var(--border); padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between; }
.lp-mock-charcount { font-size: 10px; color: var(--text3); }
.lp-mock-submit-btn { background: var(--accent); color: #fff; border-radius: 7px;
  padding: 6px 12px; font-size: 10px; font-weight: 600; display: flex; align-items: center; gap: 5px; }

/* Result card components — same as app result screen */
.lp-mock-result-qbox { background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.lp-mock-qlabel { font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text3); margin-bottom: 4px; }
.lp-mock-qtext { font-size: 10.5px; color: var(--text2); line-height: 1.4; }
.lp-mock-score-banner { border-radius: 8px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lp-mock-score-mid { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); }
.lp-mock-score-circle { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: rgba(245,158,11,0.18); display: flex; align-items: center; justify-content: center;
  font-family: 'Instrument Serif', Georgia, serif; font-size: 12px; color: #b45309; font-weight: 700; }
.lp-mock-score-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.lp-mock-score-sub { font-size: 10px; color: var(--text2); line-height: 1.4; }
.lp-mock-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.lp-mock-card { background: var(--bg); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.lp-mock-card-header { padding: 6px 10px; font-size: 8px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; }
.lp-mock-card-green { background: rgba(22,163,74,0.07); color: #15803d;
  border-bottom: 1px solid rgba(22,163,74,0.12); }
.lp-mock-card-red { background: rgba(220,38,38,0.06); color: #b91c1c;
  border-bottom: 1px solid rgba(220,38,38,0.1); }
.lp-mock-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.lp-mock-point { font-size: 9.5px; color: var(--text2); line-height: 1.4; display: flex; gap: 4px; align-items: flex-start; }
.lp-mock-plus { color: #16a34a; font-weight: 700; flex-shrink: 0; }
.lp-mock-minus { color: #dc2626; font-weight: 700; flex-shrink: 0; }
.lp-mock-model { background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: 8px; padding: 8px 12px; }
.lp-mock-model-label { display: block; font-size: 8px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--accent); margin-bottom: 4px; }
.lp-mock-model-text { font-size: 9.5px; color: var(--text2); line-height: 1.55; }

/* Mobile: result card becomes below, not floating */
@media (max-width: 640px) {
  .lp-mock-result-float { position: relative; bottom: auto; right: auto;
    width: 100%; margin-top: 12px; }
  .lp-mock-result-float.hero-in { transform: translateY(0); }
  .lp-mockup-wrap { margin-top: 32px; }
}

/* ── HERO MOCKUP ENTRANCE ANIMATION ─────────────────────────── */
/* Override the old scroll-triggered opacity:0 default */
.lp-mockup {
  opacity: 0;
  transform: translateY(40px) scale(0.97);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1),
              transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.lp-mockup.hero-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.lp-mock-result-float {
  opacity: 0;
  transform: translateY(20px) translateX(8px);
  transition: opacity 0.6s 0.35s cubic-bezier(0.22,1,0.36,1),
              transform 0.6s 0.35s cubic-bezier(0.22,1,0.36,1);
}
.lp-mock-result-float.hero-in {
  opacity: 1;
  transform: translateY(0) translateX(0);
}
