/* ============================================================
   PrepDeck design system
   Radius rule: cards 14px, small surfaces 10px, pills 999px
   Accent: emerald, locked. Importance colors are semantic only.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececee;
  --text: #1a1a1f;
  --muted: #55555f;
  --faint: #8b8b94;
  --border: #e5e5e8;
  --border-strong: #d6d6db;

  --accent: #059669;
  --accent-ink: #047857;
  --accent-soft: #ecfdf5;
  --accent-border: #b5ead6;
  --on-accent: #ffffff;

  --high: #b42318;      --high-soft: #fee4e2;  --high-border: #fecdca;
  --med:  #93540d;      --med-soft:  #fef0c7;  --med-border:  #fedf89;
  --extra:#5b5b64;      --extra-soft:#ececee;  --extra-border:#dcdce1;

  --code-bg: #f7f7f8;
  --shadow-card: 0 1px 2px rgb(20 20 24 / .04), 0 10px 30px -18px rgb(20 20 24 / .18);
  --shadow-pop: 0 24px 70px -20px rgb(20 20 24 / .35);

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "JetBrains Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0f;
  --surface: #161619;
  --surface-2: #1d1d21;
  --surface-3: #26262b;
  --text: #ededf0;
  --muted: #a4a4ad;
  --faint: #74747e;
  --border: #2a2a30;
  --border-strong: #3a3a41;

  --accent: #2eb984;
  --accent-ink: #8fd0b2;
  --accent-soft: #0b2b20;
  --accent-border: #1d5641;
  --on-accent: #062b1d;

  --high: #fda29b;      --high-soft: #3b1512;  --high-border: #61221d;
  --med:  #fdd07a;      --med-soft:  #34240a;  --med-border:  #584012;
  --extra:#a0a0a9;      --extra-soft:#242428;  --extra-border:#38383e;

  --code-bg: #1a1a1f;
  --shadow-card: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px -18px rgb(0 0 0 / .6);
  --shadow-pop: 0 24px 70px -20px rgb(0 0 0 / .7);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
a { color: var(--accent-ink); text-decoration: none; }
/* Underlines are banned on hover site-wide: affordance comes from color + hover fill */
a:hover, a:active, a:focus-visible { text-decoration: none; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
.shell { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Tabular numerals for precision metrics */
.cd-num,
.stat-chip b,
.exam-date-day,
.marks,
.tab-count,
.countdown-pill {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 16px; border-radius: 999px; font-weight: 700;
}
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-size: 19px;
}
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; font-weight: 600;
  transition: border-color .15s ease, color .15s ease;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text); }
.search-trigger kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; color: var(--faint);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: grid; place-items: center; font-size: 18px;
  transition: border-color .15s ease, transform .1s ease;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.96); }

/* ---------- Home ---------- */
.home-intro { padding: 48px 0 8px; }
.home-intro h1 { font-size: clamp(26px, 4.5vw, 38px); letter-spacing: -.03em; max-width: 18ch; }
.home-intro .lede { margin-top: 12px; color: var(--muted); font-size: 17px; max-width: 60ch; }
.home-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.stat-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; font-size: 13.5px; color: var(--muted);
}
.stat-chip b { color: var(--text); font-family: var(--font-display); font-size: 15px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 16px; }
.section-head h2 { font-size: 21px; letter-spacing: -.02em; }
.section-head span { color: var(--faint); font-size: 13.5px; font-weight: 600; }

.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-bottom: 56px; }
.subject-card {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius, 14px); border-radius: 14px;
  padding: 20px; text-align: left; color: var(--text);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.subject-card.ready:hover { border-color: var(--accent-border); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.subject-card.ready:active { transform: translateY(0); }
.subject-card.pending { opacity: .78; cursor: default; }
.subject-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid var(--accent-border);
  display: grid; place-items: center; font-size: 22px;
}
.subject-card.pending .subject-icon { background: var(--surface-2); color: var(--faint); border-color: var(--border); }
.subject-card h3 { font-size: 16.5px; letter-spacing: -.01em; }
.subject-card .sub-meta { color: var(--muted); font-size: 13.5px; }
.subject-card .card-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.subject-card.ready .card-foot i { color: var(--accent-ink); font-size: 15px; }
.subject-card.ready .card-foot span { font-size: 13px; font-weight: 700; color: var(--accent-ink); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid var(--extra-border); background: var(--extra-soft); color: var(--extra);
}
.badge.ready { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-border); }
.badge.high { background: var(--high-soft); color: var(--high); border-color: var(--high-border); }
.badge.med { background: var(--med-soft); color: var(--med); border-color: var(--med-border); }
.badge.extra { background: var(--extra-soft); color: var(--extra); border-color: var(--extra-border); }
.badge.type { text-transform: none; letter-spacing: 0; }

/* ---------- Subject page ---------- */
.subject-hero { padding: 36px 0 0; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.subject-hero .subject-icon { width: 52px; height: 52px; font-size: 27px; }
.subject-hero-info { flex: 1; min-width: 240px; }
.subject-hero-info h1 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -.03em; }
.subject-hero-info .lede { color: var(--muted); margin-top: 6px; font-size: 15px; max-width: 62ch; }
.subject-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.tabbar-wrap {
  position: sticky; top: 64px; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.tabbar {
  display: flex; gap: 4px; overflow-x: auto; padding: 12px 0; scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; border: 1px solid transparent; background: none;
  color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 8px 15px; border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); }
.tab .tab-count { font-size: 11.5px; opacity: .6; margin-left: 5px; font-family: var(--font-mono); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px 0 4px; }
.toolbar-label { font-size: 13px; font-weight: 700; color: var(--faint); margin-right: 2px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.toolbar .spacer { flex: 1; }

.q-list { display: flex; flex-direction: column; gap: 12px; padding: 16px 0 56px; }

.q-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  transition: border-color .15s ease;
}
.q-card.open { border-color: var(--border-strong); }
.q-head {
  width: 100%; display: flex; align-items: flex-start; gap: 12px;
  background: none; border: 0; text-align: left; color: var(--text);
  padding: 16px 18px;
}
.q-head:hover { background: var(--surface-2); }
.q-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--muted);
}
.q-card.open .q-num { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-border); }
.q-head-text { flex: 1; min-width: 0; }
.q-head-text .q-title { font-weight: 700; font-size: 15.5px; line-height: 1.5; letter-spacing: -.01em; }
.q-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.q-chevron { flex-shrink: 0; color: var(--faint); font-size: 18px; margin-top: 7px; transition: transform .2s ease; }
.q-card.open .q-chevron { transform: rotate(180deg); color: var(--accent-ink); }

.q-body { display: none; padding: 4px 18px 20px; border-top: 1px solid var(--border); }
.q-card.open .q-body {
  display: block;
  animation: appleSheetIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes appleSheetIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Answer typography */
.ans { margin-top: 14px; }
.ans > * + * { margin-top: 14px; }
.ans h4 { font-size: 15.5px; letter-spacing: -.01em; margin-top: 22px; display: flex; align-items: center; gap: 8px; }
.ans h4::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--accent); flex-shrink: 0; }
.ans p { color: var(--text); font-size: 15px; }
.ans b, .ans strong { color: var(--accent-ink); font-weight: 700; }
.ans ol, .ans ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 7px; }
.ans li { font-size: 15px; color: var(--text); padding-left: 4px; }
.ans li::marker { color: var(--accent-ink); font-weight: 800; }

.box { border-radius: 12px; padding: 13px 16px; font-size: 14.5px; border: 1px solid; }
.box .box-label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; opacity: .8; }
.box-def { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.box-def .box-label { color: var(--accent-ink); }
.box-eg { background: var(--surface-2); border-color: var(--border); }
.box-eg .box-label { color: var(--muted); }
.box-note { background: var(--med-soft); border-color: var(--med-border); }
.box-note .box-label { color: var(--med); }

.ans table { width: 100%; border-collapse: collapse; font-size: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ans th { background: var(--surface-2); text-align: left; font-family: var(--font-display); font-size: 12.5px; letter-spacing: .01em; }
.ans th, .ans td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ans tr:last-child td { border-bottom: 0; }
.ans td { color: var(--muted); }
.ans td:first-child { color: var(--text); font-weight: 600; }

.diagram { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow-x: auto; }
.diagram svg { display: block; margin: 0 auto; min-width: 100%; }
.diagram figcaption { text-align: center; font-size: 12.5px; color: var(--faint); margin-top: 8px; font-weight: 600; }
/* SVG diagram theme colors */
.dbox { fill: var(--surface); stroke: var(--border-strong); }
.dbox-accent { fill: var(--accent-soft); stroke: var(--accent-border); }
.dtext { fill: var(--text); font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.dtext-accent { fill: var(--accent-ink); }
.dtext-dim { fill: var(--muted); font-size: 10.5px; }
.dline { stroke: var(--faint); stroke-width: 1.4; fill: none; }
.darrow { fill: var(--faint); }
.diamond { fill: var(--med-soft); stroke: var(--med-border); }

.ans pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--text);
}

.rev-blurb { border-left: 3px solid var(--accent); padding: 8px 0 8px 14px; color: var(--muted); font-size: 14px; }
.rev-blurb b { color: var(--accent-ink); }

/* Quick revision */
.rev-card { background: var(--surface); border: 1px solid var(--accent-border); border-radius: 14px; padding: 16px 18px; }
.rev-card .q-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.rev-card .rev-blurb { margin-top: 8px; }
.rev-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  color: var(--text); border-radius: 14px; padding: 13px 16px; margin: 16px 0 4px; font-size: 14px;
}
.rev-banner i { color: var(--accent-ink); font-size: 18px; margin-top: 1px; }

/* Papers */
.paper-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 16px 0 56px; }
.paper-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; text-align: left; color: var(--text);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s ease, transform .15s ease;
}
.paper-card:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.paper-card h3 { font-size: 16px; letter-spacing: -.01em; }
.paper-card p { color: var(--muted); font-size: 13.5px; }
.paper-card .card-foot { display: flex; align-items: center; gap: 7px; color: var(--accent-ink); font-size: 13px; font-weight: 700; margin-top: 4px; }

.exam-paper {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: clamp(20px, 4vw, 44px); margin: 20px 0 56px;
}
.exam-head { text-align: center; border-bottom: 2px solid var(--text); padding-bottom: 16px; margin-bottom: 6px; }
.exam-head h2 { font-size: 20px; letter-spacing: .02em; text-transform: uppercase; }
.exam-head .exam-sub { font-family: var(--font-display); font-weight: 700; margin-top: 8px; font-size: 16px; }
.exam-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-weight: 700; font-size: 14px; margin-top: 10px; font-family: var(--font-display); }
.exam-note { font-size: 13.5px; color: var(--muted); border-bottom: 1px solid var(--border); padding: 12px 2px; }
.exam-note b { color: var(--text); }
.exam-section-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin: 26px 0 4px; display: flex; align-items: baseline; gap: 10px; }
.exam-section-title small { color: var(--faint); font-size: 12.5px; font-weight: 600; }
.exam-q { display: flex; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); font-size: 14.5px; align-items: baseline; }
.exam-q:last-child { border-bottom: 0; }
.exam-q .n { font-family: var(--font-display); font-weight: 700; min-width: 22px; }
.exam-q .marks { margin-left: auto; font-family: var(--font-display); font-weight: 700; white-space: nowrap; color: var(--muted); }
.exam-q .hint { color: var(--faint); font-size: 13px; display: block; }
.paper-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 10px 20px; white-space: nowrap;
  font-size: 14px; font-weight: 700; border: 1px solid transparent;
  transition: transform .1s ease, border-color .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); text-decoration: none; }

/* Pending subject page */
.pending-page { text-align: center; padding: 80px 0 90px; }
.pending-page .subject-icon { margin: 0 auto 18px; }
.pending-page h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -.03em; }
.pending-page .lede { color: var(--muted); max-width: 52ch; margin: 12px auto 0; }
.pending-checklist {
  list-style: none; margin: 28px auto 0; padding: 0; max-width: 440px;
  display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.pending-checklist li { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; }
.pending-checklist i { color: var(--accent-ink); font-size: 17px; margin-top: 3px; }
.pending-page .btn { margin-top: 28px; }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px;
  overscroll-behavior: contain;
}
.search-overlay[hidden] { display: none; }
.search-panel {
  width: 100%; max-width: 620px; max-height: 70vh;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; overflow: hidden;
  overscroll-behavior: contain;
}
.search-input-row {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.search-input-row:focus-within {
  background: var(--surface-2);
}
.search-input-row i { color: var(--faint); font-size: 19px; }
.search-input-row input {
  flex: 1; border: 0; outline: none; background: none; color: var(--text);
  font-family: var(--font-body); font-size: 16px; font-weight: 600;
}
.search-input-row input:focus-visible { outline: none; }
.search-input-row input::placeholder { color: var(--faint); font-weight: 500; }
.search-results { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.search-hint { padding: 22px; text-align: center; color: var(--faint); font-size: 14px; }
.sr-item {
  width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  display: block; padding: 11px 12px; border-radius: 10px;
}
.sr-item:hover, .sr-item:focus-visible { background: var(--surface-2); }
.sr-item .sr-q { font-weight: 700; font-size: 14px; line-height: 1.45; }
.sr-item .sr-path { font-size: 12px; color: var(--faint); margin-top: 3px; }
.sr-item .sr-path b { color: var(--accent-ink); }
.sr-item mark { background: var(--med-soft); color: var(--med); border-radius: 3px; padding: 0 2px; }
.sr-empty { padding: 26px; text-align: center; color: var(--faint); font-size: 14px; }
.sr-group { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 12px 12px 4px; }

/* ---------- Skeleton loader (visible before the app boots) ---------- */
.skeleton { padding: 48px 0 8px; }
.sk-line { height: 18px; border-radius: 8px; background: var(--surface-3); margin-bottom: 14px; }
.sk-h1 { height: 38px; width: 46%; margin-bottom: 22px; }
.sk-w60 { width: 60%; }
.sk-w80 { width: 80%; }
.sk-row { display: flex; gap: 10px; margin: 22px 0 30px; }
.sk-pill { height: 32px; width: 120px; border-radius: 999px; background: var(--surface-3); }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sk-card { height: 150px; border-radius: 14px; background: var(--surface-3); }
@media (max-width: 900px) { .sk-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .sk-grid { grid-template-columns: 1fr; } .sk-h1 { width: 70%; } }
@media (prefers-reduced-motion: no-preference) {
  .sk-line, .sk-pill, .sk-card { animation: skPulse 1.2s ease-in-out infinite; }
  @keyframes skPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 20px; }
.footer-inner { padding: 26px 20px 40px; color: var(--muted); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.footer-note { color: var(--faint); }

/* ---------- Theme reveal (View Transitions) ---------- */
/* Theme circular reveal: the clip-path drives the new snapshot, so disable defaults */
html.theme-morphing::view-transition-old(root),
html.theme-morphing::view-transition-new(root) { animation: none !important; mix-blend-mode: normal; }
/* While the wipe runs, no color transitions anywhere (prevents double animation) */
html.theme-morphing body,
html.theme-morphing body * { transition: none !important; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .view-enter { animation: viewIn .35s cubic-bezier(.16, 1, .3, 1) both; }
  @keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .q-card, .rev-card { animation: cardIn .3s ease both; }
  @keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Mobile bottom navigation + touch targets ---------- */
.mobile-nav { display: none; }
@media (max-width: 860px) {
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
    display: flex; gap: 4px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--border);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mnav-link {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 48px; padding: 6px 4px; border-radius: 12px;
    color: var(--faint); font-size: 10.5px; font-weight: 700;
    text-decoration: none !important;
    transition: color .2s ease, background .2s ease;
  }
  .mnav-link i { font-size: 21px; line-height: 1; }
  .mnav-link.active { color: var(--accent-ink); background: var(--accent-soft); }
  body { padding-bottom: 74px; }
}

@media (max-width: 640px) {
  /* Comfortable touch targets (44px guideline) on phones */
  .chip { padding: 10px 15px; min-height: 44px; display: inline-flex; align-items: center; }
  .tab { padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; }
  .btn-sm { padding: 9px 14px; min-height: 40px; }
  .sub-quick-pill { padding: 8px 11px; }
  .search-trigger { width: 42px; height: 42px; }
  .icon-btn { width: 42px; height: 42px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .shell { padding: 0 16px; }
  .search-trigger-label, .search-trigger kbd { display: none; }
  .search-trigger { padding: 9px; border-radius: 999px; }
  .home-intro { padding-top: 34px; }
  .subject-grid { grid-template-columns: 1fr; }
  .paper-list { grid-template-columns: 1fr; }
  .tabbar-wrap { top: 63px; }
  .q-head { padding: 14px; }
  .q-body { padding: 4px 14px 18px; }
  .exam-paper { padding: 18px 14px; }
  .ans pre { font-size: 12px; }
}

/* ---------- Print (predicted papers) ---------- */
@media print {
  .site-header, .site-footer, .toolbar, .tabbar-wrap, .paper-actions, .search-overlay { display: none !important; }
  body { background: #fff; color: #000; font-size: 12.5px; }
  .exam-paper { border: 1px solid #000; box-shadow: none; margin: 0; }
  .ans b, .ans strong { color: #000; }
}

/* ---------- Header Navigation Links ---------- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link i { font-size: 16px; }
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}
@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ---------- Academic Dashboard Widgets ---------- */
.dash-overview-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin: 24px 0 32px;
}
@media (max-width: 860px) {
  .dash-overview-grid { grid-template-columns: 1fr; }
}

/* Countdown Card */
.countdown-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.countdown-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
}
.cd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cd-title-group h3 {
  font-size: 18px;
  letter-spacing: -.02em;
}
.cd-subtitle {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
}
.cd-timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.cd-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
}
.cd-num {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent-ink);
}
.cd-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  margin-top: 4px;
}
.cd-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Today's Tasks Widget */
.dash-tasks-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}
.dash-widget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dash-widget-head h3 {
  font-size: 17px;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-widget-head h3 i { color: var(--accent); }
.dash-task-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 14px;
  flex: 1;
}
.dash-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.dash-task-item:hover { border-color: var(--border-strong); }
.dash-task-item.completed { opacity: .78; background: var(--surface); }
.dash-task-item.completed .task-text { color: var(--muted); }
.task-checkbox-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  margin-top: 2px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.task-checkbox-btn:active {
  transform: scale(0.85);
}
.dash-task-info { flex: 1; min-width: 0; }
.task-text { font-weight: 600; line-height: 1.4; color: var(--text); }
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 4px;
}

/* Assignments Alert Strip */
.assign-alert-strip {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 80%, transparent), color-mix(in srgb, var(--surface) 90%, transparent));
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.assign-alert-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.assign-alert-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}
.assign-alert-text h4 { font-size: 16px; font-weight: 700; }
.assign-alert-text p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

/* Subject Card Progress Bar */
.sub-progress-wrap {
  margin: 8px 0 4px;
}
.sub-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.sub-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}
.sub-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--faint);
  margin-top: 4px;
  font-weight: 600;
}
.sub-quick-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.sub-quick-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sub-quick-pill:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Question Completed Toggle Button */
.q-action-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-sm:hover { border-color: var(--border-strong); color: var(--text); }
.btn-sm.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-border); }

/* ---------- Examination Timetable Page ---------- */
.timetable-hero {
  padding: 36px 0 16px;
}
.timetable-hero h1 { font-size: clamp(26px, 4vw, 36px); letter-spacing: -.03em; }
.timetable-hero .lede { color: var(--muted); margin-top: 8px; font-size: 16px; max-width: 64ch; }

.timetable-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 24px 0 48px;
}
.exam-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.exam-row-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}
.exam-row-card.highlight {
  border-color: var(--accent-border);
  background: linear-gradient(90deg, var(--accent-soft), var(--surface));
}
.exam-row-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.exam-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 60px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-display);
}
.exam-row-card.highlight .exam-date-badge {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.exam-date-day { font-size: 20px; font-weight: 800; line-height: 1; }
.exam-date-mon { font-size: 11px; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.exam-details h3 { font-size: 16.5px; }
.exam-details p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.exam-row-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.countdown-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.countdown-pill.urgent {
  background: var(--high-soft);
  color: var(--high);
  border-color: var(--high-border);
}

/* ---------- Study Planner Page ---------- */
.planner-hero { padding: 36px 0 16px; }
.planner-hero h1 { font-size: clamp(26px, 4vw, 36px); letter-spacing: -.03em; }
.planner-hero .lede { color: var(--muted); margin-top: 8px; font-size: 16px; max-width: 64ch; }

.phase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 32px;
}
@media (max-width: 900px) {
  .phase-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .phase-grid { grid-template-columns: 1fr; }
}
.phase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.phase-card.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.phase-card h4 { font-size: 14px; font-weight: 700; }
.phase-card .phase-dates { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.phase-card p { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* Add Task Box */
.add-task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
}
.add-task-card h4 { font-size: 15px; margin-bottom: 12px; }
.add-task-form {
  display: grid;
  grid-template-columns: 1.5fr 2fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}
@media (max-width: 860px) {
  .add-task-form { grid-template-columns: 1fr 1fr; }
  .add-task-form button { grid-column: span 2; }
}
.add-task-form input, .add-task-form select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.add-task-form input:focus-visible, .add-task-form select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Priority Badges */
.prio-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.prio-high { background: var(--high-soft); color: var(--high); border: 1px solid var(--high-border); }
.prio-med { background: var(--med-soft); color: var(--med); border: 1px solid var(--med-border); }

/* ---------- Dedicated Assignments Section ---------- */
.assign-selector-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 16px;
}
.assign-tab-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.assign-tab-btn:hover { color: var(--text); border-color: var(--border-strong); }
.assign-tab-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.assign-doc-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: clamp(20px, 4vw, 36px);
  margin-bottom: 48px;
}
.assign-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.assign-meta-bar h2 { font-size: 22px; }
.assign-meta-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.checklist-container {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0 24px;
}
.checklist-container h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.checklist-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background .12s ease;
}
.checklist-label:hover { background: var(--surface); }
.checklist-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Search Filters Bar */
.search-filters {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.search-chip {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.search-chip:hover { border-color: var(--border-strong); color: var(--text); }
.search-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============================================================
   Apple Design: Fluid Spring Motion, Materials & Feedback
   (WWDC Designing Fluid Interfaces & Principles of Great Design)
   ============================================================ */

/* 1. Immediate Tactile Press Feedback (Kill Latency on Pointer-Down) */
button:active,
.btn:active,
.btn-sm:active,
.chip:active,
.subject-card.ready:active,
.paper-card:active,
.q-head:active,
.nav-link:active,
.icon-btn:active,
.search-trigger:active,
.assign-tab-btn:active {
  transform: scale(0.976);
  transition: transform 110ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 2. Micro-Interaction Spring Checkmark */
@keyframes appleSpringCheck {
  0% { transform: scale(0.6); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.task-checkbox-btn:active i,
.btn-sm.active i,
[data-toggle-rev].active i,
.checklist-label input[type="checkbox"]:checked {
  animation: appleSpringCheck 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3. Apple Card Materials & Specular Light Edge */
.subject-card,
.countdown-hero,
.assign-alert-strip,
.q-card,
.exam-row-card,
.phase-card,
.add-task-card,
.assign-doc-card,
.exam-paper {
  border-radius: 18px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease;
}

[data-theme="light"] .countdown-hero,
[data-theme="light"] .subject-card,
[data-theme="light"] .assign-alert-strip,
[data-theme="light"] .assign-doc-card,
[data-theme="light"] .exam-row-card {
  border-top: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 12px 32px -10px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .countdown-hero,
[data-theme="dark"] .subject-card,
[data-theme="dark"] .assign-alert-strip,
[data-theme="dark"] .assign-doc-card,
[data-theme="dark"] .exam-row-card {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.55);
}

/* 4. Full-Width Countdown Hero Layout */
.countdown-hero {
  margin: 18px 0 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: clamp(20px, 3.5vw, 32px);
}
.cd-timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.cd-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 8px;
  text-align: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cd-box:hover {
  transform: translateY(-2px);
}

/* 5. Smooth View Entrances */
.view-enter {
  animation: appleViewIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes appleViewIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 6. Reduced Motion Strict Compliance */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .view-enter, .q-card.open .q-body {
    animation: none !important;
  }
}

/* 7. Reduced Transparency & High Contrast Compliance */
@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .tabbar-wrap,
  .search-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg) !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #71717a;
    --border-strong: #09090b;
    --muted: #18181b;
  }
  [data-theme="dark"] {
    --border: #a1a1aa;
    --border-strong: #ffffff;
    --muted: #f4f4f5;
  }
  .subject-card, .q-card, .btn, .chip, .badge, .exam-row-card {
    border-width: 2px !important;
  }
}

/* ============================================================
   Polish layer: anchor offsets, stagger, selection, search pop
   ============================================================ */

/* Dashboard redesign classes */
.intro-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.home-intro h1 { font-size: clamp(26px, 4vw, 36px); } /* dashboard scale, not landing scale */
.home-intro .lede { font-size: 15.5px; }
.assign-alert-strip {
  /* calm surface instead of the loud gradient */
  background: var(--surface);
  border: 1px solid var(--accent-border);
}
.assign-progress {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px;
  font-variant-numeric: tabular-nums;
}
.assign-progress b { color: var(--accent-ink); }
.sub-blurb { font-size: 13px; color: var(--muted); margin-top: 6px; text-wrap: pretty; }

/* Subjects and exam schedule: one scannable list */
.dash-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 10px;
}
.sched-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 44px; }
.sched-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; color: var(--text);
  transition: border-color .2s ease, transform .2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .2s ease;
}
.sched-row:hover { border-color: var(--accent-border); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.sched-row:active { transform: scale(0.995); }
.sched-row .subject-icon.sm { width: 38px; height: 38px; font-size: 19px; border-radius: 10px; flex-shrink: 0; }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.sr-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sr-sub .ok { color: var(--accent-ink); font-weight: 700; }
.sr-sub .warn { color: var(--med); font-weight: 700; }
.sr-exam { text-align: right; display: flex; flex-direction: column; flex-shrink: 0; }
.sr-date { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sr-days { font-size: 10.5px; color: var(--faint); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sched-row.next { border-color: var(--accent-border); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 55%); }
.sched-row.next .sr-days { color: var(--accent-ink); }
.sr-chev { color: var(--faint); font-size: 16px; flex-shrink: 0; }
@media (max-width: 640px) {
  .sched-row { gap: 10px; padding: 11px 12px; }
  .sr-chev { display: none; }
  .sr-date { font-size: 11.5px; }
  .sr-days { font-size: 9.5px; }
}

/* Anchored cards must clear the sticky header + tab bar when deep-linked */
.q-card, .rev-card, .exam-paper, .exam-row-card, .phase-card, .assign-doc-card {
  scroll-margin-top: 132px;
}

/* Brand-colored text selection */
::selection { background: var(--accent); color: var(--on-accent); }

/* Deeper resting shadow for an opened question card */
.q-card.open { box-shadow: var(--shadow-card); }

/* Search panel: springy pop instead of instant appearance */
.search-panel { animation: panelPop .32s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes panelPop {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* Staggered entry cascade: cards arrive in sequence, not as one block */
@media (prefers-reduced-motion: no-preference) {
  .subject-grid .subject-card,
  .paper-list .paper-card,
  .phase-grid .phase-card,
  .timetable-grid .exam-row-card,
  .q-list > * {
    animation: cardIn .4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .subject-grid .subject-card,
  .paper-list .paper-card,
  .q-list > *,
  .phase-grid .phase-card,
  .timetable-grid .exam-row-card {
    animation-delay: 0ms;
  }
  .subject-grid .subject-card:nth-child(2), .paper-list .paper-card:nth-child(2),
  .q-list > *:nth-child(2), .phase-grid .phase-card:nth-child(2),
  .timetable-grid .exam-row-card:nth-child(2) { animation-delay: 40ms; }
  .subject-grid .subject-card:nth-child(3), .paper-list .paper-card:nth-child(3),
  .q-list > *:nth-child(3), .phase-grid .phase-card:nth-child(3),
  .timetable-grid .exam-row-card:nth-child(3) { animation-delay: 80ms; }
  .subject-grid .subject-card:nth-child(4), .q-list > *:nth-child(4),
  .phase-grid .phase-card:nth-child(4),
  .timetable-grid .exam-row-card:nth-child(4) { animation-delay: 120ms; }
  .subject-grid .subject-card:nth-child(5), .q-list > *:nth-child(5),
  .timetable-grid .exam-row-card:nth-child(5) { animation-delay: 160ms; }
  .subject-grid .subject-card:nth-child(6), .q-list > *:nth-child(6),
  .timetable-grid .exam-row-card:nth-child(6) { animation-delay: 200ms; }
  .subject-grid .subject-card:nth-child(7), .q-list > *:nth-child(7),
  .timetable-grid .exam-row-card:nth-child(7) { animation-delay: 240ms; }
  .q-list > *:nth-child(8) { animation-delay: 280ms; }
  .q-list > *:nth-child(9) { animation-delay: 320ms; }
  .q-list > *:nth-child(10) { animation-delay: 360ms; }
  .q-list > *:nth-child(n+11) { animation-delay: 400ms; }
}
