:root {
  color-scheme: light;
  --bg: #f4f1e8; --panel: #fffdf7; --ink: #171a1f; --muted: #5d646e;
  --line: #c9c4b8; --accent: #12664f; --accent-2: #d95f02; --canvas: #080b10;
  --shadow: 0 8px 24px rgba(35, 31, 24, .09);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f14; --panel: #121a21; --ink: #f7f5ed; --muted: #aeb7be;
  --line: #34414a; --accent: #58d4ab; --accent-2: #ff9b51; --canvas: #020406;
  --shadow: 0 8px 30px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; }
body { overscroll-behavior: none; }
button { color: inherit; font: inherit; }
.exhibit { min-height: 100vh; padding: clamp(14px, 2vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 60px); line-height: .95; letter-spacing: -.045em; }
.subtitle { margin: 8px 0 0; color: var(--muted); max-width: 720px; font-size: clamp(13px, 1.4vw, 17px); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.quiet, .tool, .segmented button { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 11px; font-weight: 750; cursor: pointer; }
.load-state { min-width: 180px; display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 750; }
progress { width: 100%; accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); }
fieldset { border: 0; margin: 0; padding: 0; }
legend { margin: 0 0 4px 2px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.segmented { display: flex; gap: 4px; }
#difficulty-options button { display: grid; gap: 1px; text-align: left; line-height: 1.05; }
#difficulty-options small { color: var(--muted); font-size: 9px; font-weight: 700; }
#difficulty-options button.selected small { color: inherit; opacity: .75; }
.segmented button.selected, .tool[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.predict { min-height: 52px; margin-left: auto; border: 0; border-radius: 11px; padding: 14px 32px; background: var(--accent); color: #fff; font-size: 20px; font-weight: 900; cursor: pointer; }
[data-theme="dark"] .predict { color: #07100e; }
.predict:disabled { opacity: .45; cursor: wait; }
.workbench { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(250px, 1fr) minmax(250px, 1fr) minmax(270px, .9fr); gap: 12px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: clamp(10px, 1.3vw, 18px); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.panel-heading { min-height: 51px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading > div { display: flex; align-items: baseline; gap: 8px; }
.panel-heading h2 { margin: 0; font-size: clamp(17px, 1.8vw, 24px); letter-spacing: -.02em; }
.panel-heading p { margin: 3px 0 0; max-width: 205px; color: var(--muted); font-size: 10px; text-align: right; }
.step { color: var(--accent); font-size: 10px; font-weight: 900; }
.pixel-canvas { display: block; width: min(100%, calc((100vh - 280px))); aspect-ratio: 1; margin: auto; background: var(--canvas); border: 1px solid var(--line); border-radius: 6px; image-rendering: pixelated; touch-action: none; }
.microcopy { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.legend { margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.swatch { width: 11px; height: 11px; border: 1px solid var(--line); border-radius: 2px; }
.swatch.raised { background: #2b83ba; }.swatch.zero { background: #f7f7f7; }.swatch.lowered { background: #d95f02; }
.prediction-empty { flex: 1; display: grid; place-content: center; color: var(--muted); text-align: center; padding: 30px; border: 1px dashed var(--line); border-radius: 10px; }
.prediction-result { min-height: 0; flex: 1; }
.predicted { display: grid; grid-template-columns: 1fr auto; align-items: end; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.predicted span { color: var(--muted); font-size: 12px; font-weight: 750; }.predicted strong { grid-row: span 2; font-size: clamp(58px, 9vw, 114px); line-height: .8; color: var(--accent); }.predicted small { color: var(--muted); }
.probabilities { display: grid; gap: clamp(3px, .7vh, 8px); margin-top: 12px; }
.prob-row { display: grid; grid-template-columns: 15px 1fr 50px; align-items: center; gap: 7px; font-size: 11px; font-variant-numeric: tabular-nums; }
.bar { height: clamp(8px, 1.45vh, 15px); border-radius: 3px; background: color-mix(in srgb, var(--line) 55%, transparent); overflow: hidden; }.bar i { display: block; height: 100%; background: var(--accent-2); }
footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; } footer p { margin: 0; }
.attract-banner { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 4; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 850; box-shadow: var(--shadow); }
@media (max-width: 1020px) {
  .workbench { grid-template-columns: minmax(250px, 1fr) minmax(250px, 1fr); }
  .result-panel { grid-column: 1 / -1; }
  .prediction-result { display: grid; grid-template-columns: 180px 1fr; gap: 18px; }.predicted { align-self: start; }
  .pixel-canvas { width: min(100%, 43vh); }
}
@media (orientation: portrait), (max-width: 670px) {
  .exhibit { gap: 10px; }.topbar { align-items: stretch; }.top-actions { flex-direction: column; align-items: stretch; }
  .subtitle { max-width: 500px; }.toolbar { align-items: center; }.predict { margin-left: 0; flex: 1; }
  .workbench { grid-template-columns: 1fr 1fr; }.panel { padding: 9px; }.result-panel { grid-column: 1 / -1; }
  .panel-heading { display: block; min-height: 58px; }.panel-heading p { text-align: left; max-width: none; }
  .pixel-canvas { width: 100%; }.legend { flex-direction: column; gap: 2px; }.microcopy { display: none; }
  footer { display: block; }.prediction-result { grid-template-columns: 125px 1fr; }
}
@media (max-width: 480px) { .workbench { grid-template-columns: 1fr; }.result-panel { grid-column: auto; }.topbar { display: block; }.top-actions { margin-top: 10px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
