/* ===== Interview Trainer — styles ===== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-dim: #5b6270;
  --text-faint: #8a91a0;
  --accent: #3b6ef5;
  --accent-weak: #e6edff;
  --green: #1f9d55;
  --green-weak: #e3f5ec;
  --amber: #c47f00;
  --amber-weak: #fbf1dc;
  --red: #d64545;
  --red-weak: #fbe6e6;
  --purple: #7b5cff;
  --shadow: 0 1px 3px rgba(20,24,33,.08), 0 6px 20px rgba(20,24,33,.06);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0f1116;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e7eaf0;
  --text-dim: #9aa2b1;
  --text-faint: #6b7280;
  --accent: #5b8cff;
  --accent-weak: #1c2740;
  --green: #46c07f;
  --green-weak: #16281f;
  --amber: #e0a63a;
  --amber-weak: #2c2410;
  --red: #e56b6b;
  --red-weak: #2c1717;
  --purple: #9b82ff;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }
header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 26px;
}
.top-inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, var(--accent), var(--purple)); }
nav.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.tabs a {
  padding: 7px 13px; border-radius: 9px; color: var(--text-dim);
  font-size: 14px; font-weight: 500;
}
nav.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
nav.tabs a.active { background: var(--accent-weak); color: var(--accent); }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); }

/* ===== Generic ===== */
h1 { font-size: 28px; letter-spacing: -.5px; margin: 6px 0 4px; }
h2 { font-size: 20px; letter-spacing: -.3px; margin: 34px 0 12px; }
h3 { font-size: 16px; margin: 22px 0 8px; }
.lead { color: var(--text-dim); font-size: 15.5px; max-width: 70ch; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; background: var(--surface-2); color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .4px;
}
.pill.coding { background: var(--accent-weak); color: var(--accent); }
.pill.system-design { background: var(--green-weak); color: var(--green); }
.pill.behavioral { background: var(--amber-weak); color: var(--amber); }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 780px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card.click { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.card.click:hover { transform: translateY(-2px); border-color: var(--text-faint); }

button.btn {
  font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 18px; border-radius: 10px;
}
button.btn:hover { border-color: var(--text-faint); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.primary:hover { filter: brightness(1.05); }
button.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Home ===== */
.hero { padding: 14px 0 6px; }
.deck-tile { display: flex; flex-direction: column; gap: 10px; }
.deck-tile .count { font-size: 32px; font-weight: 700; letter-spacing: -1px; }
.deck-tile .sub { font-size: 13px; color: var(--text-dim); }
.progress-bar { height: 7px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #4bd694); }
.stat-row { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 4px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 22px; letter-spacing: -.5px; }
.stat span { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }

/* ===== Reference ===== */
/* ---- pattern mindmap ---- */
:root { --mm0:#3b6ef5; --mm1:#7b5cff; --mm2:#1f9d55; --mm3:#c47f00; --mm4:#d64545; --mm5:#0e8f9c; }
:root[data-theme="dark"] { --mm0:#5b8cff; --mm1:#9b82ff; --mm2:#46c07f; --mm3:#e0a63a; --mm4:#e56b6b; --mm5:#33b6c4; }
.mm-wrap { overflow-x: auto; margin: 16px 0 10px; padding-bottom: 4px; }
.mindmap { width: 100%; max-width: 662px; min-width: 600px; height: auto; display: block; }
.mm-c0 { --c: var(--mm0); } .mm-c1 { --c: var(--mm1); } .mm-c2 { --c: var(--mm2); }
.mm-c3 { --c: var(--mm3); } .mm-c4 { --c: var(--mm4); } .mm-c5 { --c: var(--mm5); }
.mm-link { fill: none; stroke: var(--c); stroke-width: 1.5; opacity: .5; }
.mm-rootbox { fill: url(#mmroot); }
.mm-roott { fill: #fff; font-family: var(--sans); font-size: 13px; font-weight: 700; }
.mm-roots { fill: rgba(255,255,255,.85); font-family: var(--sans); font-size: 11px; }
.mm-cl { fill: color-mix(in srgb, var(--c) 13%, var(--surface)); stroke: var(--c); stroke-width: 1.3; }
.mm-clt { fill: var(--c); font-family: var(--sans); font-size: 11.5px; font-weight: 700; }
.mm-leaf { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.mm-bar { stroke: none; fill: var(--c); }
.mm-leaft { fill: var(--text); font-family: var(--sans); font-size: 12.5px; font-weight: 600; }
.ref-intro { margin: 6px 0 24px; padding-bottom: 22px; border-bottom: 1px solid var(--border); max-width: 900px; }
.ref-intro h1 { margin: 0 0 8px; }
.ref-intro .lead { line-height: 1.65; }
.ref-intro .pill { vertical-align: middle; margin: 0 1px; }
.ref-layout { display: grid; grid-template-columns: 240px 1fr; gap: 30px; align-items: start; }
@media (max-width: 860px) { .ref-layout { grid-template-columns: 1fr; } .ref-toc { position: static !important; max-height: none !important; } }
.ref-toc {
  position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto;
  font-size: 13.5px; padding-right: 6px;
}
.ref-toc .deck-group { margin-bottom: 14px; }
.ref-toc .deck-group > div { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); margin: 8px 0 5px; }
.ref-toc a { display: block; padding: 4px 10px; border-radius: 7px; color: var(--text-dim); }
.ref-toc a:hover { background: var(--surface-2); text-decoration: none; }
.ref-toc a.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.ref-search { width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; margin-bottom: 14px; font-family: inherit; }
.ref-content { min-width: 0; }
.ref-section { margin-bottom: 40px; scroll-margin-top: 80px; }
.ref-content p { color: var(--text); }
.ref-content ul { padding-left: 20px; }
.ref-content li { margin: 4px 0; }
.ref-content code:not(pre code) { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.ref-content table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 12px 0; display: block; overflow-x: auto; }
.ref-content th, .ref-content td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.ref-content th { background: var(--surface-2); font-weight: 600; }
pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13px;
  line-height: 1.5; margin: 12px 0;
}
pre code { font-family: var(--mono); }
/* syntax highlighting tokens (light defaults) */
.tok-kw  { color: #a626a4; font-weight: 600; }
.tok-str { color: #3f8f3f; }
.tok-num { color: #b76b01; }
.tok-com { color: #9aa1ac; font-style: italic; }
.tok-fn  { color: #3b6ef5; }
.tok-op  { color: #0184bc; }
:root[data-theme="dark"] .tok-kw  { color: #d68bd6; }
:root[data-theme="dark"] .tok-str { color: #8ec07c; }
:root[data-theme="dark"] .tok-num { color: #e0a56b; }
:root[data-theme="dark"] .tok-com { color: #7d8590; }
:root[data-theme="dark"] .tok-fn  { color: #6cb0ff; }
:root[data-theme="dark"] .tok-op  { color: #5bc4d0; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-weak); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 14px 0; font-size: 14px; }
.callout.warn { border-color: var(--amber); background: var(--amber-weak); }
.mnemonic {
  border-left: 3px solid var(--purple);
  background: color-mix(in srgb, var(--purple) 10%, transparent);
  padding: 8px 13px; border-radius: 0 8px 8px 0; margin: 14px 0 6px;
  font-size: 13.5px; line-height: 1.5;
}
.mnemonic b { color: var(--purple); }

/* ===== Flashcards ===== */
.study-wrap { max-width: 680px; margin: 0 auto; }
.study-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.flash {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); padding: 34px 30px; min-height: 300px;
  display: flex; flex-direction: column;
}
.flash .topic { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; }
.flash .front { font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.flash .divider { border: none; border-top: 1px dashed var(--border); margin: 20px 0; }
.flash .back { font-size: 15px; color: var(--text); }
.flash .back p:first-child { margin-top: 0; }
.flash .back ul { padding-left: 20px; }
.flash .back code:not(pre code) { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.rate {
  padding: 12px 6px; border-radius: 11px; border: 1px solid var(--border); cursor: pointer;
  font-weight: 600; font-size: 14px; text-align: center; background: var(--surface); font-family: inherit; color: var(--text);
}
.rate small { display: block; font-weight: 400; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.rate.again:hover { border-color: var(--red); background: var(--red-weak); }
.rate.hard:hover { border-color: var(--amber); background: var(--amber-weak); }
.rate.good:hover { border-color: var(--accent); background: var(--accent-weak); }
.rate.easy:hover { border-color: var(--green); background: var(--green-weak); }
.study-progress { height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.study-progress > span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ===== Quiz ===== */
.quiz-wrap { max-width: 680px; margin: 0 auto; }
.choice {
  display: block; width: 100%; text-align: left; padding: 14px 16px; margin: 9px 0;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
  cursor: pointer; font-size: 15px; font-family: inherit; color: var(--text); transition: border-color .1s;
}
.choice:hover:not(:disabled) { border-color: var(--text-faint); }
.choice.correct { border-color: var(--green); background: var(--green-weak); }
.choice.wrong { border-color: var(--red); background: var(--red-weak); }
.choice .key { font-family: var(--mono); font-weight: 700; margin-right: 10px; color: var(--text-faint); }
.explain { margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }

/* ===== misc ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip {
  padding: 6px 13px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13.5px; font-family: inherit; color: var(--text-dim);
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text-dim); }
footer.foot { text-align: center; color: var(--text-faint); font-size: 12.5px; margin-top: 50px; }
