/* Story Bank — styles. Same tokens and premium dark look as the Academy
   (academy/academy.css), but its own sheet: this page has no lesson engine. */

:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface2: #1c232d;
  --border: #2b3442;
  --ink: #e6edf3;
  --muted: #94a3b8;
  --accent: #a5b4fc;
  --accent2: #f0abfc;
  --good: #6ee7b7;
  --bad: #fda4af;
  --warn: #fcd34d;
  --r: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); line-height: 1.55; font-size: 16px;
  min-height: 100svh;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; font-size: inherit; }
b, strong { color: #fff; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding-left: 20px; }
li { margin: 4px 0; }
a:focus-visible, button:focus-visible, summary:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px;
}

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(14,17,22,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar a.back { color: var(--muted); font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; white-space: nowrap; }
.topbar a.back:hover { color: var(--accent); }
.topbar .ttl { font-weight: 700; font-size: 15px; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { width: 70px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { font-size: 18px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.topbar nav a:hover { background: var(--surface2); }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- home ---------- */
.hero { padding: 28px 0 8px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent2); background: rgba(240,171,252,.1); border: 1px solid rgba(240,171,252,.3);
  padding: 4px 10px; border-radius: 999px;
}
.hero h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.15; margin: 14px 0 10px; letter-spacing: -.01em; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: 16px; }
.lede b { color: var(--ink); }

.statsbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.statsbar span {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--muted);
}
.statsbar b { color: var(--ink); }

.cta {
  display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(120deg, var(--accent), var(--accent2)); color: #12131a;
  font-weight: 800; font-size: 18px; padding: 16px 20px; border-radius: var(--r);
  box-shadow: var(--shadow); margin: 8px 0 20px;
}
.cta span { font-weight: 600; font-size: 14px; opacity: .8; }
.cta:active { transform: scale(.99); }

.tiles { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px 16px 16px 64px; color: var(--muted); font-size: 14px; min-height: 92px;
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(.99); }
.tile b { color: var(--ink); font-size: 16px; }
.tile .te { position: absolute; left: 16px; top: 16px; font-size: 30px; line-height: 1; }
.tile .tn {
  position: absolute; left: 10px; top: 46px; font-size: 11px; font-weight: 800; color: var(--accent);
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--accent);
  display: inline-flex; align-items: center; justify-content: center; background: var(--bg);
}

.foot { margin-top: 28px; color: var(--muted); font-size: 14px; }
.foot p { margin-bottom: 12px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- section intro + lists ---------- */
.intro { padding: 22px 0 6px; }
.intro h2 { margin: 0 0 8px; font-size: 24px; }
.intro p { color: var(--muted); }
.intro b, .intro i { color: var(--ink); }
.ghead { margin: 26px 0 10px; font-size: 18px; }
.ghead .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); padding: 20px 0; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.setup .filters { flex-wrap: wrap; overflow: visible; }
.fchip {
  flex: none; appearance: none; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; min-height: 40px;
}
.fchip.on { background: rgba(165,180,252,.16); color: var(--ink); border-color: var(--accent); }

details.item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  margin: 10px 0; overflow: hidden;
}
details.item[open] { border-color: #3a4558; }
details.item { scroll-margin-top: calc(64px + env(safe-area-inset-top)); }
details.item > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
  min-height: 52px;
}
details.item > summary::-webkit-details-marker { display: none; }
details.item > summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 22px; line-height: 1; transition: transform .2s; padding-left: 6px; }
details.item[open] > summary::after { transform: rotate(90deg); }
details.item .qt { font-weight: 600; }

.story .em { font-size: 28px; line-height: 1.1; }
.story .st { display: flex; flex-direction: column; gap: 3px; }
.story .st b { font-size: 17px; }
.story .hook { color: var(--ink); opacity: .85; font-size: 14px; }
.story .meta { color: var(--muted); font-size: 12px; }

.qbody, .sbody { padding: 0 16px 16px; border-top: 1px solid var(--border); }

/* rating dot */
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); margin-top: 6px; display: inline-block; }
.dot.bad { background: var(--bad); border-color: var(--bad); }
.dot.warn { background: var(--warn); border-color: var(--warn); }
.dot.good { background: var(--good); border-color: var(--good); }
.qlinks .dot { margin: 0 8px 0 0; vertical-align: -1px; }

/* ---------- content blocks ---------- */
.block { margin-top: 14px; }
.bh { font-size: 13px; font-weight: 800; letter-spacing: .02em; color: var(--accent); margin-bottom: 6px; text-transform: uppercase; }
.bh .sub { text-transform: none; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.why { background: rgba(165,180,252,.07); border: 1px solid rgba(165,180,252,.2); border-radius: 12px; padding: 12px 14px; }
.context { background: rgba(240,171,252,.07); border: 1px solid rgba(240,171,252,.25); border-radius: 12px; padding: 12px 14px; }
.tests ul { padding-left: 18px; }
.lookfor { background: rgba(110,231,183,.05); border: 1px solid rgba(110,231,183,.22); border-radius: 12px; padding: 12px 14px; }
.lookfor .bh { color: var(--good); }
ul.ticks { list-style: none; padding-left: 0; }
ul.ticks li { position: relative; padding-left: 26px; }
ul.ticks li::before { content: "✓"; position: absolute; left: 4px; color: var(--good); font-weight: 800; }
.avoid .bh { color: var(--bad); }
.beats ul { padding-left: 0; list-style: none; }
.beats li { position: relative; padding: 8px 12px 8px 30px; background: var(--surface2); border-radius: 10px; margin: 6px 0; }
.beats li::before { content: "▸"; position: absolute; left: 12px; color: var(--accent2); }
.answer { position: relative; background: var(--surface2); border-radius: 12px; padding: 12px 14px; border-left: 3px solid var(--accent2); }
.answer p { font-size: 15.5px; }
.answer.blur > :not(.cover) { filter: blur(7px); user-select: none; -webkit-user-select: none; pointer-events: none; }
.answer .cover {
  position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer; border-radius: 12px;
  background: rgba(14,17,22,.35); color: var(--ink); font-weight: 700; font-size: 15px; padding: 16px;
}
.choose ul, .avoid ul { padding-left: 18px; }
.choose { background: rgba(252,211,77,.06); border: 1px solid rgba(252,211,77,.22); border-radius: 12px; padding: 12px 14px; }
.avoid li::marker { color: var(--bad); }
.me { background: rgba(110,231,183,.06); border: 1px solid rgba(110,231,183,.2); border-radius: 12px; padding: 12px 14px; }
.mine { background: rgba(110,231,183,.06); border: 1px solid rgba(110,231,183,.25); border-radius: 12px; padding: 12px 14px; }
.pre { white-space: pre-wrap; }
ul.check { list-style: none; padding-left: 0; }
ul.check li { padding-left: 26px; position: relative; }
ul.check li::before { content: "☐"; position: absolute; left: 2px; color: var(--accent); }

/* ✏️ fill-in: a detail the resume doesn't state */
.fill {
  display: inline; background: rgba(252,211,77,.12); color: #fde68a;
  border: 1px dashed rgba(252,211,77,.55); border-radius: 6px; padding: 0 5px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; font-size: .95em;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; font-size: 13px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); }
.chip.story { color: var(--ink); border-color: rgba(165,180,252,.4); min-height: 36px; }
.chip.num { color: var(--ink); font-weight: 600; }
.sbody > .chips { margin-top: 14px; }

.star { display: flex; gap: 12px; margin-top: 14px; }
.star .sl {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #12131a; background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.star b { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }

details.fu { background: var(--surface2); border-radius: 10px; margin: 6px 0; }
details.fu > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 15px; }
details.fu > p { padding: 0 12px 10px; color: var(--ink); opacity: .9; }
.qlinks { list-style: none; padding-left: 0; }
.qlinks li { margin: 6px 0; }
.qlinks a { color: var(--ink); }

/* notes */
.notes { margin-top: 16px; }
.notes label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 800; color: var(--good); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.notes .saved { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.notes textarea {
  width: 100%; min-height: 96px; resize: vertical; background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.5;
}

/* buttons */
.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; padding: 10px 14px; min-height: 44px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--ink);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent2)); color: #12131a; border: 0; }
.btn.big { width: 100%; min-height: 52px; font-size: 17px; margin-top: 16px; }
.btn.ghost { background: transparent; }
.mockrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mockhint { width: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.rate .rl { width: 100%; font-size: 13px; color: var(--muted); }
.rbtn {
  flex: 1; min-width: 92px; appearance: none; cursor: pointer; min-height: 48px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--ink); font-weight: 700;
}
.rbtn.r0.on { background: rgba(253,164,175,.18); border-color: var(--bad); }
.rbtn.r1.on { background: rgba(252,211,77,.16); border-color: var(--warn); }
.rbtn.r2.on { background: rgba(110,231,183,.16); border-color: var(--good); }

/* ---------- drill + facts card ---------- */
.dcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 16px; margin-top: 18px; box-shadow: var(--shadow); }
.dprog { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.dprog .bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.dprog .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .3s; }
.dq { font-size: clamp(21px, 5.2vw, 26px); line-height: 1.25; margin: 12px 0 8px; }
.decode-d > summary { color: var(--accent); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.timer { font-variant-numeric: tabular-nums; }
.timer.running { border-color: var(--accent); }
.timer.ok { border-color: var(--good); color: var(--good); }
.timer.long { border-color: var(--warn); color: var(--warn); }
.say { color: var(--muted); margin-top: 16px; }
.dfoot { display: flex; gap: 18px; justify-content: center; margin-top: 18px; font-size: 14px; }
.dfoot .link { text-decoration: none; color: var(--muted); }
.done h2 { margin-top: 0; }
.tally { display: flex; flex-wrap: wrap; gap: 14px; font-weight: 700; }
.sub { color: var(--muted); font-size: 14px; }
.done .btn.ghost { width: 100%; margin-top: 10px; }

.opts { display: grid; gap: 8px; margin-top: 12px; }
.opt {
  appearance: none; cursor: pointer; text-align: left; min-height: 52px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--ink); font-size: 16px;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; opacity: .75; }
.opt.right { border-color: var(--good); background: rgba(110,231,183,.12); opacity: 1; }
.opt.wrong { border-color: var(--bad); background: rgba(253,164,175,.12); opacity: 1; }
.okb { background: rgba(110,231,183,.07); border: 1px solid rgba(110,231,183,.25); border-radius: 12px; padding: 12px 14px; }
.badb { background: rgba(253,164,175,.07); border: 1px solid rgba(253,164,175,.25); border-radius: 12px; padding: 12px 14px; }
.okb .chips, .badb .chips { margin-top: 10px; }

/* ---------- cheat sheet ---------- */
.cheat section.block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.numgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.num { background: var(--surface2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.num b { font-size: 22px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tl { list-style: none; padding-left: 0; border-left: 2px solid var(--border); margin-left: 6px; }
.tl li { position: relative; padding: 2px 0 12px 16px; display: flex; flex-direction: column; }
.tl li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.tl .when { font-size: 12px; color: var(--muted); font-weight: 700; }
.tl .tn2 { font-size: 14px; color: var(--muted); }
.strengths, .glance { list-style: none; padding-left: 0; }
.strengths li, .glance li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border); }
.strengths li:last-child, .glance li:last-child { border-bottom: 0; }
.strengths span, .glance span { color: var(--muted); font-size: 14px; }
.glance a { color: var(--ink); }
.qf { margin: 0; }
.qf dt { font-weight: 700; margin-top: 10px; }
.qf dd { margin: 2px 0 0; color: var(--muted); }

/* ---------- private pack card ---------- */
.packcard { background: var(--surface); border: 1px dashed rgba(240,171,252,.5); border-radius: var(--r); padding: 16px; margin: 0 0 20px; }
.packcard.loaded { border-style: solid; border-color: rgba(110,231,183,.35); }
.packcard p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.packcard p b { color: var(--ink); }
.pc-head { font-size: 16px; }
.pc-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pc-row label.btn { cursor: pointer; }
.pc-row label.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.pc-paste { margin-top: 12px; display: grid; gap: 8px; }
.pc-paste[hidden] { display: none; }
.pc-paste textarea { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.pc-msg { color: var(--warn) !important; min-height: 0; }
.pc-msg:empty { display: none; }
.setup .sl2 { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 14px; }

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