/* Platform pages: login, dashboard, results, admin.
   JM EDU brand: violet #4423e3 + black #1d1d1b, logo purple #663a86 (brand manual).
   The exam screens keep Bluebook's own colors (exam.css). */
:root {
  --blue: #4423e3;
  --blue-d: #3416c2;
  --blue-l: #efebff;
  --blue-line: #d6ccfc;
  --brand-grad: linear-gradient(150deg, #2a0f9e 0%, #4423e3 55%, #6b4ff0 100%);
  --ink: #1d1d1b;
  --muted: #5d6576;
  --line: #e2e5ee;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ok: #1d8348;
  --ok-l: #e5f5ec;
  --bad: #c0392b;
  --bad-l: #fdecea;
  --gold: #b7791f;
  --gold-l: #fdf3e1;
  --teal: #0e7c86;
  --teal-l: #e2f4f5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 20, 70, .06), 0 4px 16px rgba(30, 20, 70, .06);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --serif: 'Noto Serif', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 28px; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
code { background: #eef0f5; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 24px; }
.ico { flex: none; vertical-align: middle; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent; border-radius: 999px;
  padding: 10px 20px; font: 600 15px var(--sans); cursor: pointer; background: #fff; color: var(--ink); text-decoration: none !important; transition: background .15s, box-shadow .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--blue-d); }
.btn.ghost { border-color: var(--line); background: #fff; }
.btn.ghost:hover:not(:disabled) { border-color: #c5cad8; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.gold { background: #e8a33a; color: #2b1d05; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.big { padding: 14px 26px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.google { width: 100%; border-color: var(--line); }
.link { background: none; border: 0; color: var(--blue); font: 500 14px var(--sans); cursor: pointer; padding: 0; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--blue-l); color: var(--blue); white-space: nowrap; }
.chip.green { background: var(--ok-l); color: var(--ok); }
.chip.gold { background: var(--gold-l); color: var(--gold); }
.chip.teal { background: var(--teal-l); color: var(--teal); }
.chip.red { background: var(--bad-l); color: var(--bad); }

/* top bar */
.demo-bar { background: #fff7e0; color: #6b4e00; font-size: 13px; text-align: center; padding: 6px 16px; border-bottom: 1px solid #f1e2b4; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 16px; letter-spacing: .02em; text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; }
.brand-mark img { width: 42px; height: auto; display: block; }
.brand.light { color: #fff; font-size: 17px; }
.brand.light .brand-mark { width: 48px; height: 48px; border-radius: 12px; background: #fff; box-shadow: 0 4px 14px rgba(20, 0, 80, .25); }
.brand.light .brand-mark img { width: 36px; }
.topnav { display: flex; gap: 6px; flex: 1; }
.topnav a { color: var(--muted); font-weight: 600; padding: 8px 12px; border-radius: 8px; text-decoration: none; }
.topnav a:hover { background: var(--bg); }
.topnav a.active { color: var(--blue); background: var(--blue-l); }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-l); color: var(--blue); display: grid; place-items: center; font-weight: 700; }

.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }

/* footer: College Board trademark notice + privacy link */
.site-foot { max-width: 1120px; margin: 0 auto; padding: 20px 20px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.site-foot p { margin: 0 0 6px; }
.site-foot-links { font-size: 13px; }
.site-foot a { color: var(--muted); text-decoration: underline; }

/* long-form text pages (Privacy Policy) */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 40px; }
.doc h2 { font-size: 18px; margin-top: 28px; }
.doc p, .doc li { color: #2f3442; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.narrow { max-width: 460px; margin: 0 auto; }
.crumb { display: inline-block; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.h-sec { margin: 36px 0 14px; font-size: 19px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); margin-bottom: 4px; }
.empty { text-align: center; padding: 48px 20px; }
.empty.small { padding: 24px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* forms */
form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
form input, form select { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font: 400 15px var(--sans); color: var(--ink); background: #fff; }
form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(68, 35, 227, .15); }
form input:disabled { background: var(--bg); color: var(--muted); }
.pw { position: relative; display: block; }
.pw .link { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); margin-top: 3px; font-size: 13px; }
.form-row { display: flex; justify-content: flex-end; margin: -6px 0 12px; font-size: 14px; }
.form-err { color: var(--bad); font-size: 14px; min-height: 20px; margin-bottom: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* auth */
.auth { min-height: calc(100vh - 34px); display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; }
.auth-side { background: var(--brand-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; gap: 28px; }
.auth-side h2 { font-size: 30px; line-height: 1.2; margin-top: auto; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 14px; font-size: 15px; opacity: .95; }
.auth-points li { display: flex; gap: 12px; align-items: center; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px 0; }
.auth-main .site-foot { margin-top: auto; padding-top: 32px; width: 100%; max-width: 520px; border-top: 0; }
.auth-main .auth-card { margin-top: auto; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card > p.muted { margin: 0 0 24px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }

/* dashboard */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.hello h1 { margin-bottom: 4px; }
.hello p { margin: 0; }
.stats { display: flex; gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; min-width: 110px; text-align: center; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.resume-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--blue-l); border: 1.5px solid var(--blue-line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 12px; }
.resume-card h3 { margin: 0 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.resume-card p { margin: 0; }
.resume-act { display: flex; gap: 10px; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.test-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; color: var(--ink); box-shadow: var(--shadow); text-decoration: none !important; transition: transform .15s, box-shadow .15s, border-color .15s; }
.test-card:hover { transform: translateY(-2px); border-color: var(--blue-line); box-shadow: 0 8px 24px rgba(30, 20, 70, .1); }
.test-card-top { display: flex; gap: 6px; margin-bottom: 12px; }
.test-card h3 { margin-bottom: 6px; }
.test-card p { color: var(--muted); font-size: 14px; margin: 0 0 16px; flex: 1; }
.test-card-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.test-card .go { color: var(--blue); }
.test-card.locked { opacity: .75; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: #fafbfe; }
.tbl .num { text-align: right; }

/* test detail */
.test-hero { margin-bottom: 20px; }
.detail { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
.modes { display: grid; gap: 10px; margin: 8px 0 20px; }
.mode input { position: absolute; opacity: 0; }
.mode-in { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.mode-in span { color: var(--muted); font-size: 14px; grid-column: 1; }
.mode-in em { font-style: normal; font-weight: 700; grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--muted); font-size: 14px; }
.mode input:checked + .mode-in { border-color: var(--blue); background: var(--blue-l); box-shadow: inset 0 0 0 1px var(--blue); }
.mode input:checked + .mode-in em { color: var(--blue); }
.mode input:focus-visible + .mode-in { outline: 3px solid rgba(68, 35, 227, .3); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.checks .ico { color: var(--ok); margin-top: 1px; }
.attempt-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.attempt-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* results */
.finished { text-align: center; padding: 8px 0 20px; }
.finished h1 { font-size: 32px; }
.score-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--brand-grad); color: #fff; border-radius: var(--radius); padding: 28px 32px; margin-bottom: 20px; flex-wrap: wrap; }
.score-hero .eyebrow { color: rgba(255, 255, 255, .8); }
.score-hero h2 { margin: 0; font-size: 24px; }
.score-hero .muted { color: rgba(255, 255, 255, .8); margin: 6px 0 0; }
.total { text-align: right; }
.total b { font-size: 64px; line-height: 1; letter-spacing: -.02em; display: block; }
.total span { font-size: 14px; opacity: .8; }
.sec-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.sec-score { display: flex; align-items: baseline; gap: 10px; }
.sec-score span { font-weight: 700; flex: 1; }
.sec-score b { font-size: 40px; color: var(--blue); }
.sec-score small { color: var(--muted); }
.sec-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; margin: 4px 0 18px; flex-wrap: wrap; }
.sec-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dom { margin-bottom: 12px; }
.dom-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.bar { height: 8px; background: #eceef4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.qhead h3 { margin: 0; }
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: 600 13px var(--sans); color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.mod-h { font-size: 14px; color: var(--muted); margin: 20px 0 10px; }
.q-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.q-cell { position: relative; width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 14px; text-decoration: none !important; border: 1.5px solid; transition: opacity .15s; }
.q-cell.ok { background: var(--ok-l); color: var(--ok); border-color: #b3dfc4; }
.q-cell.bad { background: var(--bad-l); color: var(--bad); border-color: #f2c0ba; }
.q-cell.skip { background: #fff; color: var(--muted); border-color: #c9cdd8; border-style: dashed; }
.q-cell.mk::after { content: ''; position: absolute; top: -5px; right: -4px; width: 9px; height: 12px; background: #c0392b; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.q-cell.dim { opacity: .18; }
.q-cell.sm { width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin: 0 4px 0 12px; border-radius: 4px; }
.q-cell.sm.mk { border: 0; background: none; }
.q-cell.sm.mk::after { top: 2px; right: 3px; }
.legend { font-size: 13px; color: var(--muted); margin: 20px 0 0; }

.review-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.review-top .crumb { margin: 0; }
.review-pos { font-weight: 700; }
.review-nav { display: flex; gap: 8px; }
.review-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; min-height: 360px; }
.explain-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.explain-body { font-family: var(--serif); font-size: 16px; line-height: 1.65; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; max-width: 760px; margin: 24px auto; }
.plan { position: relative; display: flex; flex-direction: column; gap: 12px; }
.plan .checks { flex: 1; margin-bottom: 8px; }
.plan.best { border: 2px solid #e8a33a; }
.price { font-size: 34px; font-weight: 800; }
.ribbon { position: absolute; top: 16px; right: 16px; background: var(--gold-l); color: var(--gold); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.plan-line { display: flex; gap: 10px; align-items: center; }

/* admin */
.admin-tests { display: grid; gap: 12px; }
.admin-test { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.admin-test-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.admin-prev { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; line-height: 2.4; }
.admin-prev span { font-weight: 600; color: var(--muted); }
.issues { font-size: 13px; max-height: 240px; overflow: auto; padding-left: 18px; }
.issues .error { color: var(--bad); }
.issues .warn { color: var(--gold); }
details summary { cursor: pointer; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
[data-upload-out] { margin-top: 12px; }

/* dialogs & toasts */
.dlg-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.dlg { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; }
.toast { background: #1b1f2a; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .4s, transform .4s; text-align: center; }
.toast.ok { background: #14532d; }
.toast.bad { background: #7f1d1d; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 20px; gap: 16px; }
  .auth-side h2 { font-size: 22px; margin-top: 8px; }
  .auth-points { display: none; }
  .detail { grid-template-columns: 1fr; }
  .topbar-in { gap: 12px; }
  .brand span:last-child { display: none; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .total b { font-size: 48px; }
  .page { padding: 24px 16px 48px; }
  .doc { padding: 24px 18px; }
  .site-foot { padding: 18px 16px 24px; }
}
