:root {
  --ink: #1d2433;
  --ink-2: #3a4458;
  --paper: #fbf6ea;
  --paper-2: #f2e9d4;
  --terra: #c8553d;
  --mustard: #e9b44c;
  --teal: #2a9d8f;
  --sky: #a8d5e6;
  --display: "Fraunces Variable", "Fraunces", "Iowan Old Style", Georgia, serif;
  --ui: "Recursive Variable", "Recursive", ui-monospace, "SF Mono", Menlo, monospace;
  --shadow: 3px 3px 0 var(--ink);
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--display);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; border-radius: 6px; }
.sr-only, .skip:not(:focus) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow); border-radius: 10px; font: 600 14px var(--ui); }

/* Only the JS world shows these */
#stage, #labels, #intro, #hud, #tokens, #legend, #prompt, #toast, #panel, #viewfinder { display: none; }
html.js #intro { display: grid; }
html.world #stage, html.world #labels, html.world #hud, html.world #toast { display: block; }
html.world #panel:not([hidden]) { display: flex; }
html.world #tokens:not([hidden]), html.world #legend:not([hidden]) { display: flex; }
html.world #prompt:not([hidden]) { display: inline-flex; }
html.world #viewfinder:not([hidden]) { display: block; }
html.js body { overflow: hidden; height: 100dvh; background: var(--ink); }
html.js #guide { display: none; }
html.js.reading #guide { display: block; }
#guide-close { display: none; }
html.js.reading #guide-close { display: inline-flex; }

/* ---------- Stage ---------- */
#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; transition: filter .4s; }
#stage.hover canvas { cursor: pointer; }
#stage.drag canvas { cursor: grabbing; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }

/* ---------- Intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 20; align-items: end; padding: clamp(20px, 5vw, 72px);
  background: linear-gradient(100deg, rgba(14, 20, 38, .82) 0%, rgba(14, 20, 38, .55) 38%, rgba(14, 20, 38, 0) 70%),
              linear-gradient(0deg, rgba(14, 20, 38, .55), rgba(14, 20, 38, 0) 45%);
  color: var(--paper); transition: opacity .9s ease, visibility .9s;
}
html:not(.world) #intro { background: var(--ink); }
#intro.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-inner { max-width: 760px; }
.intro-kicker { font: 500 13px/1 var(--ui); font-variation-settings: "CASL" 1, "MONO" 1; letter-spacing: .08em; text-transform: uppercase; opacity: .85; display: flex; align-items: center; gap: 8px; margin: 0 0 22px; }
.intro-kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mustard); box-shadow: 0 0 0 4px rgba(233, 180, 76, .25); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(233, 180, 76, 0); } }
#intro h1 { font: 700 clamp(48px, 8.4vw, 124px)/.9 var(--display); letter-spacing: -.035em; margin: 0; font-variation-settings: "opsz" 144; }
#intro h1 em { display: block; font-weight: 400; font-style: italic; font-size: .42em; line-height: 1.08; letter-spacing: -.01em; margin-top: .3em; color: #f6d9a4; max-width: 15em; }
.intro-lede { font-size: clamp(16px, 1.5vw, 19px); max-width: 34em; margin: 26px 0 30px; opacity: .92; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.intro-howto { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 26px 0 0; font: 500 12px var(--ui); font-variation-settings: "CASL" 1; letter-spacing: .04em; opacity: .7; }
.intro-howto span::before { content: "◆ "; color: var(--mustard); }

.btn { display: inline-flex; align-items: center; gap: 10px; border-radius: 999px; padding: 14px 24px; font: 700 15px/1 var(--ui); font-variation-settings: "CASL" .6; text-decoration: none; border: 2px solid var(--ink); transition: transform .15s, box-shadow .15s, background .2s; }
.btn-primary { background: var(--mustard); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
#intro .btn-primary { border-color: var(--paper); box-shadow: 4px 4px 0 var(--paper); }
.btn-primary:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
#intro .btn-primary:hover:not(:disabled) { box-shadow: 6px 6px 0 var(--paper); }
.btn-primary:disabled { background: transparent; color: var(--paper); cursor: progress; }
.btn-primary:disabled .btn-label::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(1turn); } }
.btn-ghost { color: var(--paper); border-color: transparent; text-decoration: underline; text-underline-offset: 4px; padding-inline: 10px; }

/* ---------- HUD ---------- */
#hud { position: fixed; z-index: 17; top: 0; left: 0; right: 0; padding: max(14px, env(safe-area-inset-top)) 16px 0; pointer-events: none; justify-content: space-between; align-items: flex-start; gap: 10px; transition: opacity .5s, transform .5s; }
html.world #hud { display: flex; }
body.intro #labels { opacity: 0; }
#panel h2:focus, #guide:focus { outline: none; }
body.intro #hud, body.intro #tokens { opacity: 0; transform: translateY(-10px); pointer-events: none; }
body.photo #hud, body.photo #labels, body.photo #prompt, body.photo #tokens, body.photo #legend { opacity: 0; pointer-events: none !important; }
#hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow); border-radius: 999px; padding: 5px 16px 5px 5px; }
.brand .mono { width: 34px; height: 34px; border-radius: 50%; background: var(--terra); color: var(--paper); display: grid; place-items: center; font: 800 13px var(--ui); font-variation-settings: "CASL" 1; }
.brand b { display: block; font: 700 15px/1.1 var(--display); }
.brand small { display: block; font: 500 10.5px/1.2 var(--ui); font-variation-settings: "CASL" 1; letter-spacing: .06em; text-transform: uppercase; opacity: .65; }
.hud-right { display: flex; gap: 8px; align-items: flex-start; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow); font: 700 13px/1 var(--ui); font-variation-settings: "CASL" .7; transition: transform .12s, box-shadow .12s; }
.chip:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.chip svg { width: 20px; height: 20px; }
.chip-ink { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--terra); border-color: var(--ink); }
.chip-ink:hover { box-shadow: 4px 4px 0 var(--terra); }
.sun { width: 14px; height: 14px; border-radius: 50%; background: var(--mustard); box-shadow: inset -2px -2px 0 rgba(0,0,0,.12); transition: background .4s, box-shadow .4s; }
.sun.moon { background: #d8dcef; box-shadow: inset 4px -2px 0 #7b84a8; }
.clock-wrap, .places-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 52px; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--ink); padding: 14px; width: 270px; font: 500 13px/1.45 var(--ui); font-variation-settings: "CASL" .5; }
.pop label { display: block; font-weight: 700; margin-bottom: 8px; }
.pop input[type=range] { width: 100%; accent-color: var(--terra); }
.pop-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-weight: 700; }
.pop-note { margin: 10px 0 0; opacity: .7; font-size: 12px; }
.link-btn { background: none; border: 0; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; font: 700 12px var(--ui); }
.places { width: 300px; padding: 8px; }
.places ol { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.places li button { width: 100%; display: grid; grid-template-columns: 30px 1fr; align-items: center; text-align: left; gap: 4px 8px; background: none; border: 0; border-radius: 10px; padding: 8px; }
.places li button:hover, .places li button:focus-visible { background: var(--paper-2); }
.places li button::before { counter-increment: p; content: counter(p, decimal-leading-zero); grid-row: span 2; font: 700 12px var(--ui); color: var(--terra); }
.places li b { font: 700 15px/1.15 var(--display); }
.places li small { font: 500 11px var(--ui); opacity: .65; }
.places li.visited b::after { content: " ✓"; color: var(--teal); }
.read-link { display: block; padding: 10px 8px 6px; border-top: 1.5px dashed rgba(29,36,51,.25); margin-top: 6px; font-weight: 700; font-size: 12px; text-decoration: none; }

/* ---------- Tags in the world ---------- */
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; will-change: transform; transition: opacity .3s; }
.tag button { background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); border-radius: 999px; padding: 5px 11px 5px 9px; font: 700 12px/1 var(--ui); font-variation-settings: "CASL" 1; white-space: nowrap; display: flex; gap: 6px; align-items: center; transition: transform .15s, background .15s; }
.tag button i { font-style: normal; color: var(--terra); font-size: 11px; }
.tag button:hover { transform: translateY(-2px) rotate(-2deg); background: var(--mustard); }
.tag::after { content: ""; width: 2px; height: 14px; background: var(--ink); }
.tag.far { opacity: .0; pointer-events: none; }
.tag.near button { background: var(--mustard); }
.tag.visited button i::after { content: " ✓"; color: var(--teal); }
body.panel-open .tag { opacity: .35; }

.bubble { position: absolute; left: 0; top: 0; max-width: 220px; background: var(--ink); color: var(--paper); border-radius: 12px 12px 12px 3px; padding: 7px 10px; font: 600 11.5px/1.35 var(--ui); font-variation-settings: "CASL" 1, "MONO" 1; opacity: 0; transition: opacity .25s; will-change: transform; }
.bubble.show { opacity: 1; }
.bubble::before { content: "agent·" attr(data-n) " › "; color: #7fe3d6; }
.hint { position: absolute; left: 0; top: 0; background: var(--terra); color: var(--paper); border-radius: 10px; padding: 7px 11px; font: 700 12px/1.2 var(--ui); font-variation-settings: "CASL" 1; box-shadow: 2px 2px 0 var(--ink); border: 2px solid var(--ink); white-space: nowrap; opacity: 0; transition: opacity .4s; }
.hint.show { opacity: 1; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { margin-top: -5px; } }

/* ---------- Prompt / tokens / toast ---------- */
#prompt { position: fixed; z-index: 9; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); align-items: center; gap: 10px; padding: 12px 20px 12px 12px; border-radius: 999px; background: var(--ink); color: var(--paper); border: 2px solid var(--paper); box-shadow: 4px 4px 0 var(--terra); font: 700 15px/1 var(--ui); font-variation-settings: "CASL" .8; animation: rise .35s cubic-bezier(.2,1.4,.4,1); }
#prompt kbd { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 8px; background: var(--mustard); color: var(--ink); font: 800 13px var(--ui); }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
#tokens { position: fixed; z-index: 9; left: 16px; bottom: max(18px, env(safe-area-inset-bottom)); align-items: center; gap: 6px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 6px 8px 6px 12px; transition: opacity .4s; }
.tk-label { font: 700 10.5px var(--ui); text-transform: uppercase; letter-spacing: .07em; margin-right: 4px; }
.tk { width: 28px; height: 32px; display: grid; place-items: center; border-radius: 7px; background: var(--paper-2); border: 1.5px dashed rgba(29,36,51,.4); font: 800 16px var(--ui); color: rgba(29,36,51,.35); }
.tk.got { background: var(--mustard); border: 2px solid var(--ink); color: var(--ink); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3) rotate(-20deg); } }
#legend { position: fixed; z-index: 9; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); background: var(--ink); color: var(--paper); border-radius: 12px; padding: 9px 12px; gap: 12px; align-items: center; flex-wrap: wrap; font: 600 11.5px var(--ui); font-variation-settings: "MONO" 1; max-width: calc(100vw - 32px); }
#legend b { color: #7fe3d6; }
#legend span { display: inline-flex; gap: 6px; align-items: center; opacity: .85; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-o { background: #ff9a4d; } .sw-c { background: #4ee6ff; }
#toast { position: fixed; z-index: 30; top: 74px; left: 50%; transform: translate(-50%, -14px); opacity: 0; pointer-events: none; background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); border-radius: 12px; padding: 10px 16px; font: 700 14px/1.35 var(--ui); font-variation-settings: "CASL" .7; transition: opacity .3s, transform .3s; max-width: min(92vw, 440px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Panel ---------- */
#panel {
  position: fixed; z-index: 15; top: 72px; right: 16px; bottom: 16px; width: min(460px, calc(100vw - 32px));
  flex-direction: column; background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 7px 7px 0 var(--ink);
  overflow: auto; overscroll-behavior: contain; animation: slide .45s cubic-bezier(.2, 1.1, .3, 1);
  background-image: radial-gradient(rgba(29,36,51,.06) 1px, transparent 1px); background-size: 14px 14px;
}
@keyframes slide { from { transform: translateX(40px) rotate(1.5deg); opacity: 0; } }
#panel-body { padding: 26px 28px 6px; }
#panel-actions:empty { display: none; }
#panel-actions { padding: 6px 28px 8px; display: flex; flex-direction: column; gap: 10px; }
#panel-foot { margin-top: auto; padding: 16px 28px 22px; border-top: 2px dashed rgba(29,36,51,.2); display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 600 12px var(--ui); }
.close { position: sticky; top: 12px; margin: 12px 12px -54px auto; z-index: 2; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); font: 400 26px/1 var(--display); box-shadow: 2px 2px 0 var(--ink); }
.close:hover { background: var(--mustard); }
.next-btn { background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 10px 16px; font: 700 13px var(--ui); font-variation-settings: "CASL" .7; }
.next-btn:hover { background: var(--terra); }

/* shared content typography (panel + guide) */
.kicker { font: 700 12px/1 var(--ui); font-variation-settings: "CASL" 1; letter-spacing: .09em; text-transform: uppercase; color: var(--terra); margin: 0 0 12px; }
section h2, #panel h2 { font: 700 clamp(30px, 4vw, 40px)/1.02 var(--display); letter-spacing: -.025em; margin: 0 0 16px; font-variation-settings: "opsz" 144; max-width: 14em; }
section h3 { font: 700 13px var(--ui); letter-spacing: .06em; text-transform: uppercase; margin: 26px 0 10px; }
.lede { font-size: 19px; line-height: 1.5; font-style: italic; }
section p { margin: 0 0 14px; }
.portrait { float: right; width: 120px; height: auto; aspect-ratio: 2/3; object-fit: cover; border: 2px solid var(--ink); border-radius: 10px; box-shadow: 4px 4px 0 var(--ink); margin: 0 0 12px 16px; transform: rotate(2deg); background: var(--paper-2); }
.values { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.values li { padding-left: 22px; position: relative; }
.values li::before { content: "✳"; position: absolute; left: 0; color: var(--terra); }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--ink); }
.timeline li { position: relative; padding: 0 0 12px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.timeline li:last-child::before { background: var(--mustard); }
.timeline span { display: block; font: 700 11px var(--ui); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px !important; }
.links a { font: 700 13px/1 var(--ui); font-variation-settings: "CASL" .7; text-decoration: none; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); transition: background .15s, transform .15s; }
.links a:hover { background: var(--mustard); transform: translate(-1px, -1px); }
.links.big a:first-child { background: var(--terra); color: var(--paper); font-size: 15px; }
.colophon { font: 500 12px/1.5 var(--ui); opacity: .65; margin-top: 22px !important; }

/* actions */
.act { display: inline-flex; justify-content: center; align-items: center; gap: 10px; width: 100%; padding: 14px 18px; border-radius: 14px; border: 2px solid var(--ink); background: var(--mustard); box-shadow: 4px 4px 0 var(--ink); font: 800 15px/1.1 var(--ui); font-variation-settings: "CASL" .8; transition: transform .12s, box-shadow .12s; }
.act:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.act:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.act[aria-pressed=true] { background: var(--teal); color: var(--paper); }
.act small { font-weight: 500; opacity: .75; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 4px 4px 0 var(--ink); }
.seg button { border: 0; border-left: 2px solid var(--ink); padding: 12px 8px; background: var(--paper); font: 700 13px var(--ui); }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked=true] { background: var(--ink); color: var(--mustard); }
.act-label { font: 700 11px var(--ui); letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 -2px; }
.act-note { font: 500 12.5px/1.45 var(--ui); opacity: .75; margin: 0; }
.combo { display: flex; gap: 10px; justify-content: center; padding: 14px; background: #5c3a26; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); }
.combo.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wheel button { width: 44px; height: 28px; border: 2px solid var(--ink); border-radius: 8px; background: #e9b44c; font: 800 12px var(--ui); }
.wheel output { width: 52px; height: 58px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; font: 800 30px var(--ui); font-variation-settings: "MONO" 1; box-shadow: inset 0 6px 8px rgba(0,0,0,.18); }
.secret { background: var(--ink); color: var(--paper); border-radius: 14px; padding: 16px 18px; font: 500 14px/1.5 var(--ui); font-variation-settings: "CASL" .6; }
.secret b { color: var(--mustard); }

/* ---------- Photo mode ---------- */
#viewfinder { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.vf-frame { position: absolute; inset: max(28px, 5vh) max(18px, 5vw) 150px; }
.vf-frame > i { position: absolute; width: 34px; height: 34px; border: 3px solid #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.6)); }
.vf-frame > i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.vf-frame > i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.vf-frame > i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.vf-frame > i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.vf-grid { position: absolute; inset: 0; background:
  linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(66.66% + .5px), transparent 0),
  linear-gradient(0deg, transparent calc(33.33% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(66.66% + .5px), transparent 0); }
.vf-focus { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border: 2px solid rgba(255,255,255,.85); border-radius: 50%; }
.vf-focus::after { content: ""; position: absolute; inset: 24px; background: #fff; border-radius: 50%; }
.vf-top { position: absolute; top: max(36px, 5vh); left: 50%; transform: translateX(-50%); display: flex; gap: 22px; color: #fff; font: 700 12px var(--ui); font-variation-settings: "MONO" 1; letter-spacing: .1em; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.vf-top span:first-child { color: #ffd166; }
@keyframes blink { 50% { opacity: .2; } }
.vf-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 132px; padding: 0 max(18px, 4vw) env(safe-area-inset-bottom); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: linear-gradient(0deg, rgba(10,12,20,.85), rgba(10,12,20,.5)); pointer-events: auto; color: #fff; }
.vf-stocks { display: flex; gap: 6px; flex-wrap: wrap; }
.vf-stocks button { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.45); border-radius: 999px; padding: 8px 12px; font: 700 12px var(--ui); }
.vf-stocks button[aria-checked=true] { background: #fff; color: var(--ink); border-color: #fff; }
#shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 5px; }
#shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .1s, background .1s; }
#shutter:active span { transform: scale(.86); background: var(--mustard); }
.vf-bar .chip { color: var(--ink); }
.vf-side { display: flex; justify-content: flex-end; align-items: center; gap: 14px; flex-wrap: wrap; }
.vf-zoom { display: flex; align-items: center; gap: 8px; font: 700 12px var(--ui); }
.vf-zoom input { width: 110px; accent-color: var(--mustard); }
#roll { position: absolute; right: max(18px, 4vw); bottom: 146px; display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: auto; max-height: calc(100vh - 260px); overflow: auto; padding: 4px; }
#roll a { display: block; width: 92px; background: #fff; padding: 5px 5px 16px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(var(--r, 2deg)); animation: develop 1.2s ease; border-radius: 2px; }
#roll a:hover { transform: rotate(0) scale(1.05); }
#roll img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
@keyframes develop { from { filter: brightness(2.4) sepia(1); transform: translateY(30px) rotate(-12deg); opacity: 0; } }
.vf-flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
.vf-flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

/* ---------- Guide (text version / no-JS) ---------- */
#guide { max-width: 760px; margin: 0 auto; padding: 48px 22px 100px; }
html.js.reading #guide { position: fixed; inset: 0; z-index: 40; max-width: none; overflow: auto; background: var(--paper); padding: 0; }
html.js.reading #guide > * { max-width: 760px; margin-left: auto; margin-right: auto; padding-left: 22px; padding-right: 22px; }
.guide-head { padding-top: 32px; padding-bottom: 24px; border-bottom: 2px solid var(--ink); margin-bottom: 30px; }
.guide-head h1 { font: 800 clamp(52px, 10vw, 96px)/.9 var(--display); letter-spacing: -.04em; margin: 8px 0 18px; }
.guide-kicker { font: 700 12px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--terra); margin: 18px 0 0; }
.guide-lede { font-size: 20px; font-style: italic; max-width: 32em; }
#guide section { padding: 34px 0; border-bottom: 1.5px dashed rgba(29,36,51,.25); }
#guide section::after { content: ""; display: table; clear: both; }
#guide .portrait { width: 160px; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .hide-sm, .k-site { display: none; }
  .brand small { display: none; }
  .brand { padding-right: 12px; }
  .brand b { font-size: 14px; }
  .chip { height: 40px; padding: 0 11px; }
  #hud { padding-left: 10px; padding-right: 10px; }
  .hud-right { gap: 6px; }
  #panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 74dvh; border-radius: 18px; box-shadow: 0 -4px 0 var(--ink), 5px 5px 0 var(--ink); animation: sheet .45s cubic-bezier(.2,1.1,.3,1); }
  @keyframes sheet { from { transform: translateY(60px); opacity: 0; } }
  #panel-body { padding: 22px 20px 4px; }
  #panel-actions { padding: 6px 20px 8px; }
  #panel-foot { padding: 14px 20px 18px; }
  section h2, #panel h2 { font-size: 30px; }
  .lede { font-size: 17px; }
  .portrait { width: 96px; }
  .pop { position: fixed; left: 10px; right: 10px; width: auto; top: 64px; }
  #prompt { bottom: max(76px, calc(env(safe-area-inset-bottom) + 60px)); white-space: nowrap; }
  #tokens { left: 10px; bottom: max(12px, env(safe-area-inset-bottom)); }
  #legend { right: 10px; left: 10px; bottom: 62px; }
  .vf-bar { grid-template-columns: 1fr auto; grid-template-rows: auto auto; height: auto; padding-top: 12px; padding-bottom: max(14px, env(safe-area-inset-bottom)); row-gap: 10px; }
  .vf-stocks { grid-column: 1 / -1; justify-content: center; }
  #shutter { width: 66px; height: 66px; }
  .vf-side { justify-content: flex-end; }
  .vf-zoom input { width: 90px; }
  .vf-frame { bottom: 190px; }
  #roll { bottom: 190px; flex-direction: row-reverse; right: 10px; left: 10px; justify-content: flex-start; overflow-x: auto; }
  #roll a { width: 70px; flex: none; }
  #intro { padding: 20px 18px max(26px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(14,20,38,.92) 0%, rgba(14,20,38,.7) 55%, rgba(14,20,38,.1) 85%); }
  #intro h1 em { font-size: .5em; }
  .intro-lede { margin: 18px 0 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
