@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('/assets/fonts/atkinson-next-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
[hidden] { display: none !important; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('/assets/fonts/atkinson-next-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('/assets/fonts/atkinson-next-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('/assets/fonts/atkinson-next-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --ink: #141414; --ink-2: #4a4a47; --ink-3: #75736d;
  --paper: #fefdfb; --cream: #ede6d6; --line: #e3e0d8;
  --mint: #3ad08a; --mint-ink: #0f6b43; --flame: #ff7a3c; --red: #c4442b;
  --r: 14px; --shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 12px 32px rgba(20, 20, 20, .10);
  --sans: 'Atkinson Hyperlegible Next', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
  --pad: clamp(12px, 1.6vw, 24px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9e6de; color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
kbd { font: 600 13px/1 var(--sans); display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line); border-radius: 6px; background: #f6f5f1; color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; }

/* buttons */
.btn { appearance: none; border: 0; cursor: pointer; border-radius: 999px; padding: 11px 18px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .18s cubic-bezier(.2,.8,.2,1), background .2s, box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: #fefdfb; box-shadow: 0 0 0 2px #fefdfb, 0 0 0 4px var(--mint); }
.btn-primary:hover { background: #2a2a28; }
.btn-primary:disabled { background: #d9d6ce; color: var(--ink-3); box-shadow: none; cursor: not-allowed; }
.btn-primary kbd { background: #2c2c2a; color: #ddd; border-color: #444; }
.btn-ghost { background: #fefdfb; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-ghost:hover { background: #f4f2ec; }
.btn-ghost:disabled { color: var(--ink-3); box-shadow: inset 0 0 0 1.5px #cfccc3; cursor: not-allowed; background: #fefdfb; }
.pill { appearance: none; border: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); box-shadow: var(--shadow); border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.pill:hover { background: #fefdfb; }
.pill[aria-pressed="true"] { background: var(--ink); color: #fefdfb; }
.ico { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); color: var(--ink); border: 0; cursor: pointer; }
.ico svg { width: 17px; height: 17px; fill: currentColor; }
.ico:hover { background: #fefdfb; }
#soundBtn[aria-pressed="false"] .wave { opacity: .15; }

/* header */
.top { position: fixed; top: var(--pad); left: var(--pad); right: var(--pad); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; z-index: 5; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); box-shadow: var(--shadow); border-radius: 999px; padding: 4px 16px 4px 4px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand img { border-radius: 999px; display: block; }
.top-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ca { border: 0; cursor: pointer; background: #fefdfb; box-shadow: var(--shadow); border-radius: 999px; padding: 9px 12px; font: 500 12px var(--mono); display: inline-flex; gap: 8px; }
.ca-k { color: var(--mint-ink); font-weight: 500; }
.buy { background: var(--mint); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 13px; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); }

/* status card */
.status { position: fixed; left: var(--pad); bottom: var(--pad); width: 300px; background: #fefdfb; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; z-index: 4; }
.st-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.st-head h2 { font-size: 15px; font-weight: 800; }
.st-head p { font-size: 12.5px; color: var(--ink-3); }
.st-clock { font: 500 14px var(--sans) !important; font-variant-numeric: tabular-nums; color: var(--ink-2) !important; white-space: nowrap; }
.st-cash { font: 500 30px/1.1 var(--mono); letter-spacing: -.03em; margin: 10px 0 8px; }
.meter { height: 6px; background: #efede7; border-radius: 99px; overflow: hidden; flex: 1; }
.meter i { display: block; height: 100%; background: var(--ink); transform-origin: left; transition: transform .3s ease; }
.meter.xp { margin-bottom: 12px; }
.meter.xp i { background: var(--mint); }
.st-row { display: flex; gap: 10px; align-items: center; font-size: 12.5px; margin-top: 6px; }
.st-row span { width: 48px; color: var(--ink-2); }
.st-row b { font: 600 14px var(--sans); font-variant-numeric: tabular-nums; width: 56px; text-align: right; }
.st-row.is-low i { background: var(--red); }
.st-row.is-low span { color: var(--red); }
.st-skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.st-skills span { font-size: 11.5px; color: var(--ink-3); display: flex; flex-direction: column; }
.st-skills b { font: 500 16px var(--mono); color: var(--ink); }
.st-idle { font-size: 12px; color: var(--mint-ink); margin-top: 8px; }
.st-idle:empty { display: none; }

.task { position: fixed; top: calc(var(--pad) + 56px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fefdfb; border-radius: 999px; padding: 10px 18px; font: 500 14px var(--mono); box-shadow: 0 0 0 2px #fefdfb, 0 0 0 4px var(--flame), var(--shadow); z-index: 6; white-space: nowrap; }
.actions { position: fixed; right: var(--pad); bottom: var(--pad); display: flex; gap: 10px; align-items: center; z-index: 4; }
.enter { padding: 14px 20px; font-size: 15px; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* toasts */
#toasts { position: fixed; top: calc(var(--pad) + 56px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 7; pointer-events: none; width: min(92vw, 460px); }
.toast { background: #fefdfb; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; font-size: 14px; opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .35s cubic-bezier(.2,.8,.2,1); border-left: 4px solid var(--mint); }
.toast-bad { border-left-color: var(--red); }
.toast.is-in { opacity: 1; transform: none; }
.task:not([hidden]) ~ #toasts { top: calc(var(--pad) + 104px); }

/* speech */
#says { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.say { position: absolute; left: 0; top: 0; background: #fefdfb; border-radius: 10px; padding: 5px 10px; font-size: 12.5px; box-shadow: var(--shadow); white-space: nowrap; color: var(--ink-2); }
.say::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: #fefdfb; transform: translateX(-50%) rotate(45deg); }

/* intro card: the first thing you see, floating over the town */
.intro { position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 470px); background: #fefdfb; border-radius: 16px; box-shadow: 0 30px 80px rgba(20,20,20,.18), var(--shadow); padding: 28px 28px 24px; transition: opacity .35s, transform .35s cubic-bezier(.2,.8,.2,1); animation: card-in .7s cubic-bezier(.2,.8,.2,1) .25s both; }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, -46%); } }
.intro.is-out { opacity: 0; transform: translate(-50%, -54%); }
.intro h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-bottom: 12px; }
.intro > p { color: var(--ink-2); font-size: 15px; }
.intro .small { font-size: 13px; color: var(--ink-3); margin-top: 14px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 18px 0 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.keys div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.keys dt { display: flex; gap: 4px; min-width: 52px; font: 500 14px var(--sans); color: var(--ink-3); }
.keys dd { margin: 0; color: var(--ink-2); }
.intro-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* place panel */
.panel { position: fixed; right: var(--pad); top: calc(var(--pad) + 56px); max-height: calc(100vh - 2 * var(--pad) - 116px); max-height: calc(100dvh - 2 * var(--pad) - 116px); width: 420px; max-width: calc(100vw - 2 * var(--pad)); background: #fefdfb; border-radius: 16px; box-shadow: 0 30px 80px rgba(20,20,20,.16), var(--shadow); z-index: 6; display: flex; flex-direction: column; opacity: 0; transform: translateX(16px); transition: opacity .3s, transform .4s cubic-bezier(.2,.8,.2,1); }
.panel.is-in { opacity: 1; transform: none; }
.p-head { display: flex; justify-content: space-between; gap: 12px; padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.p-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.p-head p { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; }
.p-close { box-shadow: none; background: #f4f2ec; flex: none; }
.p-close svg { fill: none; }
.p-body { padding: 16px 22px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.p-list { display: flex; flex-direction: column; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { font-size: 16px; font-weight: 800; }
.card p { font-size: 13.5px; color: var(--ink-2); }
.card .btn { align-self: flex-start; }
.card.line { flex-direction: row; align-items: center; justify-content: space-between; }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { font-size: 12px; font-weight: 700; background: #e8f8ef; color: var(--mint-ink); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(4, auto); gap: 6px 14px; margin: 2px 0; justify-content: start; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: 11.5px; color: var(--ink-3); }
.facts dd { margin: 0; font: 500 13px var(--mono); }
.row-note { font-size: 13px !important; color: var(--ink-3) !important; }
.tabs { display: flex; gap: 4px; background: #f4f2ec; padding: 4px; border-radius: 999px; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 7px 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fefdfb; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.shop-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.shop-row h4 { font-size: 14px; }
.shop-row p { font-size: 12.5px; }
.shop-row .btn { flex: none; padding: 9px 14px; font-family: var(--mono); font-weight: 500; }
.owned { font-size: 12.5px; color: var(--ink-3); }
.perks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perk { text-align: left; border: 1.5px solid var(--ink); background: #fefdfb; border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.perk span { font-size: 12.5px; color: var(--ink-3); }
.perk:hover:not(:disabled) { background: var(--ink); color: #fefdfb; }
.perk:hover:not(:disabled) span { color: #cfcfcf; }
.perk:disabled { border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.board ol { list-style: none; margin: 0; padding: 0; counter-reset: b; }
.board li { counter-increment: b; display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.board li::before { content: counter(b); font: 500 12px var(--mono); color: var(--ink-3); }
.board li.me { background: #f1fbf5; }
.b-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-w { font: 400 12px var(--mono); color: var(--ink-3); }
.b-v { font: 500 14px var(--mono); }

/* minigames */
.p-stage { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.mg-line { font-size: 14px; color: var(--ink-2); }
.mg-bar { position: relative; height: 46px; border-radius: 12px; background: #f1efe9; overflow: hidden; }
.mg-zone { position: absolute; top: 0; bottom: 0; background: var(--mint); opacity: .85; }
.mg-mark { position: absolute; top: 6px; bottom: 6px; width: 14px; margin-left: -7px; border-radius: 6px; background: var(--ink); box-shadow: 0 0 0 2px #fefdfb; transition: background .15s; }
.mg-mark.is-good { box-shadow: 0 0 0 4px var(--mint); }
.mg-mark.is-bad { box-shadow: 0 0 0 4px var(--red); }
.mg-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mg-count { font: 500 13px var(--mono); color: var(--ink-3); }
.mg-act { min-width: 130px; padding: 14px 22px; }
.mg-email { font: 500 18px var(--mono); background: #f6f5f1; border-radius: 10px; padding: 12px 14px; }
.mg-input { font: 500 18px var(--mono); padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--ink); width: 100%; }
.mg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mg-cam { aspect-ratio: 4/3; border: 0; border-radius: 8px; background: #2a2b2c; color: #7d7f80; font: 500 13px var(--sans); display: flex; align-items: flex-end; padding: 6px; cursor: pointer; position: relative; overflow: hidden; }
.mg-cam::after { content: ''; position: absolute; left: 38%; top: 30%; width: 26%; height: 50%; border-radius: 40% 40% 20% 20%; background: #0b0b0b; opacity: 0; transition: opacity .1s; }
.mg-cam.is-on::after { opacity: 1; }
.mg-cam.is-on { background: #3a3c3e; }
.mg-cam.is-hit { background: var(--mint); }
.mg-quote { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.mg-opts { display: flex; flex-direction: column; gap: 8px; }
.mg-opt { text-align: left; border: 1.5px solid var(--line); background: #fefdfb; border-radius: 10px; padding: 11px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.mg-opt:hover { border-color: var(--ink); }
.mg-timebar { height: 4px; background: var(--flame); border-radius: 9px; transform-origin: left; }
.result { display: flex; flex-direction: column; gap: 8px; }
.result h3 { font-size: 22px; font-weight: 800; }
.result p { color: var(--ink-2); }
.result .btn { margin-top: 8px; align-self: flex-start; }

/* name dialog */
.dlg { position: fixed; inset: 0; z-index: 20; background: rgba(20,20,20,.25); display: grid; place-items: center; padding: 16px; }
.dlg[hidden] { display: none; }
.dlg-card { background: #fefdfb; border-radius: 16px; padding: 24px; width: min(420px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.dlg-card h2 { font-size: 22px; font-weight: 800; }
.dlg-card p { font-size: 14px; color: var(--ink-2); }
.dlg-card input { font: 500 17px var(--sans); padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--ink); }
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; }

@media (max-width: 760px) {
  :root { --pad: 10px; }
  .brand span { display: none; }
  .brand { padding: 4px; }
  #soundBtn { display: none; }
  .top-r { gap: 6px; }
  .status { width: auto; right: var(--pad); padding: 12px 14px; bottom: calc(var(--pad) + env(safe-area-inset-bottom)); }
  .st-cash { font-size: 22px; margin: 4px 0 6px; }
  .st-skills { display: none; }
  .actions { bottom: calc(var(--pad) + 190px + env(safe-area-inset-bottom)); }
  .panel { left: var(--pad); right: var(--pad); width: auto; top: auto; bottom: var(--pad); max-height: 78vh; transform: translateY(24px); }
  .intro { padding: 22px 20px 20px; top: 46%; }
  .intro h1 { font-size: 26px; }
  .keys { grid-template-columns: 1fr 1fr; }
  .perks { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, auto); }
}
@media (pointer: coarse) { .keys { display: none; } .actions kbd, .enter kbd { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body:has(#intro:not([hidden])) .actions { visibility: hidden; }
/* scroll-driven: shop rows, upgrade cards and board rows rise into place as the panel scrolls */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .p-body > *, .board li { animation: rowIn linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }
}
@keyframes rowIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
/* big screens: the overlay grows with the world so it reads at 2560 */
@media (min-width: 1800px) { .top, .status, .intro, .panel, .actions, .task, #toasts { zoom: 1.2; } }
@media (min-width: 2200px) { .top, .status, .intro, .panel, .actions, .task, #toasts { zoom: 1.6; } }
