:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --surface: #fffefa;
  --ink: #252720;
  --muted: #67695e;
  --line: #ddddd1;
  --accent: #a64021;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; }
button, select { color: inherit; }
button { padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; line-height: 1.35; }
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { color: var(--surface); background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #87341b; color: #fff; }
button.quiet { background: transparent; }
button.danger { color: #9b3025; border-color: #d9afa8; }
a { color: inherit; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); max-width: 100%; }
[hidden] { display: none !important; }
.shell { width: min(1320px, calc(100% - 64px)); margin-inline: auto; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: 0.11em; font-size: 10px; font-weight: 650; }
.intro { padding: 38px 0 30px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.title-row button { flex-shrink: 0; font-size: 12px; }
h1 { font-size: clamp(30px, 4.3vw, 56px); font-weight: 600; letter-spacing: -0.065em; line-height: 1.15; min-width: 0; }
h1 span { color: var(--accent); }
.intro p:not(.eyebrow) { color: var(--muted); font-size: 16px; }
.number-panel { background: var(--ink); color: var(--surface); padding: 24px 28px; border-radius: 6px; margin-bottom: 22px; overflow: hidden; }
.number-panel .eyebrow { color: #babeb0; }
.number-top { display: flex; justify-content: space-between; gap: 16px; }
.number { font: 500 clamp(26px, 4.7vw, 58px)/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: -0.065em; padding-block: 13px 3px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.number-name { color: #dadccc; font-size: 15px; overflow-wrap: anywhere; }
.number-facts, .progress-info { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; font-size: 11px; color: #babeb0; margin-top: 12px; }
.progress-track { background: #4b4e43; height: 3px; border-radius: 2px; margin-top: 20px; }
.progress-track > div { height: 100%; width: 0; background: #d8a875; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; align-items: start; }
.main-column, .side-column { display: grid; gap: 22px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 24px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.025em; }
h3 { font-size: 14px; font-weight: 650; }
.badge { border: 1px solid var(--line); padding: 3px 7px; color: var(--muted); font-size: 10px; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.mono, .equation, .metrics strong, .proof-value { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
#story { margin-top: 5px; font-size: 12px; }
.equation { padding: 16px 12px; background: var(--paper); border-left: 2px solid var(--accent); margin-top: 16px; font-size: 13px; overflow-wrap: anywhere; }
.equation-key { margin-top: 7px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0 10px; }
.metrics strong { display: block; font-size: 17px; font-weight: 550; margin-top: 5px; }
.metrics small { color: var(--muted); }
.rate-details { border: 0; padding: 0; margin: 0 0 18px; }
.rate-details summary { color: var(--muted); font-size: 11px; font-weight: 400; }
.rate-details p { overflow-wrap: anywhere; }
.focus { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.focus legend { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.focus label { padding: 10px 8px; border: 1px solid var(--line); border-radius: 3px; font-size: 12px; cursor: pointer; }
.focus label:has(input:checked) { border-color: var(--accent); background: #faf0e6; }
.focus input { accent-color: var(--accent); margin: 0 5px 0 0; }
.focus small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.apparatus-head { margin: 22px 0 12px; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.button-group button { font-size: 11px; padding: 7px 9px; }
.small-label { font-size: 10px; color: var(--muted); }
.small-label select { margin-left: 5px; }
.upgrade { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); align-items: center; }
.upgrade-symbol { font: 24px Georgia, serif; color: var(--accent); text-align: center; }
.upgrade p { font-size: 11px; color: var(--muted); }
.upgrade strong { font-size: 12px; }
.upgrade button { min-width: 94px; font-size: 11px; }
.upgrade button small { display: block; font-family: ui-monospace, Consolas, monospace; margin-top: 3px; }
.level { color: var(--muted); font-size: 10px; font-weight: 400; margin-left: 8px; }
.advance-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 15px; }
.advance-row span { font-size: 11px; }
.graph-controls { display: flex; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.graph-controls label { font-size: 10px; color: var(--muted); }
.graph-controls select { display: block; margin-top: 4px; font-size: 11px; }
.canvas-wrap { position: relative; }
canvas { display: block; width: 100%; height: 270px; touch-action: pan-y; }
.graph-message { position: absolute; inset: 0; display: grid; place-content: center; padding: 32px; text-align: center; font-size: 12px; color: var(--muted); }
.graph-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 10px; color: var(--muted); margin-bottom: 12px; }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend span:last-child { margin-left: auto; }
.line-key { width: 16px; border-top: 2px solid var(--accent); }
.line-key.dashed { border-top: 2px dashed #9a9b8e; }
#graph-readout { min-height: 20px; margin-top: 8px; color: var(--accent); overflow-wrap: anywhere; }
.proof-value { display: block; font-size: 26px; font-weight: 500; margin-top: 16px; }
#proof-total, #proof-hint { margin-block: 8px 14px; }
.full { width: 100%; }
.research-heading { padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }
.theory, .challenge { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.theory:first-child { border-top: 0; margin-top: 0; }
.theory.learned h3, .challenge.solved h3 { color: #52613a; }
.learned-badge, .solved-badge { display: inline-block; margin-left: 8px; padding: 2px 6px; border: 1px solid #cbd4bb; border-radius: 3px; background: #eef2e7; color: #52613a; font-size: 10px; font-weight: 500; vertical-align: middle; }
.theory p, .challenge p { font-size: 11px; color: var(--muted); margin: 4px 0 9px; }
.theory button, .challenge button { font-size: 11px; width: 100%; }
.challenge h3 { font-size: 13px; }
.challenge .reward { color: var(--accent); }
#challenge-status { margin-top: 12px; }
#cancel-challenge { margin-top: 20px; }
.field-notes > p:not(.eyebrow) { color: var(--muted); font-size: 12px; margin-top: 12px; }
details { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 13px; }
summary { cursor: pointer; font-size: 12px; font-weight: 600; }
details p { font-size: 11px; color: var(--muted); margin-top: 10px; }
.atlas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.landmark { border-left: 2px solid var(--line); padding: 4px 10px; }
.landmark.found { border-color: var(--accent); }
.landmark strong { display: block; font-size: 12px; }
.landmark small { color: var(--muted); display: block; margin-top: 3px; font-size: 10px; }
.landmark:not(.found) { opacity: 0.6; }
footer { display: flex; gap: 14px 24px; flex-wrap: wrap; align-items: center; padding: 24px 0; margin-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
footer button { font-size: 11px; }
.notice { background: #eceee3; border-left: 3px solid #7b895e; padding: 12px 16px; font-size: 12px; margin-bottom: 20px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; width: min(540px, calc(100% - 32px)); padding: 24px; max-height: 90vh; overflow: auto; }
dialog::backdrop { background: rgb(37 39 32 / 45%); }
dialog p { font-size: 12px; }
dialog textarea { width: 100%; margin: 9px 0; padding: 10px; border: 1px solid var(--line); background: var(--paper); border-radius: 3px; font: 11px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.settings-actions { margin: 18px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
dialog .danger { margin-top: 16px; }
.skip-link { position: absolute; top: 8px; left: 12px; padding: 8px 12px; background: var(--surface); transform: translateY(-200%); z-index: 2; }
.skip-link:focus { transform: none; }
@media (max-width: 1080px) {
  .shell { width: calc(100% - 40px); }
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
  .panel { padding: 18px; }
  .main-column, .side-column { gap: 16px; }
  .focus { grid-template-columns: 1fr; }
  .focus small { display: inline; margin-left: 6px; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-column .field-notes { grid-column: 1 / -1; }
  .focus { grid-template-columns: repeat(3, 1fr); }
  .focus small { display: block; margin-left: 0; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 28px); }
  .intro { padding-block: 28px 24px; }
  .number-panel { padding: 20px; }
  .number-top { flex-wrap: wrap; }
  .side-column { grid-template-columns: 1fr; }
  .focus { grid-template-columns: 1fr; }
  .focus small { display: inline; margin-left: 6px; }
  .upgrade { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .upgrade-symbol { display: none; }
  .upgrade button { min-width: 82px; }
  .atlas { grid-template-columns: 1fr; }
  .graph-controls { gap: 10px; }
  .metrics { gap: 12px; }
  .metrics strong { font-size: 14px; }
}
