/* NIGHT MARKET — interface. Fonts are self-hosted (SIL OFL 1.1, see vendor/fonts). */
@font-face { font-family: "Space Grotesk"; src: url("vendor/fonts/SpaceGrotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("vendor/fonts/JetBrainsMono-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
    --bg: #07060f;
    --ink: #fff3e4;
    --dim: #c2b3c9;
    --faint: #7d7192;
    --pink: #ff5c93;
    --amber: #ffc060;
    --cyan: #6fe6ff;
    --green: #74f0a7;
    --danger: #ff6b6b;
    --glass: rgba(20, 14, 34, 0.8);
    --glass-strong: rgba(17, 12, 30, 0.92);
    --line: rgba(255, 196, 150, 0.16);
    --line-strong: rgba(255, 196, 150, 0.42);
    --display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
    font-family: var(--display); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#view.picking { cursor: pointer; }
#view.placing { cursor: crosshair; }
#fade { position: fixed; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.4s ease; z-index: 20; }
#fade.on { opacity: 1; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--amber); }
button, select { font: inherit; color: inherit; }
kbd { font-family: var(--mono); font-size: 0.72em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.06); color: var(--ink); white-space: nowrap; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 10px; }

.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
    backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; color: var(--amber); text-transform: uppercase; }
.dimLabel { font-size: 10.5px; letter-spacing: 0.18em; color: var(--faint); }

/* ---------------- buttons ---------------- */
.btn { font-weight: 500; font-size: 15px; letter-spacing: 0.03em; color: var(--ink); cursor: pointer;
    min-height: 46px; padding: 11px 22px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
    transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, box-shadow 0.18s; }
.btn:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.primary { border-color: transparent; color: #1c0a12; font-weight: 600;
    background: linear-gradient(120deg, #ffd27a, #ff8a6b 55%, #ff5c93); box-shadow: 0 8px 34px rgba(255, 110, 120, 0.3); }
.btn.primary:hover { box-shadow: 0 10px 44px rgba(255, 92, 147, 0.5); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.btn.danger { border-color: rgba(255, 107, 107, 0.5); color: #ffc0c0; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.iconBtn { width: 46px; height: 46px; display: inline-grid; place-items: center; border-radius: 14px; cursor: pointer; color: var(--dim);
    border: 1px solid transparent; background: transparent; transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s var(--ease); }
.iconBtn.glass { border: 1px solid var(--line); color: var(--ink); }
.iconBtn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------------- title ---------------- */
.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; animation: screenIn 0.6s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }
#title { justify-content: center; padding: calc(24px + var(--safe-t)) 7vw calc(24px + var(--safe-b));
    background: linear-gradient(90deg, rgba(7, 6, 15, 0.86) 0%, rgba(7, 6, 15, 0.45) 44%, transparent 72%); }
.wordmark { font-weight: 700; font-size: clamp(48px, 10.5vw, 136px); line-height: 0.88; letter-spacing: 0.02em; margin: 14px 0 20px; display: flex; flex-direction: column; }
.wordmark span:first-child { color: #fff; text-shadow: 0 0 8px #fff, 0 0 26px var(--pink), 0 0 70px rgba(255, 92, 147, 0.75); animation: flicker 7s linear infinite; }
.wordmark span:last-child { color: #fff7e6; text-shadow: 0 0 8px #fff, 0 0 26px var(--amber), 0 0 70px rgba(255, 170, 60, 0.7); }
@keyframes flicker { 0%, 91%, 93%, 96%, 100% { opacity: 1; } 92%, 95% { opacity: 0.55; } }
.lede { font-size: clamp(16px, 2vw, 21px); color: var(--dim); max-width: 27em; }
.menu { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 14px; }
.menu .btn.primary { min-width: 150px; }
.foot { position: absolute; left: 7vw; right: 7vw; bottom: calc(18px + var(--safe-b)); font-size: 13px; color: var(--faint); }
.foot a { color: var(--dim); }

/* ---------------- labels over the 3D scene ---------------- */
#labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#labels > * { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; }
.tag { display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 6px; border-radius: 999px; font-size: 13px; background: rgba(12, 8, 22, 0.78);
    border: 1px solid var(--line); transform-origin: 50% 100%; }
.tag .ico { font-size: 16px; line-height: 1; }
.tag b { font-family: var(--mono); font-weight: 500; }
.tag .q { font-family: var(--mono); font-size: 11px; padding: 0 5px; border-radius: 8px; background: rgba(255, 255, 255, 0.12); color: var(--dim); }
.tag .q.full { background: var(--danger); color: #230505; }
.tag.shut { border-color: rgba(255, 107, 107, 0.6); color: #ffc0c0; }
.mark { font-size: 17px; filter: drop-shadow(0 2px 4px #000); }
.pop { font-family: var(--mono); font-weight: 700; font-size: 15px; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
.pop.money { color: var(--amber); }
.pop.good { color: var(--green); }
.pop.bad { color: var(--danger); }
.pop.emoji { font-size: 20px; }
.nameTag { padding: 3px 9px; border-radius: 8px; font-size: 13px; background: rgba(12, 8, 22, 0.86); border: 1px solid var(--line-strong); }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; animation: screenIn 0.5s var(--ease) both; }
#hud > * { pointer-events: auto; }
.topbar { position: absolute; top: calc(12px + var(--safe-t)); left: 14px; right: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none !important; }
.topbar > * { pointer-events: auto; }
.pill { border-radius: 999px; padding: 8px 15px; display: flex; align-items: center; gap: 8px; min-height: 46px; }
.nightTag b { font-size: 20px; color: var(--amber); }
.clock { margin-left: 8px; font-size: 15px; }
.clockBar { width: 84px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.clockBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--pink)); }
.stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stat b { font-size: 16px; font-weight: 500; }
.stat .ico { font-size: 15px; color: var(--amber); }
.stat.low b { color: var(--danger); }
.topRight { display: flex; gap: 8px; align-items: center; }
.speed { padding: 4px; gap: 2px; }
.speed button { min-width: 44px; height: 44px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--dim); display: grid; place-items: center; }
.speed button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.speed button[aria-pressed="true"] { background: linear-gradient(120deg, #ffd27a, #ff8a6b); color: #1c0a12; font-weight: 700; }

.feed { position: absolute; left: 14px; top: calc(74px + var(--safe-t)); width: min(340px, calc(100% - 28px)); display: flex; flex-direction: column; gap: 6px; pointer-events: none !important; }
.feed li { padding: 7px 12px; border-radius: 12px; font-size: 13.5px; background: rgba(12, 8, 22, 0.7); border: 1px solid var(--line); animation: feedIn 0.35s var(--ease) both; transition: opacity 0.6s; }
.feed li.old { opacity: 0; }
.feed li.bad { border-color: rgba(255, 107, 107, 0.5); }
.feed li.good { border-color: rgba(116, 240, 167, 0.45); }
@keyframes feedIn { from { opacity: 0; transform: translateX(-12px); } }

.status { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: min(560px, calc(100% - 32px)); text-align: center;
    font-size: 15px; color: var(--ink); text-shadow: 0 2px 12px #000, 0 0 3px #000; pointer-events: none !important; }
.status.warn { color: #ffc0c0; }

/* ---------------- dock (before opening) ---------------- */
.dock { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); width: min(980px, calc(100% - 20px));
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; padding: 10px; border-radius: 24px; align-items: stretch; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { min-width: 84px; min-height: 44px; padding: 0 14px; border-radius: 13px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--dim); text-align: left; font-size: 14px; }
.tabs button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.tabs button[aria-selected="true"] { color: var(--ink); background: rgba(255, 255, 255, 0.09); border-color: var(--line); }
.panel { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; align-items: stretch; min-height: 124px; padding: 2px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.go { min-width: 128px; border: 0; border-radius: 18px; cursor: pointer; font-weight: 600; font-size: 15px; line-height: 1.2; color: #1c0a12;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(140deg, #ffd27a, #ff8a6b 55%, #ff5c93);
    box-shadow: 0 8px 34px rgba(255, 110, 120, 0.32); transition: transform 0.18s var(--ease), box-shadow 0.18s, filter 0.18s; }
.go:hover { transform: translateY(-2px); box-shadow: 0 12px 44px rgba(255, 92, 147, 0.5); }
.go:active { transform: scale(0.97); }
.go.notReady { filter: saturate(0.35) brightness(0.8); box-shadow: none; }
.go svg { stroke-width: 2.4; }
.go .short { display: none; }

/* things that live in the panel */
.tile { flex: none; width: 184px; padding: 9px 12px; border-radius: 15px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: 4px; transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease); }
.tile:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.tile.sel { border-color: var(--amber); background: rgba(255, 192, 96, 0.12); }
.tile.cant { opacity: 0.45; }
.tile .head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.tile .head > span:first-child { display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; }
.tile .head .ico { font-size: 22px; line-height: 1; }
.tile .price { font-family: var(--mono); font-size: 13px; color: var(--amber); }
.tile p { font-size: 12.5px; color: var(--dim); line-height: 1.35; }
.tile .nums { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: auto; }
.group { flex: none; display: flex; flex-direction: column; gap: 6px; }
.group > small { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--faint); padding-left: 2px; }
.group .rowed { display: flex; gap: 8px; flex: 1; }
.sep { flex: none; width: 1px; background: var(--line); margin: 4px 4px; }
.person { flex: none; width: 204px; padding: 9px 10px; border-radius: 15px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); cursor: pointer; text-align: left;
    display: grid; grid-template-columns: auto 1fr; gap: 3px 9px; align-content: start; transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease); }
.person:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.person.sel { border-color: var(--amber); }
.person .avatar { grid-row: span 2; }
.person b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .traits { grid-column: 1 / -1; font-size: 12px; color: var(--dim); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .foot2 { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 6px; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--amber); margin-top: 2px; }
.pips { letter-spacing: 1px; color: var(--amber); font-size: 11px; }
.pips i { font-style: normal; color: rgba(255, 255, 255, 0.2); }
.slotPick { display: flex; flex-direction: column; gap: 8px; justify-content: center; padding: 0 6px; }
.slotPick .slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slotPick .slots button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(116, 240, 167, 0.12); cursor: pointer; font-family: var(--mono); }
.slotPick .slots button:hover { background: rgba(116, 240, 167, 0.3); }
.slotPick .slots button.taken { background: rgba(255, 192, 96, 0.14); }
.slotPick .slots button[disabled] { opacity: 0.25; pointer-events: none; }
.info { flex: none; min-width: 200px; max-width: 300px; padding: 8px 12px; font-size: 13.5px; color: var(--dim); display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.info b { color: var(--ink); font-weight: 500; }
.info .mod { color: var(--amber); }

/* night bar */
.nightBar { grid-template-columns: repeat(4, auto) 1fr; gap: 6px; width: min(760px, calc(100% - 20px)); padding: 8px 10px; }
.fact { padding: 8px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); min-width: 84px; }
.fact small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--faint); margin-bottom: 1px; white-space: nowrap; }
.fact b { font-size: 18px; font-weight: 500; }
.fact.wide { min-width: 0; overflow: hidden; }
.who { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-height: 44px; align-items: center; }
.who button { flex: none; min-height: 44px; padding: 2px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.06); cursor: pointer; font-size: 13px; white-space: nowrap; }
.who button:hover { background: rgba(255, 255, 255, 0.14); }
.who span { font-size: 13px; color: var(--faint); }

/* ---------------- portraits ---------------- */
.avatar { position: relative; width: 40px; height: 44px; border-radius: 11px; background: var(--shirt); overflow: hidden; flex: none; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.4); }
.avatar::before { content: ""; position: absolute; left: 8px; right: 8px; top: 7px; height: 24px; border-radius: 6px; background: var(--skin);
    box-shadow: 0 -7px 0 1px var(--hair); }
.avatar::after { content: ""; position: absolute; left: 14px; top: 17px; width: 4px; height: 5px; border-radius: 1px; background: #15121c; box-shadow: 9px 0 0 #15121c; }
.avatar.big { width: 56px; height: 62px; border-radius: 14px; }
.avatar.big::before { left: 11px; right: 11px; top: 10px; height: 33px; border-radius: 8px; box-shadow: 0 -10px 0 2px var(--hair); }
.avatar.big::after { left: 19px; top: 24px; width: 5px; height: 7px; box-shadow: 13px 0 0 #15121c; }

/* ---------------- detail card ---------------- */
.card.side { position: absolute; right: 14px; top: calc(72px + var(--safe-t)); width: min(340px, calc(100% - 28px)); max-height: calc(100% - 290px - var(--safe-t)); overflow-y: auto;
    padding: 14px 16px 16px; border-radius: 20px; background: var(--glass-strong); animation: cardIn 0.3s var(--ease) both; scrollbar-width: thin; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.cardHead { display: flex; gap: 12px; align-items: center; }
.cardHead h3 { font-size: 20px; font-weight: 600; line-height: 1.15; }
.cardHead .sub { font-size: 13px; color: var(--dim); }
.cardHead .x { margin-left: auto; align-self: flex-start; margin-right: -8px; margin-top: -6px; }
.cardHead .bigIco { font-size: 38px; line-height: 1; }
.bars { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; margin: 12px 0 4px; font-size: 13px; }
.bars span { color: var(--dim); }
.bars em { font-style: normal; font-family: var(--mono); font-size: 12px; min-width: 2.2em; text-align: right; }
.bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width 0.3s; }
.bar.mid i { background: var(--amber); } .bar.low i { background: var(--danger); }
.lines { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.line { display: grid; grid-template-columns: 22px 1fr; gap: 2px 6px; font-size: 13.5px; padding: 7px 9px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--faint); }
.line .i { grid-row: span 2; font-size: 16px; line-height: 1.25; }
.line b { font-weight: 600; }
.line span { color: var(--dim); line-height: 1.35; }
.line.good { border-left-color: var(--green); } .line.bad { border-left-color: var(--danger); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 5px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--dim); }
.kv b { font-weight: 500; font-family: var(--mono); font-size: 13px; text-align: right; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.06); cursor: pointer; font-size: 20px; line-height: 1; }
.stepper button:hover { background: rgba(255, 255, 255, 0.14); }
.stepper b { font-family: var(--mono); font-size: 20px; min-width: 2.6em; text-align: center; }
.stepper small { color: var(--dim); font-size: 12.5px; line-height: 1.3; }
.cardActions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cardActions .btn { flex: 1; min-width: 96px; }
select.pick { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: #1a1228; color: var(--ink); cursor: pointer; margin-top: 4px; }
.fieldLabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--faint); margin-top: 12px; display: block; }
.blurb { font-size: 13.5px; color: var(--dim); margin-top: 10px; line-height: 1.45; }
.parts { font-size: 12.5px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.parts i { font-style: normal; padding: 2px 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
.parts i.good { color: var(--green); } .parts i.bad { color: #ffb0b0; }

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; overflow-y: auto;
    background: rgba(7, 6, 15, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: overlayIn 0.3s ease both; }
@keyframes overlayIn { from { opacity: 0; } }
.card.modal { width: min(460px, 100%); padding: 28px 26px 24px; text-align: center; background: var(--glass-strong); animation: cardIn 0.5s var(--ease) both; }
.card.modal.left { text-align: left; width: min(540px, 100%); }
.card.modal h2 { font-weight: 600; font-size: 28px; margin: 4px 0 6px; line-height: 1.15; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.actions.col { flex-direction: column; }
.left .actions { justify-content: flex-end; }
.ledger { margin: 14px 0 6px; font-size: 15px; }
.ledger div { display: flex; justify-content: space-between; padding: 5px 0; }
.ledger div span { color: var(--dim); }
.ledger div b { font-family: var(--mono); font-weight: 500; }
.ledger .neg b { color: #ffb0b0; }
.ledger .total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 10px; font-size: 18px; }
.ledger .total span { color: var(--ink); }
.ledger .total.up b { color: var(--green); } .ledger .total.down b { color: var(--danger); }
.repRow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13.5px; background: rgba(255, 255, 255, 0.04); }
.chip b { font-family: var(--mono); font-weight: 500; }
.chip.up b { color: var(--green); } .chip.down b { color: var(--danger); }
.moments { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.moments p { font-size: 14px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--green); color: var(--dim); }
.moments p.bad { border-left-color: var(--danger); }
.staffRows { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; scrollbar-width: thin; }
.staffRows div { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; font-size: 14px; padding: 4px 2px; align-items: center; }
.staffRows div span { color: var(--dim); font-family: var(--mono); font-size: 12.5px; }
.staffRows .up { color: var(--green); } .staffRows .down { color: var(--danger); }
.eventHead { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.eventText { font-size: 16px; line-height: 1.55; color: var(--ink); }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.choice { text-align: left; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); cursor: pointer; min-height: 56px;
    transition: border-color 0.18s, background 0.18s, transform 0.18s var(--ease); }
.choice:hover { border-color: var(--amber); background: rgba(255, 192, 96, 0.1); transform: translateX(3px); }
.choice b { display: block; font-weight: 600; font-size: 15.5px; }
.choice span { font-size: 13.5px; color: var(--dim); }
.choice[disabled] { opacity: 0.4; pointer-events: none; }
.choice.picked { border-color: var(--amber); background: rgba(255, 192, 96, 0.14); opacity: 1; }
.eventResult { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 192, 96, 0.1); border-left: 3px solid var(--amber); font-size: 15.5px; line-height: 1.5; }
.bigStars { font-size: 50px; letter-spacing: 10px; margin: 8px 0 4px 10px; color: rgba(255, 255, 255, 0.13); }
.bigStars span { display: inline-block; }
.bigStars span.on { color: var(--amber); text-shadow: 0 0 26px rgba(255, 192, 96, 0.85); animation: starPop 0.6s cubic-bezier(0.2, 1.9, 0.4, 1) both; }
.bigStars span.on:nth-child(2) { animation-delay: 0.18s; } .bigStars span.on:nth-child(3) { animation-delay: 0.36s; }
@keyframes starPop { from { transform: scale(0) rotate(-120deg); opacity: 0; } }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 4px; }
.facts div { padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.facts small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; color: var(--faint); margin-bottom: 2px; }
.facts b { font-size: 17px; font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head { margin-bottom: 8px; }
.setRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); min-height: 58px; cursor: pointer; }
.setRow small { display: block; color: var(--faint); font-size: 13px; }
input[type="range"] { width: 160px; accent-color: var(--pink); height: 28px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); position: relative; cursor: pointer; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.switch:checked { background: linear-gradient(120deg, #ffd27a, #ff5c93); }
.switch:checked::after { transform: translateX(22px); }
.help { border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; color: var(--dim); }
.help p + p { margin-top: 8px; line-height: 1.9; }

.toast { position: fixed; left: 50%; top: calc(72px + var(--safe-t)); transform: translate(-50%, -12px); z-index: 12; padding: 11px 18px; border-radius: 999px; font-size: 15px;
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--ease); max-width: calc(100% - 24px); text-align: center; background: var(--glass-strong); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 107, 107, 0.6); color: #ffd0d0; }
.toast.good { border-color: rgba(116, 240, 167, 0.55); }

/* ---------------- small screens ---------------- */
@media (max-width: 760px) {
    #title { background: linear-gradient(180deg, rgba(7, 6, 15, 0.7), rgba(7, 6, 15, 0.2) 45%, rgba(7, 6, 15, 0.8)); align-items: center; text-align: center; }
    .wordmark { align-items: center; }
    .menu { justify-content: center; }
    .lede { margin: 0 auto; }
    .topbar { flex-wrap: wrap; gap: 6px; }
    .nightTag { order: 1; } .topRight { order: 2; margin-left: auto; } .stats { order: 3; width: 100%; justify-content: flex-start; }
    .pill { padding: 6px 12px; min-height: 44px; }
    .clockBar { width: 50px; }
    /* speed buttons move down to where a thumb can reach them */
    #speedCtl { position: fixed; right: 10px; bottom: calc(176px + var(--safe-b)); z-index: 5; }
    .feed { top: calc(124px + var(--safe-t)); width: min(280px, calc(100% - 28px)); }
    .feed li { font-size: 12.5px; padding: 5px 10px; }
    .dock { grid-template-columns: 1fr auto; grid-template-areas: "tabs go" "panel panel"; gap: 8px; padding: 8px; border-radius: 20px; }
    .tabs { grid-area: tabs; flex-direction: row; }
    .tabs button { min-width: 0; flex: 1; text-align: center; padding: 0 8px; }
    .panel { grid-area: panel; min-height: 132px; }
    .go { grid-area: go; flex-direction: row; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 13px; }
    .go .long { display: none; }
    .go .short { display: inline; }
    .status { font-size: 14px; }
    .nightBar { grid-template-columns: repeat(4, 1fr); grid-template-areas: none; }
    .nightBar .fact { min-width: 0; padding: 6px 8px; }
    .nightBar .fact.wide { grid-column: 1 / -1; }
    .fact b { font-size: 16px; }
    /* the card becomes a sheet above the dock */
    .card.side { left: 10px; right: 10px; top: auto; bottom: calc(232px + var(--safe-b)); width: auto; max-height: 46vh; }
    body.night .card.side { bottom: calc(236px + var(--safe-b)); max-height: 40vh; }
    body.hasCard .status { display: none; }
    .tile { width: 150px; } .person { width: 164px; }
}
@media (max-height: 560px) and (min-width: 761px) {
    .panel { min-height: 112px; }
    .tile p { display: none; }
    .card.side { max-height: calc(100% - 230px); }
    .card.modal { padding: 18px 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------------- icons, coins and other juice ---------------- */
.ic { width: auto; height: auto; stroke: none; fill: none; flex: none; vertical-align: -0.22em; display: inline-block; }
.ico .ic { vertical-align: middle; }
.price .ic, .nums .ic { vertical-align: -0.2em; margin-right: 2px; }
.stat .ico { display: grid; place-items: center; }
.stat.cash b { min-width: 3.2em; }
.stat.flash { animation: pillBump 0.32s var(--ease); }
@keyframes pillBump { 35% { transform: scale(1.12); box-shadow: 0 0 26px rgba(255, 200, 61, 0.6); } }
.coinFly { position: fixed; left: 0; top: 0; z-index: 30; margin: -11px 0 0 -11px; pointer-events: none; will-change: transform; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.tag.sold { animation: tagSold 0.35s var(--ease); }
@keyframes tagSold { 30% { scale: 1.22; } }
.pop.emoji .ic { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }

/* buttons you can feel: a lip underneath that the button sinks into when pressed */
.btn, .go, .tile, .person, .choice, .stepper button, .slotPick .slots button { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.btn:active, .tile:active, .person:active, .choice:active, .stepper button:active, .slotPick .slots button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn.primary, .go { box-shadow: 0 4px 0 #b84a52, 0 10px 30px rgba(255, 110, 120, 0.3); }
.btn.primary:active, .go:active { transform: translateY(3px); box-shadow: 0 1px 0 #b84a52; }
.btn.ghost { box-shadow: none; }

/* managers */
.tile.manager { width: 214px; }
.tile.manager .head > span:first-child { gap: 9px; }
.tile.manager .avatar { width: 30px; height: 33px; border-radius: 9px; }
.tile.manager .avatar::before { left: 6px; right: 6px; top: 5px; height: 18px; box-shadow: 0 -5px 0 1px var(--hair); }
.tile.manager .avatar::after { left: 10px; top: 12px; width: 3px; height: 4px; box-shadow: 7px 0 0 #15121c; }
.tile.manager.has { border-color: rgba(116, 240, 167, 0.45); }
.tile.manager .nums { display: flex; align-items: center; gap: 6px; color: var(--amber); }
.tile[disabled] { opacity: 0.7; pointer-events: none; }

/* while you were away */
.bigIcon { display: block; margin: 0 auto 6px; width: 64px; height: 64px; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px); } }
.offlineCash { font-size: 44px; font-weight: 700; color: var(--amber); margin: 14px 0 2px; text-shadow: 0 0 28px rgba(255, 192, 96, 0.55); animation: starPop 0.6s cubic-bezier(0.2, 1.9, 0.4, 1) both 0.2s; }

/* closing: the ledger writes itself, row by row */
.ledger div { animation: rowIn 0.35s var(--ease) both; }
.ledger div:nth-child(2) { animation-delay: 0.08s; } .ledger div:nth-child(3) { animation-delay: 0.16s; } .ledger div:nth-child(4) { animation-delay: 0.24s; }
.ledger div:nth-child(5) { animation-delay: 0.32s; } .ledger div:nth-child(6) { animation-delay: 0.4s; } .ledger div:nth-child(7) { animation-delay: 0.5s; } .ledger div:nth-child(8) { animation-delay: 0.6s; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } }
.cardHead .bigIco { display: grid; place-items: center; }

@media (max-width: 760px) {
    .tabs button { font-size: 13px; padding: 0 2px; flex: 1 1 auto; }
    .tabs { gap: 2px; }
    .go { padding: 0 10px; gap: 4px; }
    .tile.manager { width: 190px; }
}

/* ---------- upgrade levels ---------- */
.levelBar { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; }
.levelBar span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--amber); white-space: nowrap; }
.levelBar div { flex: 1; display: flex; gap: 3px; }
.levelBar i { flex: 1; height: 8px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.levelBar i.on { background: linear-gradient(#ffd98a, #ffb23e); box-shadow: 0 0 8px rgba(255, 190, 90, 0.5); }
.levelBar i.step { margin-left: 5px; }
.upgrade { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 9px 12px; border-radius: 14px; cursor: pointer; text-align: left; color: #10301d;
    border: 0; background: linear-gradient(#9af7bf, #57d88d); box-shadow: 0 3px 0 #2b8f58; font-family: var(--display); min-height: 48px; }
.upgrade:hover { filter: brightness(1.06); }
.upgrade:active { transform: translateY(2px); box-shadow: 0 1px 0 #2b8f58; }
.upgrade[disabled] { filter: grayscale(0.85) brightness(0.75); cursor: default; }
.upgrade > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.upgrade b { font-size: 14.5px; }
.upgrade small { font-size: 11.5px; opacity: 0.8; }
.upgrade .price { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-weight: 700; font-size: 14px; }
.weather { display: inline-flex; align-items: center; margin-left: 2px; }

/* ---------- tutorial coach ---------- */
.coach { position: fixed; left: 0; top: 0; z-index: 14; width: min(320px, calc(100vw - 20px)); padding: 13px 15px 11px; border-radius: 16px; color: #2a1a26;
    background: #fff6e6; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 0 3px var(--amber); font-size: 14.5px; line-height: 1.42; transition: transform 0.25s var(--ease); }
.coach::after { content: ""; position: absolute; left: var(--arrow, 50%); bottom: -9px; width: 16px; height: 16px; margin-left: -8px; background: #fff6e6; transform: rotate(45deg); box-shadow: 3px 3px 0 var(--amber); }
.coach.below::after { bottom: auto; top: -9px; box-shadow: -3px -3px 0 var(--amber); }
.coach.free::after { display: none; }
.coach.fresh { animation: coachIn 0.35s var(--ease); }
.coachActions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
.coach .link { background: none; border: 0; padding: 6px 0; font: inherit; font-size: 12.5px; color: #8a6f7e; text-decoration: underline; cursor: pointer; min-height: 32px; }
.coachTarget { outline: 3px solid var(--amber) !important; outline-offset: 3px; animation: coachPulse 1.1s ease-in-out infinite; }
@keyframes coachPulse { 50% { outline-offset: 7px; outline-color: #fff; } }
@keyframes coachIn { from { opacity: 0; scale: 0.9; } }
@media (prefers-reduced-motion: reduce) { .coachTarget, .coach.fresh { animation: none; } .coach { transition: none; } }

/* ---------- a chunkier, toy-like interface: thick outlines, solid panels, buttons with a lip ---------- */
:root { --glass: rgba(44, 30, 74, 0.95); --glass-strong: rgba(40, 27, 68, 0.98); --line: rgba(255, 224, 190, 0.3); --line-strong: rgba(255, 228, 196, 0.6); }
.glass { border-width: 2px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.12); -webkit-backdrop-filter: none; backdrop-filter: none; }
.stat b, .nightTag b { font-weight: 800; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.btn { border-width: 2px; font-weight: 700; border-radius: 14px; }
.btn.primary, .go { background: linear-gradient(#ffdd6b, #ff9d3d); color: #3a1a05; box-shadow: 0 5px 0 #b3560f, inset 0 2px 0 rgba(255, 255, 255, 0.55); font-weight: 800; }
.btn.primary:hover, .go:hover { box-shadow: 0 5px 0 #b3560f, inset 0 2px 0 rgba(255, 255, 255, 0.55); filter: brightness(1.07); transform: translateY(-1px); }
.btn.primary:active, .go:active { transform: translateY(4px); box-shadow: 0 1px 0 #b3560f; }
.btn.danger { background: linear-gradient(#ff8f8f, #e8504f); color: #3a0808; border-color: transparent; box-shadow: 0 4px 0 #9c2a2a; }
.tile, .person, .choice { border-width: 2px; border-radius: 16px; background: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.42); }
.tile.sel, .person.sel { box-shadow: 0 4px 0 #b3560f; }
.tile .head, .person b { font-weight: 700; }
.tabs button { font-weight: 600; }
.tabs button[aria-selected="true"] { background: linear-gradient(#ffdd6b, #ffab45); color: #3a1a05; font-weight: 800; border-color: transparent; box-shadow: 0 3px 0 #b3560f; }
.speed button[aria-pressed="true"] { box-shadow: 0 3px 0 #b3560f; font-weight: 800; }
.tag { border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); font-weight: 700; }
.pop.money { color: #ffe36e; font-size: 19px; font-weight: 800; text-shadow: 0 2px 0 #7a3d05, 0 0 3px #000; }
.bar { height: 12px; border: 2px solid rgba(0, 0, 0, 0.4); }
.card.side, .card.modal { border-width: 2px; }
.upgrade { border-radius: 16px; box-shadow: 0 5px 0 #2b8f58, inset 0 2px 0 rgba(255, 255, 255, 0.5); }
.upgrade:active { transform: translateY(4px); }
