@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #d2d2d7;
  --soft: rgba(0, 0, 0, 0.08);
  --surface: #ffffff;
  --alt: #f5f5f7;
  --blue: #005ea2;
  --blue-dark: #004785;
  --blue-soft: rgba(0, 94, 162, 0.08);
  --hugger: #1c7ed6;
  --hugger-text: #174f86;
  --hugger-soft: #e6f0fa;
  --nipper: #e8590c;
  --nipper-text: #a2400c;
  --nipper-soft: #fdebe0;
  --honey: #ffbf1f;
  --honey-text: #8a5300;
  --honey-soft: #fff4d6;
  --good: #1f7a46;
  --good-soft: #e5f4ea;
  --warn: #8a5300;
  --warn-soft: #fff3dc;
  --alert: #b42318;
  --alert-soft: #fdecea;
  --radius: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
p { margin: 0 0 0.7em; }
h1, h2, h3 { margin: 0; }
a { color: var(--blue); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; text-decoration: none;
}
.skip:focus { top: 10px; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- frame ---------- */

.app { display: flex; flex-direction: column; height: 100vh; }

.top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--soft);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 36% 40%, var(--ink) 0 9%, transparent 10%),
    radial-gradient(circle at 64% 40%, var(--ink) 0 9%, transparent 10%), #ffc29a;
  box-shadow: inset 0 0 0 1.6px var(--ink);
}
.brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 0.98rem; white-space: nowrap; }

.steps { position: relative; flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.steps ol { display: flex; gap: 4px; margin: 0; padding: 3px; list-style: none; background: var(--alt); border-radius: 999px; }
.step-btn {
  position: relative;
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  border: 0; background: transparent; border-radius: 999px;
  padding: 6px 12px 6px 7px; cursor: pointer;
  font-size: 0.82rem; font-weight: 500; color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.step-btn:hover { color: var(--ink); }
.step-n {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.7rem; font-weight: 700; background: #fff; border: 1px solid var(--line);
}
.step-btn.is-past .step-n { background: var(--ink); color: #fff; border-color: var(--ink); }
.step-btn.is-current { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); font-weight: 600; }
.step-btn.is-current .step-n { background: var(--blue); color: #fff; border-color: var(--blue); }

.top-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.link-btn {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; color: var(--blue); text-decoration: none; cursor: pointer;
}
.link-btn:hover { background: var(--blue-soft); }

.main {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(380px, 1fr);
}
.col { min-height: 0; overflow-y: auto; padding: 20px 22px 28px; }
.col-right { background: var(--alt); border-left: 1px solid var(--soft); }
.col-right:focus { outline: none; }

/* ---------- story ---------- */

.story { max-width: 66ch; }
.eyebrow {
  margin: 0 0 6px; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue);
}
.eyebrow-hot { color: var(--honey-text); }
.story-title {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem); font-weight: 700;
  letter-spacing: -0.028em; line-height: 1.15; margin-bottom: 10px;
}
.story-title:focus { outline: none; }
.story p { color: #3a3a3c; }
.story strong { color: var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hint {
  font-size: 0.86rem; color: var(--warn) !important;
  background: var(--warn-soft); border-radius: 12px; padding: 9px 12px;
}
.hint .btn { margin-left: 6px; }
.goals { list-style: none; margin: 10px 0 12px; padding: 0; display: grid; gap: 6px; }
.goal { display: flex; gap: 9px; align-items: flex-start; font-size: 0.9rem; color: #3a3a3c; }
.goal-mark {
  flex: 0 0 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  border: 1.6px solid var(--line); background: #fff;
}
.goal.is-done .goal-mark {
  border-color: var(--good);
  background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.6 2.6L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.steps-list { margin: 6px 0 10px; padding-left: 1.3em; color: #3a3a3c; }
.steps-list li { margin-bottom: 5px; }

.research {
  margin: 14px 0; padding: 14px 16px;
  background: var(--alt); border-radius: 14px;
  font-size: 0.88rem;
}
.research p { color: #3a3a3c; margin-bottom: 0.5em; }
.research p:last-child { margin-bottom: 0; }
.research-k { font-size: 0.7rem !important; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted) !important; }
.did { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--soft); border-radius: 14px; }
.did ul { margin: 0; padding-left: 1.2em; }
.final-q {
  margin-top: 16px !important; font-size: 1.12rem; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.4; color: var(--ink) !important;
}

/* ---------- act 5: sealed exam, where next ---------- */

.sealed { margin: 16px 0; padding: 14px 16px; border-radius: 14px; background: var(--honey-soft); }
.sealed p { color: #3a3a3c; }
.sealed-t { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 8px; }
.sealed-t:focus { outline: none; }
.sealed .cta-row { margin-top: 8px; }
.runs { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 0.82rem; font-variant-numeric: tabular-nums; background: #fff; border-radius: 10px; overflow: hidden; }
.runs caption { text-align: left; font-size: 0.78rem; color: var(--muted); padding-bottom: 6px; }
.runs th, .runs td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--soft); }
.runs thead th { font-weight: 650; color: var(--muted); font-size: 0.74rem; }
.runs tbody th { font-weight: 600; }
.tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: 0.68rem; font-weight: 650; color: var(--alert); background: var(--alert-soft); }
.next { margin: 16px 0 4px; }
.next ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.next li { font-size: 0.9rem; color: #3a3a3c; }
.next a { font-weight: 650; text-decoration: none; }
.next a:hover { text-decoration: underline; }
.next li span { display: block; font-size: 0.84rem; color: var(--muted); }

/* ---------- before/after strip on notices ---------- */

.cmp { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--soft); border-radius: 14px; font-size: 0.84rem; }
.cmp-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp-t caption { text-align: left; font-weight: 650; padding-bottom: 6px; color: var(--ink); }
.cmp-t th, .cmp-t td { padding: 3px 6px; text-align: right; }
.cmp-t th[scope="row"] { text-align: left; font-weight: 500; color: #3a3a3c; }
.cmp-t thead th { font-size: 0.74rem; font-weight: 650; color: var(--muted); }
.cmp-moved { margin: 8px 0 2px !important; font-weight: 600; color: var(--ink) !important; }
.cmp-list { margin: 0; padding-left: 1.2em; color: #3a3a3c; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: #8aa9c4; cursor: progress; }
.btn-primary[aria-disabled="true"]:active { transform: none; }
.btn-quiet { background: #fff; color: var(--blue); border-color: var(--line); }
.btn-quiet:hover { background: var(--blue-soft); }
.btn-quiet:disabled { color: var(--faint); background: var(--alt); cursor: default; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--blue-soft); }

/* ---------- panels ---------- */

.panel { margin-top: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-title { font-size: 0.98rem; font-weight: 650; letter-spacing: -0.015em; }
.panel-sub { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }

.toolset { display: inline-flex; padding: 3px; gap: 2px; background: var(--alt); border-radius: 999px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; border-radius: 999px;
  padding: 6px 11px; font-size: 0.8rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tool svg { width: 14px; height: 14px; }
.tool:hover { color: var(--ink); }
.tool.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.tool[data-tool="sticker"].is-on svg { color: #e0a000; }

.composition { margin-bottom: 10px; overflow-x: auto; }
.mix { border-collapse: separate; border-spacing: 0; font-size: 0.76rem; min-width: 320px; }
.mix th, .mix td { padding: 4px 10px; text-align: center; }
.mix thead th { font-weight: 600; color: var(--muted); }
.mix tbody th { text-align: left; font-weight: 600; white-space: nowrap; padding-left: 0; }
.mix td { font-variant-numeric: tabular-nums; border-radius: 8px; }
.mix td.is-zero { color: var(--muted); }
.mix td.is-skew { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot-hugger { background: var(--hugger); }
.dot-nipper { background: var(--nipper); }

/* ---------- cards ---------- */

.grid { display: grid; gap: 10px; }
.grid-train { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.grid-pool { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.grid > [role="listitem"] { min-width: 0; }

.card {
  position: relative; width: 100%;
  display: flex; flex-direction: column;
  padding: 5px 5px 7px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--soft);
  text-align: left; cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card.is-static { cursor: default; }
button.card:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
.thumb { position: relative; display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--alt); }
.thumb .chip { position: absolute; left: 4px; bottom: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.thumb svg { display: block; width: 100%; height: 100%; }
.card-name { display: block; margin-top: 5px; padding: 0 3px; font-size: 0.74rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-align: center; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  font-size: 0.66rem; font-weight: 650; padding: 2px 7px; border-radius: 999px;
}
.chip svg { width: 10px; height: 10px; }
.chip-hugger { color: var(--hugger-text); background: var(--hugger-soft); }
.chip-nipper { color: var(--nipper-text); background: var(--nipper-soft); }
.thumb .chip-hugger { background: #eef5fc; }
.thumb .chip-nipper { background: #fff1e8; }
.chip.is-lie { box-shadow: inset 0 0 0 1.5px currentColor; }
.card-hint {
  position: absolute; left: 50%; top: 10px; transform: translate(-50%, -4px);
  padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  background: rgba(29, 29, 31, 0.86); color: #fff; white-space: nowrap;
  max-width: calc(100% - 10px); overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease, transform 0.15s ease;
}
.card:hover .card-hint, .card:focus-visible .card-hint { opacity: 1; transform: translate(-50%, 0); }
.card.is-pool { background: var(--surface); }
.pred {
  position: absolute; right: 9px; top: 9px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  opacity: 0; transition: background 0.12s linear, opacity 0.15s ease;
}
.pred.is-hugger, .pred.is-nipper { opacity: 1; }
.pred.is-hugger { background: var(--hugger); }
.pred.is-nipper { background: var(--nipper); }
.pred.is-wrong { box-shadow: 0 0 0 2px var(--alert), 0 1px 3px rgba(0, 0, 0, 0.25); }

.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.fgroup { display: flex; flex-wrap: wrap; gap: 4px; }
.fchip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 11px; font-size: 0.78rem; font-weight: 500; color: #3a3a3c; cursor: pointer;
}
.fchip:hover { border-color: var(--faint); }
.fchip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pool-sec + .pool-sec { margin-top: 16px; }
.pool-h { font-size: 0.8rem; font-weight: 650; margin-bottom: 8px; }
.pool-h span { font-weight: 500; color: var(--muted); margin-left: 4px; }
.empty-inline { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }

/* ---------- machine ---------- */

.machine-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.train-btn { padding: 11px 26px; font-size: 0.98rem; min-width: 112px; }
.train-btn.is-nudge { box-shadow: 0 0 0 4px rgba(0, 94, 162, 0.18); }
.stats { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 8px; margin-top: 14px; }
.stat {
  display: flex; flex-direction: column; min-width: 0;
  background: #fff; border-radius: 14px; padding: 10px 12px;
  border: 1px solid var(--soft); transition: opacity 0.2s ease;
}
.stat.is-stale { opacity: 0.5; }
.stat-k { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat-v { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-v-sm { font-size: 1.05rem; }
.stat-n { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.stat-exam .stat-v { color: var(--ink); }
.loss { width: 100%; height: 26px; margin: 2px 0; overflow: visible; }
.loss path { fill: none; stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.status { min-height: 1.3em; margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); }
.findings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.finding {
  border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font-size: 0.78rem; font-weight: 650;
}
.tone-warn.finding { background: var(--warn-soft); color: var(--warn); }
.tone-alert.finding { background: var(--alert-soft); color: var(--alert); }
.tone-good.finding { background: var(--good-soft); color: var(--good); }

.tabs {
  display: flex; gap: 2px; margin: 16px 0 12px; padding: 3px;
  background: rgba(0, 0, 0, 0.05); border-radius: 999px;
}
.tabs [role="tab"] {
  flex: 1 1 0; border: 0; background: transparent; border-radius: 999px;
  padding: 7px 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs [role="tab"][aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.tab-panel:focus-visible { outline-offset: 4px; border-radius: 8px; }

.empty { background: #fff; border-radius: var(--radius); padding: 22px; border: 1px solid var(--soft); }
.empty-t { font-weight: 650; margin-bottom: 4px; }
.empty p { font-size: 0.88rem; color: var(--muted); }

.exam-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 550; cursor: pointer; }
.switch input {
  appearance: none; width: 32px; height: 19px; border-radius: 999px; margin: 0;
  background: var(--line); position: relative; cursor: pointer; transition: background 0.15s ease; flex: 0 0 auto;
}
.switch input::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease;
}
.switch input:checked { background: var(--blue); }
.switch input:checked::after { transform: translateX(13px); }
.switch svg { width: 13px; height: 13px; color: #e0a000; vertical-align: -2px; }
.switch-star input:checked { background: #d99400; }
.exam-sum { font-size: 0.85rem; color: #3a3a3c; margin-bottom: 10px; }
.exam-sum.is-stale { opacity: 0.55; }
.grid-exam { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.ex {
  width: 100%; display: flex; flex-direction: column; gap: 4px;
  padding: 4px 4px 6px; border-radius: 12px; background: #fff;
  border: 1.5px solid transparent; cursor: pointer; transition: transform 0.15s ease;
}
.ex:hover { transform: translateY(-2px); }
.ex.is-wrong { border-color: #f0b4ad; background: #fff7f6; }
.ex .thumb { border-radius: 8px; }
.ex-v { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 0.68rem; font-weight: 650; }
.ex-mark svg { width: 12px; height: 12px; display: block; }
.ex.is-right .ex-mark { color: var(--good); }
.ex.is-wrong .ex-mark { color: var(--alert); }

/* ---------- inspector ---------- */

.inspect { background: #fff; border-radius: var(--radius); padding: 14px; border: 1px solid var(--soft); }
.inspect-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.inspect-count { margin: 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
.inspect-count strong { color: var(--ink); }
.inspect-body { display: flex; flex-wrap: wrap; gap: 16px; }
.inspect-fig { margin: 0; flex: 0 1 200px; min-width: 160px; }
.inspect-img { border-radius: 14px; overflow: hidden; aspect-ratio: 1; }
.inspect-img svg { display: block; width: 100%; height: 100%; }
.inspect-fig figcaption { margin-top: 8px; }
.inspect-side { flex: 1 1 230px; min-width: 0; }
.verdict { margin: 0 0 10px; display: grid; gap: 6px; }
.verdict div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verdict dt { width: 7.2em; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.verdict dd { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.verdict .chip { font-size: 0.75rem; padding: 3px 9px; }
.verdict-mark { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 0.78rem; }
.verdict-mark svg { width: 13px; height: 13px; }
.verdict-mark.is-right { color: var(--good); }
.verdict-mark.is-wrong { color: var(--alert); }
.note { margin: 12px 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.45; }

.legend { display: flex; justify-content: space-between; margin: 0 0 4px; font-size: 0.7rem; font-weight: 650; padding-left: 11.4rem; padding-right: 2.8rem; }
.lg-hugger { color: var(--hugger-text); }
.lg-nipper { color: var(--nipper-text); }
.bars { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 3px; }
.bar-row { display: grid; grid-template-columns: 11rem 1fr 2.4rem; align-items: center; gap: 6px; font-size: 0.74rem; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3a3a3c; }
.bar-read { color: var(--muted); }
.bar-track { position: relative; height: 10px; background: #eeeef1; border-radius: 999px; }
.bar-track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--faint); }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; transition: width 0.25s ease; }
.bar-right { left: 50%; background: var(--nipper); }
.bar-left { right: 50%; background: var(--hugger); }
.bar-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- learned ---------- */

.learned.is-stale .probes, .learned.is-stale .bars { opacity: 0.55; }
.sub-h { font-size: 0.9rem; font-weight: 650; margin: 18px 0 2px; letter-spacing: -0.01em; }
.sub-p { font-size: 0.78rem; color: var(--muted); margin-bottom: 8px; }
.probes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.probe { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 2.8rem; align-items: center; gap: 8px; font-size: 0.78rem; }
.probe-l { color: #3a3a3c; }
.probe.is-good .probe-l { font-weight: 650; color: var(--ink); }
.probe-track { height: 10px; background: #e6e6ea; border-radius: 999px; overflow: hidden; }
.probe-fill { display: block; height: 100%; background: #3a3a3c; border-radius: 999px; transition: width 0.25s ease; }
.probe.is-good .probe-fill { background: var(--good); }
.probe-fill.is-err { background: var(--alert); }
.probe-v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fd { border-radius: 12px; padding: 10px 12px; font-size: 0.82rem; }
.fd p { margin: 0; color: #3a3a3c; }
.fd .fd-t { font-weight: 700; margin-bottom: 2px; }
.fd.tone-warn { background: var(--warn-soft); }
.fd.tone-warn .fd-t { color: var(--warn); }
.fd.tone-alert { background: var(--alert-soft); }
.fd.tone-alert .fd-t { color: var(--alert); }
.fd.tone-good { background: var(--good-soft); }
.fd.tone-good .fd-t { color: var(--good); }

/* ---------- dialogs ---------- */

dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(29, 29, 31, 0.38); }
.reveal { width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
.reveal-in { padding: 26px 28px 24px; }
.reveal-title:focus { outline: none; }
.reveal-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.028em; line-height: 1.15; margin-bottom: 12px; }
.reveal-body p { color: #3a3a3c; }
.reveal-body .research { margin-bottom: 4px; }
.reveal[open] { animation: pop 0.22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh;
  width: min(460px, 100vw); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
}
.drawer-in { padding: 22px 24px 28px; font-size: 0.88rem; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-head h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
.drawer-in > p { color: #3a3a3c; background: var(--alt); border-radius: 12px; padding: 12px 14px; }
.src { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.src a { font-weight: 600; text-decoration: none; line-height: 1.4; }
.src a:hover { text-decoration: underline; }
.src p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }

.dock { display: none; }
.show-sm { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .main { grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-loss { grid-column: 1 / -1; }
}

@media (max-width: 899px) {
  body { font-size: 15px; }
  .app { height: auto; min-height: 100vh; padding-bottom: 72px; }
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .brand { order: 1; }
  .top-actions { order: 2; margin-left: auto; }
  .steps { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .steps ol { flex: 0 0 auto; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .brand-name { font-size: 0.92rem; }
  .link-btn { padding: 6px 8px; font-size: 0.8rem; }
  .reveal-in { padding: 20px 20px 18px; }
  .reveal-title { font-size: 1.3rem; }
  .reveal .research { font-size: 0.82rem; }
  .main { display: block; }
  .col { overflow: visible; padding: 18px 16px 24px; }
  .col-right { border-left: 0; border-top: 1px solid var(--soft); }
  .grid-train { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .grid-pool { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .grid-exam { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-name { font-size: 0.7rem; }
  .thumb .chip { font-size: 0.6rem; padding: 1px 6px; left: 3px; bottom: 3px; }
  .train-btn { display: none; }
  .dock {
    display: flex; align-items: center; gap: 8px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--soft);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }
  .dock-stats { flex: 1 1 auto; display: flex; gap: 12px; font-size: 0.78rem; color: var(--muted); }
  .dock-stats strong { color: var(--ink); font-size: 0.92rem; }
  .bar-row { grid-template-columns: 9.6rem 1fr 2.2rem; }
  .legend { padding-left: 10rem; padding-right: 2.6rem; }
  .drawer { width: 100vw; }
}

@media (max-width: 420px) {
  .step-btn:not(.is-current) .step-l { display: none; }
  .step-btn:not(.is-current) { padding: 5px; }
  .step-btn { padding: 5px 10px 5px 5px; }
  .steps ol { gap: 6px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-v { font-size: 1.45rem; }
  .inspect-fig { flex-basis: 100%; max-width: 240px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
