:root {
  --ink: #1b1226;
  --ink2: #2a1d3a;
  --ink3: #3d2c52;
  --paper: #fff4dc;
  --paper2: #f0dcb4;
  --muted: #b8a6c8;
  --gold: #ffd030;
  --gold2: #d09a10;
  --red: #e8574a;
  --green: #7cc457;
  --teal: #4cc8b0;
  --blue: #62a8ee;
  --px: 3px;
  --font: 'Pixelify Sans', ui-monospace, monospace;
  --font2: 'Press Start 2P', ui-monospace, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0e0916; color: var(--paper); font-family: var(--font); overscroll-behavior: none; }
body { background: radial-gradient(circle at 50% 0%, #2a1d3a, #0e0916 70%); }
button { font-family: inherit; color: inherit; }
img { image-rendering: pixelated; }

#app {
  position: relative; max-width: 520px; height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ink);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 0 0 3px #000, 0 0 60px #000;
}

/* ------------------------------------------------------------ HUD */
#hud { padding: 6px 8px 4px; background: linear-gradient(#2a1d3a, #1b1226); border-bottom: 3px solid #000; flex: none; }
#hud.hidden { display: none; }
.hud-top { display: flex; align-items: center; gap: 10px; }
.day { font-family: var(--font2); font-size: 10px; display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; width: 92px; }
.day b { color: var(--gold); }
.day span { color: var(--muted); font-size: 8px; }
.bar { width: 100%; height: 6px; background: #000; margin-top: 3px; box-shadow: inset 0 0 0 1px #4a3a5a; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); }
.city { flex: 1; display: flex; flex-direction: column; line-height: 1.05; }
.city b { font-size: 19px; letter-spacing: .5px; }
.tod { font-family: var(--font2); font-size: 7px; color: var(--muted); }
.tod.pagi { color: #ffe0a0; } .tod.siang { color: #a8dcff; } .tod.sore { color: #ff9a70; } .tod.malam { color: #9aa8ff; }
.icon-btn { background: var(--ink3); border: 0; padding: 5px; box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #5a4870, 0 0 0 2px #000; cursor: pointer; }
.icon-btn img { width: 24px; height: 24px; display: block; }
.hud-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 5px; }
.stat { display: flex; align-items: center; gap: 3px; background: #120c1a; padding: 3px 4px; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #3a2c4a; min-width: 0; }
.stat img { width: 18px; height: 18px; flex: none; }
.stat > div { display: flex; flex-direction: column; line-height: 1; min-width: 0; flex: 1; }
.stat small { font-size: 9px; color: var(--muted); text-transform: uppercase; }
.stat b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.cash b { color: var(--gold); } .stat.debt b { color: #ff8a7a; } .stat.bank b { color: var(--teal); } .stat.full b { color: #ff8a7a; }
.sbar { height: 6px; background: #000; margin-top: 3px; }
.sbar i { display: block; height: 100%; background: var(--green); }
.sbar i.low { background: var(--red); animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* ------------------------------------------------------------ stage */
#stage { position: relative; flex: none; display: flex; justify-content: center; background: #000; border-bottom: 3px solid #000; }
#scene { display: block; width: 100%; aspect-ratio: 3 / 2; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; cursor: pointer; }

/* dialogue bubble — overlays the bottom of the stage area */
#bubble {
  position: absolute; left: 6px; right: 6px; z-index: 40; display: none;
  top: calc(var(--stage-bottom, 50%) + 6px);
  background: var(--paper); color: var(--ink); padding: 8px 10px 8px 8px; gap: 8px; align-items: flex-start;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper2), 0 0 0 9px #000, 0 10px 20px #0008;
  cursor: pointer; flex-wrap: wrap; animation: pop .14s steps(3);
}
#bubble.show { display: flex; }
#bubble.narrator { background: #241a33; color: var(--paper); box-shadow: 0 0 0 3px #000, 0 0 0 6px #5a4870, 0 0 0 9px #000, 0 10px 20px #0008; }
@keyframes pop { from { transform: scale(.92); opacity: .4; } }
.p-frame { flex: none; width: 64px; height: 64px; background: linear-gradient(#ffe7b0, #f0c880); box-shadow: 0 0 0 3px var(--ink); }
.p-frame canvas { width: 64px; height: 64px; image-rendering: pixelated; display: block; }
.b-body { flex: 1; min-width: 0; }
.b-name { font-family: var(--font2); font-size: 9px; color: #b8343a; margin-bottom: 4px; }
.b-text { font-size: 17px; line-height: 1.2; min-height: 2.4em; }
.b-more { position: absolute; right: 8px; bottom: 4px; font-size: 10px; animation: bob .5s steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.b-choices { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.b-choices .btn { width: 100%; justify-content: space-between; }
.b-choices small { opacity: .8; font-size: 12px; }

#banner {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%); width: 88%; z-index: 30; display: none;
  background: #f4ecd8; color: #1b1226; padding: 10px 12px 8px; text-align: center;
  box-shadow: 0 0 0 3px #1b1226, 4px 6px 0 3px #0008; font-family: Georgia, serif;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, #0000000a 3px 4px);
  animation: drop .3s steps(5);
}
#banner.show { display: block; }
#banner .k { font-family: var(--font2); font-size: 8px; border-bottom: 2px solid #1b1226; padding-bottom: 4px; margin-bottom: 5px; letter-spacing: 1px; }
#banner .t { font-weight: 700; font-size: 17px; line-height: 1.15; }
#banner.up .t { color: #8a1a24; } #banner.down .t { color: #145a62; }
#banner .tap { font-family: var(--font2); font-size: 7px; opacity: .5; margin-top: 4px; }
@keyframes drop { from { transform: translate(-50%, -140%) rotate(-4deg); } }

#toast { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: #000c; color: var(--paper); padding: 6px 10px; font-size: 14px; z-index: 31; opacity: 0; pointer-events: none; transition: opacity .2s; white-space: nowrap; box-shadow: 0 0 0 2px var(--gold2); }
#toast.show { opacity: 1; }

/* ------------------------------------------------------------ panel */
#panel { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; background: var(--ink); padding: 6px 6px 8px; }
.goods { display: flex; flex-direction: column; gap: 5px; }
.good-row {
  display: grid; grid-template-columns: 36px 1fr auto 86px; align-items: center; gap: 8px;
  background: #2a1d3a; border: 0; padding: 4px 8px 4px 4px; text-align: left; cursor: pointer; width: 100%;
  box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #4a3a5e, 0 0 0 2px #000;
}
.good-row:active { transform: translateY(1px); box-shadow: inset 3px 3px 0 #1b1226, 0 0 0 2px #000; }
.good-row img { width: 32px; height: 32px; }
.good-row.na { opacity: .5; }
.good-row.owned { background: #2e2440; }
.good-row.profit { box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #4a3a5e, 0 0 0 2px #000, inset 0 0 0 999px #7cc45712; }
.good-row.profit .g-own b { color: var(--green); }
.good-row.hot { animation: hot 1s steps(2) infinite; }
@keyframes hot { 50% { box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #4a3a5e, 0 0 0 2px #e8574a; } }
.good-row.cold .g-price small { color: var(--teal); }
.g-name { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.g-name b { font-size: 17px; }
.g-name small, .g-own small, .g-price small { font-size: 11px; color: var(--muted); }
.g-own { text-align: right; display: flex; flex-direction: column; line-height: 1.05; }
.g-own b { font-size: 14px; }
.g-price { text-align: right; display: flex; flex-direction: column; line-height: 1.05; }
.g-price b { font-size: 15px; color: var(--gold); }
.g-price small.up { color: #ff8a7a; } .g-price small.down { color: var(--green); }
.hot .g-price small { color: #ff8a7a !important; font-weight: 700; }

/* ------------------------------------------------------------ dock */
#dock { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px 6px 8px; background: linear-gradient(#1b1226, #120c1a); border-top: 3px solid #000; }
#dock.hidden { display: none; }
#dock.travel-dock { grid-template-columns: auto 1fr; }
.dock-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--ink3); border: 0; padding: 5px 0 4px; cursor: pointer; box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #6a5880, 0 0 0 2px #000; }
.dock-btn img { width: 28px; height: 28px; }
.dock-btn span { font-size: 12px; }
.dock-btn:active { transform: translateY(1px); box-shadow: inset 3px 3px 0 #1b1226, 0 0 0 2px #000; }
.dock-btn.dim { opacity: .55; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; font-weight: 600;
  background: #5a4870; color: var(--paper); border: 0; padding: 9px 12px; cursor: pointer; min-height: 42px;
  box-shadow: inset -3px -3px 0 #2e2240, inset 3px 3px 0 #8a76a4, 0 0 0 3px #000;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 3px 3px 0 #2e2240, 0 0 0 3px #000; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { width: 100%; font-size: 18px; min-height: 50px; }
.btn.go, .btn.buy { background: #3f8f3e; box-shadow: inset -3px -3px 0 #235a35, inset 3px 3px 0 #7cc457, 0 0 0 3px #000; }
.btn.sell { background: #d4652a; box-shadow: inset -3px -3px 0 #93391e, inset 3px 3px 0 #f39a3a, 0 0 0 3px #000; }
.btn.nego { background: #3a6fc8; box-shadow: inset -3px -3px 0 #253f8a, inset 3px 3px 0 #62a8ee, 0 0 0 3px #000; }
.btn.ghost { background: #2a1d3a; box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #4a3a5e, 0 0 0 3px #000; }
.btn.sq { width: 46px; padding: 0; font-size: 22px; }
.btn.toggle { width: 100%; justify-content: space-between; margin-bottom: 10px; }
.btn.toggle span { font-family: var(--font2); font-size: 10px; color: #ff8a7a; }
.btn.toggle.on span { color: var(--green); }
#bubble .btn { color: var(--paper); }

/* ------------------------------------------------------------ sheet */
#sheet-wrap { position: absolute; inset: 0; z-index: 20; display: none; background: #0007; align-items: flex-end; }
#sheet-wrap.show { display: flex; }
.sheet {
  width: 100%; max-height: 66%; display: flex; flex-direction: column; background: #241a33;
  box-shadow: 0 -3px 0 #000, 0 -6px 0 #5a4870, 0 -9px 0 #000; animation: up .18s steps(4);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes up { from { transform: translateY(40%); } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #2e2240; border-bottom: 3px solid #000; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 20px; }
.sheet-ico { width: 32px; height: 32px; }
.sheet-head .x { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px 8px; }
.sheet-body { padding: 10px 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; background: #1b1226; border: 0; padding: 8px 4px; font-size: 15px; cursor: pointer; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #3a2c4a; color: var(--muted); }
.tab.on { background: #5a4870; color: var(--paper); box-shadow: 0 0 0 2px #000, inset 3px 3px 0 #8a76a4; }
.tab:disabled { opacity: .35; }
.trade-info, .trade-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.trade-sum { grid-template-columns: repeat(2, 1fr); background: #1b1226; padding: 8px; box-shadow: 0 0 0 2px #000; }
.trade-info div, .trade-sum div { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.trade-info small, .trade-sum small { font-size: 11px; color: var(--muted); }
.trade-info b { font-size: 14px; }
.trade-sum b { font-size: 17px; color: var(--gold); }
.trade-sum em { font-style: normal; font-size: 12px; }
.good { color: var(--green) !important; } .bad { color: #ff8a7a !important; } .muted { color: var(--muted) !important; }
p.muted { margin: 0; font-size: 14px; }
.trade-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.trade-actions .btn { min-height: 52px; }
.picker { display: flex; flex-direction: column; gap: 8px; }
.pick-row { display: flex; align-items: center; gap: 10px; }
.pick-val { flex: 1; text-align: center; font-size: 24px; font-weight: 700; color: var(--paper); background: #120c1a; padding: 6px; box-shadow: 0 0 0 2px #000; }
.pick-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pick-quick .btn { min-height: 36px; padding: 4px; font-size: 14px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; background: #120c1a; box-shadow: 0 0 0 2px #000; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; background: var(--gold); box-shadow: inset -3px -3px 0 var(--gold2), 0 0 0 2px #000; }
input[type=range]::-moz-range-track { height: 8px; background: #120c1a; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 0; background: var(--gold); border: 2px solid #000; }
.info-line { font-size: 15px; color: var(--muted); }
.shop-row { display: flex; align-items: center; gap: 10px; background: #2a1d3a; padding: 8px; box-shadow: 0 0 0 2px #000; }
.shop-row.veh { background: #2e2a1a; }
.s-name { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.s-name b { font-size: 17px; } .s-name small { font-size: 13px; color: var(--muted); }
.shop-row .btn { min-width: 98px; font-size: 14px; }
.own-items { font-size: 13px; color: var(--muted); }
.rumor { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; background: #2a1d3a; padding: 6px 8px; box-shadow: 0 0 0 2px #000; }
.rumor img { width: 32px; height: 32px; }
.rumor p { margin: 0; font-size: 14px; line-height: 1.2; }
.rumor small { font-size: 11px; color: var(--muted); }
.rumor .tag { font-family: var(--font2); font-size: 7px; padding: 4px; background: #1b1226; }
.rumor.true .tag { color: var(--green); } .rumor.false .tag { color: #ff8a7a; }
.book-wrap { overflow-x: auto; }
table.book { border-collapse: collapse; width: 100%; font-size: 12px; }
.book th { font-family: var(--font2); font-size: 7px; color: var(--muted); padding: 4px 2px; }
.book td { text-align: center; padding: 2px; border-top: 1px solid #3a2c4a; line-height: 1; }
.book td img { width: 24px; height: 24px; }
.book td small { display: block; font-size: 9px; color: #6a5880; }
.book td.hi { color: var(--gold); } .book td.lo { color: var(--green); } .book td.nil { color: #4a3a5a; }
.rival { display: grid; grid-template-columns: 28px 40px 1fr auto; gap: 8px; align-items: center; background: #2a1d3a; padding: 6px 8px; box-shadow: 0 0 0 2px #000; }
.rival.you { background: #2e2a1a; box-shadow: 0 0 0 2px var(--gold2); }
.rival .rank { font-family: var(--font2); font-size: 10px; color: var(--gold); }
.rival canvas { width: 40px; height: 40px; image-rendering: pixelated; background: #ffe7b0; }
.rival small { display: block; font-size: 12px; color: var(--muted); line-height: 1.1; }
.rival .worth { color: var(--gold); font-size: 15px; }
.help p { margin: 0 0 8px; font-size: 15px; line-height: 1.3; }
.help b { color: var(--gold); }

/* ------------------------------------------------------------ travel */
#panel.travel { padding-top: 8px; }
.dests { display: flex; flex-direction: column; gap: 6px; }
.dest { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; background: #2a1d3a; border: 0; text-align: left; padding: 6px 8px; cursor: pointer; box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #4a3a5e, 0 0 0 2px #000; }
.dest.sel { background: #3a3a1a; box-shadow: inset -3px -3px 0 #1b1226, inset 3px 3px 0 #6a6a2a, 0 0 0 2px var(--gold); }
.dest img { width: 32px; height: 32px; }
.d-name { display: flex; flex-direction: column; line-height: 1.1; }
.d-name b { font-size: 17px; } .d-name small { font-size: 12px; color: var(--muted); }
.d-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.d-meta b { font-size: 14px; color: var(--gold); } .d-meta small { font-size: 12px; color: var(--muted); }
.hints { display: flex; gap: 1px; margin-top: 2px; } .hints img { width: 16px; height: 16px; }
.trip { display: flex; gap: 10px; align-items: center; padding: 10px; background: #2a1d3a; box-shadow: 0 0 0 2px #000; }
.trip img { width: 32px; height: 32px; }
.trip b { display: block; font-size: 18px; } .trip small { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ title */
#panel.title { display: flex; flex-direction: column; gap: 14px; padding: 8px 18px 18px; background: radial-gradient(circle at 50% 0%, #3a2450, var(--ink) 70%); }
.logo { text-align: center; margin-top: 6px; }
.logo .l1, .logo .l2 { font-family: var(--font2); line-height: 1; letter-spacing: 2px; }
.logo .l1 { font-size: clamp(30px, 10vw, 44px); color: var(--gold); text-shadow: 3px 0 #000, -3px 0 #000, 0 3px #000, 0 -3px #000, 0 6px #b8343a, 3px 6px #000, -3px 6px #000, 0 9px #000; }
.logo .l2 { font-size: clamp(22px, 7vw, 30px); color: var(--paper); margin-top: 10px; text-shadow: 3px 0 #000, -3px 0 #000, 0 3px #000, 0 -3px #000, 0 5px #3a6fc8, 0 8px #000; }
.logo .tag { margin-top: 12px; color: var(--muted); font-size: 15px; }
.title-btns { display: flex; flex-direction: column; gap: 10px; }
.hs { background: #120c1a; padding: 8px 10px; box-shadow: 0 0 0 2px #000; font-size: 14px; }
.hs b { color: var(--gold); }
.hs div { display: flex; justify-content: space-between; gap: 8px; }
.hs div span:nth-child(2) { color: var(--muted); flex: 1; }
.creator { display: flex; align-items: center; justify-content: center; gap: 14px; }
.big-portrait { width: 128px; height: 128px; image-rendering: pixelated; background: linear-gradient(#ffe7b0, #f0c880); box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--paper2), 0 0 0 9px #000; }
.lbl { font-family: var(--font2); font-size: 8px; color: var(--muted); }
.name-in { font-family: var(--font); font-size: 20px; padding: 8px 10px; background: #120c1a; color: var(--paper); border: 0; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #3a2c4a; width: 100%; }

/* ------------------------------------------------------------ end */
.end-card { text-align: center; display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 12px; }
.end-card .k { font-family: var(--font2); font-size: 8px; color: var(--muted); }
.end-card h1 { margin: 0; font-family: var(--font2); font-size: 20px; color: var(--gold); line-height: 1.3; text-shadow: 0 3px #000; }
.end-card .en { color: var(--muted); }
.end-card .score { font-size: 28px; font-weight: 700; }
.end-card p { margin: 0; }
.end-card .stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; text-align: left; }
.end-card .stats div { background: #2a1d3a; padding: 6px 8px; box-shadow: 0 0 0 2px #000; display: flex; justify-content: space-between; align-items: center; }
.end-card .stats small { color: var(--muted); font-size: 13px; }

@media (min-width: 521px) { #app { margin-top: 0; } }
@media (max-height: 640px) { .b-text { font-size: 15px; } .good-row img { width: 28px; height: 28px; } }
.cargo { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.cargo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cg { display: flex; align-items: center; gap: 4px; background: #2a1d3a; padding: 4px; box-shadow: 0 0 0 2px #000; }
.cg img { width: 32px; height: 32px; } .cg b { font-size: 15px; }
.cg.perish { box-shadow: 0 0 0 2px #93391e; }

/* ================================================================ CRT feel for the UI */
#app::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 200;
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .09) 2px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, .35) 100%);
  mix-blend-mode: multiply;
}
body:not(.no-crt) #app { text-shadow: 0 0 6px rgba(255, 230, 200, .12); }
body.no-crt #app::after { display: none; }
#scene { image-rendering: auto; }
#app.poweron { animation: poweron .75s cubic-bezier(.2, .8, .2, 1); }
@keyframes poweron {
  0% { transform: scale(1, .004); filter: brightness(6); }
  35% { transform: scale(1, .02); filter: brightness(4); }
  70% { transform: scale(1, 1.03); filter: brightness(1.6); }
  100% { transform: scale(1, 1); filter: brightness(1); }
}
#stage.shake { animation: shake .5s steps(10); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-4px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }

/* ================================================================ boot */
#boot { position: absolute; inset: 0; z-index: 150; background: #050308; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#boot.gone { animation: fadeout .4s forwards; pointer-events: none; }
@keyframes fadeout { to { opacity: 0; } }
.boot-inner { width: 80%; max-width: 340px; text-align: center; }
.studio { font-family: var(--font2); font-size: clamp(22px, 8vw, 34px); letter-spacing: 4px; color: #fff4dc;
  text-shadow: 0 0 8px #ff9a3a, 0 0 22px #e8574a, 3px 3px 0 #b8343a; animation: studio 2s ease-out both; }
@keyframes studio { from { letter-spacing: 24px; opacity: 0; filter: blur(6px); } }
.presents { margin: 10px 0 34px; color: var(--muted); font-size: 15px; letter-spacing: 2px; animation: studio 2s .4s ease-out both; }
.boot-bar { height: 14px; background: #120c1a; box-shadow: 0 0 0 3px #000, 0 0 0 5px #3d2c52; padding: 2px; }
.boot-bar .fill { height: 100%; width: 0; transition: width .12s steps(4);
  background: repeating-linear-gradient(90deg, var(--gold) 0 8px, var(--gold2) 8px 10px); box-shadow: 0 0 12px #ffd03088; }
.boot-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--muted); }
.tap { margin-top: 30px; font-family: var(--font2); font-size: 13px; color: var(--gold); visibility: hidden; line-height: 1.8; }
.tap small { display: block; font-family: var(--font); font-size: 13px; color: var(--muted); letter-spacing: 1px; }
#boot.ready .tap { visibility: visible; animation: blink .8s steps(2) infinite; }
#boot.ready .boot-bar .fill { background: var(--green); box-shadow: 0 0 14px #7cc457aa; }

/* ================================================================ title */
#title-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; display: none; z-index: 5; }
#title-fx.show { display: block; }
.sunburst { position: absolute; left: 50%; top: 44%; width: 260%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 110, .26) 0 9deg, rgba(255, 120, 80, .0) 9deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0 10%, transparent 48%); mask: radial-gradient(circle, #000 0 10%, transparent 48%);
  animation: spin 30s linear infinite; mix-blend-mode: screen; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.flare { position: absolute; left: 50%; top: 44%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 250, 220, .55), rgba(255, 180, 90, .18) 35%, transparent 65%); mix-blend-mode: screen; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: translate(-50%, -50%) scale(1.12); } }
.logo-wrap { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); text-align: center; pointer-events: auto; cursor: pointer; padding: 10px 16px 12px; }
.logo-wrap.spin .logo-word span { animation: hop .7s cubic-bezier(.3, 1.8, .5, 1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes hop { 30% { transform: translateY(-28px) rotate(-12deg) scale(1.2); } }
.logo-word { display: flex; justify-content: center; font-family: var(--font2); line-height: 1; }
.logo-word span { display: inline-block; position: relative; animation: slam .7s cubic-bezier(.2, 2, .4, 1) both, wave 2.6s ease-in-out infinite;
  animation-delay: calc(.15s + var(--i) * 80ms), calc(1.6s + var(--i) * 110ms); }
@keyframes slam { 0% { transform: translateY(-160px) scale(2.6) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes wave { 50% { transform: translateY(-5px); } }
.w1 { font-size: clamp(30px, 11.2vw, 54px); }
.w1 span {
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, .95) 48%, transparent 56%), linear-gradient(180deg, #fffbe0 0 22%, #ffd030 22% 52%, #f39a3a 52% 76%, #d4652a 76%);
  background-size: 400% 100%, 100% 100%; animation-name: slam, wave, shine; animation-duration: .7s, 2.6s, 3.2s; animation-iteration-count: 1, infinite, infinite;
  animation-delay: calc(.15s + var(--i) * 80ms), calc(1.6s + var(--i) * 110ms), calc(1.2s + var(--i) * 60ms);
  filter: drop-shadow(2px 0 0 #1b1226) drop-shadow(-2px 0 0 #1b1226) drop-shadow(0 -2px 0 #1b1226) drop-shadow(0 2px 0 #1b1226) drop-shadow(0 4px 0 #b8343a) drop-shadow(0 3px 0 #7a1f33) drop-shadow(0 2px 0 #1b1226) drop-shadow(0 6px 6px rgba(0, 0, 0, .5));
}
@keyframes shine { 0%, 55% { background-position: 100% 0, 0 0; } 100% { background-position: -30% 0, 0 0; } }
.w2 { font-size: clamp(34px, 13vw, 64px); margin-top: 6px; transform: skewX(-9deg); }
.w2 span {
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(180deg, #ffffff 0 30%, #b4dcff 30% 50%, #3a6fc8 50% 62%, #b4dcff 62% 78%, #62a8ee 78%);
  filter: drop-shadow(2px 0 0 #120c1a) drop-shadow(-2px 0 0 #120c1a) drop-shadow(0 -2px 0 #120c1a) drop-shadow(0 2px 0 #120c1a) drop-shadow(0 0 6px #e8574a) drop-shadow(0 5px 0 #e8574a) drop-shadow(0 2px 0 #120c1a) drop-shadow(0 0 14px rgba(255, 120, 60, .8));
}
.ribbon { margin: 10px auto 0; display: inline-block; white-space: nowrap; position: relative; background: #b8343a; padding: 5px 14px; font-family: var(--font2); font-size: clamp(7px, 2.3vw, 10px); color: #fff4dc;
  box-shadow: 0 0 0 2px #1b1226, 0 4px 0 2px #1b1226; animation: slam .6s 1s both, wobble 3s 2s ease-in-out infinite; letter-spacing: 1px; }
.ribbon::before, .ribbon::after { content: ''; position: absolute; top: 6px; width: 14px; height: 100%; background: #7a1f33; z-index: -1; box-shadow: 0 0 0 2px #1b1226; }
.ribbon::before { left: -10px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.ribbon::after { right: -10px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
@keyframes wobble { 50% { transform: rotate(-1.5deg) scale(1.03); } }
.marquee { position: absolute; inset: 0; border: 5px dotted; border-radius: 10px; pointer-events: none; animation: bulbs .5s steps(1) infinite; }
.marquee.a { border-color: #ffe680; filter: drop-shadow(0 0 4px #ffd030); }
.marquee.b { inset: 2px; border-color: #ff6a5a; animation-delay: .25s; filter: drop-shadow(0 0 4px #e8574a); }
@keyframes bulbs { 50% { opacity: 0; } }
.twinkle { position: absolute; color: #fffbe0; font-style: normal; font-size: 14px; text-shadow: 0 0 8px #ffd030; animation: twinkle 1.6s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(0) rotate(0); opacity: 0; } 50% { transform: scale(1.3) rotate(90deg); opacity: 1; } }

#panel.title { gap: 12px; padding-top: 12px; }
.press-start { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; border: 0; cursor: pointer; padding: 14px 8px;
  font-family: var(--font2); font-size: clamp(13px, 4.4vw, 18px); color: #1b1226; background: linear-gradient(#fff4a0, #ffd030 50%, #e0a030);
  box-shadow: inset -4px -4px 0 #a0601e, inset 4px 4px 0 #fffbe0, 0 0 0 3px #000, 0 0 26px #ffd03088; animation: glowpulse 1.2s ease-in-out infinite; }
.press-start .arrow { animation: blink .6s steps(2) infinite; }
.press-start:active { transform: translateY(2px); }
@keyframes glowpulse { 50% { box-shadow: inset -4px -4px 0 #a0601e, inset 4px 4px 0 #fffbe0, 0 0 0 3px #000, 0 0 40px #ffd030cc; } }
.cont-sub { text-align: center; color: var(--muted); font-size: 14px; margin-top: -6px; }
.title-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.hs-title { font-family: var(--font2); font-size: 9px; color: var(--gold); text-align: center; margin-bottom: 6px; }
.hs-row { display: grid !important; grid-template-columns: 34px 1fr auto auto; gap: 8px; }
.hs-row em { font-style: normal; color: var(--teal); font-family: var(--font2); font-size: 8px; align-self: center; }
.ticker { display: flex; align-items: center; background: #000; box-shadow: 0 0 0 2px #b8343a; overflow: hidden; height: 28px; }
.ticker b { flex: none; background: #b8343a; color: #fff; font-family: var(--font2); font-size: 8px; padding: 0 8px; height: 100%; display: flex; align-items: center; z-index: 1; }
.crawl { flex: 1; overflow: hidden; white-space: nowrap; }
.crawl span { display: inline-block; padding-left: 100%; animation: crawl 70s linear infinite; color: #ffe08a; font-size: 15px; }
@keyframes crawl { to { transform: translateX(-100%); } }
.credits { text-align: center; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.credits a { color: var(--paper); text-decoration: none; font-family: var(--font2); font-size: 11px; align-self: center; padding: 8px 14px; background: #120c1a; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #3d2c52; }
.credits a .x { font-family: system-ui, sans-serif; font-size: 15px; }
.credits .ai { font-size: 11px; color: #6a5880; }
.frontpage { background: #f4ecd8; color: #1b1226; padding: 10px 12px; text-align: left; box-shadow: 0 0 0 3px #1b1226, 4px 5px 0 3px #0008; font-family: Georgia, serif; animation: drop .35s steps(5); }
.frontpage .fp-k { font-family: var(--font2); font-size: 7px; border-bottom: 2px solid #1b1226; padding-bottom: 4px; margin-bottom: 6px; }
.frontpage h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.15; }
.frontpage p { margin: 0 0 4px; font-size: 14px; color: #4a3a2a; }
