/* ============================================================
   QASMT Prep — Practice Portal
   Design direction: calm academic / trustworthy edu-portal.
   Dark navy sidebar, light airy main, teal + amber accents,
   subject colour-coding, soft depth. Built to feel intentional.
   ============================================================ */

:root {
  /* Brand / structure */
  --navy:      #0f2a43;
  --navy-2:    #143a5c;
  --navy-3:    #1d4a72;
  --brand:     #1d6fb8;
  --teal:      #12b5a5;
  --amber:     #f5a524;

  /* Surfaces & ink */
  --bg:        #eef2f8;
  --bg-2:      #e6ecf5;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --ink:       #16232f;
  --ink-2:     #3d4d5c;
  --muted:     #6b7c8d;
  --line:      #e2e8f1;
  --line-2:    #d5deea;

  /* Semantic */
  --green:     #16a34a;
  --green-bg:  #dcfce7;
  --red:       #dc2626;
  --red-bg:    #fee2e2;
  --yellow:    #d97706;
  --yellow-bg: #fef3c7;

  /* Subjects */
  --math:      #2563eb;
  --numerical: #0d9488;
  --reading:   #7c3aed;
  --verbal:    #ea580c;

  /* Geometry */
  --header-h:  64px;
  --side-w:    248px;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(16,42,67,.06), 0 8px 24px rgba(16,42,67,.08);
  --shadow-lg: 0 12px 40px rgba(16,42,67,.16);
  --ease:      cubic-bezier(.16,1,.3,1);

  --font: "Segoe UI", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ============================================================
   APP SHELL — grid: header spans top, sidebar left, main right
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "header header" "sidebar main";
  min-height: 100vh;
}

/* ---------- HEADER ---------- */
.app-header {
  grid-area: header;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16,42,67,.02);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--navy), var(--navy-3));
  color: var(--teal); font-family: var(--serif); font-size: 22px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -.2px; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.header-target {
  font-size: 12.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; display: flex; align-items: center; gap: 7px;
}
.header-target .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(18,181,165,.18); }
.header-target strong { color: var(--navy); }
.student-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, var(--brand), var(--teal));
}
.student-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; flex-direction: column; gap: 4px; }
.hamburger span { width: 22px; height: 2.5px; background: var(--navy); border-radius: 2px; }

/* ---------- SIDEBAR ---------- */
.app-sidebar {
  grid-area: sidebar;
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h));
  background: linear-gradient(180deg, var(--navy), #0c2136);
  color: #c9d6e5;
  display: flex; flex-direction: column;
  padding: 16px 12px;
  z-index: 30;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 10px;
  color: #b7c6d8; font-size: 14.5px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-item .ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #eaf1f8; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(18,181,165,.22), rgba(29,111,184,.18));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-item.active .ic { opacity: 1; stroke: var(--teal); }

.side-foot { margin-top: auto; display: flex; gap: 10px; padding: 10px 6px 4px; }
.side-stat {
  flex: 1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px; padding: 10px; text-align: center;
}
.side-stat strong { display: block; font-size: 19px; color: #fff; }
.side-stat span { font-size: 10.5px; color: #90a3b8; text-transform: uppercase; letter-spacing: .5px; }

.sidebar-scrim { display: none; }

/* ---------- MAIN ---------- */
.app-main {
  grid-area: main;
  padding: 30px clamp(18px, 3.5vw, 48px) 64px;
  max-width: 1180px;
  width: 100%;
}
.loading { color: var(--muted); padding: 40px 0; }

/* ============================================================
   SHARED PRIMITIVES
   ============================================================ */
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.4px; color: var(--navy); }
.page-head p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 62ch; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 30px 0 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: all .16s var(--ease);
  background: var(--surface-2); color: var(--ink); border-color: var(--line-2);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: linear-gradient(120deg, var(--brand), #1f8ac9); color: #fff; border-color: transparent; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(29,111,184,.32); }
.btn-teal { background: linear-gradient(120deg, var(--teal), #0ea89a); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: var(--red-bg); background: #fff; }
.btn-danger:hover { background: var(--red-bg); }
.btn-lg { padding: 14px 26px; font-size: 15.5px; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-green { background: var(--green-bg); color: #15803d; }
.pill-red { background: var(--red-bg); color: #b91c1c; }
.pill-yellow { background: var(--yellow-bg); color: #b45309; }
.pill-grey { background: var(--bg-2); color: var(--ink-2); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--navy), var(--navy-3) 70%, #245a86);
  color: #eaf2fa; border-radius: 18px; padding: 30px 32px;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(18,181,165,.35), transparent 65%); pointer-events: none;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.5px; }
.hero p { margin: 0; max-width: 60ch; color: #b9cde0; font-size: 14.5px; }
.hero .hero-cta { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--teal); }
.hero .btn-ghost { color: #eaf2fa; border-color: rgba(255,255,255,.25); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .stat-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 4px; color: var(--navy); }
.stat .stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat .stat-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--w,0%); background: var(--c, var(--brand)); transition: width .6s var(--ease); }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.subject-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 12px; transition: all .18s var(--ease);
  border-top: 3px solid var(--sc, var(--brand));
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.subject-card .sc-top { display: flex; align-items: center; gap: 12px; }
.subject-card .sc-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--sca, #eef); color: var(--sc, var(--brand));
}
.subject-card .sc-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.subject-card h3 { margin: 0; font-size: 16.5px; color: var(--navy); }
.subject-card .sc-meta { font-size: 12.5px; color: var(--muted); }
.subject-card .sc-progress { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; }
.subject-card .track { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.subject-card .track > i { display: block; height: 100%; width: var(--w,0%); background: var(--sc, var(--brand)); border-radius: 99px; }

/* ============================================================
   RESOURCE (5-Parts) BUTTONS
   ============================================================ */
.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.part-btn {
  display: flex; flex-direction: column; gap: 10px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--brand));
  border-radius: var(--radius); padding: 20px; cursor: pointer; box-shadow: var(--shadow);
  transition: all .18s var(--ease); color: var(--ink);
}
.part-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.part-btn .pb-top { display: flex; align-items: center; justify-content: space-between; }
.part-btn .pb-num { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--pc, var(--brand)); opacity: .5; }
.part-btn h3 { margin: 0; font-size: 17px; color: var(--navy); }
.part-btn p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.part-btn .pb-go { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--pc, var(--brand)); display: flex; align-items: center; gap: 5px; }

.links-list { display: grid; gap: 10px; }
.link-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: all .16s var(--ease);
}
.link-row:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.link-row .lr-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; color: var(--brand); flex-shrink: 0; }
.link-row .lr-body { flex: 1; min-width: 0; }
.link-row .lr-body strong { display: block; font-size: 14.5px; color: var(--navy); }
.link-row .lr-body span { font-size: 12.5px; color: var(--muted); }
.link-row .lr-arrow { color: var(--muted); }

/* Rendered markdown (strategy docs) */
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 40px); box-shadow: var(--shadow); }
.doc h1, .doc h2, .doc h3, .doc h4 { color: var(--navy); line-height: 1.25; }
.doc h1 { font-size: 26px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 2px solid var(--line); }
.doc h2 { font-size: 20px; margin: 30px 0 12px; }
.doc h3 { font-size: 16.5px; margin: 22px 0 8px; }
.doc h4 { font-size: 14.5px; margin: 18px 0 6px; }
.doc p { color: var(--ink-2); margin: 10px 0; }
.doc ul, .doc ol { color: var(--ink-2); padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc strong { color: var(--ink); }
.doc code { background: var(--bg-2); padding: 2px 6px; border-radius: 5px; font-size: .9em; color: var(--navy); }
.doc blockquote { margin: 14px 0; padding: 12px 18px; border-left: 4px solid var(--teal); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.doc a { color: var(--brand); text-decoration: underline; }
.doc .table-wrap { overflow-x: auto; margin: 16px 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.doc th, .doc td { border: 1px solid var(--line-2); padding: 9px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--surface-2); color: var(--navy); font-weight: 700; }
.doc tr:nth-child(even) td { background: var(--surface-2); }

.doc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* ============================================================
   TEST SELECTION
   ============================================================ */
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.set-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: all .18s var(--ease);
  display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--sc, var(--brand));
}
.set-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.set-card .set-n { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.set-card h3 { margin: 0; font-size: 16px; color: var(--navy); }
.set-card .set-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.set-card .set-best { margin-top: auto; font-size: 12.5px; }

.subject-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.subject-tab {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .16s var(--ease);
}
.subject-tab:hover { border-color: var(--sc); }
.subject-tab.active { background: var(--sc, var(--navy)); color: #fff; border-color: transparent; }

/* ============================================================
   QUIZ RUNNER
   ============================================================ */
.quiz-wrap { max-width: 1120px; }
.quiz-bar {
  position: sticky; top: calc(var(--header-h) + 0px); z-index: 20;
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.quiz-bar .qb-title { font-weight: 700; color: var(--navy); font-size: 15px; }
.quiz-bar .qb-title span { color: var(--muted); font-weight: 500; font-size: 13px; }
.quiz-bar .qb-progress { flex: 1; height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.quiz-bar .qb-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--teal)); width: 0; transition: width .3s var(--ease); }
.timer {
  display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 16px; color: var(--navy);
  background: var(--surface-2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px;
}
.timer svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.timer.warn { color: var(--yellow); border-color: var(--yellow-bg); background: var(--yellow-bg); }
.timer.danger { color: var(--red); border-color: var(--red-bg); background: var(--red-bg); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.quiz-layout { display: grid; grid-template-columns: 1fr 210px; gap: 20px; align-items: start; }

.q-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.q-passage {
  padding: 22px 26px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  max-height: 340px; overflow-y: auto;
}
.q-passage .qp-title { font-family: var(--serif); font-size: 18px; color: var(--navy); margin: 0 0 6px; }
.q-passage .qp-type { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--teal); font-weight: 700; margin-bottom: 10px; }
.q-passage p { color: var(--ink-2); margin: 0 0 10px; font-size: 14.5px; line-height: 1.65; }
.q-passage.poem p { white-space: pre-wrap; font-style: italic; }

.q-body { padding: 26px; }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-num { font-size: 13px; font-weight: 700; color: var(--muted); }
.q-topic { font-size: 11.5px; }
.q-stem { font-size: 17px; color: var(--ink); line-height: 1.55; margin-bottom: 8px; font-weight: 500; }
.q-figure { margin: 14px 0; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; display: inline-block; }
.q-figure svg { width: 300px; max-width: 100%; height: auto; display: block; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.option {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1.5px solid var(--line-2); border-radius: 11px; cursor: pointer;
  background: var(--surface); transition: all .14s var(--ease); text-align: left; width: 100%;
}
.option:hover { border-color: var(--brand); background: #f6faff; }
.option .opt-key {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--bg-2); color: var(--ink-2); transition: all .14s var(--ease);
}
.option .opt-text { font-size: 15px; color: var(--ink); }
.option .opt-text svg { width: 150px; max-width: 100%; height: auto; vertical-align: middle; display: block; }
.option.selected { border-color: var(--brand); background: #eaf4ff; box-shadow: inset 0 0 0 1px var(--brand); }
.option.selected .opt-key { background: var(--brand); color: #fff; }

.q-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.q-actions .spacer { flex: 1; }
.flag-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.flag-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.flag-btn.on { color: var(--amber); border-color: var(--amber); background: #fff8ec; }
.flag-btn.on svg { fill: var(--amber); }

/* Question navigator */
.q-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; position: sticky; top: calc(var(--header-h) + 74px); }
.q-nav h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.q-nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.q-dot {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .14s var(--ease);
  display: grid; place-items: center; position: relative;
}
.q-dot:hover { border-color: var(--brand); }
.q-dot.answered { background: var(--navy); color: #fff; border-color: var(--navy); }
.q-dot.current { outline: 3px solid rgba(29,111,184,.35); border-color: var(--brand); }
.q-dot.flagged::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; background: var(--amber); border-radius: 50%; border: 1.5px solid #fff; }
.q-nav .qn-legend { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); }
.q-nav .qn-legend span { display: flex; align-items: center; gap: 7px; }
.q-nav .qn-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.q-nav .submit-wrap { margin-top: 16px; }

/* ============================================================
   RESULTS REPORT
   ============================================================ */
.result-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 32px; box-shadow: var(--shadow-lg); margin-bottom: 22px;
  border-top: 5px solid var(--rc, var(--brand));
}
.score-ring { position: relative; width: 132px; height: 132px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .sr-num { position: absolute; inset: 0; display: grid; place-items: center; flex-direction: column; }
.score-ring .sr-num b { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1; }
.score-ring .sr-num small { font-size: 12px; color: var(--muted); }
.result-hero .rh-body h1 { margin: 0 0 4px; font-size: 24px; color: var(--navy); }
.result-hero .rh-body .rh-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.result-hero .verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result-hero .verdict .big-pill { font-size: 14px; padding: 8px 16px; }

.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.rstat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.rstat .rs-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.rstat .rs-value { font-size: 22px; font-weight: 800; color: var(--navy); margin-top: 3px; }

.benchmark-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.benchmark-box h3 { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
.benchmark-box .bm-note { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.bm-track { position: relative; height: 34px; background: var(--bg-2); border-radius: 10px; overflow: hidden; }
.bm-track .bm-fill { height: 100%; border-radius: 10px; transition: width .7s var(--ease); }
.bm-track .bm-marker { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--navy); }
.bm-track .bm-marker::after { content: attr(data-label); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.bm-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }

.topic-breakdown { display: grid; gap: 10px; }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; }
.topic-row .tr-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.topic-row .tr-track { grid-column: 1 / -1; height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.topic-row .tr-track > i { display: block; height: 100%; border-radius: 99px; }
.topic-row .tr-score { font-size: 13px; font-weight: 700; }

.review-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.review-item .ri-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; cursor: pointer; }
.review-item .ri-badge { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 15px; color: #fff; }
.review-item .ri-badge.ok { background: var(--green); }
.review-item .ri-badge.no { background: var(--red); }
.review-item .ri-badge.skip { background: var(--muted); }
.review-item .ri-q { flex: 1; }
.review-item .ri-q .ri-num { font-size: 12px; color: var(--muted); font-weight: 700; }
.review-item .ri-q .ri-stem { font-size: 14.5px; color: var(--ink); margin-top: 2px; }
.review-item .ri-chev { color: var(--muted); transition: transform .2s var(--ease); }
.review-item.open .ri-chev { transform: rotate(180deg); }
.review-body { display: none; padding: 0 20px 20px 58px; }
.review-item.open .review-body { display: block; }
.review-figure { margin: 8px 0 14px; }
.review-figure svg { width: 260px; max-width: 100%; height: auto; }
.ans-line { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 7px; }
.ans-line.correct { background: var(--green-bg); color: #15803d; }
.ans-line.your-wrong { background: var(--red-bg); color: #b91c1c; }
.ans-line .al-key { font-weight: 800; }
.explain-box { margin-top: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.explain-box .eb-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--teal); margin-bottom: 6px; }
.explain-box p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.explain-box.why-wrong .eb-label { color: var(--red); }

.review-filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ============================================================
   HISTORY
   ============================================================ */
.hist-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.hist { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.hist th { text-align: left; padding: 13px 16px; background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); }
table.hist td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
table.hist tr:last-child td { border-bottom: 0; }
table.hist tr.clickable { cursor: pointer; }
table.hist tr.clickable:hover td { background: var(--surface-2); }
.subject-dot { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.subject-dot i { width: 10px; height: 10px; border-radius: 50%; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 54px; height: 54px; stroke: var(--line-2); fill: none; stroke-width: 1.5; margin-bottom: 14px; }
.empty-state h3 { color: var(--ink-2); margin: 0 0 6px; }

/* ============================================================
   MISTAKE NOTEBOOK (오답노트)
   ============================================================ */
.subject-tab .tab-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px;
}
.subject-tab.active .tab-badge { background: rgba(255,255,255,.28); }
.mistake-item.is-resolved { opacity: .74; }
.mistake-item .ri-stem { font-weight: 500; }

.learn-block {
  margin-top: 16px; border: 1px solid #c9ebe6;
  background: linear-gradient(180deg, #f1fbf9, #f6fcff);
  border-radius: 12px; padding: 16px 18px;
}
.learn-concept { display: flex; gap: 9px; align-items: center; font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 14px; }
.learn-concept .lc-ic { font-size: 17px; }

.wordgroup { margin-bottom: 14px; }
.wordgroup:last-of-type { margin-bottom: 0; }
.wg-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--teal); margin-bottom: 4px; }
.wg-note { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.wg-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.wordcard { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.wordcard b { display: block; color: var(--navy); font-size: 14.5px; margin-bottom: 1px; }
.wordcard span { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }

.learn-practice { margin-top: 16px; border-top: 1px dashed #bfe4de; padding-top: 14px; }
.learn-practice .btn.open { background: var(--navy); }
.practice-wrap { margin-top: 14px; display: grid; gap: 12px; }
.practice-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.practice-stem { font-size: 14.5px; color: var(--ink); margin-bottom: 11px; line-height: 1.5; }
.practice-opts { display: flex; flex-direction: column; gap: 7px; }
.practice-opt {
  display: flex; align-items: center; gap: 11px; text-align: left; width: 100%;
  background: var(--surface-2); border: 1.5px solid var(--line-2); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; cursor: pointer; transition: all .14s var(--ease); color: var(--ink);
}
.practice-opt:hover { border-color: var(--teal); }
.practice-opt .po-key { width: 24px; height: 24px; border-radius: 6px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.practice-item.answered .practice-opt { cursor: default; }
.practice-item.answered .practice-opt:hover { border-color: var(--line-2); }
.practice-opt.correct { background: var(--green-bg); border-color: var(--green); color: #15803d; }
.practice-opt.correct .po-key { background: var(--green); color: #fff; }
.practice-opt.correct:hover { border-color: var(--green); }
.practice-opt.wrong { background: var(--red-bg); border-color: var(--red); color: #b91c1c; }
.practice-opt.wrong .po-key { background: var(--red); color: #fff; }
.practice-explain { margin-top: 11px; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.practice-explain .pe-tag { font-weight: 700; color: var(--teal); margin-right: 6px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-scrim { position: fixed; inset: 0; background: rgba(15,42,67,.5); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); max-width: 440px; width: 100%; padding: 26px; }
.modal h3 { margin: 0 0 8px; color: var(--navy); font-size: 19px; }
.modal p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .quiz-layout { grid-template-columns: 1fr; }
  .q-nav { position: static; order: -1; }
  .q-nav-grid { grid-template-columns: repeat(10, 1fr); }
  .result-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}
@media (max-width: 760px) {
  :root { --side-w: 0px; }
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  .hamburger { display: flex; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 268px;
    transform: translateX(-100%); transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg); padding-top: 20px;
  }
  body.nav-open .app-sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(15,42,67,.45); z-index: 25; }
  .header-target { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .stat-row { grid-template-columns: 1fr; }
  .student-name { display: none; }
  .app-main { padding: 20px 16px 50px; }
}
