:root {
  --bg: #0c0c10; --panel: rgba(14, 14, 20, 0.82); --line: #2c2c38; --ink: #ecebf2; --dim: #9a98a8;
  --gold: #ffd34d; --cash: #5fe07a; --prod: #b48cff;
  --font: 'Press Start 2P', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 10px; }
body.playing #game { cursor: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }
small { color: var(--dim); font-size: 0.8em; }
.sub { color: var(--dim); font-size: 8px; line-height: 1.6; }
button { font-family: var(--font); font-size: 9px; color: var(--ink); background: #2a2a36; border: 2px solid #000;
  box-shadow: inset -2px -2px 0 #1a1a22, inset 2px 2px 0 #3d3d4c; padding: 8px 10px; cursor: pointer; }
button:hover:not(:disabled) { background: #36364a; }
button:disabled { opacity: 0.4; cursor: default; }

/* screens */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8, 8, 12, 0.55); z-index: 10; overflow-y: auto; }
.card { width: min(560px, 100%); background: var(--panel); border: 4px solid #000; box-shadow: 0 0 0 2px var(--line), 8px 8px 0 rgba(0,0,0,.5); padding: 24px; text-align: center; }
h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.25; color: var(--ink); text-shadow: 4px 4px 0 #000; letter-spacing: 2px; }
h1 span { color: var(--gold); }
h1.rip span { color: #e5484d; }
.tag { color: var(--dim); margin: 0 0 18px; font-size: 9px; }
#name { width: 100%; font-family: var(--font); font-size: 12px; padding: 12px; background: #15151c; color: var(--ink); border: 2px solid #000; box-shadow: inset 2px 2px 0 #0a0a0e; text-align: center; margin-bottom: 14px; }
#gangs { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.gang { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; line-height: 1.5; border-color: #000; }
.gang canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.gang span { color: var(--c); font-size: 8px; }
.gang.sel { background: var(--d); box-shadow: 0 0 0 3px var(--c); }
.cta { width: 100%; font-size: 13px; padding: 14px; background: #8a6b12; color: #fff6d4; box-shadow: inset -3px -3px 0 #5a4508, inset 3px 3px 0 #c79c20; }
.cta:hover:not(:disabled) { background: #a1801b; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 16px 0 8px; text-align: left; font-size: 8px; color: var(--dim); }
.controls b { color: var(--ink); }
.how { font-size: 8px; line-height: 1.8; color: var(--dim); text-align: left; }
.how b { color: var(--ink); }
#best { margin-top: 8px; }

/* hud */
.panel { background: var(--panel); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line); padding: 10px; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#stats { position: absolute; left: 12px; top: 12px; width: 250px; line-height: 1.6; }
#stats .who { font-size: 10px; margin-bottom: 6px; }
#stats .who small { display: block; }
.row { display: flex; justify-content: space-between; gap: 8px; }
.row.big { font-size: 12px; margin-top: 6px; }
.cash { color: var(--cash); } .prod { color: var(--prod); }
.bar { position: relative; height: 10px; background: #000; border: 2px solid #000; margin: 4px 0; }
.bar i { display: block; height: 100%; background: var(--gold); transition: width .1s linear; }
.bar.hp { height: 14px; } .bar.hp i { background: #4ee06a; }
.bar em { position: absolute; inset: 0; font-style: normal; font-size: 7px; line-height: 10px; text-align: center; color: #fff; text-shadow: 1px 1px 0 #000; }
#turf { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; }
.blk { width: 220px; background: var(--panel); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line); padding: 8px; }
.blk.contested { box-shadow: 0 0 0 2px #fff; animation: blink .4s steps(2) infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 2px #e5484d; } }
.blk .bn { font-size: 9px; display: flex; justify-content: space-between; }
.blk .pk { font-size: 7px; color: var(--dim); line-height: 1.5; }
.blk .pk.mine { color: var(--gold); }
.mid { font-size: 7px; color: var(--dim); writing-mode: vertical-rl; }
#perks { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
#perks span { background: #2b2206; color: var(--gold); border: 2px solid #000; padding: 4px 8px; font-size: 8px; }
#board { position: absolute; right: 12px; top: 12px; width: 230px; font-size: 8px; line-height: 1.9; }
#board .h { color: var(--gold); margin-bottom: 4px; }
#board > div:not(.h):not(.gr) { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px; }
#board b { font-weight: normal; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#board .me { background: rgba(255,255,255,0.08); }
#board .gr { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 7px; justify-content: space-between; margin-top: 6px; border-top: 2px solid var(--line); padding-top: 4px; }
#weapon { position: absolute; left: 12px; bottom: 12px; width: 200px; }
#weapon .wn { font-size: 10px; }
#weapon .ammo { font-size: 20px; margin: 8px 0; }
#weapon .slots { display: flex; gap: 4px; }
#weapon .slots span { width: 22px; height: 22px; display: grid; place-items: center; background: #111; color: #444; border: 2px solid #000; font-size: 8px; }
#weapon .slots span.own { color: var(--ink); }
#weapon .slots span.cur { background: #8a6b12; color: #fff; }
#minimap { position: absolute; right: 12px; bottom: 12px; width: 200px; height: 180px; image-rendering: pixelated; border: 3px solid #000; box-shadow: 0 0 0 2px var(--line); }
#prompt { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); background: #000; color: var(--gold); padding: 8px 12px; font-size: 9px; }
#feed { position: fixed; right: 12px; bottom: 206px; width: 340px; text-align: right; font-size: 8px; line-height: 1.9; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; pointer-events: none; z-index: 6; }
#hurt { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(200, 0, 0, 0.0); z-index: 4; }
#hurt.on { animation: hurt .35s ease-out; }
@keyframes hurt { from { box-shadow: inset 0 0 140px rgba(220, 20, 30, 0.75); } to { box-shadow: inset 0 0 140px rgba(220, 20, 30, 0); } }

/* shop */
#modal { background: #121219; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); z-index: 8; }
#modal .mh { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gold); margin-bottom: 10px; }
#modal .mh small { flex: 1; color: var(--cash); font-size: 10px; }
#modal .item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 2px solid var(--line); }
#modal .item b { font-weight: normal; font-size: 10px; }
#modal .acts { display: flex; gap: 6px; flex-shrink: 0; }
#modal .foot { margin-top: 8px; }

/* death */
#deathInfo p { line-height: 1.8; font-size: 9px; }
#deathInfo .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
#deathInfo .grid div { background: #111118; border: 2px solid #000; padding: 10px; font-size: 11px; }
#deathInfo .grid small { display: block; margin-bottom: 6px; font-size: 7px; }
.newbest { color: var(--gold); }

@media (max-width: 900px) {
  #turf { top: auto; bottom: 170px; flex-direction: column; } .mid { display: none; } .blk { width: 200px; }
  #board { display: none; } #stats { width: 200px; } #perks { top: auto; bottom: 330px; }
  #minimap { width: 150px; height: 135px; } #feed { bottom: 160px; width: 240px; }
}

/* ---------- touch / phone ---------- */
#touch { display: none; }
.touch-only { display: none !important; }
body.touch .touch-only { display: grid !important; }
body.touch .desk-only { display: none !important; }
body.touch.playing #touch { display: block; position: fixed; inset: 0; z-index: 7; touch-action: none; user-select: none; -webkit-user-select: none; }
body.touch.playing, body.touch.playing #game { touch-action: none; overscroll-behavior: none; }
.stick { position: fixed; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.35); background: rgba(0,0,0,0.25); pointer-events: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.55); transform: translate(-50%, -50%); }
.stick.aim { border-color: rgba(255, 211, 77, 0.55); }
.stick.aim i { background: rgba(255, 211, 77, 0.7); }
#tbtns { position: fixed; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#tbtns button { min-width: 72px; min-height: 44px; font-size: 9px; background: rgba(30, 30, 42, 0.85); touch-action: none; }
#thint { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-size: 7px; color: rgba(255,255,255,0.4); white-space: nowrap; pointer-events: none; animation: fadehint 1s 8s forwards; }
@keyframes fadehint { to { opacity: 0; } }

/* compact HUD on touch devices */
body.touch #prompt { display: none !important; }
body.touch #board { display: none; }
body.touch #stats { left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(8px + env(safe-area-inset-top, 0px)); width: 170px; padding: 6px; font-size: 7px; line-height: 1.5; }
body.touch #stats .who { font-size: 8px; margin-bottom: 2px; }
body.touch #stats .row.big { font-size: 9px; margin-top: 2px; }
body.touch #stats .sub { font-size: 6px; }
body.touch .bar { height: 7px; margin: 2px 0; } body.touch .bar.hp { height: 11px; } body.touch .bar em { line-height: 7px; font-size: 6px; }
body.touch #weapon { left: calc(8px + env(safe-area-inset-left, 0px)); bottom: auto; top: calc(150px + env(safe-area-inset-top, 0px)); width: 170px; padding: 6px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
body.touch #weapon .wn { font-size: 7px; } body.touch #weapon .ammo { font-size: 11px; margin: 0; }
body.touch #weapon .slots { display: none; }
body.touch #turf { left: auto; right: calc(8px + env(safe-area-inset-right, 0px)); top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; transform: none; flex-direction: column; gap: 4px; }
body.touch .blk { width: 150px; padding: 5px; } body.touch .blk .bn { font-size: 7px; } body.touch .blk .pk { display: none; }
body.touch .mid { display: none; }
body.touch #perks { left: auto; right: calc(8px + env(safe-area-inset-right, 0px)); top: calc(94px + env(safe-area-inset-top, 0px)); bottom: auto; transform: none; flex-direction: column; align-items: flex-end; gap: 4px; }
body.touch #perks span { font-size: 6px; padding: 3px 5px; }
body.touch #minimap { right: calc(8px + env(safe-area-inset-right, 0px)); bottom: auto; top: calc(150px + env(safe-area-inset-top, 0px)); width: 120px; height: 108px; }
body.touch #feed { right: auto; left: 50%; transform: translateX(-50%); top: calc(250px + env(safe-area-inset-top, 0px)); bottom: auto; width: min(320px, 70vw); text-align: center; font-size: 6px; }
body.touch #modal { z-index: 9; max-height: calc(100% - 24px); overflow-y: auto; }
@media (max-width: 560px) {
  #modal .item { flex-direction: column; align-items: stretch; }
  #modal .acts button { flex: 1; }
  h1 { font-size: 22px; } .card { padding: 16px; } #gangs { gap: 6px; } .gang span { font-size: 7px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.touch #feed { top: calc(8px + env(safe-area-inset-top, 0px)); width: min(300px, calc(100vw - 400px)); }
  body.touch #weapon { top: calc(140px + env(safe-area-inset-top, 0px)); }
  body.touch #tbtns { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(26px + env(safe-area-inset-bottom, 0px)); flex-direction: row; align-items: flex-end; }
  body.touch #thint { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  body.touch #minimap { top: calc(140px + env(safe-area-inset-top, 0px)); }
  body.touch #perks { right: auto; left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(186px + env(safe-area-inset-top, 0px)); align-items: flex-start; }
  body.touch #tbE { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}

/* landscape-only on phones */
#rotate { position: fixed; inset: 0; z-index: 30; background: #0c0c10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px; color: #ecebf2; }
#rotate p { margin: 0; font-size: 14px; line-height: 1.7; color: #ffd34d; text-shadow: 3px 3px 0 #000; }
#rotate small { font-size: 8px; line-height: 1.8; color: #9a98a8; max-width: 260px; }
#rotate .phone { width: 46px; height: 80px; border: 5px solid #ecebf2; border-radius: 6px; position: relative; animation: turn 1.8s steps(1) infinite; }
#rotate .phone i { position: absolute; left: 50%; bottom: 4px; width: 8px; height: 4px; margin-left: -4px; background: #ecebf2; }
@keyframes turn { 0% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #rotate .phone { animation: none; transform: rotate(-90deg); } }
@media (orientation: landscape) and (max-height: 500px) {
  .screen { padding-block: 8px; }
  .card { padding: 12px 16px; width: min(620px, 100%); }
  h1 { font-size: 16px; margin-bottom: 4px; } h1 br { display: none; } h1 span { margin-left: 0.4em; }
  .tag { margin-bottom: 8px; font-size: 7px; }
  #name { padding: 8px; margin-bottom: 8px; font-size: 10px; }
  #gangs { margin-bottom: 8px; } .gang { flex-direction: row; justify-content: center; padding: 6px; }
  .gang canvas { width: 28px; height: 28px; }
  .cta { padding: 10px; font-size: 11px; }
  .controls { margin: 8px 0 0; } .how { display: none; } #best { margin-top: 6px; }
  #deathInfo .grid { grid-template-columns: repeat(3, 1fr); margin: 8px 0; } #deathInfo .grid div { padding: 6px; font-size: 9px; }
}

/* stacking: touch layer < hud (minimap tappable) < modal < map */
#hud { z-index: 8; }
#modal, body.touch #modal { z-index: 9; }
#minimap { pointer-events: auto; cursor: zoom-in; }
#mapview { position: fixed; inset: 0; z-index: 11; background: rgba(8, 8, 12, 0.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: zoom-out; touch-action: none; }
#bigmap { image-rendering: pixelated; border: 4px solid #000; box-shadow: 0 0 0 2px var(--line); max-width: calc(100vw - 32px); }
#mapview .legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 8px; color: var(--dim); }
#mapview .me { color: #fff; } #mapview .st { color: var(--gold); } #mapview .gs { color: #f3d27a; } #mapview .pl { color: var(--prod); }
/* context button (sell/shop/plug/stash) sits under the right thumb */
body.touch #tbE { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); min-width: 96px; min-height: 64px; font-size: 12px; z-index: 2;
  background: #8a6b12; color: #fff6d4; box-shadow: inset -3px -3px 0 #5a4508, inset 3px 3px 0 #c79c20; touch-action: none; }

.bar.armor { height: 10px; } .bar.armor i { background: #7fb2ff; } .bar.armor.none em { color: #666; }
body.touch .bar.armor { height: 9px; }
#mapview .hp { color: #ff6b6b; } #mapview .ar { color: #7fb2ff; }

/* mode picker + crew hud */
#modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.mode { display: flex; flex-direction: column; gap: 6px; padding: 10px; text-align: center; line-height: 1.4; }
.mode b { font-weight: normal; font-size: 10px; color: var(--ink); }
.mode small { font-size: 7px; }
.mode.sel { background: #3a2f0c; box-shadow: 0 0 0 3px var(--gold); }
.mode.sel b { color: var(--gold); }
#stats .crew { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 4px; border-top: 2px solid var(--line); color: var(--gold); }
@media (orientation: landscape) and (max-height: 500px) { #modes { margin-bottom: 6px; } .mode { padding: 6px; flex-direction: row; justify-content: center; } .mode small { display: none; } }

body.touch #stats .ks, body.touch #stats .nw, body.touch #stats .who + .row + .bar + .sub { display: none; }
body.touch #stats .crew { margin-top: 3px; padding-top: 2px; font-size: 7px; }
.tag.crewtag { color: var(--gold); }
@media (orientation: landscape) and (max-height: 500px) {
  body.touch #tbE { bottom: calc(40px + env(safe-area-inset-bottom, 0px)); min-height: 58px; }
  body.touch #minimap { top: calc(132px + env(safe-area-inset-top, 0px)); width: 110px; height: 99px; }
}

#modal .sect { margin-top: 10px; padding-top: 8px; border-top: 2px solid var(--gold); color: var(--gold); font-size: 9px; }
#modal .acts.wrap { flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
#modal .chip { padding: 4px 6px; font-size: 7px; margin: 2px 2px 0 0; }
#modal .item.dim { opacity: 0.5; }
#modal { max-height: calc(100% - 24px); overflow-y: auto; }
#modal .item { flex-wrap: wrap; }
#modal .item > div:first-child { flex: 1 1 220px; min-width: 0; }
#modal .acts { flex-wrap: wrap; justify-content: flex-end; }
#mapview .pr { color: #c9a13b; }
#stats .inc span:last-child { color: var(--cash); }
body.touch #stats .inc { font-size: 6px; }
#stats .prod i { font-style: normal; } #stats .prod .gr { color: #5fe07a; } #stats .prod .wh { color: #e8ecff; }
#stats .prod .bl { color: #4fc3ff; }
#stats .row.prod { font-size: 8px; color: var(--dim); }

/* ---------- safe areas: keep everything clear of notches, home bars and the app's own chrome ---------- */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
html, body { height: 100%; }
#game { width: 100%; height: 100%; }               /* 100vh lies on phones; fill the real viewport instead */
.screen { padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
#stats { top: calc(12px + var(--sat)); left: calc(12px + var(--sal)); }
#board { top: calc(12px + var(--sat)); right: calc(12px + var(--sar)); }
#weapon { bottom: calc(12px + var(--sab)); left: calc(12px + var(--sal)); }
#minimap { bottom: calc(12px + var(--sab)); right: calc(12px + var(--sar)); }
#modal, body.touch #modal {
  top: calc(50% + (var(--sat) - var(--sab)) / 2);
  max-height: calc(100% - 24px - var(--sat) - var(--sab));
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
#mapview { padding: var(--sat) var(--sar) var(--sab) var(--sal); }
/* iOS inflates text in landscape unless told not to; keep the pixel font at the sizes we set */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#modal .subsect { margin-top: 8px; font-size: 7px; color: var(--dim); letter-spacing: 1px; }
#weapon .slots { flex-wrap: wrap; align-items: center; }
#weapon .slots .q { font-size: 6px; margin-left: 4px; }
#modal .heatbtn { display: flex; width: 100%; justify-content: space-between; align-items: center; margin: 0 0 10px;
  padding: 12px; font-size: 11px; color: #fff3d0; background: #6e1f1f; box-shadow: inset -3px -3px 0 #3f1010, inset 3px 3px 0 #a33a2a; }
#modal .heatbtn:hover { background: #852626; }
#modal .heatbtn small { color: #ffcf9a; font-size: 7px; }
#modal .heatbtn.back { background: #2a2a36; color: var(--ink); box-shadow: inset -2px -2px 0 #1a1a22, inset 2px 2px 0 #3d3d4c; justify-content: flex-start; }

/* O'Block traps box */
.blk.ob .traps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 4px 0; }
.blk.ob .traps span { height: 8px; background: #000; border: 2px solid #444; display: block; }
.blk.ob .traps span i { display: block; height: 100%; }
#mapview .ob { color: #7fc8f0; }

/* gang carousel */
#gangs .arr { font-size: 18px; padding: 0; }
.gcard { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px; background: linear-gradient(180deg, var(--d), #101016);
  border: 3px solid #000; box-shadow: 0 0 0 2px var(--c); cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; min-width: 0; }
.gcard canvas { width: 120px; height: 150px; image-rendering: pixelated; flex-shrink: 0; }
.ginfo { text-align: left; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gname { font-size: 15px; line-height: 1.3; text-shadow: 2px 2px 0 #000; }
.gtag { font-size: 8px; color: var(--dim); letter-spacing: 2px; }
.gswatch { display: flex; gap: 4px; } .gswatch i { width: 16px; height: 16px; border: 2px solid #000; }
.glive { font-size: 7px; color: var(--dim); line-height: 1.8; }
#gdots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.gdot { width: 14px; height: 14px; padding: 0; background: #222; border: 2px solid #000; box-shadow: none; }
.gdot.sel { background: var(--c); box-shadow: 0 0 0 2px var(--c); }
@media (max-width: 560px) { .gcard { flex-direction: column; gap: 8px; } .ginfo { text-align: center; align-items: center; } .gname { font-size: 12px; } }
@media (orientation: landscape) and (max-height: 500px) {
  .gcard { padding: 4px; gap: 10px; } .gcard canvas { width: 60px; height: 75px; } .gname { font-size: 11px; } .ginfo { gap: 4px; }
  #gdots { margin-bottom: 8px; } .gdot { width: 10px; height: 10px; }
}
/* MORE HEAT sits in the shop title row */
#modal .mh .heatbtn { display: inline-flex; width: auto; margin: 0; padding: 6px 10px; font-size: 9px; flex-shrink: 0; }

/* ---------- radar panel (phones): turf chips + minimap in one corner, minimap is display-only ---------- */
#minimap { width: 210px; height: 135px; }
body.touch #turf { right: calc(8px + var(--sar)); top: calc(8px + var(--sat)); left: auto; bottom: auto; transform: none;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 168px; flex-direction: initial; }
body.touch .blk { width: auto; min-width: 0; padding: 3px 4px; border-width: 2px; box-shadow: none; }
body.touch .blk .bn { font-size: 6px; gap: 2px; overflow: hidden; white-space: nowrap; }
body.touch .blk .bn small { font-size: 5px; flex-shrink: 0; }
body.touch .blk .bar { height: 4px; margin: 2px 0 0; border-width: 1px; }
body.touch .blk .pk { display: none; }
body.touch .blk.ob .traps { margin: 2px 0 0; gap: 2px; } body.touch .blk.ob .traps span { height: 4px; border-width: 1px; }
body.touch #minimap { pointer-events: none; right: calc(8px + var(--sar)); top: calc(70px + var(--sat)); bottom: auto; width: 168px; height: 108px; }
body.touch #perks { right: auto; left: calc(8px + var(--sal)); top: calc(186px + var(--sat)); align-items: flex-start; }
@media (orientation: landscape) and (max-height: 500px) {
  body.touch #minimap { top: calc(70px + var(--sat)); width: 150px; height: 96px; }
  body.touch #turf { width: 150px; }
  body.touch #tbE { bottom: calc(40px + var(--sab)); }
}
.blk .short { display: none; }
body.touch .blk .full { display: none; } body.touch .blk .short { display: inline; }
body.touch .blk .bn { display: flex; justify-content: space-between; }

/* gang rail */
#gdots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
#gdots::-webkit-scrollbar { display: none; }
#gdots .gdot { width: auto; height: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 3px;
  background: #15151c; border: 2px solid #000; box-shadow: none; flex-shrink: 0; opacity: 0.6; }
#gdots .gdot canvas { width: 36px; height: 46px; image-rendering: pixelated; }
#gdots .gdot span { font-size: 6px; color: var(--c); letter-spacing: 1px; }
#gdots .gdot:hover { opacity: 0.9; }
#gdots .gdot.sel { opacity: 1; background: var(--d); box-shadow: 0 0 0 2px var(--c); }
@media (orientation: landscape) and (max-height: 500px) {
  #gdots { margin-bottom: 6px; gap: 4px; padding: 2px; } #gdots .gdot { padding: 2px 4px; } #gdots .gdot canvas { width: 22px; height: 28px; } #gdots .gdot span { font-size: 5px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .card .tag { display: none; }
  #name { padding: 6px; margin-bottom: 6px; }
  .controls { margin-top: 4px; gap: 3px 12px; }
  #gangs { margin-bottom: 4px; }
}
#modal, #modal button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#modal button:active:not(:disabled) { transform: translateY(1px); filter: brightness(1.2); }

/* explosives in the weapon box */
#weapon .thr { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 6px; color: #555; }
#weapon .thr .has { color: var(--gold); }
body.touch #weapon .thr { display: none; }
#tbtns #tbT { background: #5a2a12; color: #ffd9b0; }
/* spawn choice */
#spawnpick { display: flex; justify-content: center; align-items: center; gap: 6px; margin: -6px 0 12px; font-size: 7px; color: var(--dim); }
#spawnpick .sp { padding: 6px 10px; font-size: 7px; }
#spawnpick .sp.sel { background: #3a2f0c; box-shadow: 0 0 0 2px var(--gold); color: var(--gold); }
@media (orientation: landscape) and (max-height: 500px) { #spawnpick { margin: -2px 0 6px; } }
#stats .prod b { font-weight: normal; } #stats .prod .sm { display: none; }
body.touch #stats .prod .lg { display: none; } body.touch #stats .prod .sm { display: inline; }
body.touch #stats .row.prod { white-space: nowrap; }
#stats .car span:first-child { color: #ffd34d; }

/* continue + start over */
.cta.cont { margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.cta.cont small { color: #fff3c4; font-size: 7px; letter-spacing: 0; }
.cta.alt { background: #2a2a36; color: var(--dim); box-shadow: inset -2px -2px 0 #1a1a22, inset 2px 2px 0 #3d3d4c; font-size: 9px; padding: 10px; }
/* mansion tabs + quantity picker */
#modal .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 0 8px; }
#modal .tabs button { padding: 8px 4px; font-size: 8px; }
#modal .tabs button.on { background: #3a2f0c; color: var(--gold); box-shadow: inset 0 -3px 0 var(--gold); }
#modal .qrow { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px 0; border-top: 2px solid var(--line); }
#modal .qh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
#modal .qh b { font-weight: normal; font-size: 10px; }
#modal .qctl { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#modal .qctl > button { min-width: 34px; padding: 7px 8px; }
#modal .qv { min-width: 70px; text-align: center; font-size: 11px; color: var(--ink); background: #0d0d12; border: 2px solid #000; padding: 6px 4px; }
#modal .qp { font-size: 8px; } #modal .qp.on { color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
#modal .qact { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#modal .qact button { padding: 9px; }
#modal .glist { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
/* picker + actions share one line; tighter on phones */
#modal .qrow { grid-template-columns: 1fr auto; grid-template-areas: "qh qh" "qctl qact"; align-items: center; }
#modal .qh { grid-area: qh; } #modal .qctl { grid-area: qctl; } #modal .qact { grid-area: qact; grid-template-columns: auto auto; }
#modal .qact button { padding: 8px 10px; font-size: 8px; }
@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  #modal .qrow { padding: 5px 0; gap: 4px; }
  #modal .qctl > button, #modal .qp { min-width: 0; padding: 5px 6px; font-size: 7px; }
  #modal .qv { min-width: 52px; padding: 4px 2px; font-size: 9px; }
  #modal .qact button { padding: 6px 8px; font-size: 7px; }
  #modal .tabs button { padding: 6px 2px; font-size: 7px; }
}

/* ---------- wanted stars + hot money ---------- */
#stats .row.wanted { margin-top: 3px; font-size: 9px; color: #9fc4ff; }
#stats .row.wanted .stars { font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1; color: #e8ecff; letter-spacing: 1px; animation: copflash 0.5s steps(1) infinite; }
#stats .row.wanted .stars.hi { color: #ff8a8e; }
@keyframes copflash { 50% { color: #5f8dff; } }
body.touch #stats .row.wanted { font-size: 7px; margin-top: 2px; align-items: center; }
body.touch #stats .row.wanted .stars { font-size: 12px; }

/* home invasion: nerves meter in the resident panel */
#modal .bar.nerves { margin: 6px 0 8px; } #modal .bar.nerves i { background: linear-gradient(90deg, #9fd3ff, #f0a040 50%, #e5484d); }

#tbtns #tbU { background: #1f4a2a; color: #b8f5c4; }

/* the stats box folds down to a slim strip (tap it, or H) */
#stats { pointer-events: auto; cursor: pointer; }
#stats.mini { width: 150px; }
body.touch #stats.mini { width: 120px; padding: 4px 6px; }
#stats.mini .bar.armor { height: 4px; margin: 1px 0; }
#stats.mini .row.prod i { font-style: normal; }

/* ---------- subway ---------- */
.bullet { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 18px; }
.bullet.sm { width: 14px; height: 14px; font-size: 9px; vertical-align: middle; }
#subway { position: fixed; inset: 0; z-index: 50; background: #111318; overflow: hidden; }
#subway .tunnel { position: absolute; left: 0; right: 0; top: 18%; height: 34%; background: #050608; }
#subway .streaks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 140px, rgba(255,226,140,0.9) 140px 150px, transparent 150px 320px);
  filter: blur(1px); animation: tunnel 0.35s linear infinite; }
@keyframes tunnel { from { background-position: 0 0; } to { background-position: -320px 0; } }
#subway .car { position: absolute; inset: 0; pointer-events: none; animation: rattle 0.18s steps(2) infinite; }
@keyframes rattle { 50% { transform: translateY(2px); } }
#subway .win { position: absolute; top: 16%; height: 38%; width: 26%; border: 10px solid #9aa2ad; border-radius: 14px; box-shadow: inset 0 0 0 4px #5a6270; }
#subway .win:nth-child(1) { left: 4%; } #subway .win:nth-child(2) { left: 37%; } #subway .win:nth-child(3) { left: 70%; }
#subway .car { background: linear-gradient(#c9ced6 0 16%, transparent 16% 54%, #c9ced6 54% 62%, #7a8494 62% 66%, #c9ced6 66%); }
#subway .poles i { position: absolute; top: 0; bottom: 12%; width: 8px; background: linear-gradient(90deg, #8a8f99, #f2f2f2, #8a8f99); }
#subway .poles i:nth-child(1) { left: 20%; } #subway .poles i:nth-child(2) { left: 46%; } #subway .poles i:nth-child(3) { left: 72%; } #subway .poles i:nth-child(4) { left: 96%; }
#subway .seats { position: absolute; left: 0; right: 0; bottom: 6%; height: 14%; background: repeating-linear-gradient(90deg, #f06a2a 0 70px, #d85a20 70px 74px); border-top: 6px solid #a8481a; }
#subway .sign { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: #111; color: #fff; padding: 8px 18px; border: 3px solid #000; }
#subway .sign small { display: block; font-size: 8px; color: #aaa; } #subway .sign b { font-size: 14px; }
#subway .doors { position: absolute; left: 0; right: 0; bottom: 28%; text-align: center; color: #ffe27a; font-size: 10px; text-shadow: 2px 2px 0 #000; opacity: 0; }
#subway.go .doors { animation: doors 2.6s steps(1) forwards; }
@keyframes doors { 0% { opacity: 1; } 18% { opacity: 0; } 80% { opacity: 0; } 82% { opacity: 1; } }
/* ---------- dice ---------- */
#modal .die { font-family: Arial, Helvetica, sans-serif; font-size: 34px; line-height: 1; margin-right: 4px; color: #f2f2f2; }
#modal .item.dice b { display: block; margin-top: 6px; }

/* pickup basketball timing bar */
#modal .shotbar { position: relative; height: 26px; margin: 12px 0; background: #1b1b1f; border: 3px solid #000; }
#modal .shotbar .zone { position: absolute; top: 0; bottom: 0; background: #2e8b57; }
#modal .shotbar .mark { position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px; background: #ffd34d; left: 0; animation: sweep 1s ease-in-out infinite alternate; }
@keyframes sweep { from { left: 0%; } to { left: 100%; } }
#modal button.big { min-width: 160px; min-height: 52px; font-size: 14px; background: #c94a2a; }

/* poker cards */
#modal .hand { margin: 2px 0 8px; } #modal .pcard { display: inline-block; min-width: 30px; padding: 5px 3px; margin-right: 4px; background: #f2f2f2; color: #111; border: 2px solid #000; text-align: center; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 15px; } #modal .pcard.red { color: #c0262d; }

/* gun sprites: inline shop icons (row height unchanged), the mansion gun wall */
#modal .gicon { height: 11px; width: auto; vertical-align: -1px; margin-right: 5px; image-rendering: pixelated; }
#modal .gwall { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 6px 0; padding: 8px; background: #3a2c20; border: 2px solid #1a120c;
  background-image: radial-gradient(#1a120c 1px, transparent 1.5px); background-size: 10px 10px; }
#modal .gwall .peg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 54px; padding: 4px; margin: 0; background: rgba(0,0,0,0.25); border: 1px solid #5a4430; }
#modal .gwall .peg.empty { border-style: dashed; opacity: 0.5; }
#modal .gwall .peg span { font-size: 6px; line-height: 1.2; text-align: center; }
#modal .gwall .wicon { max-width: 96px; max-height: 30px; image-rendering: pixelated; }

/* car paint swatches in the customs bay / chop shop */
#modal .swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#modal .swatches .sw { width: 26px; height: 20px; min-width: 0; padding: 0; margin: 0; border: 2px solid #0d0d10; box-shadow: 0 0 0 1px #5a5d66; }
#modal .swatches .sw.on { box-shadow: 0 0 0 2px #ffd34d; }

/* the Gangsta Card */
#modal .gcard { display: flex; justify-content: center; margin: 8px 0; }
#modal .gcard img { width: auto; max-width: min(100%, 360px); max-height: 72vh; height: auto; image-rendering: auto; border: 0; }
#modal.cardmode { width: min(980px, calc(100vw - 20px)); padding: 8px; }
#modal .gcard.wide { margin: 0 0 6px; }
#modal .gcard.wide img { max-width: 100%; max-height: calc(100vh - 104px); width: auto; }
#modal .acts.center { justify-content: center; display: flex; gap: 8px; }
#modal a.btn { display: inline-block; padding: 8px 12px; background: #ffd34d; color: #111; font: inherit; font-size: 9px; text-decoration: none; border: 2px solid #000; }
#deathInfo .gcard { display: flex; justify-content: center; margin-top: 10px; }
#deathInfo .gcard img { width: 100%; max-width: 280px; height: auto; }
#deathInfo .gcard.wide img { max-width: 100%; }

/* stash / vault sliders */
#modal .qs { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#modal .qs button { flex: 0 0 auto; padding: 8px 8px; font-size: 8px; }
#modal .qs input[type=range] { flex: 1 1 auto; min-width: 80px; height: 28px; accent-color: #ffd34d; touch-action: none; }
#modal .qh small b { color: #fff; }

/* best run card on the menu */
#best .bestcard { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 8px auto 0; padding: 4px; background: none; border: 0; cursor: pointer; }
#best .bestcard img { height: 96px; width: auto; image-rendering: auto; border: 2px solid #000; }
#best .bestcard span { font-size: 7px; color: #ffd34d; }
.cardview { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; }
.cardview img { max-width: 100%; max-height: calc(100vh - 60px); width: auto; height: auto; }
.cardview small { color: #8a8f99; font-size: 8px; }

/* street cee-lo */
#modal .cl-info { display: flex; gap: 12px; flex-wrap: wrap; font-size: 9px; margin: 2px 0 8px; color: #ffd34d; }
#modal .cl-table { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
#modal .cl-seat { flex: 1 1 90px; background: #0d0d10; border: 2px solid #26272e; padding: 6px; text-align: center; }
#modal .cl-seat small { display: block; font-size: 7px; color: #8a8f99; }
#modal .cl-seat.me { border-color: #3a5a8a; }
#modal .cl-seat.win { border-color: #5fe07a; background: #12251a; }
#modal .cl-seat .die { font-size: 22px; line-height: 1.1; color: #f2f2f2; }
#modal .cl-res { font-size: 10px; margin: 6px 0; }
#modal .cl-side { background: #1c1a10; border: 2px solid #6a5a20; padding: 8px; margin: 6px 0; font-size: 8px; line-height: 1.6; }
#modal .cl-side span { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#modal .cl-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
#modal .cl-chips button { flex: 1 1 60px; }
#modal .cl-chips button.on { background: #ffd34d; color: #111; }
#modal .cl-roll { flex: 2 1 140px; background: #5fe07a; color: #0d0d10; font-size: 11px; padding: 12px; }

/* gun shop: fixed-height panel so nothing in it can move the Recruit bar pinned to its bottom edge */
#modal.shopm { height: calc(100% - 24px - var(--sat) - var(--sab)); padding-bottom: 0; display: flex; flex-direction: column; }
#modal.shopm > * { flex-shrink: 0; }
#modal .clsbar { display: flex; width: 100%; justify-content: space-between; align-items: center; margin: 0 0 4px; padding: 6px 10px; font-size: 8px;
  background: #1c1c26; color: var(--dim); box-shadow: inset -2px -2px 0 #111118, inset 2px 2px 0 #2c2c3a; }
#modal .clsbar small { font-size: 7px; color: var(--dim); }
#modal .clsbar.on { background: #6b1f1f; color: #fff; box-shadow: inset -2px -2px 0 #3d1010, inset 2px 2px 0 #8a2b2b; }
#modal .clsbar.on small { color: #ffcf9a; }
#modal .clsopen { border-left: 3px solid #6b1f1f; padding-left: 8px; margin: 0 0 8px; }
#modal .clsopen > .item:first-child { border-top: 0; }
#modal .recbar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: auto -10px 0; padding: 8px 10px; background: #1a1a10; border-top: 3px solid var(--gold); }
#modal .recbar b { font-size: 10px; color: var(--gold); font-weight: normal; }
#modal .recbar small { font-size: 8px; }
#modal .recbar button { flex-shrink: 0; }
@media (orientation: landscape) and (max-height: 500px) { #modal .recbar .sub { display: none; } #modal .recbar { padding-top: 6px; padding-bottom: 6px; } }

/* death screen on any landscape screen: words + RUN IT BACK on the left, the card on the right sized to fit. No scrolling.
   Phones drop the stat boxes (the card already shows them). */
@media (orientation: landscape) and (min-width: 640px) {
  #death .card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px; align-items: center; align-content: center; width: min(1100px, 100%); }
  #death .card > *, #deathInfo > * { grid-column: 1; }
  #deathInfo { display: contents; }
  #deathInfo p { margin: 0 0 8px; }
  #deathInfo .gcard.death { grid-column: 2; grid-row: 1 / span 8; margin: 0; align-self: center; }
  #deathInfo .gcard.death img { width: auto; max-width: 52vw; max-height: calc(100vh - 48px - var(--sat) - var(--sab)); }
  #again { margin-top: 6px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #deathInfo .grid { display: none; }
  #deathInfo .gcard.death img { max-width: 48vw; }
}
#modal .upbtn.on { background: #6b1f1f; color: #fff; }
#modal .updrawer { border-left: 3px solid var(--gold); padding-left: 8px; margin: 0 0 6px; }
#modal .updrawer .item:first-child { border-top: 0; }

/* feedback: a quiet text link on the menu + death screen, and a small panel over everything */
.fblink { background: none; border: 0; box-shadow: none; color: var(--dim); font-size: 8px; padding: 6px; margin: 6px auto 0; display: block; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.fblink:hover { color: var(--ink); background: none; }
#fbk { z-index: 12; background: rgba(8, 8, 12, 0.8); }
#fbk .fbcard { width: min(460px, 100%); text-align: left; }
#fbk .mh { display: flex; justify-content: space-between; align-items: center; color: var(--gold); font-size: 12px; margin-bottom: 8px; }
#fbk textarea { width: 100%; box-sizing: border-box; background: #0b0b10; color: var(--ink); border: 2px solid var(--line); padding: 8px; font: 10px/1.6 'Press Start 2P', monospace; resize: none; }
#fbk textarea:focus { outline: none; border-color: var(--gold); }
#fbk .fbrow { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 10px; }
#fbk .fbrow .cta { width: auto; padding: 8px 18px; }
#fbk #fbmsg { min-height: 1em; margin-top: 6px; color: var(--cash); }
@media (orientation: landscape) and (max-height: 500px) { #fbk textarea { rows: 3; height: 74px; } #fbk .fbcard { padding: 10px 14px; } }
