/*
  SAMAN'S STUDY LOVE — "The Revision Notebook"
  ---------------------------------------------------------------------------
  THESIS: The study app IS Saman's own beautifully kept revision notebook.
    It refuses the pastel study-SaaS dashboard and the dark focus-timer app.
    Navigation is the notebook's tabbed edge; feedback is stationery
    (a highlighter pass, a tick, a red-pencil mark, a bookmark).
  OWN-WORLD: Cool blue-white paper (#F5F8FA), night-blue fountain ink (#26313F),
    one rose margin rule (#E4A3B8) down every page. Four highlighter washes —
    mint/red/lavender/sun — used ONLY with meaning. Solway slab headings,
    Atkinson Hyperlegible body, Kalam handwriting reserved for love alone.
  STORY: Saman opens the notebook to today's page, already warm with her name
    and the date; she generates a page of questions, works them with instant
    stationery feedback, and watches her weak pages grow fewer.
  FIRST VIEWPORT: Tabbed edge at left; today's page open — display greeting,
    the pressed-flower anniversary in the corner, "pick up where you left off"
    as the primary action, stat marks and a margin love note below.
  FORM: Grounded direction "The Revision Notebook" (#3 of the ordered list),
    seed 4c69fd8c. No skeuomorphic staging borrowed; the page itself is the
    stage. Romance lives in the margin, in one hand.
*/

/* ============================= TOKENS ============================= */
:root {
  --cool-paper: #F5F8FA;
  --paper-deep: #EAF0F4;
  --panel: #FFFFFF;
  --feint-rule: #DCE7EE;
  --margin-rose: #E4A3B8;
  --rose-ink: #9E4768;
  --night-ink: #26313F;
  --night-ink-deep: #1A2330;
  --ink-soft: #51616E;
  --ink-placeholder: #9AA8B3;

  --mint-wash: #D5EEDF;
  --mint-ink: #1E6E47;
  --red-wash: #F9DFE3;
  --red-ink: #AC3B45;
  --lav-wash: #E5E1F6;
  --lav-ink: #5B4EA5;
  --sun-wash: #FBEFC9;
  --sun-ink: #7A5D18;

  --r-hairline: 2px;
  --r-pip: 3px;
  --r-focus: 4px;
  --r-key: 7px;
  --r-control: 9px;
  --r-tab: 10px;
  --r-page: 14px;
  --r-pill: 999px;

  --sp-xs: 6px;
  --sp-sm: 10px;
  --sp-md: 18px;
  --sp-lg: 28px;
  --sp-xl: 44px;

  --shadow-rest: 0 1px 2px rgba(38, 49, 63, 0.05);
  --shadow-lift: 0 6px 20px rgba(38, 49, 63, 0.10);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sidebar-w: 248px;
  --measure: 68ch;

  --font-display: 'Solway', Georgia, serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --font-hand: 'Kalam', 'Segoe Script', cursive;
  --font-urdu: 'Noto Nastaliq Urdu', serif;

  --on-accent: #ffffff;
  --hover-veil: rgba(255, 255, 255, 0.6);
  --bar-glass: rgba(245, 248, 250, 0.9);
  --code-bg: rgba(38, 49, 63, 0.08);
  --cream-hi: #FFFDF6;
  --cream-lo: #FFFBEE;
  --cream-edge: #F1E6C8;
  --heart: #E4A3B8;
  --rule-line: rgba(38, 49, 63, 0.055);
}

/* ---- Night notebook (dark): studying by lamplight ---- */
:root[data-theme="dark"] {
  --cool-paper: #141b26;   /* the desk at night — ground + primary-button text */
  --paper-deep: #1e2836;   /* wells, chips, inactive tabs */
  --panel: #212d3c;        /* the lit page */
  --feint-rule: #34414f;   /* hairlines */
  --margin-rose: #e0a0b6;
  --rose-ink: #f3bacb;
  --night-ink: #eaf1f7;    /* primary ink (light) + primary-button fill */
  --night-ink-deep: #d7e2ec;
  --ink-soft: #a9b7c5;
  --ink-placeholder: #6f7f8c;

  --mint-wash: #1f3a2c;  --mint-ink: #8fd6ab;
  --red-wash: #452630;   --red-ink: #f2a3ae;
  --lav-wash: #2c2a48;   --lav-ink: #c3b8f3;
  --sun-wash: #3a3320;   --sun-ink: #e8d191;

  --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 10px 30px rgba(0, 0, 0, 0.55);

  --on-accent: #16202b;
  --hover-veil: rgba(255, 255, 255, 0.05);
  --bar-glass: rgba(20, 27, 38, 0.9);
  --code-bg: rgba(255, 255, 255, 0.09);
  --cream-hi: #2a2620;
  --cream-lo: #241f17;
  --cream-edge: #4a4230;
  --heart: #e9a9be;
  --rule-line: rgba(233, 240, 247, 0.05);
}
:root[data-theme="dark"] .margin-note,
:root[data-theme="dark"] .note--pinned {
  border-color: var(--cream-edge);
}

/* ============================= RESET ============================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--night-ink);
  background: var(--cool-paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--margin-rose); outline-offset: 2px; border-radius: 4px; }

/* Ruled-paper texture, used only on signature zones. Faint grain — text stays primary. */
.ruled {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 37px,
    var(--rule-line) 37px,
    var(--rule-line) 38px
  );
  background-position: 0 8px;
}

/* ============================= APP SHELL ============================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---- The tabbed edge (sidebar) ---- */
.edge {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--paper-deep);
  border-right: 1px solid var(--feint-rule);
  padding: var(--sp-md) 0 var(--sp-md) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  overflow-y: auto;
  overflow-x: hidden;        /* the tabs' -1px reach must not spawn a scrollbar */
  scrollbar-width: none;     /* Firefox: no scrollbar chrome */
  -ms-overflow-style: none;  /* legacy Edge */
}
.edge::-webkit-scrollbar { width: 0; height: 0; } /* WebKit: no scrollbar chrome */
.edge__brand {
  padding-right: var(--sp-md);
}
.edge__brand-mark {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--rose-ink);
  line-height: 1.1;
}
.edge__brand-sub {
  font-size: 0.75rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 8px 14px;
  margin-right: -1px;
  border-radius: var(--r-tab) 0 0 var(--r-tab);
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.tab svg { width: 19px; height: 19px; flex: none; opacity: 0.85; }
.tab__badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--rose-ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
:root[data-theme="dark"] .tab__badge { color: #16202b; }
.tab:hover { background: var(--hover-veil); color: var(--night-ink); }
.tab--active {
  background: var(--panel);
  color: var(--night-ink);
  box-shadow: var(--shadow-rest);
}
.tab--active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--margin-rose);
}
.edge__foot {
  margin-top: auto;
  padding-right: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.edge__admin {
  font-family: var(--font-hand);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  opacity: 0.6;
  transition: opacity 0.2s;
}
.edge__admin:hover { opacity: 1; color: var(--rose-ink); }
.lockbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-control);
  color: var(--ink-soft);
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.16s, color 0.16s;
}
.lockbtn:hover { background: var(--panel); color: var(--night-ink); }
.lockbtn svg { width: 15px; height: 15px; }

/* Theme toggle (sun/moon) */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-control);
  color: var(--ink-soft);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.theme-toggle:hover { background: var(--panel); color: var(--night-ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
.edge__foot .theme-toggle {
  display: flex; align-items: center; justify-content: flex-start;
  width: 100%; height: auto; gap: 10px; padding: 9px 14px;
  font-size: 0.875rem; font-weight: 600; color: var(--night-ink);
}
.edge__foot .theme-toggle svg { flex: none; }
.edge__foot .theme-toggle .label-dark { display: none; }
:root[data-theme="dark"] .edge__foot .theme-toggle .label-light { display: none; }
:root[data-theme="dark"] .edge__foot .theme-toggle .label-dark { display: inline; }

/* ---- Main content column ---- */
.main {
  min-width: 0;
  padding: var(--sp-xl) clamp(var(--sp-md), 5vw, 56px);
}
.wrap { max-width: 1040px; margin: 0 auto; }

/* Mobile top bar (hidden on desktop) */
.topbar { display: none; }
.scrim { display: none; }

/* ============================= TYPOGRAPHY ============================= */
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.25;
}
.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.lead { color: var(--ink-soft); max-width: var(--measure); }
.muted { color: var(--ink-soft); }
.hand { font-family: var(--font-hand); }
/* Urdu Nastaliq — small RTL accent only (never UI, data, or body). */
.nastaliq {
  font-family: var(--font-urdu);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 2.1;
  font-weight: 600;
}
.nastaliq--rose { color: var(--rose-ink); }

/* ============================= PAGE PANEL ============================= */
.panel {
  position: relative;
  background-color: var(--panel);
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-page);
  box-shadow: var(--shadow-rest);
  padding: var(--sp-lg) var(--sp-lg) var(--sp-lg) calc(var(--sp-lg) + 20px);
}
.panel::before {
  content: '';
  position: absolute;
  left: 26px; top: 16px; bottom: 16px;
  width: 2px;
  background: var(--margin-rose);
  opacity: 0.55;
  border-radius: 2px;
}
.panel--plain { padding-left: var(--sp-lg); }
.panel--plain::before { display: none; }
.panel--link { transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease); }
.panel--link:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }

/* ============================= BUTTONS ============================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  padding: 12px 26px;
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--night-ink);
  color: var(--cool-paper);
  transition: background 0.16s var(--ease), transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.btn:hover { background: var(--night-ink-deep); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn svg { width: 18px; height: 18px; }
.btn--ghost {
  background: transparent;
  color: var(--night-ink);
  border-color: var(--feint-rule);
}
.btn--ghost:hover { background: var(--paper-deep); box-shadow: none; }
.btn--rose { background: var(--rose-ink); }
.btn--rose:hover { background: #883a58; }
.btn--danger { background: transparent; color: var(--red-ink); border-color: var(--red-wash); }
.btn--danger:hover { background: var(--red-wash); box-shadow: none; }
.btn--sm { padding: 8px 16px; font-size: 0.875rem; }
.btn--block { width: 100%; }

/* ============================= CHIPS ============================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-deep);
  color: var(--night-ink);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.chip:hover { border-color: var(--margin-rose); }
.chip--active { background: var(--night-ink); color: var(--cool-paper); }
/* Weak-topic chip: a teacher's red-pencil underline, text stays fully legible. */
.chip--weak {
  text-decoration: underline;
  text-decoration-color: var(--red-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.chip--weak:hover { border-color: var(--red-ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }

/* Radio/checkbox chips (label wrapping a hidden input) */
.optchip input { position: absolute; opacity: 0; pointer-events: none; }
.optchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 17px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s var(--ease);
}
.optchip:hover { color: var(--night-ink); }
.optchip:has(input:checked) {
  background: var(--night-ink);
  color: var(--cool-paper);
}
.optchip:has(input:focus-visible) { outline: 2px solid var(--margin-rose); outline-offset: 2px; }

/* ============================= FORMS ============================= */
.field { margin-bottom: var(--sp-lg); }
.field__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: var(--sp-sm);
}
.field__hint { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--night-ink);
  background: var(--panel);
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-control);
  padding: 12px 14px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

/* Date input: match the styled fields and give the calendar icon our colour. */
input[type=date] {
  min-height: 46px;
  color-scheme: light;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] input[type=date] { color-scheme: dark; }
input[type=date]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 4px;
  margin-left: 4px;
  border-radius: var(--r-key);
  opacity: 0.75;
  transition: opacity 0.16s, background 0.16s;
}
input[type=date]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: var(--paper-deep);
}
input[type=date]::-webkit-datetime-edit { color: var(--night-ink); padding: 2px 0; }
input[type=date]::-webkit-datetime-edit-fields-wrapper { color: var(--night-ink); }
input[type=date]:invalid::-webkit-datetime-edit,
input[type=date]:not(:valid)::-webkit-datetime-edit { color: var(--ink-placeholder); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--margin-rose);
  box-shadow: 0 0 0 3px rgba(228, 163, 184, 0.25);
}
input::placeholder, textarea::placeholder { color: var(--ink-placeholder); }

/* Add-custom-subject controls */
.optchip--add {
  background: transparent;
  border: 1px dashed var(--margin-rose);
  color: var(--rose-ink);
  font-weight: 700;
}
.optchip--add:hover { background: var(--paper-deep); }
.subject-add { display: flex; gap: var(--sp-sm); align-items: center; margin-top: var(--sp-sm); }
.subject-add[hidden] { display: none; }
.subject-add input { flex: 1; }
.gen-textarea { min-height: 0; }
.subject-add-input { margin-top: var(--sp-sm); }

/* Searchable combobox (book picker) */
.combo { position: relative; }
.combo__input { padding-right: 42px; }
.combo__toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--ink-soft);
  padding: 6px; border-radius: var(--r-key); display: grid; place-items: center;
}
.combo__toggle:hover { color: var(--night-ink); background: var(--paper-deep); }
.combo__toggle svg { width: 18px; height: 18px; }
.combo__list {
  position: absolute; z-index: 12; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--feint-rule);
  border-radius: var(--r-control); box-shadow: var(--shadow-lift);
  max-height: 264px; overflow-y: auto; padding: 6px; margin: 0;
}
.combo__opt {
  padding: 9px 12px; border-radius: var(--r-key); cursor: pointer;
  font-size: 0.9375rem; display: flex; align-items: center; gap: 8px;
}
.combo__opt:hover, .combo__opt.active { background: var(--paper-deep); }
.combo__opt svg { width: 16px; height: 16px; flex: none; color: var(--ink-soft); }
.combo__opt--add { color: var(--rose-ink); font-weight: 700; }
.combo__opt--add svg { color: var(--rose-ink); }
.combo__empty { padding: 10px 12px; color: var(--ink-soft); font-size: 0.9375rem; }

/* Range slider */
.range-row { display: flex; align-items: center; gap: var(--sp-md); }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 6px; border-radius: 999px;
  background: var(--paper-deep); cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--rose-ink); border: 3px solid var(--panel);
  box-shadow: var(--shadow-rest);
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--rose-ink); border: 3px solid var(--panel);
}
.range-value {
  min-width: 52px; text-align: center;
  font-weight: 700; font-size: 1.0625rem;
  color: var(--night-ink);
  background: var(--paper-deep);
  border-radius: var(--r-control);
  padding: 6px 4px;
}

/* ============================= UTILITY LAYOUT ============================= */
.stack > * + * { margin-top: var(--sp-md); }
.stack-lg > * + * { margin-top: var(--sp-lg); }
.row { display: flex; gap: var(--sp-md); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-md); flex-wrap: wrap; }
.grid { display: grid; gap: var(--sp-md); }
.page-head { margin-bottom: var(--sp-lg); }
.page-head .page-title { margin-bottom: 6px; }
.spacer { flex: 1; }
.center-narrow { max-width: 680px; margin: 0 auto; }

/* ============================= HIGHLIGHTER ============================= */
.hl {
  position: relative;
  display: inline;
  background-repeat: no-repeat;
  background-size: 100% 44%;
  background-position: 0 82%;
  padding: 0 2px;
}
.hl--mint { background-image: linear-gradient(var(--mint-wash), var(--mint-wash)); }
.hl--sun { background-image: linear-gradient(var(--sun-wash), var(--sun-wash)); }
.hl--rose { background-image: linear-gradient(var(--red-wash), var(--red-wash)); }
.hl--lav { background-image: linear-gradient(var(--lav-wash), var(--lav-wash)); }

/* ============================= DASHBOARD ============================= */
.today {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-lg);
  align-items: start;
  margin-bottom: var(--sp-lg);
}
.today__head {
  padding: var(--sp-lg) var(--sp-lg) var(--sp-lg) calc(var(--sp-lg) + 20px);
}
.today__date {
  font-size: 0.9375rem; color: var(--ink-soft);
  font-weight: 600; margin-bottom: var(--sp-sm);
}
.today__greeting {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin-bottom: var(--sp-md);
}
.today__resume { margin-top: var(--sp-md); }

/* Anniversary — pressed flower in the corner */
.anniv {
  text-align: center;
  padding: var(--sp-lg) var(--sp-md);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(228,163,184,0.14), transparent 70%),
    var(--panel);
}
.anniv__flower { font-size: 2rem; line-height: 1; }
.anniv__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--rose-ink);
  line-height: 1;
  margin: var(--sp-sm) 0 4px;
}
.anniv__label { font-size: 0.875rem; color: var(--ink-soft); }
.anniv__count {
  margin-top: var(--sp-md);
  padding-top: var(--sp-md);
  border-top: 1px dashed var(--feint-rule);
  font-size: 0.9375rem;
  color: var(--night-ink);
}
.anniv__count b { color: var(--rose-ink); }
@keyframes gentlePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.anniv--today .anniv__flower { animation: gentlePulse 2.4s var(--ease) infinite; }
.anniv__urdu { margin-top: var(--sp-sm); font-size: 1.125rem; opacity: 0.85; }

/* Stat marks */
.stat-marks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
}
.mark {
  padding: var(--sp-md);
  text-align: left;
}
.mark__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--night-ink);
}
.mark__num small { font-size: 1rem; color: var(--ink-soft); font-family: var(--font-body); }
.mark__label { font-size: 0.875rem; color: var(--ink-soft); margin-top: 6px; font-weight: 600; }
.mark__delta { font-family: var(--font-body); font-size: 0.9375rem; font-weight: 700; margin-left: 4px; }

/* Cue row: resume + review nudges */
.cue-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-md); }
.cue {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg); color: var(--night-ink);
}
.cue__icon {
  flex: none; width: 42px; height: 42px; border-radius: var(--r-control);
  display: grid; place-items: center; background: var(--paper-deep);
}
.cue__icon svg { width: 21px; height: 21px; }
.cue--resume .cue__icon { background: var(--lav-wash); color: var(--lav-ink); }
.cue--review .cue__icon { background: var(--mint-wash); color: var(--mint-ink); }
.cue__body { display: flex; flex-direction: column; min-width: 0; }
.cue__title { font-weight: 700; }
.cue__sub { font-size: 0.875rem; color: var(--ink-soft); }
.anniv .ecg { margin-top: var(--sp-md); }

/* Confidence cue — "Kuch nahi bhoola" reassurance card */
.confidence-cue {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(228, 163, 184, 0.16), transparent 62%),
    var(--panel);
  border-color: var(--margin-rose);
  color: var(--night-ink);
}
.confidence-cue__icon { font-size: 1.5rem; flex: none; }
.confidence-cue__body { display: flex; flex-direction: column; min-width: 0; }
.confidence-cue__title { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; line-height: 1.2; }
.confidence-cue__sub { color: var(--ink-soft); font-size: 0.9375rem; }
.confidence-cue__arrow { width: 22px; height: 22px; flex: none; color: var(--rose-ink); margin-left: auto; }

/* Topic pick chips carry a subtle practice count */
.topicpick__count { font-size: 0.75rem; font-weight: 700; opacity: 0.55; margin-left: 2px; }

/* ============================= EXAMS ============================= */
.cue--exam .cue__icon { background: var(--sun-wash); color: var(--sun-ink); }

.progress { height: 8px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.progress--lg { height: 12px; }
.progress__fill { height: 100%; background: var(--mint-ink); border-radius: 999px; }

.exam-type {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--lav-ink); background: var(--lav-wash);
  border-radius: 999px; padding: 3px 10px;
}

.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-md); }
.exam-card { display: flex; flex-direction: column; gap: 8px; }
.exam-card__top { display: flex; justify-content: space-between; align-items: center; }
.exam-card__days { font-size: 0.8125rem; font-weight: 700; color: var(--ink-soft); }
.exam-card__days.is-soon { color: var(--red-ink); }
.exam-card__days.is-past { opacity: 0.7; }
.exam-card__name { font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; }
.exam-card__meta { font-size: 0.875rem; color: var(--ink-soft); }
.exam-card .progress { margin-top: 4px; }
.exam-card__pct { font-size: 0.8125rem; color: var(--ink-soft); font-weight: 600; }

.exam-overview { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-lg); flex-wrap: wrap; }
.exam-overview__body { flex: 1; min-width: 240px; }
.exam-overview__text { font-size: 1.0625rem; line-height: 1.6; margin-top: 6px; }

/* Plan */
.plan-day__head {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--rose-ink); margin-bottom: var(--sp-sm);
}
.plan-item {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-md);
  padding: 12px 0; border-bottom: 1px solid var(--feint-rule); flex-wrap: wrap;
}
.plan-item:last-child { border-bottom: none; }
.plan-item__main { display: flex; align-items: center; gap: var(--sp-sm); min-width: 0; flex-wrap: wrap; }
.plan-item__topic { font-weight: 700; }
.plan-item__subject { font-size: 0.8125rem; color: var(--ink-soft); }
.plan-item__actions { display: flex; gap: 8px; flex: none; }

.badge { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.badge--strong { background: var(--mint-wash); color: var(--mint-ink); }
.badge--okay { background: var(--sun-wash); color: var(--sun-ink); }
.badge--weak { background: var(--red-wash); color: var(--red-ink); }
.badge--new { background: var(--paper-deep); color: var(--ink-soft); }

/* Exam create/edit subject rows */
.exam-subrow { display: grid; grid-template-columns: 190px 1fr auto; gap: var(--sp-sm); margin-bottom: var(--sp-sm); align-items: center; }
@media (max-width: 640px) { .exam-subrow { grid-template-columns: 1fr; } }

/* Revision-notes modal */
.revise-modal { position: fixed; inset: 0; z-index: 70; background: rgba(38, 49, 63, 0.45); display: grid; place-items: center; padding: var(--sp-md); }
.revise-modal[hidden] { display: none; }
.revise-modal__card {
  background: var(--panel); border: 1px solid var(--feint-rule); border-radius: var(--r-page);
  box-shadow: var(--shadow-lift); max-width: 620px; width: 100%; max-height: 82vh; overflow-y: auto; padding: var(--sp-lg);
}
.revise-modal__body { line-height: 1.6; }
.revise-modal__body ul { list-style: disc; padding-left: 1.2em; margin: 8px 0; }
.revise-modal__body li { margin-bottom: 4px; }
.revise-modal__body p + p { margin-top: 8px; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-md); }
.quick__item {
  display: flex; flex-direction: column; gap: 10px;
  padding: var(--sp-md);
  color: var(--night-ink);
}
.quick__icon {
  width: 40px; height: 40px; border-radius: var(--r-control);
  display: grid; place-items: center;
  background: var(--paper-deep);
}
.quick__icon svg { width: 21px; height: 21px; }
.quick__item:hover .quick__icon { background: var(--lav-wash); color: var(--lav-ink); }
.quick__title { font-weight: 700; }
.quick__sub { font-size: 0.8125rem; color: var(--ink-soft); }

/* Love note in the margin */
.margin-note {
  position: relative;
  background: linear-gradient(180deg, var(--cream-hi), var(--cream-lo));
  border: 1px solid var(--cream-edge);
  border-radius: var(--r-page);
  padding: var(--sp-lg) var(--sp-lg) var(--sp-lg) calc(var(--sp-lg) + 8px);
}
.margin-note::before {
  content: '';
  position: absolute; left: 18px; top: 14px; bottom: 14px;
  width: 2px; background: var(--margin-rose); opacity: 0.5; border-radius: 2px;
}
.margin-note__label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--rose-ink); text-transform: uppercase; margin-bottom: 8px;
}
.margin-note__text {
  font-family: var(--font-hand);
  font-size: 1.375rem;
  line-height: 1.5;
  color: var(--night-ink);
}
.margin-note__sign {
  font-family: var(--font-hand);
  text-align: right;
  color: var(--rose-ink);
  margin-top: var(--sp-sm);
  font-size: 1.0625rem;
}

/* Recent + weak lists */
.reclist { display: flex; flex-direction: column; }
.recitem {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: 14px 0;
  border-bottom: 1px solid var(--feint-rule);
}
.recitem:last-child { border-bottom: none; }
.recitem__score {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  min-width: 62px; text-align: center;
  border-radius: var(--r-control); padding: 6px 4px;
}
.recitem__meta { min-width: 0; }
.recitem__title { font-weight: 700; }
.recitem__sub { font-size: 0.8125rem; color: var(--ink-soft); }
.score-good { background: var(--mint-wash); color: var(--mint-ink); }
.score-mid { background: var(--sun-wash); color: var(--sun-ink); }
.score-low { background: var(--red-wash); color: var(--red-ink); }

/* ============================= EMPTY STATES ============================= */
.empty {
  text-align: center;
  padding: var(--sp-xl) var(--sp-md);
  color: var(--ink-soft);
}
.empty__mark { font-size: 2.4rem; margin-bottom: var(--sp-sm); }
.empty__title { font-family: var(--font-display); font-size: 1.375rem; color: var(--night-ink); margin-bottom: 8px; }
.empty__body { max-width: 42ch; margin: 0 auto var(--sp-lg); }

/* ============================= GENERATE / LOADING ============================= */
.gen-loading { display: none; text-align: center; padding: var(--sp-xl) 0; }
.gen-loading.on { display: block; }
.gen-form.off { display: none; }
.penline {
  width: 200px; height: 3px; margin: var(--sp-lg) auto 0;
  border-radius: 3px; background: var(--paper-deep); overflow: hidden;
}
.penline::after {
  content: ''; display: block; height: 100%; width: 40%;
  border-radius: 3px; background: var(--rose-ink);
  animation: pen 1.3s var(--ease) infinite;
}
@keyframes pen { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.gen-loading__note { font-family: var(--font-hand); font-size: 1.25rem; color: var(--rose-ink); margin-top: var(--sp-md); }

/* ============================= TEST ENGINE ============================= */
.focus-shell { min-height: 100vh; display: flex; flex-direction: column; }
.focus-top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bar-glass);
  backdrop-filter: saturate(1.1) blur(2px);
  border-bottom: 1px solid var(--feint-rule);
  padding: var(--sp-md) clamp(var(--sp-md), 5vw, 40px);
  display: flex; align-items: center; gap: var(--sp-md);
}
.focus-top__title { font-weight: 700; font-size: 0.9375rem; }
.focus-top__title small { color: var(--ink-soft); font-weight: 600; display: block; font-size: 0.8125rem; }
.focus-body { flex: 1; padding: var(--sp-xl) clamp(var(--sp-md), 5vw, 40px); }
.q-wrap { max-width: 760px; margin: 0 auto; }

.progress-pages {
  display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto;
}
.pagepip {
  width: 10px; height: 13px; border-radius: 2px;
  background: var(--paper-deep); border: 1px solid var(--feint-rule);
}
.pagepip--done { background: var(--night-ink); border-color: var(--night-ink); }
.pagepip--right { background: var(--mint-wash); border-color: var(--mint-ink); }
.pagepip--wrong { background: var(--red-wash); border-color: var(--red-ink); }
.pagepip--current { outline: 2px solid var(--margin-rose); outline-offset: 1px; }

.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-soft); font-size: 0.9375rem; }

.q-counter { font-size: 0.875rem; color: var(--ink-soft); font-weight: 600; margin-bottom: var(--sp-sm); }
.q-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.35;
  margin-bottom: var(--sp-lg);
}
.options { display: flex; flex-direction: column; gap: var(--sp-sm); }
.opt {
  display: flex; align-items: flex-start; gap: var(--sp-md);
  text-align: left; width: 100%;
  background: var(--panel);
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-control);
  padding: 16px 18px;
  font-size: 1rem; color: var(--night-ink);
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}
.opt:hover:not(:disabled) { border-color: var(--margin-rose); transform: translateX(2px); }
.opt:disabled { cursor: default; }
.opt__key {
  flex: none;
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--paper-deep); color: var(--ink-soft);
  font-weight: 700; font-size: 0.875rem;
}
.opt--correct { border-color: var(--mint-ink); background: var(--mint-wash); }
.opt--correct .opt__key { background: var(--mint-ink); color: var(--on-accent); }
.opt--correct .opt__mark { color: var(--mint-ink); }
.opt--wrong .opt__mark { color: var(--red-ink); }
.opt--wrong { border-color: var(--red-ink); background: var(--red-wash); }
.opt--wrong .opt__key { background: var(--red-ink); color: var(--on-accent); }
.opt__mark { margin-left: auto; flex: none; }
.opt__mark svg { width: 20px; height: 20px; }

.feedback {
  margin-top: var(--sp-md);
  border-radius: var(--r-control);
  padding: var(--sp-md) var(--sp-md) var(--sp-md) var(--sp-md);
  display: none;
}
.feedback.on { display: block; animation: rise 0.28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.feedback--correct { background: var(--mint-wash); }
.feedback--wrong { background: var(--red-wash); }
.feedback__verdict { font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; margin-bottom: 4px; }
.feedback--correct .feedback__verdict { color: var(--mint-ink); }
.feedback--wrong .feedback__verdict { color: var(--red-ink); }
.feedback__exp { color: var(--night-ink); }

/* Hint (offered before answering) */
.hint-row { margin: 0 0 var(--sp-md); }
.hint-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--lav-wash); color: var(--lav-ink);
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 16px; font-weight: 600; font-size: 0.9375rem;
  transition: filter 0.14s, transform 0.1s;
}
.hint-btn:hover { filter: brightness(0.97); transform: translateY(-1px); }
.hint-btn svg { width: 17px; height: 17px; }
.hint-box {
  margin-top: var(--sp-sm);
  background: var(--lav-wash); color: var(--night-ink);
  border-radius: var(--r-control);
  padding: 12px 16px; line-height: 1.55;
  animation: rise 0.24s var(--ease);
}

/* Discuss-this-question chat (inside the feedback panel) */
.discuss { margin-top: var(--sp-md); border-top: 1px solid var(--feint-rule); padding-top: var(--sp-sm); }
.discuss__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; padding: 6px 2px;
  color: var(--ink-soft); font-weight: 600; font-size: 0.9375rem;
  transition: color 0.14s;
}
.discuss__toggle:hover { color: var(--night-ink); }
.discuss__toggle svg { width: 17px; height: 17px; }
.discuss__panel { margin-top: var(--sp-sm); }
.discuss__log {
  display: flex; flex-direction: column; gap: var(--sp-sm);
  max-height: 320px; overflow-y: auto;
  padding: 4px 2px var(--sp-sm);
}
.discuss__hint { color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.5; }
.discuss__log .bubble { max-width: 92%; font-size: 0.95rem; }
.discuss__form { display: flex; align-items: flex-end; gap: var(--sp-sm); }
.discuss__input {
  flex: 1; min-height: 0; resize: none;
  padding: 10px 14px; line-height: 1.5;
}
.discuss__form .btn { flex: none; align-self: stretch; display: inline-flex; align-items: center; }

.test-nav { display: flex; align-items: center; gap: var(--sp-md); margin-top: var(--sp-lg); }
.bookmark-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--feint-rule);
  border-radius: var(--r-control); padding: 10px 16px;
  color: var(--ink-soft); font-weight: 600; font-size: 0.9375rem;
  transition: all 0.14s;
}
.bookmark-btn svg { width: 17px; height: 17px; }
.bookmark-btn.on { background: var(--lav-wash); color: var(--lav-ink); border-color: transparent; }

/* Confetti of small hearts on correct */
.spark {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 50; overflow: hidden;
}
.spark span {
  position: absolute; font-size: 18px;
  animation: sparkfall 1.1s var(--ease) forwards;
}
@keyframes sparkfall {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(120px) scale(1); }
}

/* ===================== CUSTOM QUESTIONS (question bank) ===================== */
.qbank-subject { margin-bottom: var(--sp-xl); }
.qbank-subject__head { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-md); }
.qbank-count {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  background: var(--night-ink); color: var(--cool-paper);
  border-radius: 999px; padding: 2px 10px; line-height: 1.5;
}
.qbank-count--soft { background: var(--paper-deep); color: var(--ink-soft); }

.qbank-topic { margin-bottom: var(--sp-md); padding: var(--sp-md) var(--sp-lg); }
.qbank-topic__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); flex-wrap: wrap; }
.qbank-topic__title { display: flex; align-items: center; gap: var(--sp-sm); }
.qbank-topic__name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }

.qbank-sub { border-top: 1px solid var(--feint-rule); }
.qbank-sub:first-of-type { margin-top: var(--sp-sm); }
.qbank-sub__head {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: 12px 2px; cursor: pointer; list-style: none;
}
.qbank-sub__head::-webkit-details-marker { display: none; }
.qbank-sub__head:focus-visible { outline: 2px solid var(--margin-rose); outline-offset: 2px; border-radius: 4px; }
.qbank-chevron { width: 16px; height: 16px; color: var(--ink-soft); flex: none; transition: transform 0.18s; }
.qbank-sub[open] > .qbank-sub__head .qbank-chevron { transform: rotate(90deg); }
.qbank-sub__name { font-weight: 600; }
.qbank-sub__head .spacer { flex: 1; }

.qbank-questions { display: flex; flex-direction: column; gap: var(--sp-md); padding: 4px 2px var(--sp-md); }
.qbank-q { padding: var(--sp-md); background: var(--paper-deep); border-radius: var(--r-control); }
.qbank-q__stem { font-weight: 600; line-height: 1.5; margin-bottom: var(--sp-sm); }
.qbank-q__num { color: var(--ink-soft); }
.qbank-q__opts { display: flex; flex-direction: column; }
.qbank-q__key { font-weight: 700; color: var(--ink-soft); flex: none; }
.review-opt--correct .qbank-q__key { color: var(--mint-ink); }
.qbank-q__hint { font-size: 0.9375rem; color: var(--lav-ink); margin-top: 4px; padding-left: 4px; }
.qbank-flag {
  display: inline-block; margin-top: var(--sp-sm);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 9px; border-radius: 999px;
}
.qbank-flag--key { background: var(--mint-wash); color: var(--mint-ink); }
.qbank-flag--verified { background: var(--lav-wash); color: var(--lav-ink); }

/* ============================= RESULTS ============================= */
.result-hero {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--sp-lg);
  align-items: center;
  padding: var(--sp-xl) var(--sp-lg) var(--sp-xl) calc(var(--sp-lg) + 20px);
}
.result-ring { text-align: center; }
.result-pct {
  font-family: var(--font-display); font-weight: 700;
  font-size: 4.5rem; line-height: 1; color: var(--night-ink);
}
.result-pct sup { font-size: 1.5rem; color: var(--ink-soft); }
.result-raw { color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.result-msg__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.9rem; line-height: 1.15; margin-bottom: var(--sp-sm);
}
.result-meta { display: flex; gap: var(--sp-lg); margin-top: var(--sp-md); flex-wrap: wrap; }
.result-meta div { font-size: 0.9375rem; color: var(--ink-soft); }
.result-meta b { display: block; font-size: 1.125rem; color: var(--night-ink); font-family: var(--font-display); }
.result-actions { display: flex; gap: var(--sp-md); flex-wrap: wrap; margin: var(--sp-lg) 0; }

.review-q {
  padding: var(--sp-md) var(--sp-md) var(--sp-md) calc(var(--sp-md) + 14px);
  border-bottom: 1px solid var(--feint-rule);
}
.review-q:last-child { border-bottom: none; }
.review-q__q { font-weight: 700; margin-bottom: var(--sp-sm); }
.review-opt {
  padding: 8px 12px; border-radius: 7px; font-size: 0.9375rem;
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.review-opt--correct { background: var(--mint-wash); color: var(--mint-ink); font-weight: 600; }
.review-opt--chosen-wrong { background: var(--red-wash); color: var(--red-ink); }
.review-exp { font-size: 0.9375rem; color: var(--ink-soft); margin-top: var(--sp-sm); padding-left: 4px; }
.review-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  color: var(--lav-ink); background: var(--lav-wash);
  border-radius: 999px; padding: 3px 10px; margin-bottom: var(--sp-sm);
}

/* ============================= ANALYTICS ============================= */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-lg); }
.chart-box { min-height: 260px; position: relative; }
.chart-box canvas { max-height: 300px; }

.weakbar {
  display: grid; grid-template-columns: 1fr 46px; gap: var(--sp-md);
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--feint-rule);
}
.weakbar:last-child { border-bottom: none; }
.weakbar__track { height: 10px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; }
.weakbar__fill { height: 100%; background: var(--red-ink); border-radius: 999px; opacity: 0.75; }
.weakbar__top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.weakbar__name { font-weight: 700; font-size: 0.9375rem; }
.weakbar__sub { font-size: 0.8125rem; color: var(--ink-soft); }
.weakbar__pct { font-family: var(--font-display); font-weight: 700; color: var(--red-ink); text-align: right; }

/* At-a-glance row */
.glance { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-md); }
.glance__item { padding: var(--sp-sm) var(--sp-md); }
.glance__num { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--night-ink); }
.glance__num small { font-size: 1rem; color: var(--ink-soft); font-family: var(--font-body); }
.glance__label { font-size: 0.875rem; color: var(--ink-soft); margin-top: 6px; font-weight: 600; }
.trend-up { color: var(--mint-ink); }
.trend-down { color: var(--red-ink); }

/* Consistency heatmap */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 13px);
  gap: 3px;
  width: max-content;
}
.heatcell { width: 13px; height: 13px; border-radius: var(--r-pip); background: var(--paper-deep); }
.heatcell[data-l="-1"] { background: transparent; }
.heatcell[data-l="0"] { background: var(--paper-deep); }
.heatcell[data-l="1"] { background: var(--mint-wash); }
.heatcell[data-l="2"] { background: var(--mint-bar); }
.heatcell[data-l="3"] { background: var(--mint-ink); }
.heat-legend { display: flex; align-items: center; gap: 5px; margin-top: var(--sp-md); font-size: 0.8125rem; color: var(--ink-soft); }

/* Mastery rows */
.mastery-row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-md);
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--feint-rule);
}
.mastery-row:last-child { border-bottom: none; }
.mastery-row__name { font-weight: 700; font-size: 0.9375rem; }
.mastery-row__name--good {
  text-decoration: underline; text-decoration-color: var(--mint-ink);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.mastery-row__sub { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 4px; }
.mastery-row__track { height: 9px; border-radius: 999px; background: var(--paper-deep); overflow: hidden; margin: 6px 0; }
.mastery-row__fill { height: 100%; background: var(--red-ink); opacity: 0.75; border-radius: 999px; }
.mastery-row__pct { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; text-align: right; }
.mastery-row__pct--good { color: var(--mint-ink); }

/* ============================= MISTAKES ============================= */
.mistake-item {
  padding: var(--sp-md) var(--sp-md) var(--sp-md) calc(var(--sp-md) + 14px);
  border-bottom: 1px solid var(--feint-rule);
  display: grid; grid-template-columns: 26px 1fr; gap: var(--sp-md); align-items: start;
}
.mistake-item:last-child { border-bottom: none; }
.mistake-check { margin-top: 4px; }
.mistake-check input { width: 20px; height: 20px; accent-color: var(--rose-ink); cursor: pointer; }
.sticky-bar {
  position: sticky; bottom: 0; z-index: 4;
  background: var(--panel); border: 1px solid var(--feint-rule);
  border-radius: var(--r-page); box-shadow: var(--shadow-lift);
  padding: var(--sp-md) var(--sp-lg);
  display: flex; align-items: center; gap: var(--sp-md);
  margin-top: var(--sp-lg);
}

/* ============================= REVIEW ============================= */
.review-start { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); flex-wrap: wrap; }
.review-start__body { display: flex; align-items: center; gap: var(--sp-md); }
.review-start__num {
  font-family: var(--font-display); font-weight: 700; font-size: 2.6rem;
  min-width: 70px; height: 70px; border-radius: var(--r-page);
  display: grid; place-items: center;
  background: var(--mint-wash); color: var(--mint-ink);
}

/* ============================= SEARCH ============================= */
.search-hit {
  display: flex; align-items: baseline; gap: var(--sp-md);
  padding: 12px 0; border-bottom: 1px solid var(--feint-rule);
  color: var(--night-ink);
}
.search-hit:last-child { border-bottom: none; }
.search-hit:hover .search-hit__text { color: var(--rose-ink); }
.search-hit .review-tag { margin: 0; flex: none; }
.search-hit__text { min-width: 0; }

/* ============================= FLASHCARDS ============================= */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-md); }
.deck-card { display: flex; flex-direction: column; gap: 8px; min-height: 130px; }
.deck-card__topic { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.deck-card__meta { font-size: 0.8125rem; color: var(--ink-soft); }
.deck-card__foot { margin-top: auto; display: flex; align-items: center; gap: var(--sp-sm); }

.flashstage { max-width: 620px; margin: 0 auto; text-align: center; }
.flashcard {
  perspective: 1400px;
  height: 340px; margin: var(--sp-lg) 0;
  cursor: pointer;
}
.flashcard__inner {
  position: relative; width: 100%; height: 100%;
  transition: transform 0.5s var(--ease);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard__inner { transform: rotateY(180deg); }
.flashcard__face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-xl);
  background: var(--panel); border: 1px solid var(--feint-rule);
  border-radius: var(--r-page); box-shadow: var(--shadow-rest);
}
.flashcard__face-tag { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--sp-md); }
.flashcard__front .flashcard__face-tag { color: var(--rose-ink); }
.flashcard__text { font-size: 1.375rem; line-height: 1.4; color: var(--night-ink); }
.flashcard__back { transform: rotateY(180deg); }
.flashcard__back .flashcard__face-tag { color: var(--mint-ink); }
.flashcard__back .flashcard__text { font-size: 1.125rem; }
.flash-controls { display: flex; align-items: center; justify-content: center; gap: var(--sp-md); }
.flash-counter { font-weight: 700; color: var(--ink-soft); min-width: 64px; }

/* ============================= CHAT ============================= */
.chat-shell { display: grid; grid-template-columns: 240px 1fr; gap: var(--sp-lg); align-items: start; }
.chat-sessions { display: flex; flex-direction: column; gap: 4px; }
.chat-session {
  display: block; padding: 10px 12px; border-radius: var(--r-control);
  color: var(--ink-soft); font-size: 0.9375rem; font-weight: 600;
  border: 1px solid transparent;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-session:hover { background: var(--paper-deep); color: var(--night-ink); }
.chat-session--active { background: var(--panel); border-color: var(--feint-rule); color: var(--night-ink); }

.chat-main { display: flex; flex-direction: column; min-height: 62vh; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: var(--sp-md); padding: var(--sp-md) 0; }
.bubble { max-width: 82%; padding: 12px 16px; border-radius: 14px; line-height: 1.55; }
.bubble--user { align-self: flex-end; background: var(--night-ink); color: var(--cool-paper); border-bottom-right-radius: 4px; }
.bubble--ai { align-self: flex-start; background: var(--paper-deep); color: var(--night-ink); border-bottom-left-radius: 4px; }
.bubble--ai strong { color: var(--night-ink); }
.bubble--ai code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.bubble--ai ul { list-style: disc; padding-left: 1.2em; margin: 6px 0; }
.bubble--ai ol { list-style: decimal; padding-left: 1.3em; margin: 6px 0; }
.bubble--ai li + li { margin-top: 2px; }
.bubble--ai h4 { font-family: var(--font-display); font-size: 0.98rem; font-weight: 700; margin: 10px 0 4px; }
.bubble--ai h4:first-child { margin-top: 0; }
.bubble--ai p + p { margin-top: 8px; }
.typing { display: inline-flex; gap: 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); opacity: 0.5; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
.chat-compose { display: flex; gap: var(--sp-sm); padding-top: var(--sp-md); border-top: 1px solid var(--feint-rule); }
.chat-compose textarea { min-height: 48px; max-height: 140px; }

/* ============================= NOTES ============================= */
.notes-grid { columns: 3 260px; column-gap: var(--sp-md); }
.note {
  break-inside: avoid; margin-bottom: var(--sp-md);
  padding: var(--sp-md) var(--sp-md) var(--sp-md) calc(var(--sp-md) + 12px);
}
.note--pinned { background: linear-gradient(180deg, var(--cream-hi), var(--cream-lo)); border-color: var(--cream-edge); }
.note__subject { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.note__title { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; margin: 6px 0; }
.note__body { color: var(--night-ink); white-space: pre-wrap; font-size: 0.9375rem; }
.note__foot { display: flex; gap: 8px; margin-top: var(--sp-md); }
.iconbtn {
  background: transparent; border: none; color: var(--ink-soft);
  padding: 6px; border-radius: var(--r-key); display: inline-grid; place-items: center;
  transition: background 0.14s, color 0.14s;
}
.iconbtn:hover { background: var(--paper-deep); color: var(--night-ink); }
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn--pin.on { color: var(--sun-ink); }
.iconbtn--danger:hover { color: var(--red-ink); background: var(--red-wash); }

/* ============================= ADMIN ============================= */
.lovenote-row {
  display: flex; align-items: center; gap: var(--sp-md);
  padding: 14px 0; border-bottom: 1px solid var(--feint-rule);
}
.lovenote-row:last-child { border-bottom: none; }
.lovenote-row__text { flex: 1; font-family: var(--font-hand); font-size: 1.125rem; }
.lovenote-row__text.off { opacity: 0.4; text-decoration: line-through; }

/* ============================= TOASTS ============================= */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--night-ink); color: var(--cool-paper);
  padding: 12px 20px; border-radius: var(--r-control);
  box-shadow: var(--shadow-lift); font-weight: 600; font-size: 0.9375rem;
  animation: rise 0.24s var(--ease);
}
.toast--err { background: var(--red-ink); }

/* ============================= LOCK SCREEN ============================= */
.lock {
  min-height: 100vh; display: grid; place-content: center; justify-items: center;
  padding: var(--sp-lg) var(--sp-md);
  background:
    radial-gradient(140% 100% at 50% -10%, rgba(228,163,184,0.16), transparent 60%),
    var(--cool-paper);
}
.lock__book {
  width: 100%; max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--feint-rule);
  border-radius: var(--r-page);
  box-shadow: 0 20px 60px rgba(38,49,63,0.14);
  padding: var(--sp-lg) var(--sp-xl) var(--sp-lg) calc(var(--sp-xl) + 12px);
  position: relative;
  text-align: center;
}
.lock__book::before {
  content: ''; position: absolute; left: 22px; top: 20px; bottom: 20px;
  width: 2px; background: var(--margin-rose); opacity: 0.5; border-radius: 2px;
}
.lock__flower { font-size: 2rem; }
.lock__title {
  font-family: var(--font-hand); font-size: 2.4rem; color: var(--rose-ink);
  line-height: 1.05; margin: var(--sp-sm) 0 4px;
}
.lock__urdu { font-size: 1.375rem; margin: 2px 0 6px; opacity: 0.9; }
.lock__sub { color: var(--ink-soft); margin-bottom: var(--sp-md); }
.lock__form { display: flex; flex-direction: column; gap: var(--sp-md); text-align: left; }
.lock__err { color: var(--red-ink); font-size: 0.9375rem; text-align: center; font-weight: 600; }
.lock__love {
  color: var(--rose-ink); font-size: 1.25rem; margin-top: var(--sp-md);
  min-height: 1.6em; transition: opacity 0.32s var(--ease);
}
.lock__hint { font-family: var(--font-hand); color: var(--ink-soft); font-size: 1.0625rem; margin-top: var(--sp-sm); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s var(--ease); }

/* ============================= ROMANCE: ECG, HEARTS ============================= */
/* An ECG heartbeat line — hearts, for a doctor. Draws itself, then the heart beats. */
.ecg {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  color: var(--rose-ink);
}
.ecg svg { width: 100%; height: auto; display: block; overflow: visible; }
.ecg__line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  animation: ecgDraw 1.9s var(--ease) forwards;
}
@keyframes ecgDraw { to { stroke-dashoffset: 0; } }
.ecg__heart {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: ecgHeartIn 0.4s var(--ease) 1.7s forwards, heartBeat 1.7s ease-in-out 2.1s infinite;
}
@keyframes ecgHeartIn { to { opacity: 1; } }
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.28); }
  28% { transform: scale(1); }
  42% { transform: scale(1.16); }
  56% { transform: scale(1); }
}

/* A small refined heart glyph for love/anniversary contexts. */
.heartmark { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; color: var(--heart); }
.heartmark svg { width: 100%; height: 100%; fill: currentColor; }

/* Optional floating-hearts ambience — subtle, low-density, behind content. */
.floating-hearts {
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden;
  z-index: -1;
}
.floating-hearts span {
  position: absolute; bottom: -32px;
  color: var(--heart); opacity: 0;
  will-change: transform, opacity;
  animation: floatHeart linear infinite;
}
.floating-hearts svg { width: 100%; height: 100%; fill: currentColor; }
@keyframes floatHeart {
  0% { transform: translateY(0) rotate(-8deg); opacity: 0; }
  12% { opacity: 0.42; }
  85% { opacity: 0.28; }
  100% { transform: translateY(-118vh) rotate(10deg); opacity: 0; }
}
/* Ensure real content stacks above the ambience. */
.app, .lock { position: relative; z-index: 1; }

/* ============================= RESPONSIVE ============================= */
@media (max-width: 900px) {
  .today { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; }
  .chat-sessions { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .chat-session { white-space: nowrap; }
  .result-hero { grid-template-columns: 1fr; text-align: center; }
  .result-meta { justify-content: center; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .edge {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: 82%; max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ease);
    border-radius: 0 var(--r-page) var(--r-page) 0;
    padding-left: var(--sp-lg);
  }
  .app.nav-open .edge { transform: translateX(0); box-shadow: 0 0 60px rgba(38,49,63,0.25); }
  .app.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(38,49,63,0.35);
  }
  .tab { border-radius: var(--r-tab); margin-right: 0; }
  .topbar {
    display: flex; align-items: center; gap: var(--sp-md);
    position: sticky; top: 0; z-index: 20;
    background: var(--bar-glass);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--feint-rule);
    padding: 12px var(--sp-md);
  }
  .topbar__menu {
    background: var(--panel); border: 1px solid var(--feint-rule);
    border-radius: var(--r-control); padding: 8px; display: grid; place-items: center;
  }
  .topbar__menu svg { width: 20px; height: 20px; }
  .topbar__brand { font-family: var(--font-hand); font-size: 1.25rem; color: var(--rose-ink); }
  .main { padding: var(--sp-lg) var(--sp-md); }
  .stat-marks { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: var(--sp-md) var(--sp-md) var(--sp-md) calc(var(--sp-md) + 18px); }
  .panel::before { left: 18px; }
  .notes-grid { columns: 1; }
  .result-pct { font-size: 3.5rem; }
}

/* ============================= REDUCED MOTION ============================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .flashcard__inner { transition: none; }
  .spark { display: none; }
  .floating-hearts { display: none; }
  /* Draw the ECG fully and rest the heart, rather than animating. */
  .ecg__line { stroke-dashoffset: 0; }
  .ecg__heart { opacity: 1; }
}
