:root {
  --bg: #121212; --card: #1e1e1e; --card2: #2a2a2a; --line: #262626;
  --text: #f2f2f2; --muted: #a3a3a3; --dim: #8a8a8a;
  --accent: #e8a33d; --accent-ink: #141414; --accent-soft: #3a2c14; --accent-text: #f2be6b;
  --teal: #5cc8e0; --teal-soft: #14303a; --teal-text: #8fdceb;
  --rose-soft: #3a1f24; --rose-text: #f5b8c2;
  --green-soft: #143a24; --green-text: #9be3b5;
  --violet-soft: #2a1f3a; --violet-text: #d3bcf7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.view { padding: 20px 16px 96px; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 12px; }
.error { background: #3a1d1d; color: #ffb3b3; padding: 14px 16px; border-radius: 14px; }
h1 { margin: 0; font-size: 24px; font-weight: 700; }
h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.15; }
.sub { color: var(--muted); font-size: 13px; }
.label { color: var(--muted); font-size: 13px; }
.note { color: var(--dim); font-size: 12px; line-height: 1.4; }
.overline { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #161616; border-top: 1px solid var(--line); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; font-size: 11px; color: var(--muted); }
.tabbar button.on { color: var(--accent); }

.tile { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 18px; background: var(--card); border: 0; text-align: left; width: 100%; }
.tile .ic { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.tile .t { font-size: 17px; font-weight: 600; }
.tile.soon { background: transparent; border: 1px dashed #333; color: var(--muted); }
.col { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; flex-shrink: 0; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid #333; background: transparent; color: #e0e0e0; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.rose.on { background: var(--rose-soft); border-color: var(--rose-text); color: var(--rose-text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--card); }
.seg button { min-height: 40px; border-radius: 10px; border: 0; background: transparent; color: #d0d0d0; font-size: 14px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--card); }
.search input { flex: 1; background: transparent; border: 0; outline: none; font-size: 15px; min-width: 0; }
.search input::placeholder { color: var(--dim); }
.search svg { width: 18px; height: 18px; color: var(--dim); }

.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 0; background: var(--card); text-align: left; width: 100%; }
.item .n { font-size: 16px; font-weight: 600; }
.item svg { width: 18px; height: 18px; color: #7a7a7a; }
.badge { padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-c { background: var(--accent-soft); color: var(--accent-text); }
.b-p { background: var(--teal-soft); color: var(--teal-text); }
.b-s { background: var(--rose-soft); color: var(--rose-text); }
.group-h { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 2px 0; }
.group-h .g { font-size: 13px; font-weight: 600; color: var(--rose-text); text-transform: uppercase; letter-spacing: .08em; }
.group-h.c .g { color: var(--accent-text); }

.back { align-self: flex-start; display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: none; color: var(--accent); font-size: 15px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { padding: 12px; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fact .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.fact .v { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.rows .r { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.rows .q { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .q.t { color: var(--teal); font-weight: 600; }
.rows a { color: var(--text); text-decoration: underline; text-decoration-color: #555; text-underline-offset: 3px; }
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; font-size: 15px; line-height: 1.45; color: #e0e0e0; }
.step .num { width: 24px; height: 24px; flex-shrink: 0; border-radius: 12px; background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.text { font-size: 15px; line-height: 1.55; color: #e0e0e0; }
.warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: #f2d19b; font-size: 13px; line-height: 1.4; }

.btn { width: 100%; min-height: 52px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--card2); color: var(--text); }
.btn.ok { background: var(--green-soft); color: var(--green-text); }
.btn:disabled { background: var(--card2); color: var(--muted); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz { display: flex; flex-direction: column; gap: 16px; padding: 24px 20px; border-radius: 22px; background: var(--card); min-height: 380px; }
.score { font-size: 44px; font-weight: 700; color: var(--accent); text-align: center; }

.prep-row { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--card); }
.prep-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--card2); font-size: 22px; }
.stepper input { width: 84px; height: 44px; text-align: center; border-radius: 12px; border: 1px solid #333; background: #151515; font-size: 17px; font-weight: 600; }
.make { margin-left: auto; padding: 6px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.make.need { background: var(--teal-soft); color: var(--teal-text); }
.make.ok { background: var(--green-soft); color: var(--green-text); }
.sticky { position: sticky; bottom: 84px; }
