:root {
  --blue: #3A82D0;
  --blue-dark: #2A62A3;
  --ink: #262626;
  --mute: #9aa3ad;
  --amber: #F2B53A;
  --red: #E0533D;
  --green: #4CB06A;
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #262626; color: #fff; position: fixed; inset: 0;
  font-family: Inter, system-ui, sans-serif; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.chip { background: rgba(26,26,26,.82); border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.topbar { position: absolute; top: calc(10px + var(--st)); left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); display: flex;
  align-items: flex-start; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 7px 8px; }
.brand img { height: 38px; width: auto; display: block; }
.money { display: flex; flex-direction: column; line-height: 1; min-width: 96px; }
.money span { font-family: 'Bebas Neue', Impact, sans-serif; font-size: 30px; letter-spacing: .5px; }
.money small { font-size: 11px; color: var(--mute); font-weight: 600; margin-top: 2px; white-space: nowrap; }
.tbar { height: 4px; border-radius: 3px; background: rgba(255,255,255,.12); margin-top: 4px; overflow: hidden; }
.tbar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .3s; }
.clock { text-align: center; padding: 5px 14px 6px; }
#clock { font-family: 'Bebas Neue', Impact, sans-serif; font-size: 26px; line-height: 1; letter-spacing: .5px; }
.sub2 { font-size: 11px; font-weight: 700; color: var(--mute); letter-spacing: .8px; }
#stars { color: var(--amber); font-size: 15px; letter-spacing: 2px; line-height: 1.2; }
#stars .off { color: rgba(255,255,255,.18); }
.btns { display: flex; gap: 6px; pointer-events: auto; }
.iconbtn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(26,26,26,.82); color: #fff; font-size: 16px; cursor: pointer; }
.iconbtn:active { transform: scale(.95); }

#radio { position: absolute; top: calc(78px + var(--st)); left: 50%; transform: translate(-50%, -6px); max-width: min(560px, calc(100% - 400px));
  background: rgba(26,26,26,.88); border-radius: 12px; padding: 7px 12px; font-size: 13.5px; line-height: 1.35; opacity: 0;
  transition: opacity .25s, transform .25s; border: 1px solid rgba(255,255,255,.1); text-align: center; }
#radio.show { opacity: 1; transform: translate(-50%, 0); }
#radio b { display: block; font-size: 10.5px; letter-spacing: .8px; color: #9cc6f0; text-transform: uppercase; }

#leftcol { position: absolute; top: calc(70px + var(--st)); left: calc(10px + var(--sl)); width: 210px; display: flex; flex-direction: column; gap: 8px; }
#gauge { padding: 8px 10px 10px; }
.glabel { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; font-weight: 700;
  letter-spacing: .8px; color: var(--mute); margin-bottom: 4px; }
.glabel b { color: #fff; font-size: 12px; letter-spacing: 0; }
.glabel.fresh { margin-top: 8px; }
.bar { height: 9px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; border-radius: 6px; background: var(--blue); transition: width .15s linear; }
#freshBar { background: var(--green); }
#freshBar.warn { background: var(--amber); }
#freshBar.bad { background: var(--red); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
#combo { margin-top: 8px; font-family: 'Bebas Neue', Impact, sans-serif; font-size: 20px; color: var(--amber); letter-spacing: 1px; line-height: 1; }
#missions { padding: 8px 10px; font-size: 12px; pointer-events: auto; }
#missions h4 { margin: 0 0 4px; font-size: 10.5px; letter-spacing: .8px; color: var(--mute); }
#missions li, .mlist li { list-style: none; display: flex; gap: 6px; align-items: flex-start; margin: 3px 0; line-height: 1.3; }
#missions ul, .mlist { margin: 0; padding: 0; }
.mlist li .r, #missions li .r { margin-left: auto; color: #8fd4a2; font-weight: 700; white-space: nowrap; }
li.done { opacity: .8; } #missions li.done .t { text-decoration: line-through; }
li.fail .r { color: #ffb4a6; }

#side { position: absolute; top: calc(70px + var(--st)); right: calc(10px + var(--sr)); width: 210px; display: flex; flex-direction: column; gap: 8px; }
#minimap { width: 210px; height: 176px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); pointer-events: auto; cursor: zoom-in;
  box-shadow: 0 6px 18px rgba(0,0,0,.3); background: #8fa860; }
#jobs { display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 7px 10px; border-radius: 10px;
  background: rgba(26,26,26,.85); border: 2px solid transparent; cursor: pointer; text-align: left; color: #fff; }
.job.sel { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,130,208,.25); }
.job.special { background: linear-gradient(135deg, rgba(58,130,208,.35), rgba(26,26,26,.9) 60%); }
.job.big { background: linear-gradient(135deg, rgba(242,181,58,.3), rgba(26,26,26,.9) 60%); }
.job .t { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .w { font-size: 11px; color: var(--mute); grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .tm { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 24px; line-height: 1; text-align: right; }
.job .tm small { display: block; font-family: Inter, sans-serif; font-size: 10px; color: var(--mute); font-weight: 600; }
.job.warn .tm { color: var(--amber); }
.job.bad .tm { color: var(--red); animation: blink .5s steps(2) infinite; }
.job .prog { grid-column: 1 / span 2; height: 4px; margin-top: 5px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.job .prog i { display: block; height: 100%; background: #c9ccd1; }

#toast { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); text-align: center;
  font-family: 'Bebas Neue', Impact, sans-serif; font-size: 46px; line-height: 1; letter-spacing: 1px;
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 24px rgba(0,0,0,.35); opacity: 0; transition: opacity .25s, transform .25s; white-space: nowrap; }
#toast small { display: block; font-family: Inter, sans-serif; font-weight: 700; font-size: 15px; letter-spacing: 0; margin-top: 6px; }
#toast.show { opacity: 1; transform: translate(-50%, -60%); }
#toast.good b { color: #8fd4a2; }
#toast.gold b { color: var(--amber); }
#toast.bad { color: #ffd2c9; }
#hint { position: absolute; left: 50%; bottom: calc(24px + var(--sb)); transform: translateX(-50%);
  background: rgba(26,26,26,.85); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity .2s; white-space: nowrap; border: 1px solid rgba(255,255,255,.1); }
#hint.show { opacity: 1; }
body.touch #hint { bottom: calc(150px + var(--sb)); }

/* ---------- Touch controls ---------- */
#touch { position: fixed; left: 0; right: 0; bottom: calc(18px + var(--sb)); display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 calc(14px + var(--sr)) 0 calc(14px + var(--sl)); pointer-events: none; }
.pad { display: flex; gap: 12px; pointer-events: auto; align-items: flex-end; }
.pad .col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pad button { width: 84px; height: 84px; border-radius: 22px; border: 2px solid rgba(255,255,255,.18);
  background: rgba(26,26,26,.6); color: #fff; font-size: 30px; font-family: 'Bebas Neue', Impact, sans-serif;
  letter-spacing: 1px; touch-action: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pad button small { display: block; font-size: 13px; opacity: .7; }
.pad button.on { background: rgba(58,130,208,.75); border-color: rgba(255,255,255,.4); }
.pad .gas { background: rgba(58,130,208,.55); height: 110px; }
.pad .brake { font-size: 22px; }
.pad .horn { width: 56px; height: 48px; font-size: 22px; border-radius: 16px; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(20px + var(--st)) calc(16px + var(--sr)) calc(20px + var(--sb)) calc(16px + var(--sl)); overflow-y: auto; touch-action: pan-y;
  -webkit-overflow-scrolling: touch; }
.screen > .card { margin: auto 0; }
#title, #end, #intro, #shop, #cards, #loading { background: linear-gradient(180deg, rgba(20,20,20,.55), rgba(20,20,20,.9) 70%), url(assets/hero.jpg) center/cover no-repeat; }
#pause { background: rgba(15,15,15,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#bigmap { background: rgba(15,15,15,.92); padding: calc(12px + var(--st)) calc(12px + var(--sr)) calc(12px + var(--sb)) calc(12px + var(--sl)); }
#bigmapCanvas { max-width: 100%; max-height: calc(100% - 30px); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.maphint { color: var(--mute); font-size: 13px; margin: 8px 0 0; }
.card { width: 100%; max-width: 460px; text-align: center; }
.card.panel { background: rgba(26,26,26,.86); border-radius: 20px; padding: 22px 20px; border: 1px solid rgba(255,255,255,.08); }
.card.wide { max-width: 640px; }
.card.small { max-width: 380px; }
.logo-card { display: inline-block; background: #fff; border-radius: 16px; padding: 14px 20px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.logo-card img { height: 92px; display: block; }
h1, h2 { font-family: 'Bebas Neue', Impact, sans-serif; font-weight: 400; letter-spacing: 2px; margin: 14px 0 4px; line-height: .95; }
h1 { font-size: 76px; background: linear-gradient(180deg, #fff 55%, #cfe1f5); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 50px; margin-top: 0; }
h3 { font-size: 12px; letter-spacing: 1px; color: var(--mute); margin: 16px 0 6px; text-align: left; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 2px; color: #9cc6f0; font-weight: 700; }
.sub { margin: 4px auto 14px; max-width: 400px; color: #d7dbe0; font-size: 15px; line-height: 1.45; }
.big { display: block; width: 100%; max-width: 320px; margin: 16px auto 0; padding: 16px 20px; border: 0; border-radius: 14px;
  background: var(--blue); color: #fff; font-family: 'Bebas Neue', Impact, sans-serif; font-size: 30px; letter-spacing: 2px;
  cursor: pointer; box-shadow: 0 6px 0 var(--blue-dark), 0 12px 24px rgba(0,0,0,.3); }
.big:hover { background: #4a90db; }
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--blue-dark); }
.ghost { display: inline-block; margin-top: 14px; color: #cfd6de; background: none; border: 0; font: 600 15px Inter, sans-serif;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(26,26,26,.8); color: #fff; font: 600 14px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.pill.off { opacity: .5; text-decoration: line-through; }
.pill span { color: var(--mute); }
.keys { font-size: 12px; color: var(--mute); margin: 14px 0 0; }
.best { font-size: 13px; color: #cfd6de; margin: 10px 0 0; min-height: 1em; }
.credit { margin-top: 18px; font-size: 13px; color: #cfd6de; text-align: center; }
.credit a { color: #9cc6f0; font-weight: 700; text-decoration: none; }
.target-card { display: flex; justify-content: space-between; align-items: center; background: rgba(58,130,208,.2); border: 1px solid rgba(58,130,208,.5);
  border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.target-card span { font-weight: 600; color: #cfe1f5; }
.target-card b { font-family: 'Bebas Neue', Impact, sans-serif; font-size: 32px; font-weight: 400; letter-spacing: 1px; }
.wx-card { display: flex; gap: 12px; align-items: center; text-align: left; background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 14px; margin-top: 8px; }
.wx-card > span { font-size: 30px; }
.wx-card small { display: block; color: var(--mute); font-size: 13px; }
#introNews p { margin: 8px 0 0; background: rgba(242,181,58,.15); border: 1px solid rgba(242,181,58,.4); border-radius: 12px; padding: 8px 12px; font-size: 14px; text-align: left; }
.mlist { text-align: left; font-size: 14px; }
.mlist li { background: rgba(255,255,255,.05); border-radius: 10px; padding: 8px 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 10px; }
.stats div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 4px; }
.stats b { display: block; font-family: 'Bebas Neue', Impact, sans-serif; font-size: 30px; font-weight: 400; line-height: 1; }
.stats span { font-size: 11px; color: var(--mute); font-weight: 600; }
#shopList { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; text-align: left; }
.up { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 10px; align-items: center; background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; }
.up .ic { font-size: 26px; grid-row: 1 / span 2; }
.up b { font-size: 15px; }
.up small { grid-column: 2; color: var(--mute); font-size: 12.5px; line-height: 1.3; }
.up .pips { grid-column: 2; display: flex; gap: 4px; }
.up .pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); }
.up .pips i.on { background: var(--green); }
.up button { grid-row: 1 / span 3; grid-column: 3; border: 0; border-radius: 10px; padding: 9px 12px; background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; }
.up button:disabled { background: rgba(255,255,255,.12); color: var(--mute); cursor: default; }
#cardGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pc { border-radius: 14px; padding: 12px 10px; background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.2); min-height: 106px; }
.pc .e { font-size: 34px; filter: grayscale(1) opacity(.35); }
.pc b { display: block; font-size: 13px; margin-top: 4px; }
.pc small { color: var(--mute); font-size: 11px; }
.pc.got { background: linear-gradient(160deg, #fdfaf2, #e8dfc8); color: #262626; border: 0; box-shadow: 0 6px 16px rgba(0,0,0,.3); transform: rotate(-1deg); }
.pc.got:nth-child(even) { transform: rotate(1.2deg); }
.pc.got .e { filter: none; }
.pc.got small { color: #6b6b6b; }

body.touch .desk { display: none; }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  .brand img { height: 28px; }
  .money span { font-size: 24px; }
  .money { min-width: 78px; }
  .brand { padding: 5px 10px 6px 6px; gap: 8px; }
  #clock { font-size: 21px; }
  #stars { font-size: 12px; letter-spacing: 1px; }
  .clock { padding: 4px 9px 5px; }
  .iconbtn { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; }
  #leftcol { top: calc(66px + var(--st)); width: 148px; }
  #gauge { padding: 6px 8px 8px; }
  .glabel { font-size: 9.5px; } .glabel b { font-size: 10.5px; }
  .bar { height: 7px; }
  #missions { font-size: 11px; }
  #side { top: calc(66px + var(--st)); width: 150px; }
  #minimap { width: 150px; height: 126px; }
  .job { padding: 5px 8px; }
  .job .t { font-size: 11.5px; } .job .w { font-size: 10px; }
  .job .tm { font-size: 20px; }
  #radio { top: auto; bottom: calc(150px + var(--sb)); max-width: calc(100% - 24px); font-size: 12.5px; }
  body:not(.touch) #radio { bottom: calc(70px + var(--sb)); }
  body.touch #hint { bottom: calc(146px + var(--sb)); }
  body.touch.radio-on #hint { opacity: 0; }
  #toast { font-size: 34px; top: 40%; }
  #toast small { font-size: 13px; }
  h1 { font-size: 60px; } h2 { font-size: 42px; }
  .logo-card img { height: 70px; }
  .pad button { width: 72px; height: 72px; }
  .pad .gas { height: 96px; }
  .pad .horn { width: 50px; height: 42px; }
  .stats b { font-size: 24px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .logo-card img { height: 50px; } h1 { font-size: 46px; margin-top: 6px; }
  .topbar { top: calc(6px + var(--st)); }
  #leftcol, #side { top: calc(58px + var(--st)); }
  #side { width: 150px; } #minimap { width: 150px; height: 126px; }
  #jobs .job:nth-child(n+3) { display: none; }
  .pad button { width: 66px; height: 66px; } .pad .gas { height: 84px; } .pad .horn { width: 46px; height: 38px; }
  #radio { top: auto; bottom: calc(12px + var(--sb)); max-width: 44%; }
  body.touch #hint { bottom: calc(100px + var(--sb)); }
  .card.panel { padding: 14px; }
}

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; text-align: left; }
.mode { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; padding: 12px; border-radius: 16px; cursor: pointer;
  background: rgba(26,26,26,.85); border: 1px solid rgba(255,255,255,.14); color: #fff; }
.mode .mi { grid-row: 1 / span 3; font-size: 26px; }
.mode b { font-family: 'Bebas Neue', Impact, sans-serif; font-weight: 400; font-size: 24px; letter-spacing: 1px; line-height: 1; }
.mode small { color: #c4cbd3; font-size: 12.5px; line-height: 1.35; }
.mode em { font-style: normal; color: var(--amber); font-size: 12px; font-weight: 700; }
.mode.main { grid-column: 1 / -1; background: var(--blue); border: 0; box-shadow: 0 6px 0 var(--blue-dark), 0 12px 24px rgba(0,0,0,.3); }
.mode.main b { font-size: 30px; } .mode.main small { color: #e6f0fa; }
.mode:active { transform: translateY(2px); }
@media (max-width: 420px) { .modes { grid-template-columns: 1fr; } }

.job.wait { opacity: .78; }
.job.wait .tm { font-size: 18px; color: #9cc6f0; }
.job .take { font-family: 'Bebas Neue', Impact, sans-serif; letter-spacing: 1px; }
