@font-face { font-family: 'Source Sans 3'; src: url('../fonts/source-sans-3-normal-latin.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
:root {
  --gold: #f5a623; --gold-2: #fdb913; --gold-d: #a8640a;
  --green: #4dbf66; --green-2: #6ee08a; --green-d: #2b7a3f;
  --blue: #3b82f6; --blue-2: #60a5fa; --blue-d: #1d4ed8;
  --purple: #8b5cf6; --purple-d: #5b21b6; --red: #ef4444;
  --ink: #0a0a0b; --panel: rgba(14, 14, 16, 0.94); --panel-2: #1c1c20; --panel-3: #26262b;
  --line: rgba(255, 255, 255, 0.08); --muted: #a1a1aa;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: #fff; font-family: 'Source Sans 3', system-ui, sans-serif; overscroll-behavior: none; -webkit-user-select: none; user-select: none; overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.ico-wrap { display: inline-flex; vertical-align: -0.2em; line-height: 0; }
.ico { width: 1.2em; height: 1.2em; display: block; }

#app { position: relative; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; overflow: hidden; background: #000; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

/* ---------------- HUD ---------------- */
#hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px;
  padding: calc(8px + var(--top)) 10px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.55) 60%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.chip { justify-self: start; display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 16px; background: rgba(28,28,32,0.9); border: 1px solid var(--line); max-width: 100%; }
#city-emoji { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(160deg, #2b2b31, #151518); font-size: 20px; }
#city-emoji .ico { width: 24px; height: 24px; }
.chip-text { display: flex; flex-direction: column; text-align: left; line-height: 1.05; min-width: 0; }
.chip-text b { font-weight: 900; font-size: 14px; white-space: nowrap; }
.chip-text small { color: var(--gold); font-weight: 800; font-size: 11px; }
.money { text-align: center; }
#coins { font-size: 28px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 0 #6b3d02, 0 0 18px rgba(245,166,35,0.35); white-space: nowrap; letter-spacing: -0.01em; }
#coins .ico, #rate .ico { width: 0.85em; height: 0.85em; }
#coins.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.08); } }
#rate { font-size: 12.5px; font-weight: 800; color: #86efac; white-space: nowrap; }
.hud-right { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-weight: 900; font-size: 13px; background: rgba(28,28,32,0.9); border: 1px solid var(--line); }
.pill .ico { width: 16px; height: 16px; }
.pill.gem { background: linear-gradient(180deg, #8b5cf6, #6d28d9); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3); }
.pill.gem i { font-style: normal; width: 16px; height: 16px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-size: 13px; margin-left: 2px; }

/* ---------------- flow strip ---------------- */
#flow { position: absolute; z-index: 9; left: 8px; right: 8px; top: calc(66px + var(--top)); display: grid; grid-template-columns: 1fr 1fr 0.9fr; gap: 6px; }
.flow { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 14px; background: var(--panel); border: 2px solid transparent; text-align: left; min-width: 0; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.flow .f-ic { font-size: 18px; }
.flow .f-ic .ico { width: 22px; height: 22px; }
.f-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.f-main small { font-size: 9.5px; font-weight: 900; letter-spacing: .06em; color: var(--muted); }
.f-main b { font-size: 14px; font-weight: 900; white-space: nowrap; }
.f-main em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.flow.can em { color: var(--green-2); }
.flow.can { border-color: rgba(77,191,102,0.55); }
.flow.bottleneck { border-color: var(--red); animation: alarm 1.1s infinite; }
@keyframes alarm { 50% { border-color: rgba(239,68,68,0.3); box-shadow: 0 0 16px rgba(239,68,68,0.45); } }

/* ---------------- top stack: banner, visitor card ---------------- */
#top-stack { position: absolute; z-index: 8; top: calc(122px + var(--top)); left: 8px; right: 70px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#banner { pointer-events: auto; background: linear-gradient(90deg, #7c2d12, #c2410c 50%, #a16207); border: 2px solid var(--gold); border-radius: 14px; padding: 7px 10px; font-weight: 900; font-size: 13px; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,0.5); animation: drop .3s ease-out; }
#rider { pointer-events: auto; align-self: flex-start; width: 210px; background: var(--panel); border: 1px solid rgba(245,166,35,0.4); border-radius: 14px; padding: 7px 9px; font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,0.45); animation: drop .3s ease-out; }
#rider h4 { margin: 0 0 3px; font-size: 13px; display: flex; align-items: center; gap: 6px; font-weight: 900; }
#rider h4 .av { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #000; display: grid; place-items: center; font-size: 12px; }
#rider h4 small { color: var(--muted); font-weight: 700; }
#rider li { display: flex; align-items: center; gap: 5px; margin: 2px 0; white-space: nowrap; list-style: none; }
#rider ol { margin: 0; padding: 0; }
#rider .bar { flex: 1; height: 5px; border-radius: 3px; background: #333; overflow: hidden; min-width: 24px; }
#rider .bar i { display: block; height: 100%; background: var(--green); }
#rider li.wait { color: #fca5a5; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

/* ---------------- FABs ---------------- */
#fabs { position: absolute; z-index: 9; right: 8px; top: calc(122px + var(--top)); display: flex; flex-direction: column; gap: 9px; align-items: center; }
.fab { position: relative; width: 54px; height: 54px; border-radius: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(180deg, #2f2f36, #1a1a1f); border: 1px solid rgba(255,255,255,0.1); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.45), 0 6px 14px rgba(0,0,0,0.45); font-size: 24px; }
.fab span .ico { width: 28px; height: 28px; }
.fab i { font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: .04em; margin-top: -1px; }
.fab.smart { background: linear-gradient(180deg, var(--green-2), var(--green) 55%, var(--green-d)); }
.fab.boost { background: linear-gradient(180deg, var(--blue-2), var(--blue) 55%, var(--blue-d)); }
.fab.boost.on { background: linear-gradient(180deg, #fde68a, var(--gold) 55%, var(--gold-d)); color: #000; animation: glow 1.6s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px rgba(245,166,35,0.75); } }
.fab.pass img { width: 44px; height: 44px; object-fit: contain; }
.fab.mini { width: 42px; height: 42px; border-radius: 14px; font-size: 18px; }
.fab.mini span .ico { width: 22px; height: 22px; }
.dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); border: 2px solid #000; font-size: 10px; font-weight: 900; display: grid; place-items: center; padding: 0 4px; }
.dot.num { background: var(--gold); color: #000; }
.fab:active, .btn:active, .flow:active { transform: translateY(2px); }

/* ---------------- toasts ---------------- */
#toasts { position: absolute; z-index: 30; left: 0; right: 0; top: calc(126px + var(--top)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { max-width: 86%; background: rgba(8,8,10,0.95); border: 1px solid var(--gold); border-radius: 14px; padding: 8px 13px; font-weight: 800; font-size: 13.5px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.5); animation: drop .25s ease-out; }
.toast.big { font-size: 16px; border-width: 2px; background: linear-gradient(180deg, #1f1607, #0b0805); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .35s; }

/* ---------------- goal chip ---------------- */
#goal { position: absolute; z-index: 8; left: 8px; right: 8px; bottom: calc(104px + var(--bottom)); display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 18px; background: var(--panel); border: 1px solid rgba(245,166,35,0.35); text-align: left; box-shadow: 0 8px 22px rgba(0,0,0,0.5); }
#goal img { width: 48px; height: 48px; object-fit: contain; margin-top: -14px; }
#goal .g-main { flex: 1; min-width: 0; }
#goal small { display: block; font-size: 10px; font-weight: 900; letter-spacing: .07em; color: var(--muted); }
#goal b { font-size: 14px; font-weight: 800; }
#goal b em { font-style: normal; color: var(--gold); }
#goal .bar { height: 6px; border-radius: 3px; background: #333; overflow: hidden; margin-top: 4px; }
#goal .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
#goal.ready { border-color: var(--green); }
#goal.ready .bar i { background: var(--green); }
#goal .go { font-weight: 900; font-size: 12px; padding: 6px 10px; border-radius: 10px; background: #2a2a30; }
#goal.ready .go { background: var(--green); }

/* ---------------- bottom tabs ---------------- */
#tabs { position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 6px 4px calc(6px + var(--bottom)); background: linear-gradient(180deg, #121215, #050506); border-top: 1px solid var(--line); }
#tabs button { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; font-weight: 800; color: var(--muted); padding: 2px 0; position: relative; }
#tabs button span { font-size: 22px; }
#tabs button span .ico { width: 27px; height: 27px; }
#tabs button.active { color: #fff; }
#tabs button.active::after { content: ''; position: absolute; bottom: -4px; width: 22px; height: 3px; border-radius: 2px; background: var(--gold); }
#tabs .center span { width: 62px; height: 62px; margin-top: -26px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(180deg, #fde68a, var(--gold) 55%, var(--gold-d)); box-shadow: 0 0 0 4px #050506, inset 0 -4px 0 rgba(0,0,0,0.3), 0 6px 18px rgba(245,166,35,0.35); }
#tabs .center span .ico { width: 34px; height: 34px; }
#tabs button.ping::before { content: ''; position: absolute; top: 0; right: 24%; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid #000; }

/* ---------------- panels: venue card and sheets ---------------- */
#venue, #sheet { position: absolute; z-index: 15; left: 0; right: 0; bottom: 0; transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.9,.3,1); background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid rgba(245,166,35,0.35); border-radius: 24px 24px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,0.55); }
#venue.open, #sheet.open { transform: translateY(0); }
#venue { padding: 12px 12px calc(112px + var(--bottom)); }
#sheet { top: calc(64px + var(--top)); display: flex; flex-direction: column; padding-bottom: calc(76px + var(--bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
#sheet-body { overflow-y: auto; padding: 0 12px 16px; flex: 1; -webkit-overflow-scrolling: touch; }
.x { width: 36px; height: 36px; border-radius: 12px; background: var(--panel-3); font-size: 16px; display: grid; place-items: center; flex: none; }

.v-head { display: flex; align-items: center; gap: 10px; }
.v-thumb { width: 64px; height: 64px; border-radius: 16px; background: radial-gradient(circle at 50% 70%, #2a2a31, #111114); display: grid; place-items: center; flex: none; overflow: hidden; }
.v-thumb canvas { width: 64px; height: 64px; }
.v-title { flex: 1; min-width: 0; }
.v-title b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; }
.v-title span { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.v-title .stage { color: var(--gold); font-weight: 900; }
.hood-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr) 0.8fr; gap: 3px; margin: 10px 0 2px; }
.track i { height: 7px; border-radius: 4px; background: #333; }
.track i.done { background: var(--gold); }
.track i.part { background: linear-gradient(90deg, var(--gold) var(--p), #333 var(--p)); }
.track-names { display: grid; grid-template-columns: repeat(4, 1fr) 0.8fr; gap: 3px; font-size: 9.5px; color: var(--muted); font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 8px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 6px 9px; }
.stat small { display: block; font-size: 10px; color: var(--muted); font-weight: 800; }
.stat b { font-size: 15px; font-weight: 900; white-space: nowrap; }
.stat b .ico { width: 0.9em; height: 0.9em; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chipm { font-size: 11.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--panel-3); }
.chipm.gold { background: rgba(245,166,35,0.18); color: var(--gold-2); }
.row { display: flex; gap: 7px; align-items: stretch; }

/* glossy game buttons */
.btn { flex: 1; position: relative; border-radius: 16px; padding: 10px 8px 12px; font-weight: 900; font-size: 16px; line-height: 1.1; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.35); background: linear-gradient(180deg, #4a4a52, #34343a); box-shadow: inset 0 -5px 0 rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15); }
.btn small { display: block; font-size: 12px; font-weight: 800; opacity: .92; margin-top: 2px; }
.btn small .ico { width: 1em; height: 1em; }
.btn.green { background: linear-gradient(180deg, var(--green-2), var(--green) 50%, #3aa553); }
.btn.gold { background: linear-gradient(180deg, #fde68a, var(--gold) 50%, #e8951b); color: #1a1003; text-shadow: none; }
.btn.blue { background: linear-gradient(180deg, var(--blue-2), var(--blue) 50%, #2f6fe0); }
.btn.purple { background: linear-gradient(180deg, #a78bfa, var(--purple) 50%, #7c4ddf); }
.btn.red { background: linear-gradient(180deg, #f87171, var(--red)); }
.btn.mode { flex: 0 0 60px; font-size: 14px; background: linear-gradient(180deg, #3a3a42, #26262b); }
.btn.small { flex: none; padding: 7px 12px 9px; font-size: 13px; border-radius: 12px; }
.btn.wide { width: 100%; flex: none; }
.btn:disabled { filter: grayscale(0.7) brightness(0.65); cursor: default; }
.btn.shine::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 45%, transparent 60%); background-size: 250% 100%; animation: shine 2.4s infinite; pointer-events: none; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin: 8px 2px 0; }
.hint b { color: #fff; }

/* list rows in sheets */
.section { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 8px; font-size: 12px; font-weight: 900; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; }
.section span { letter-spacing: 0; font-size: 12px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 9px 10px; margin-bottom: 7px; }
.item.owned { opacity: .6; }
.item.locked { opacity: .45; }
.item.next { border-color: rgba(245,166,35,0.55); }
.item .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--panel-3); font-size: 22px; flex: none; }
.item .ic .ico { width: 26px; height: 26px; }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; font-size: 15px; font-weight: 900; }
.item .main span { font-size: 12px; color: var(--muted); font-weight: 700; }
.item .bar, .card .bar { height: 5px; border-radius: 3px; background: #333; overflow: hidden; margin-top: 4px; }
.item .bar i, .card .bar i { display: block; height: 100%; background: var(--gold); }
.tag { font-size: 12px; font-weight: 900; padding: 5px 9px; border-radius: 10px; background: var(--panel-3); white-space: nowrap; }
.tag.ok { background: rgba(77,191,102,0.2); color: var(--green-2); }
.tag.test { background: #7c2d12; color: #fed7aa; }
.hero { border-radius: 20px; padding: 14px; margin: 4px 0 8px; background: linear-gradient(160deg, #3b2a0c, #141414 70%); border: 1px solid rgba(245,166,35,0.45); }
.hero h3 { margin: 0 0 6px; font-size: 18px; font-weight: 900; }
.hero p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.4; color: #e4e4e7; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sg { background: rgba(0,0,0,0.35); border-radius: 12px; padding: 7px 9px; }
.sg small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 800; }
.sg b { font-size: 16px; font-weight: 900; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.tile .t-ic { font-size: 30px; }
.tile .t-ic .ico { width: 36px; height: 36px; }
.tile b { font-size: 14px; font-weight: 900; }
.tile span { font-size: 11.5px; color: var(--muted); font-weight: 700; flex: 1; }
.tile .btn { width: 100%; }
.segs { display: flex; gap: 6px; margin-bottom: 8px; }
.seg { flex: 1; padding: 9px; border-radius: 12px; background: var(--panel-2); font-weight: 900; font-size: 13px; color: var(--muted); }
.seg.on { background: var(--gold); color: #000; }
.shop-note { border: 1px solid rgba(245,166,35,0.35); border-radius: 14px; padding: 10px 12px; background: #0a0a0a; font-size: 13px; line-height: 1.4; margin-bottom: 8px; }
.shop-note b { color: var(--gold); }
.shop-note a, .modal a { color: var(--gold); font-weight: 800; }

/* ---------------- modals ---------------- */
.back { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,0.66); display: grid; place-items: center; padding: 18px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 420px; max-height: 88%; overflow-y: auto; background: linear-gradient(180deg, #19191d, #0e0e10); border: 1px solid rgba(245,166,35,0.45); border-radius: 24px; padding: 16px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.6); animation: popin .28s cubic-bezier(.2,1.4,.4,1); }
@keyframes popin { from { transform: scale(0.85); opacity: 0; } }
.modal h2 { margin: 4px 0 8px; font-size: 21px; font-weight: 900; color: var(--gold); text-transform: uppercase; letter-spacing: .01em; }
.modal p { margin: 6px 0; line-height: 1.42; font-size: 14.5px; }
.modal ul { text-align: left; padding-left: 4px; list-style: none; margin: 8px 0; }
.modal li { margin: 6px 0; font-size: 14px; line-height: 1.35; }
.modal .row { margin-top: 12px; }
.modal .muted { color: var(--muted); font-size: 13px; }
.cast { display: block; width: 130px; height: auto; margin: -4px auto 4px; filter: drop-shadow(0 8px 18px rgba(245,166,35,0.25)); }
.cast-row { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.cast-row .cast { width: 31%; max-width: 120px; margin: 0; }
.big-num { font-size: 30px; font-weight: 900; color: var(--gold); }
.settings .btn { margin-top: 8px; }
.spot h3 { margin: 6px 0 2px; color: var(--gold); text-transform: uppercase; font-weight: 900; }

/* ---------------- credits ---------------- */
#credits { position: absolute; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 30%, #1d1430, #000 70%); overflow: hidden; }
#credits .cr { position: absolute; left: 0; right: 0; top: 100%; text-align: center; padding: 0 24px; animation: roll 60s linear forwards; }
@keyframes roll { to { transform: translateY(-260%); } }
#credits h1 { color: var(--gold); font-size: 30px; margin: 10px 0; }
#credits .role { color: var(--muted); font-size: 13px; margin: 18px 0 2px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
#credits .who { font-size: 18px; font-weight: 900; margin: 0; }
#credits .close { position: absolute; left: 16px; right: 16px; bottom: calc(16px + var(--bottom)); }
#credits img.logo { width: 70%; max-width: 280px; }
