/* ScoreScale design system — "calm and premium"
   Fonts: Fraunces (headings, big numbers) + Inter (everything else).
   Pages link this file, then add only their own page-specific styles. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Brand */
  --navy: #0F2A4A;
  --navy-hover: #1B3A60;
  --navy-soft: #F2F6FB;
  --navy-line: #D6E1EE;
  --lime: #A3E635;
  --lime-hover: #B5EE55;
  --lime-soft: #F3FAE3;
  --lime-ink: #3F6212;

  /* Neutrals (warm) */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F5F5F0;
  --line: #ECECE6;
  --line-strong: #DCDCD3;
  --ink: #111827;
  --ink-2: #4B5563;
  --ink-3: #8A8F98;

  /* Status */
  --good: #3F7D20;
  --good-soft: #EEF6E8;
  --bad: #B42318;
  --bad-soft: #FDF0EE;
  --warn: #B45309;
  --warn-soft: #FDF4E7;

  /* Subjects */
  --math: #2F5D8C;      --math-soft: #EDF3F9;
  --reading: #4D7C0F;   --reading-soft: #F1F6E8;
  --writing: #B45309;   --writing-soft: #FBF2E6;
  --science: #6D28D9;   --science-soft: #F3EEFC;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 1px rgba(17, 24, 39, 0.02);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.12);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; color: inherit; }

/* ── Type ─────────────────────────────────────────────── */
.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }
.h1 { font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.15; letter-spacing: -0.015em; }
.h2 { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.25; }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.02em; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }

/* ── App shell: sidebar + mobile top bar ─────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; min-width: 232px; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 1.5rem 0.75rem; position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 0.6rem 1.75rem; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--navy); display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding-bottom: 7px; }
.brand-mark span { width: 3px; border-radius: 2px; background: #fff; }
.brand-mark span:nth-child(1) { height: 6px; opacity: 0.6; }
.brand-mark span:nth-child(2) { height: 10px; opacity: 0.8; }
.brand-mark span:nth-child(3) { height: 14px; background: var(--lime); }
.brand-name { font-family: var(--font-display); font-size: 20px; font-weight: 500; color: var(--navy); letter-spacing: -0.01em; }
.nav-section { font-size: 11px; font-weight: 500; color: var(--ink-3); padding: 0 0.6rem; margin: 1.1rem 0 0.35rem; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0.6rem; font-size: 14px; color: var(--ink-2);
  border-radius: var(--r-sm); text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item i { font-size: 18px; color: var(--ink-3); transition: color 0.15s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--navy-soft); color: var(--navy); font-weight: 500; }
.nav-item.active i { color: var(--navy); }
.sidebar-bottom { margin-top: auto; padding: 1rem 0.6rem 0; border-top: 1px solid var(--line); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; letter-spacing: 0.02em; }
.user-name { font-size: 13px; font-weight: 500; }
.user-plan { font-size: 11px; color: var(--ink-3); }

.main { margin-left: 232px; flex: 1; min-width: 0; padding: 2.25rem 2.5rem 3rem; }
.page { max-width: 1160px; margin: 0 auto; }

.m-topbar, .m-overlay { display: none; }
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .m-topbar { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: rgba(250, 250, 247, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); align-items: center; justify-content: space-between; padding: 0 10px 0 16px; z-index: 50; }
  .m-topbar .brand { padding: 0; }
  .m-menu-btn { width: 44px; height: 44px; border: none; background: none; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; width: 264px; min-width: 264px; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .m-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35); z-index: 55; }
  .main { margin-left: 0; padding: 76px 16px 40px; }
  input, textarea, select { font-size: 16px !important; }
}

/* ── Cards ────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1rem; }
.card-title { font-family: var(--font-display); font-size: 18px; font-weight: 500; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--ink-3); }
.card.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.card.dark .card-sub, .card.dark .muted { color: rgba(255, 255, 255, 0.62); }

/* ── Buttons & links ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 17px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); }
.btn-accent { background: var(--lime); color: var(--navy); }
.btn-accent:hover { background: var(--lime-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-3); }
.btn-ghost { background: none; color: var(--ink-2); padding: 0 8px; height: 32px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link { color: var(--navy); font-weight: 500; text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Segmented control (SAT / ACT) ───────────────────── */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented button { border: none; background: none; height: 30px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--navy); box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08); }

/* ── Pills & chips ────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill i { font-size: 16px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* Subject color helpers */
.s-Math { --s: var(--math); --s-soft: var(--math-soft); }
.s-Reading { --s: var(--reading); --s-soft: var(--reading-soft); }
.s-Writing, .s-English { --s: var(--writing); --s-soft: var(--writing-soft); }
.s-Science { --s: var(--science); --s-soft: var(--science-soft); }
.s-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--s-soft, var(--surface-2)); color: var(--s, var(--ink-2)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 17px; }

/* ── Forms ────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.input, .select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15, 42, 74, 0.1); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ── Modals ───────────────────────────────────────────── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 1000; align-items: center; justify-content: center; overflow-y: auto; padding: 2rem 1rem; }
.modal { background: var(--surface); border-radius: 20px; padding: 1.75rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); margin: auto; }
.modal.wide { max-width: 540px; }
.modal h2 { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.modal .lead { font-size: 13px; color: var(--ink-2); margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Empty states ─────────────────────────────────────── */
.empty { text-align: center; padding: 1.5rem 0.5rem; color: var(--ink-3); font-size: 13px; }
.empty i { font-size: 26px; color: var(--line-strong); display: block; margin-bottom: 6px; }

/* ── Progress bar ─────────────────────────────────────── */
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--s, var(--navy)); transition: width 0.6s ease; }

/* Toasts from gamify.js, recolored to match */
.ss-toast { background: var(--navy) !important; font-family: var(--font-ui); font-weight: 500 !important; }
.ss-toast.good { background: var(--lime) !important; color: var(--navy) !important; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
