:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --text: #1d1f1e;
  --muted: #5d625f;
  --border: #dedcd3;
  --accent: #1f5c4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --excel: #1d6b3a;
  --sql: #2a4f8f;
  --warn: #9a4a10;
  --warn-soft: #fbeee2;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141615; --surface: #1c1f1d; --surface-2: #252926; --text: #e8eae8; --muted: #a3aaa6;
    --border: #343a36; --accent: #6cc3a3; --accent-ink: #0d1f18; --accent-soft: #1f3a30;
    --excel: #6fcf8f; --sql: #8fb2f0; --warn: #f0a46a; --warn-soft: #3a2a1d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141615; --surface: #1c1f1d; --surface-2: #252926; --text: #e8eae8; --muted: #a3aaa6;
  --border: #343a36; --accent: #6cc3a3; --accent-ink: #0d1f18; --accent-soft: #1f3a30;
  --excel: #6fcf8f; --sql: #8fb2f0; --warn: #f0a46a; --warn-soft: #3a2a1d; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.35rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

.topbar {
  display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap;
  padding: 0.85rem max(16px, calc((100vw - 1100px) / 2)); background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.topbar nav a {
  text-decoration: none; color: var(--text); padding: 0.4rem 0.75rem; border-radius: 8px; font-size: 0.92rem;
  border: 1px solid transparent;
}
.topbar nav a:hover { background: var(--surface-2); }
.topbar nav a.active { background: var(--accent-soft); border-color: var(--border); }

main { max-width: 1100px; margin: 0 auto; padding: 2rem 16px 3rem; outline: none; }
.footer { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 2.5rem; color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.split { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 0.92rem; padding: 0.55rem 1rem; min-height: 40px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface-2);
}
.tag.excel { color: var(--excel); }
.tag.sql { color: var(--sql); }

.hero { padding: 0.5rem 0 1rem; max-width: 760px; }
.section-title { margin: 2rem 0 0.75rem; }

/* files */
.files { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.file {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; background: var(--surface);
  text-decoration: none; color: var(--text);
}
.file:hover { background: var(--surface-2); }
.file .name { font-size: 0.85rem; color: var(--muted); word-break: break-all; }

/* timer */
.timer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.clocks { display: flex; gap: 1.75rem; }
.clock { text-align: right; }
.clock .label { font-size: 0.75rem; color: var(--muted); }
.clock .value { font-size: 1.9rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.expired .clock.remaining .value { color: var(--warn); }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 0.6rem 0.9rem; font-weight: 600; }

/* exam layout */
.exam { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; align-items: start; }
.qnav { display: flex; flex-direction: column; gap: 0.35rem; position: sticky; top: 76px; }
.qnav button {
  text-align: left; font: inherit; font-size: 0.9rem; cursor: pointer; padding: 0.55rem 0.75rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  display: flex; gap: 0.6rem; align-items: center;
}
.qnav button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.qnav .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.8rem; }
.question-text { font-size: 1.2rem; line-height: 1.5; margin: 0.25rem 0 1rem; }
.answer { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 0.9rem 1rem; border-radius: 0 8px 8px 0; }
.answer p:last-child { margin-bottom: 0; }
pre {
  font-family: var(--mono); font-size: 0.85rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem 0.9rem; overflow-x: auto; white-space: pre; margin: 0.5rem 0 0;
}
code { font-family: var(--mono); font-size: 0.88em; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num { font-variant-numeric: tabular-nums; }

.vars { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.var { border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.9rem; background: var(--surface); }
.var .k { font-weight: 600; }
.equation { font-family: var(--mono); font-size: 0.9rem; background: var(--surface-2); padding: 0.7rem 0.9rem; border-radius: 8px; overflow-x: auto; }

/* list pages */
.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
select, input[type="search"] {
  font: inherit; font-size: 0.92rem; padding: 0.5rem 0.7rem; min-height: 40px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
input[type="search"] { flex: 1 1 220px; }
.list { display: flex; flex-direction: column; gap: 0.5rem; }
.item {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; background: var(--surface);
}
.item:hover { background: var(--surface-2); }
.item .meta { font-size: 0.82rem; color: var(--muted); }
.item .title { font-weight: 500; }

/* examiner mode */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.options { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; margin: 0; }
.options label { display: flex; gap: 0.6rem; align-items: center; }
.options input { width: 18px; height: 18px; accent-color: var(--accent); }
.followup { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 0.8rem 1rem; border-radius: 0 8px 8px 0; }
.followup p:last-child { margin-bottom: 0; }
.followup .why { color: var(--warn); font-style: italic; margin-top: -0.4rem; }
.examiner .question-text { font-size: 1.3rem; }
.tag.rec { color: #c62828; border-color: currentColor; }
.voice-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.voice-row select { max-width: 100%; min-width: 220px; }
.voice-row input[type="range"] { width: 160px; accent-color: var(--accent); }
.heard { border: 1px dashed var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; color: var(--muted); }
.heard p { margin: 0; font-size: 0.95rem; }
textarea {
  font: inherit; font-size: 0.95rem; width: 100%; padding: 0.6rem 0.75rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical;
}
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.92rem; }
.levels legend { padding: 0 0.3rem; font-weight: 600; }
.levels label { align-items: baseline; }
.sound { margin: 0; color: var(--muted); }
.bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 30px; }
.bars span { width: 8px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.85; }
.bars span:last-child { opacity: 1; }
.checklist li { display: flex; gap: 0.5rem; align-items: baseline; }
.checklist li.miss { color: var(--muted); }
.home-feature { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), var(--surface)); }

@media (max-width: 760px) {
  main { padding-top: 1.25rem; }
  .exam { grid-template-columns: 1fr; }
  .qnav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 0.25rem; }
  .qnav button { flex: 0 0 auto; }
  .qnav .label { display: none; }
  .clocks { gap: 1rem; }
  .clock .value { font-size: 1.5rem; }
  .topbar { gap: 0.5rem; }
}
