/* כיסא פלסטיק — game UI. Layout: full-bleed 3D park; menus are stacked "screens" over it; HUD on top during play. */
@font-face { font-family: "Rubik"; src: url("../assets/fonts/rubik-500.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("../assets/fonts/rubik-700.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("../assets/fonts/rubik-900.ttf") format("truetype"); font-weight: 800 900; font-display: swap; }

:root {
  --ink: #14151d;
  --ink-2: #1d1f2b;
  --panel: rgba(22, 20, 34, .86);
  --panel-edge: #3b2f5c;
  --text: #fffaf0;
  --muted: #c8bfd8;
  --gold: #ffd23f;
  --orange: #ff8a1a;
  --green: #36d46a;
  --red: #ff3b3b;
  --blue: #2a9df4;
  --money: #9cf06a;
  --font: "Rubik", "Arial Hebrew", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--font); font-weight: 700; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
#app { position: fixed; inset: 0; }
#app canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------------------------------------------------------------- text */
.t-stroke { paint-order: stroke fill; -webkit-text-stroke: .18em var(--ink); }
.title { font-weight: 900; font-size: clamp(2rem, 9vw, 3.6rem); line-height: 1; letter-spacing: -.01em; text-wrap: balance; paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); text-shadow: 0 6px 0 var(--ink); }
.h2 { font-weight: 900; font-size: clamp(1.5rem, 6.4vw, 2.2rem); line-height: 1.05; paint-order: stroke fill; -webkit-text-stroke: 6px var(--ink); text-shadow: 0 4px 0 var(--ink); margin: 0; }
.muted { color: var(--muted); font-weight: 500; }
.gold { color: var(--gold); }

/* ---------------------------------------------------------------- image buttons (the CasualGameButtons pack, 9-sliced) */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-width: 9rem; height: 64px;
  border-style: solid; border-width: 0 32px; border-image: url("../assets/ui/orange_L_pill.png") 0 64 fill / 0 32px stretch;
  font-weight: 900; font-size: 1.35rem; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35); paint-order: stroke fill; -webkit-text-stroke: 5px rgba(60,20,0,.45);
  transition: transform .08s ease, filter .12s ease; white-space: nowrap; padding: 0 .3em 6px; }
.btn:hover { filter: brightness(1.08); }
.btn:active, .btn.pressed { transform: translateY(3px) scale(.97); filter: brightness(.95); }
.btn:disabled { filter: grayscale(.85) brightness(.75); cursor: not-allowed; }
.btn.xl { height: 84px; border-width: 0 42px; border-image-width: 0 42px; font-size: 1.9rem; min-width: 15rem; padding-bottom: 8px; }
.btn.m { height: 52px; border-width: 0 26px; border-image-width: 0 26px; font-size: 1.1rem; min-width: 7rem; padding-bottom: 5px; -webkit-text-stroke-width: 4px; }
.btn.s { height: 44px; border-width: 0 22px; border-image-width: 0 22px; font-size: .95rem; min-width: 5rem; padding-bottom: 4px; -webkit-text-stroke-width: 3px; }
.btn.wide { width: 100%; }
.btn.green  { border-image-source: url("../assets/ui/green_L_pill.png"); -webkit-text-stroke-color: rgba(0,60,20,.45); }
.btn.blue   { border-image-source: url("../assets/ui/blue_L_pill.png"); -webkit-text-stroke-color: rgba(0,30,80,.45); }
.btn.purple { border-image-source: url("../assets/ui/purple_L_pill.png"); -webkit-text-stroke-color: rgba(50,0,70,.45); }
.btn.red    { border-image-source: url("../assets/ui/red_L_pill.png"); -webkit-text-stroke-color: rgba(80,0,0,.45); }
.btn.grey   { border-image-source: url("../assets/ui/grey_L_pill.png"); -webkit-text-stroke-color: rgba(0,0,0,.45); }
.btn.yellow { border-image-source: url("../assets/ui/yellow_L_pill.png"); color: #3a2400; text-shadow: 0 2px 0 rgba(255,255,255,.4); -webkit-text-stroke: 0; }
.btn .ico { width: 1.15em; height: 1.15em; flex: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.btn .price { display: inline-flex; align-items: center; gap: .2em; font-size: .8em; }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }

/* round icon buttons */
.ibtn { width: 56px; height: 56px; flex: none; display: grid; place-items: center; background: url("../assets/ui/blue_S_round.png") center / 100% 100% no-repeat; transition: transform .08s; padding-bottom: 4px; }
.ibtn:active { transform: translateY(2px) scale(.94); }
.ibtn svg { width: 26px; height: 26px; fill: #fff; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.ibtn.grey { background-image: url("../assets/ui/grey_S_round.png"); }
.ibtn.red { background-image: url("../assets/ui/red_S_round.png"); }
.ibtn.green { background-image: url("../assets/ui/green_S_round.png"); }
.ibtn.purple { background-image: url("../assets/ui/purple_S_round.png"); }
.ibtn.orange { background-image: url("../assets/ui/orange_S_round.png"); }
.ibtn.yellow { background-image: url("../assets/ui/yellow_S_round.png"); }
.ibtn.yellow svg { fill: #4a2c00; }
.ibtn.sm { width: 44px; height: 44px; } .ibtn.sm svg { width: 20px; height: 20px; }
.ibtn[data-on="0"] { filter: grayscale(1) brightness(.8); }

/* ---------------------------------------------------------------- screens & panels */
.screen { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-inline: 16px; padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 80% at 50% 0%, rgba(40,20,60,.25), rgba(12,10,20,.78) 75%); overflow-y: auto; animation: fadein .25s ease; }
.screen[hidden] { display: none !important; }
.screen.clear { background: linear-gradient(180deg, rgba(10,8,20,.55), rgba(10,8,20,.05) 30%, rgba(10,8,20,.1) 60%, rgba(10,8,20,.75)); }
.panel { position: relative; width: min(560px, 100%); background: linear-gradient(180deg, rgba(48,38,78,.95), rgba(26,22,44,.95)); border: 4px solid var(--ink);
  border-radius: 30px; box-shadow: 0 0 0 3px #6b56a8 inset, 0 10px 0 var(--ink), 0 24px 60px rgba(0,0,0,.55); padding: 34px 20px 20px; display: grid; gap: 14px; }
.panel.narrow { width: min(420px, 100%); }
.ribbon { position: absolute; top: -30px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 92%; height: 62px; display: flex; align-items: center; justify-content: center;
  border-style: solid; border-width: 0 31px; border-image: url("../assets/ui/red_L_pill.png") 0 64 fill / 0 31px stretch; padding: 0 .5em 6px;
  font-weight: 900; font-size: 1.5rem; paint-order: stroke fill; -webkit-text-stroke: 5px rgba(80,0,0,.5); text-shadow: 0 3px 0 rgba(0,0,0,.3); white-space: nowrap; }
.ribbon.purple { border-image-source: url("../assets/ui/purple_L_pill.png"); }
.ribbon.green { border-image-source: url("../assets/ui/green_L_pill.png"); }
.ribbon.blue { border-image-source: url("../assets/ui/blue_L_pill.png"); }
.ribbon.orange { border-image-source: url("../assets/ui/orange_L_pill.png"); }
.close-x { position: absolute; top: -18px; inset-inline-end: -12px; z-index: 2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.stack { display: grid; gap: 10px; }
.card { background: rgba(0,0,0,.28); border: 2px solid rgba(255,255,255,.08); border-radius: 18px; padding: 12px 14px; }
.chip { display: inline-flex; align-items: center; gap: .35em; height: 40px; padding: 0 14px 0 8px; border-radius: 999px; background: rgba(10,8,20,.72); border: 3px solid var(--ink);
  box-shadow: 0 0 0 2px rgba(255,255,255,.12) inset, 0 4px 0 var(--ink); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip .coin { width: 26px; height: 26px; }
.chip.money { color: var(--money); }

/* ---------------------------------------------------------------- splash / loading */
#loading { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; align-content: center; gap: 22px; padding-inline: 16px;
  background: radial-gradient(90% 60% at 50% 35%, #ff9a2e, #e8551b 55%, #8a2310); text-align: center; }
#loading[hidden] { display: none !important; }
#loading img { width: min(46vw, 230px); height: auto; filter: drop-shadow(0 14px 0 rgba(0,0,0,.25)); animation: bob 1.6s ease-in-out infinite; }
#loading .title { font-size: clamp(2.4rem, 12vw, 4.2rem); }
.loadbar { width: min(320px, 76vw); height: 26px; border-radius: 99px; background: rgba(0,0,0,.35); border: 4px solid var(--ink); overflow: hidden; box-shadow: 0 5px 0 var(--ink); }
.loadbar i { display: block; height: 100%; width: 8%; background: linear-gradient(180deg, #fff27a, #ffc21a 55%, #ff9a10); border-radius: inherit; transition: width .3s; }
#load-tip { font-weight: 700; color: #fff3e0; max-width: 30ch; min-height: 2.6em; }
.legal-line { font-size: .78rem; font-weight: 500; color: rgba(255,255,255,.7); }
.legal-line a, .legal-line button { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- main menu */
#s-main { justify-content: space-between; }
.topbar { width: 100%; max-width: 980px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.profile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 4px solid var(--ink); background: linear-gradient(#ffd23f, #ff8a1a); display: grid; place-items: center; font-weight: 900; font-size: 1.4rem; color: #4a2400; box-shadow: 0 4px 0 var(--ink); }
.pname { display: grid; line-height: 1.1; min-width: 0; }
.pname b { font-weight: 900; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }
.pname small { font-weight: 700; color: var(--gold); font-size: .78rem; paint-order: stroke fill; -webkit-text-stroke: 3px var(--ink); }
.hero { display: grid; justify-items: center; gap: 6px; text-align: center; margin-top: -2vh; }
.hero img { width: min(40vw, 190px); height: auto; filter: drop-shadow(0 10px 0 rgba(0,0,0,.3)); animation: bob 2.4s ease-in-out infinite; }
.hero .title { font-size: clamp(2.8rem, 13vw, 5rem); color: #fff; }
.hero .tag { font-weight: 900; color: var(--gold); font-size: clamp(1rem, 4.2vw, 1.35rem); paint-order: stroke fill; -webkit-text-stroke: 5px var(--ink); }
.menu-actions { display: grid; gap: 12px; justify-items: center; width: min(420px, 100%); }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.menu-grid .btn { min-width: 0; width: 100%; }
.badge-new { position: absolute; top: -10px; inset-inline-start: -6px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 900; padding: 3px 8px; border-radius: 99px; border: 3px solid var(--ink); -webkit-text-stroke: 0; }
.footer { width: 100%; text-align: center; display: grid; gap: 4px; }

/* ---------------------------------------------------------------- character select */
#s-chars .panel { width: min(640px, 100%); }
.charstage { position: relative; height: min(46vh, 380px); border-radius: 22px; background: radial-gradient(70% 70% at 50% 60%, rgba(255,190,90,.35), rgba(0,0,0,0) 70%), linear-gradient(180deg, #2a2148, #15122a); border: 3px solid rgba(255,255,255,.08); overflow: hidden; }
.charstage canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.charstage .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.charstage .nav.prev { inset-inline-start: 8px; } .charstage .nav.next { inset-inline-end: 8px; }
.charstage .lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,8,20,.45); pointer-events: none; }
.charstage .lock svg { width: 70px; height: 70px; fill: #fff; filter: drop-shadow(0 4px 0 var(--ink)); }
.charinfo { display: grid; gap: 6px; text-align: center; }
.charinfo .h2 { font-size: 2rem; }
.charinfo p { margin: 0; color: var(--muted); font-weight: 500; }
.stats { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 4.6rem 1fr; align-items: center; gap: 8px; font-weight: 900; font-size: .85rem; }
.stat .bar { height: 14px; border-radius: 99px; background: rgba(0,0,0,.4); border: 2px solid var(--ink); overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: linear-gradient(180deg, #ffe066, #ff9a10); border-radius: inherit; }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.25); border: 2px solid var(--ink); }
.dots i.on { background: var(--gold); transform: scale(1.25); }
.dots i.owned { background: rgba(255,255,255,.6); }

/* ---------------------------------------------------------------- store */
.store-list { display: grid; gap: 10px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.store-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; }
.store-item .pic { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font-size: 2.1rem; background: linear-gradient(#ffd56a, #ff9a2a); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.store-item b { font-weight: 900; font-size: 1.05rem; display: block; }
.store-item small { color: var(--muted); font-weight: 500; }
.owned-tag { font-weight: 900; color: var(--green); paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }

/* ---------------------------------------------------------------- leaderboard */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px; }
.pod { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0; }
.pod .avatar { width: 58px; height: 58px; }
.pod .block { width: 100%; border-radius: 14px 14px 6px 6px; border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 1.6rem; box-shadow: 0 4px 0 var(--ink); }
.pod.p1 .block { height: 96px; background: linear-gradient(#ffe36b, #f5a512); color: #5a3a00; }
.pod.p2 .block { height: 72px; background: linear-gradient(#eef1f5, #a9b2bd); color: #33404d; }
.pod.p3 .block { height: 56px; background: linear-gradient(#f4b27a, #b9672d); color: #4a2408; }
.pod .nm { font-weight: 900; font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .sc { font-weight: 900; color: var(--gold); font-size: .85rem; font-variant-numeric: tabular-nums; }
.lb-list { display: grid; gap: 6px; max-height: 34vh; overflow-y: auto; }
.lb-row { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.28); }
.lb-row.me { background: linear-gradient(90deg, rgba(255,210,63,.3), rgba(255,138,26,.2)); outline: 2px solid var(--gold); }
.lb-row .rk { font-weight: 900; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.lb-row .nm { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-row .sc { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); font-weight: 500; padding: 14px; }

/* ---------------------------------------------------------------- settings / forms */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.25); }
.setrow span { font-weight: 900; }
.toggle { width: 74px; height: 40px; border-radius: 99px; border: 3px solid var(--ink); background: #5a5470; position: relative; box-shadow: 0 3px 0 var(--ink) inset, 0 3px 0 var(--ink); flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: inset-inline-start .15s; }
.toggle[aria-checked="true"] { background: var(--green); }
.toggle[aria-checked="true"]::after { inset-inline-start: 37px; }
.seg { display: inline-flex; border-radius: 99px; border: 3px solid var(--ink); overflow: hidden; }
.seg button { padding: 6px 12px; font-weight: 900; font-size: .9rem; background: #3d3656; }
.setrow .seg { flex-wrap: nowrap; }
.seg button[aria-pressed="true"] { background: var(--orange); }
input[type="range"] { accent-color: var(--orange); width: 9rem; }
.field { width: 100%; height: 58px; border-radius: 18px; border: 4px solid var(--ink); background: #fffaf0; color: var(--ink); font-weight: 900; font-size: 1.25rem; padding: 0 16px; box-shadow: 0 4px 0 var(--ink); text-align: center; -webkit-user-select: text; user-select: text; }
.field::placeholder { color: #a39b8a; }
.err { color: #ff8a8a; font-weight: 700; min-height: 1.2em; text-align: center; }
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 2px; background: rgba(255,255,255,.15); }
.fine { font-size: .78rem; color: var(--muted); font-weight: 500; text-align: center; line-height: 1.45; }
.fine a, .fine button { color: var(--gold); text-decoration: underline; }

/* ---------------------------------------------------------------- legal */
.legal { max-height: 62vh; overflow-y: auto; padding-inline-end: 4px; font-weight: 500; line-height: 1.6; color: #efe8f8; -webkit-user-select: text; user-select: text; }
.legal h3 { font-weight: 900; color: var(--gold); margin: 14px 0 4px; font-size: 1.05rem; }
.legal p, .legal li { margin: 0 0 6px; max-width: 65ch; }
.legal ul { padding-inline-start: 1.2em; margin: 0 0 6px; }

/* ---------------------------------------------------------------- tutorial / install */
.slides { position: relative; min-height: 300px; }
.slide { display: grid; justify-items: center; gap: 10px; text-align: center; }
.slide[hidden] { display: none; }
.slide .art { width: 150px; height: 150px; border-radius: 34px; display: grid; place-items: center; font-size: 4.6rem; background: linear-gradient(#ffd56a, #ff8a1a); border: 5px solid var(--ink); box-shadow: 0 7px 0 var(--ink); transform: rotate(-4deg); }
.slide .art.b { background: linear-gradient(#7fd8ff, #2a7de1); } .slide .art.g { background: linear-gradient(#8ff0a4, #1fb257); } .slide .art.p { background: linear-gradient(#e4a8ff, #9b4ed6); } .slide .art.r { background: linear-gradient(#ff9d9d, #e0262f); }
.slide p { margin: 0; color: #f4ecff; font-weight: 500; max-width: 32ch; line-height: 1.45; }
.steps { display: grid; gap: 10px; text-align: start; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.step .n { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--orange); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.step p { margin: 0; font-weight: 600; }
.ios-share { display: inline-block; vertical-align: -4px; width: 22px; height: 22px; }
.phone-art { width: 120px; height: 120px; border-radius: 28px; overflow: hidden; border: 5px solid var(--ink); box-shadow: 0 6px 0 var(--ink); margin-inline: auto; }
.phone-art img { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- HUD restyle */
#hud { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); inset-inline: 10px; display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; pointer-events: none; z-index: 10; }
#hud[hidden] { display: none !important; }
.stats-box { display: grid; gap: 6px; padding: 8px 12px; border-radius: 20px; width: min(330px, 62vw); background: rgba(14,12,24,.72); border: 3px solid var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,.1) inset, 0 4px 0 var(--ink); }
.respect { display: flex; align-items: baseline; gap: 8px; }
.respect b { font-weight: 900; font-size: 1.7rem; color: var(--gold); font-variant-numeric: tabular-nums; paint-order: stroke fill; -webkit-text-stroke: 5px var(--ink); line-height: 1; }
.respect span { font-size: .78rem; font-weight: 900; color: var(--muted); }
#combo { font-weight: 900; color: var(--orange); font-size: 1.3rem; paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }
.spacer { flex: 1; }
.meter { display: grid; grid-template-columns: 2.8rem 1fr; align-items: center; gap: 8px; font-size: .74rem; font-weight: 900; color: var(--muted); }
.meter .bar { height: 12px; border-radius: 999px; background: rgba(0,0,0,.45); border: 2px solid var(--ink); overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s; }
#hp-fill { background: linear-gradient(180deg, #8ff07a, #2fb14a); } #hp-fill.low { background: linear-gradient(180deg, #ff8a8a, #e0262f); animation: blink .6s infinite alternate; }
#chaos-fill { background: linear-gradient(90deg, var(--gold), var(--orange), var(--red)); }
.hud-chips { display: flex; gap: 6px; }
.hud-chips .chip { height: 30px; font-size: .85rem; padding: 0 10px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
.tools { display: flex; gap: 6px; pointer-events: auto; }
#police { position: fixed; top: calc(98px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); height: 46px; display: flex; align-items: center; padding: 0 22px 5px;
  border-style: solid; border-width: 0 23px; border-image: url("../assets/ui/blue_M_pill.png") 0 64 fill / 0 23px stretch; font-weight: 900; z-index: 11; white-space: nowrap; animation: siren .5s infinite alternate; paint-order: stroke fill; -webkit-text-stroke: 4px rgba(0,0,40,.5); }
#police[hidden] { display: none; }
#mission { position: fixed; top: calc(106px + env(safe-area-inset-top, 0px)); inset-inline-start: 10px; display: flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 16px; z-index: 10; pointer-events: none;
  max-width: min(420px, calc(100vw - 20px)); background: rgba(14,12,24,.75); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: .9rem; }
#mission[hidden] { display: none; }
#mission .m-label { font-size: .7rem; font-weight: 900; color: #fff; background: var(--red); border-radius: 99px; padding: 2px 8px; }
#mission-text { font-weight: 700; min-width: 0; } #mission .m-n { font-weight: 900; color: var(--gold); } #mission .m-r { font-weight: 900; color: var(--money); }
#wallet { position: fixed; top: calc(146px + env(safe-area-inset-top, 0px)); inset-inline-start: 10px; padding: 6px 12px; border-radius: 16px; z-index: 10; font-weight: 700; font-size: .88rem; background: rgba(14,12,24,.75); border: 3px solid var(--ink); }
#wallet[hidden] { display: none; }
#wallet button { border-radius: 999px; padding: 3px 10px; background: var(--red); color: #fff; font-weight: 900; border: 2px solid var(--ink); }
#toasts { position: fixed; top: calc(186px + env(safe-area-inset-top, 0px)); inset-inline: 16px; display: grid; justify-items: center; gap: 6px; pointer-events: none; z-index: 12; }
.toast { padding: 6px 16px; border-radius: 999px; font-weight: 900; font-size: 1rem; background: rgba(14,12,24,.85); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); animation: pop .25s ease-out; max-width: 100%; text-align: center; paint-order: stroke fill; }
.toast.good { color: var(--gold); } .toast.bad { color: #fff; background: var(--red); } .toast.info { color: #fff; }
#prompt { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; padding: 6px 16px 6px 8px; border-radius: 999px; z-index: 10; pointer-events: none; white-space: nowrap;
  font-weight: 900; background: rgba(14,12,24,.82); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
#prompt[hidden] { display: none; }
kbd { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 10px; font-family: var(--font); font-weight: 900; color: #3a2400; background: linear-gradient(#ffe36b, #ffb21a); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
#flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle, transparent 40%, rgba(229,56,59,.55)); opacity: 0; z-index: 9; }
#flash.on { animation: flash .45s ease-out; }
#speedlines { position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: 0; transition: opacity .2s;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0) 0deg 4deg, rgba(255,255,255,.16) 4.5deg 5deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 32%, #000 75%); mask-image: radial-gradient(circle at 50% 50%, transparent 32%, #000 75%); }
#speedo { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 6px; row-gap: 4px; padding: 8px 16px; border-radius: 18px; z-index: 10; pointer-events: none;
  background: rgba(14,12,24,.8); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
#speedo[hidden] { display: none; }
#speedo b { font-weight: 900; font-size: 2.3rem; line-height: 1; color: #5fe3ff; font-variant-numeric: tabular-nums; min-width: 2.4ch; text-align: center; paint-order: stroke fill; -webkit-text-stroke: 5px var(--ink); }
#speedo span { font-weight: 900; color: var(--muted); font-size: .8rem; }
#speedo .bbar { grid-column: 1 / -1; height: 9px; width: 150px; border-radius: 99px; background: rgba(0,0,0,.45); border: 2px solid var(--ink); overflow: hidden; }
#speedo .bbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff7a1a, #ffd23f); }
#speedo small { grid-column: 1 / -1; font-size: .7rem; font-weight: 900; color: var(--muted); text-align: center; }
#speedo.boost b { color: #ff8a2a; }

/* touch controls */
#touch { position: fixed; inset: auto 0 0 0; height: 240px; z-index: 15; pointer-events: none; }
#touch[hidden] { display: none; }
#joy { position: absolute; left: 22px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 136px; height: 136px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,.04)); border: 4px solid rgba(20,21,29,.7); box-shadow: 0 0 0 3px rgba(255,255,255,.18) inset; pointer-events: auto; touch-action: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px; background: url("../assets/ui/grey_S_round.png") center / 100% 100% no-repeat; }
.acts { position: absolute; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(4, 60px); grid-template-rows: repeat(2, 60px); gap: 8px; pointer-events: auto; direction: ltr; }
.acts button { width: 60px; height: 60px; background: url("../assets/ui/purple_S_round.png") center / 100% 100% no-repeat; font-weight: 900; font-size: .82rem; color: #fff; padding-bottom: 5px; touch-action: none; paint-order: stroke fill; -webkit-text-stroke: 3px rgba(0,0,0,.4); }
.acts .e { grid-column: 4; grid-row: 1 / span 2; height: 128px; width: 60px; background: url("../assets/ui/orange_XL_round.png") center / 100% 100% no-repeat; font-size: 1rem; }
.acts .f { background-image: url("../assets/ui/red_S_round.png"); }
.acts .r { background-image: url("../assets/ui/green_S_round.png"); }
.acts .q { background-image: url("../assets/ui/yellow_S_round.png"); color: #3a2400; -webkit-text-stroke: 0; }
.acts .c { background-image: url("../assets/ui/blue_S_round.png"); }
.acts button:active { transform: scale(.92); }
.has-touch #prompt { bottom: calc(196px + env(safe-area-inset-bottom, 0px)); }
.has-touch #speedo { bottom: calc(250px + env(safe-area-inset-bottom, 0px)); }

/* in-game kiosk shop */
.shop-list { display: grid; gap: 8px; max-height: 56vh; overflow-y: auto; }
.shop-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; text-align: start; padding: 10px 14px; border-radius: 16px; background: rgba(0,0,0,.28); border: 2px solid rgba(255,255,255,.08); }
.shop-item .si-name { font-weight: 900; font-size: 1.02rem; }
.shop-item .si-desc { grid-row: 2; color: var(--muted); font-size: .85rem; font-weight: 500; }
.shop-item .si-price { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 900; font-size: 1.3rem; color: var(--money); paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }
.shop-item:hover:not(:disabled) { border-color: var(--gold); }
.shop-item:disabled { opacity: .45; cursor: not-allowed; }

/* game over */
.score-big { font-weight: 900; font-size: clamp(3rem, 15vw, 4.6rem); line-height: 1; color: var(--gold); text-align: center; font-variant-numeric: tabular-nums; paint-order: stroke fill; -webkit-text-stroke: 9px var(--ink); text-shadow: 0 6px 0 var(--ink); }
.stars { display: flex; justify-content: center; gap: 6px; }
.stars svg { width: 54px; height: 54px; filter: drop-shadow(0 4px 0 var(--ink)); }
.stars svg:nth-child(2) { width: 68px; height: 68px; transform: translateY(-10px); }
.stars .off { fill: #4a4466; } .stars .on { fill: var(--gold); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.result-grid .card { text-align: center; padding: 8px; }
.result-grid b { display: block; font-weight: 900; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.result-grid small { color: var(--muted); font-weight: 600; }
.newbest { justify-self: center; background: var(--red); color: #fff; font-weight: 900; padding: 4px 14px; border-radius: 99px; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); animation: pulse 1s ease-in-out infinite; }
.newbest[hidden] { display: none; }

/* video-mode captions */
#caption { position: fixed; top: 16%; inset-inline: 6%; z-index: 80; text-align: center; font-weight: 900; font-size: clamp(2.2rem, 10vw, 4rem); line-height: 1.05; color: #fff; pointer-events: none;
  paint-order: stroke fill; -webkit-text-stroke: 12px var(--ink); text-shadow: 0 8px 0 var(--ink); }
#caption em { font-style: normal; color: var(--gold); }
#caption[hidden] { display: none; }
#touchfx { position: fixed; z-index: 90; width: 70px; height: 70px; margin: -35px; border-radius: 50%; border: 5px solid rgba(255,255,255,.9); background: rgba(255,255,255,.25); pointer-events: none; opacity: 0; }


/* ---------------------------------------------------------------- landscape phones (rotated) */
@media (orientation: landscape) and (max-height: 560px) {
  .screen { justify-content: flex-start; padding-block: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)); padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  .screen > .panel { margin-block: auto; margin-top: max(auto, 26px); }
  .screen { padding-top: calc(32px + env(safe-area-inset-top, 0px)); }
  .panel { padding: 30px 16px 14px; gap: 10px; width: min(760px, 100%); }
  .panel.narrow { width: min(560px, 100%); }
  .ribbon { height: 50px; top: -24px; font-size: 1.2rem; border-width: 0 25px; border-image-width: 0 25px; }
  .btn { height: 52px; border-width: 0 26px; border-image-width: 0 26px; font-size: 1.15rem; }
  .btn.xl { height: 62px; border-width: 0 31px; border-image-width: 0 31px; font-size: 1.45rem; min-width: 12rem; }
  #s-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; align-items: center; justify-items: center; gap: 6px 24px; }
  #s-main .topbar { grid-column: 1 / -1; }
  #s-main .hero { margin: 0; }
  #s-main .hero img { width: min(22vh, 130px); }
  #s-main .hero .title { font-size: clamp(2.2rem, 11vh, 3.4rem); }
  #s-main .menu-actions { gap: 8px; }
  #s-main .footer { grid-column: 1 / -1; }
  #s-chars .panel { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; width: min(820px, 100%); }
  #s-chars .charstage { grid-row: 1 / span 4; height: min(72vh, 340px); }
  .store-list, .shop-list, .legal { max-height: 58vh; }
  .lb-list { max-height: 30vh; }
  .pod.p1 .block { height: 64px; } .pod.p2 .block { height: 50px; } .pod.p3 .block { height: 40px; }
  .slides { min-height: 0; }
  .slide .art { width: 90px; height: 90px; font-size: 2.8rem; border-radius: 24px; }
  .slide .h2 { font-size: 1.4rem; }
  .stars svg { width: 40px; height: 40px; } .stars svg:nth-child(2) { width: 50px; height: 50px; }
  .score-big { font-size: 2.8rem; }
  #s-over .panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; width: min(760px, 100%); }
  #s-over .stars, #s-over .score-big, #s-over .newbest, #s-over #ov-why { grid-column: 1; }
  #s-over .result-grid { grid-column: 2; grid-row: 1 / span 3; }
  #s-over .row { grid-column: 2; }
  #loading img { width: min(28vh, 160px); }
  .phone-art { width: 80px; height: 80px; }
  #mission { top: calc(84px + env(safe-area-inset-top, 0px)); }
  #wallet { top: calc(122px + env(safe-area-inset-top, 0px)); }
  #toasts { top: calc(10px + env(safe-area-inset-top, 0px)); inset-inline: 30%; }
  .stats-box { width: min(300px, 40vw); padding: 6px 10px; }
  .respect b { font-size: 1.35rem; }
  #police { top: calc(56px + env(safe-area-inset-top, 0px)); }
  #touch { height: 100%; }
  #joy { left: max(22px, env(safe-area-inset-left, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px; }
  .acts { right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); grid-template-columns: repeat(4, 52px); grid-template-rows: repeat(2, 52px); gap: 6px; }
  .acts button { width: 52px; height: 52px; font-size: .74rem; }
  .acts .e { height: 110px; width: 52px; }
  .has-touch #prompt { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .has-touch #speedo { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  #caption { top: 12%; font-size: clamp(1.8rem, 9vh, 3rem); }
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes blink { to { opacity: .5; } }
@keyframes siren { to { filter: hue-rotate(150deg) saturate(1.6); } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
@media (max-width: 560px) { .panel { padding: 32px 14px 16px; border-radius: 26px; } .btn.xl { min-width: 0; width: 100%; } .menu-grid .btn { font-size: 1.05rem; } }
@media (max-height: 640px) { .hero img { width: 110px; } .hero .title { font-size: 2.6rem; } .charstage { height: 34vh; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.vmode *, .vmode *::before, .vmode *::after { animation: none !important; transition: none !important; }

/* video mode: captions sit above the menus instead of covering their ribbons */
.vmode.vcap #caption { top: 4.5%; font-size: clamp(2rem, 9vw, 3.4rem); }
.vmode.vcap .screen { padding-top: 19vh; }
.vmode.vcap #s-main .hero img { display: none; }
.vmode.vcap #mission { visibility: hidden; }
