/* Switchback by DevBanjo.
   Layout: a full-width pixel diorama with the answer in a game dialog box, then plain
   panels framed like wooden signboards. Pixel type for the name, ages and numbers only;
   sentences use readable type. */
:root {
  --bg: #DCEBC8;
  --ink: #22301F;
  --muted: #55624F;
  --paper: #FFFDF6;
  --frame: #6B4A2B;
  --frame-hi: #A87443;
  --gold: #E7B53C;
  --leaf: #3E8A3D;
  --dialog: #17213F;
  --dialog-ink: #F4F1FF;
  --dialog-mute: #BFC4E6;
  --bad: #B6402E;
  --scene-bg: #6EBBEA;
  --focus: #1F6FD1;
  --f-pixel: 'Jersey 10', 'Courier New', monospace;
  --f-body: 'Chivo', 'Segoe UI', system-ui, sans-serif;
  --px: 3px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121826; --ink: #ECE8DA; --muted: #A9AFBC; --paper: #1C2434; --frame: #8A5E36; --frame-hi: #C18A54;
  --gold: #FFCF5A; --leaf: #7CC35A; --dialog: #0D1328; --dialog-ink: #F4F1FF; --dialog-mute: #B3B9DE; --bad: #FF8A72;
  --scene-bg: #1B2050; --focus: #8CC4FF; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #121826; --ink: #ECE8DA; --muted: #A9AFBC; --paper: #1C2434; --frame: #8A5E36; --frame-hi: #C18A54;
  --gold: #FFCF5A; --leaf: #7CC35A; --dialog: #0D1328; --dialog-ink: #F4F1FF; --dialog-mute: #B3B9DE; --bad: #FF8A72;
  --scene-bg: #1B2050; --focus: #8CC4FF; color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--f-body); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.bar { display: flex; align-items: baseline; gap: 10px; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--dialog); color: var(--dialog-ink); }
.word { font-family: var(--f-pixel); font-size: 34px; line-height: 1; text-decoration: none; }
.word b { font-weight: 400; color: var(--gold); }
.by { font-size: 13px; color: var(--dialog-mute); }

/* ---------- the diorama ---------- */
.hero { position: relative; background: var(--scene-bg); }
.scene-wrap { width: 100%; max-width: 1280px; margin: 0 auto; aspect-ratio: 16 / 9; max-height: 720px; }
.scene { display: flex; justify-content: center; overflow: hidden; }
.scene-stage { position: relative; overflow: hidden; }
.scene-layer { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.layer-map { visibility: hidden; }
.layer-sky { filter: blur(calc(var(--px) * 0.7)) saturate(1.05); }
/* tilt-shift: a blurred copy shows at the top and bottom edges only */
.layer-bloom { filter: blur(calc(var(--px) * 1.1)); -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 46%, transparent 82%, #000 100%); mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 46%, transparent 82%, #000 100%); }
.layer-fore { filter: blur(calc(var(--px) * 1.8)); opacity: .95; }
.layer-motes { filter: drop-shadow(0 0 calc(var(--px) * 1.5) rgba(255, 236, 160, .95)); }
.scene-light, .scene-rays, .scene-vignette { position: absolute; inset: 0; pointer-events: none; }
.scene-light { background: radial-gradient(ellipse at 84% 6%, rgba(255, 228, 150, .65), rgba(255, 228, 150, 0) 58%); mix-blend-mode: soft-light; }
.scene-rays { background: repeating-linear-gradient(112deg, rgba(255, 246, 214, .17) 0 calc(var(--px) * 5), rgba(255, 246, 214, 0) calc(var(--px) * 5) calc(var(--px) * 21)); -webkit-mask-image: radial-gradient(ellipse at 84% 0%, #000 0%, transparent 62%); mask-image: radial-gradient(ellipse at 84% 0%, #000 0%, transparent 62%); animation: rays 14s ease-in-out infinite alternate; }
.scene[data-mode="dusk"] .scene-light { background: radial-gradient(ellipse at 84% 34%, rgba(255, 200, 120, .45), rgba(255, 200, 120, 0) 50%); }
.scene[data-mode="dusk"] .scene-rays { display: none; }
.scene-vignette { background: radial-gradient(ellipse at 50% 55%, rgba(16, 12, 28, 0) 52%, rgba(16, 12, 28, .5) 100%); }
@keyframes rays { from { transform: translateX(calc(var(--px) * -4)); opacity: .8; } to { transform: translateX(calc(var(--px) * 4)); opacity: 1; } }
.scene-labels { position: absolute; inset: 0; }
.scene-flag { position: absolute; transform: translate(-50%, -100%); font-family: var(--f-pixel); font-size: max(12px, calc(var(--px) * 7)); line-height: 1; padding: 3px 6px 2px; background: var(--dialog); color: var(--dialog-ink); white-space: nowrap; box-shadow: 0 -2px 0 0 var(--dialog-ink), 0 2px 0 0 var(--dialog-ink), -2px 0 0 0 var(--dialog-ink), 2px 0 0 0 var(--dialog-ink); }
.scene-flag.flag-home { background: var(--gold); color: #1A1E33; }
.scene-flag.flag-ghost { background: rgba(23, 33, 63, .78); }

/* ---------- the answer, in a game dialog box ---------- */
.dialog { max-width: 760px; margin: 0 auto; position: relative; top: -12px; background: var(--dialog); color: var(--dialog-ink); padding: 16px 18px; box-shadow: 0 -3px 0 0 var(--gold), 0 3px 0 0 var(--gold), -3px 0 0 0 var(--gold), 3px 0 0 0 var(--gold), 0 0 0 6px var(--dialog); display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 800px) { .dialog { margin-left: max(16px, env(safe-area-inset-left, 0px)); margin-right: max(16px, env(safe-area-inset-right, 0px)); } }
.dialog h1 { font-size: clamp(22px, 4.6vw, 30px); line-height: 1.2; font-weight: 800; }
.dialog h1 .age { font-family: var(--f-pixel); font-weight: 400; font-size: 1.35em; color: var(--gold); line-height: 1; }
.dialog p { color: var(--dialog-mute); font-size: 16px; line-height: 1.45; }
.dialog .example { font-size: 14px; color: var(--gold); }

/* ---------- panels ---------- */
main { display: flex; flex-direction: column; gap: 28px; padding-bottom: 40px; }
.panel { width: calc(100% - 2 * max(16px, env(safe-area-inset-left, 0px))); max-width: 760px; margin: 0 auto; background: var(--paper); padding: 20px 18px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 -4px 0 0 var(--frame), 0 4px 0 0 var(--frame), -4px 0 0 0 var(--frame), 4px 0 0 0 var(--frame), inset 0 3px 0 0 var(--frame-hi); }
.panel h2 { font-family: var(--f-pixel); font-weight: 400; font-size: 30px; line-height: 1; }
.panel.quiet { font-size: 15px; }

/* ---------- form ---------- */
.fields { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 16px; padding: 0; }
.opt { font-weight: 400; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--frame); border-radius: 0; padding: 10px 12px; width: 100%; min-height: 44px; }
input::placeholder { color: var(--muted); opacity: .85; }
.hint { font-size: 14px; color: var(--muted); }
.hint.warn { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 15px; padding: 8px 12px; min-height: 40px; border: 2px solid var(--frame); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.chip small { display: block; font-size: 13px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--dialog); color: var(--dialog-ink); border-color: var(--dialog); }
.chip[aria-pressed="true"] small { color: var(--dialog-mute); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; border: 2px solid var(--frame); cursor: pointer; font-size: 16px; }
.seg input:checked + span { background: var(--dialog); color: var(--dialog-ink); border-color: var(--dialog); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 16px; }
.check input { width: 22px; height: 22px; min-height: 0; }

/* ---------- three ways in ---------- */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.modes label { position: relative; display: flex; }
.modes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.modes span { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 2px solid var(--frame); cursor: pointer; }
.modes b { font-weight: 800; font-size: 16px; }
.modes small { font-size: 14px; color: var(--muted); line-height: 1.35; }
.modes input:checked + span { background: var(--dialog); color: var(--dialog-ink); border-color: var(--dialog); box-shadow: inset 0 0 0 2px var(--gold); }
.modes input:checked + span small { color: var(--dialog-mute); }
.modes input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- job lists ---------- */
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.jobrow { width: 100%; font: inherit; text-align: left; cursor: pointer; background: transparent; color: var(--ink); border: 2px solid color-mix(in srgb, var(--frame) 55%, transparent); padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.jobrow:hover { border-color: var(--frame); }
.jobrow[aria-pressed="true"] { border-color: var(--dialog); box-shadow: inset 4px 0 0 0 var(--gold); }
.jobrow b { font-weight: 600; min-width: 0; }
.jobrow .when { font-family: var(--f-pixel); font-size: 21px; line-height: 1; color: var(--leaf); white-space: nowrap; }
.jobrow .when.no { color: var(--bad); }
.jobrow .facts, .jobrow .majors { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.majors-box { display: flex; flex-direction: column; gap: 8px; }
.majors-box h3 { margin: 0; font-size: 17px; }
#more { align-self: flex-start; }
#field-chips .chip { font-size: 14px; min-height: 36px; padding: 6px 10px; }
#hometype { margin-bottom: 4px; }

/* ---------- state + metro, browsing ---------- */
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 8px; }
.browse summary { cursor: pointer; font-size: 15px; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.browse[open] summary { margin-bottom: 10px; }
.browse h4 { margin: 12px 0 6px; font-size: 15px; }
.browse .chip { font-size: 14px; min-height: 36px; padding: 6px 10px; }
#job-browser { margin-top: 10px; }
.jobs li.group { font-weight: 700; font-size: 16px; padding-top: 10px; }
.jobs li.group small { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }

/* ---------- compare ---------- */
.compare { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.compare li { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 2px dotted color-mix(in srgb, var(--ink) 25%, transparent); }
.compare li:last-child { border-bottom: 0; }
.compare .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.compare .top b { font-weight: 600; min-width: 0; }
.compare .when { font-family: var(--f-pixel); font-size: 22px; line-height: 1; color: var(--leaf); white-space: nowrap; }
.compare .when.no { color: var(--bad); }
.compare .meta { font-size: 14px; color: var(--muted); }
.compare .track { position: relative; height: 14px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.compare .bar { position: absolute; top: 0; bottom: 0; background: var(--leaf); }
.compare .bar.no { background: repeating-linear-gradient(90deg, var(--bad) 0 6px, transparent 6px 10px); }
.compare .ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.compare .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.compare li.now .top b::after { content: " (on the map now)"; font-weight: 400; color: var(--muted); }

/* ---------- path ---------- */
.path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.path li { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 2px dotted color-mix(in srgb, var(--ink) 25%, transparent); font-variant-numeric: tabular-nums; }
.path li:last-child { border-bottom: 0; }
.path .age { font-family: var(--f-pixel); font-size: 24px; line-height: 1; }
.path .what small { display: block; color: var(--muted); font-size: 14px; }
.path .amt { font-weight: 600; text-align: right; }
.path li.home .age { color: var(--leaf); }
.path li.miss .age { color: var(--bad); }

/* ---------- what ifs ---------- */
.whatifs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.whatif { font: inherit; text-align: left; cursor: pointer; padding: 12px 14px; background: transparent; color: var(--ink); border: 2px solid var(--frame); display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.whatif:hover { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.whatif b { font-weight: 600; }
.whatif span { font-family: var(--f-pixel); font-size: 22px; line-height: 1.1; color: var(--leaf); }
.whatif span.no { color: var(--bad); }

/* ---------- money ---------- */
.money { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-variant-numeric: tabular-nums; }
.money dt { color: var(--muted); }
.money dd { margin: 0; text-align: right; font-weight: 600; }
.money .sum { border-top: 2px solid var(--frame); padding-top: 8px; color: var(--ink); font-weight: 600; }
.adjust summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.adjust[open] summary { margin-bottom: 14px; }

/* ---------- how and sources ---------- */
.how, .sources { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.sources { font-size: 14px; color: var(--muted); }
.foot { text-align: center; font-size: 14px; color: var(--muted); padding-block: 8px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- buttons (home screen kit) ---------- */
.btn { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 14px; border: 2px solid var(--frame); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--dialog); color: var(--dialog-ink); border-color: var(--dialog); }
.btn.quiet { border-color: transparent; color: var(--muted); }
main > .hs-card { width: calc(100% - 32px); max-width: 760px; margin: 0 auto; background: var(--paper); padding: 18px; box-shadow: 0 -4px 0 0 var(--frame), 0 4px 0 0 var(--frame), -4px 0 0 0 var(--frame), 4px 0 0 0 var(--frame); }
main > .hs-card h2 { font-family: var(--f-pixel); font-weight: 400; font-size: 26px; line-height: 1; }
:root { --hs-surface: var(--paper); --hs-ink: var(--ink); --hs-muted: var(--muted); --hs-line: var(--frame); --hs-accent: var(--dialog); --hs-on-accent: var(--dialog-ink); --hs-tile: var(--leaf); }
#home-panel { max-width: 760px; margin: 0 auto 16px; text-align: left; }

@media (prefers-reduced-motion: reduce) { .scene-rays { animation: none; } }
