:root { --acc: #ffd23f; --grn: #19a35b; --ink: #0d1117; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1410; color: #fff;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; z-index: 10; }
.screen.show { display: flex; }
#loading, #title { background: radial-gradient(ellipse at 50% 30%, rgba(40,20,10,.35), rgba(10,6,4,.85)); }
#loading { background: #140d09; }
.logo { display: flex; flex-direction: column; line-height: .9; transform: skewX(-8deg); text-shadow: 0 4px 0 #000, 0 0 30px rgba(0,0,0,.6); }
.logo .l1 { font-size: clamp(40px, 12vw, 84px); color: var(--acc); letter-spacing: 2px; }
.logo .l2 { font-size: clamp(30px, 9vw, 62px); color: #fff; letter-spacing: 6px; }
.logo .l3 { font-size: clamp(34px, 10.5vw, 72px); color: var(--grn); letter-spacing: 4px; -webkit-text-stroke: 1px #000; }
.tag { max-width: 420px; font-family: Arial, sans-serif; font-weight: 700; font-size: 16px; margin: 4px 0 8px; text-shadow: 0 2px 4px #000; }
.small { font-family: Arial, sans-serif; font-size: 14px; opacity: .9; }
.bar { width: min(320px, 80vw); height: 10px; background: #333; border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .2s; }

.big { background: var(--acc); color: #111; font-size: 22px; padding: 14px 34px; border-radius: 14px; box-shadow: 0 5px 0 #8a6b00; min-width: 220px; letter-spacing: 1px; }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a6b00; }
.mid { background: var(--acc); color: #111; font-size: 16px; padding: 12px 16px; border-radius: 12px; flex: 1; min-width: 0; }
.ghost { background: rgba(255,255,255,.12); color: #fff; border: 2px solid rgba(255,255,255,.35); }
.mini { background: rgba(0,0,0,.55); color: #fff; font-size: 14px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); }
.row { display: flex; gap: 10px; width: 100%; max-width: 420px; }

.sheet { top: auto; bottom: 0; justify-content: flex-start; background: linear-gradient(180deg, rgba(12,10,8,.0), rgba(12,10,8,.88) 18%, rgba(12,10,8,.96));
  padding: 34px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 62%; gap: 10px; }
.sheet.tall { max-height: 86%; }
.sheethead { font-size: 18px; letter-spacing: 3px; color: var(--acc); display: flex; align-items: center; gap: 10px; }
.carrow { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; justify-content: space-between; }
.arrow { background: rgba(255,255,255,.14); width: 56px; height: 56px; border-radius: 50%; font-size: 22px; flex: none; border: 2px solid rgba(255,255,255,.35); }
.carinfo { flex: 1; }
.carname { font-size: 28px; letter-spacing: 1px; text-transform: uppercase; }
.stats { width: 100%; max-width: 380px; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 12px; letter-spacing: 1px; }
.stats .sb { height: 10px; background: rgba(255,255,255,.15); border-radius: 5px; overflow: hidden; }
.stats .sb i { display: block; height: 100%; background: linear-gradient(90deg, var(--grn), var(--acc)); }
.mlist { width: 100%; max-width: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; touch-action: pan-y; }
.mitem { text-align: left; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.18); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.mitem .num { font-size: 26px; color: var(--acc); width: 30px; text-align: center; flex: none; }
.mitem .mt { font-size: 17px; }
.mitem .md { font-family: Arial, sans-serif; font-size: 13px; opacity: .85; margin-top: 2px; }
.mitem .mb { margin-left: auto; font-family: Arial, sans-serif; font-size: 12px; text-align: right; flex: none; }
.mitem.done { border-color: var(--grn); }
.mitem.done .mb { color: #6dff9f; }
.where { font-family: Arial, sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 2px; color: var(--acc); text-transform: uppercase; }
#brief p { font-family: Arial, sans-serif; font-size: 15px; max-width: 440px; margin: 0; line-height: 1.35; }
.goal { background: rgba(255,210,63,.15); border: 2px solid var(--acc); border-radius: 10px; padding: 8px 12px; font-size: 15px; max-width: 440px; }
.help { max-width: 420px; line-height: 1.4; }
.restitle { font-size: 34px; letter-spacing: 1px; }
.restitle.win { color: #6dff9f; } .restitle.lose { color: #ff6b5b; }
#resDetail { font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5; }
.board { width: 100%; max-width: 360px; font-family: Arial, sans-serif; font-size: 14px; text-align: left; }
.board .bh { font-family: "Arial Black", Arial; font-size: 12px; letter-spacing: 2px; color: var(--acc); margin-bottom: 4px; text-align: center; }
.board .br { display: flex; justify-content: space-between; padding: 3px 8px; border-radius: 6px; }
.board .br.me { background: rgba(255,210,63,.2); }
.board a { color: #fff; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button { pointer-events: auto; }
#hudTop { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; gap: 8px; align-items: flex-start; }
#hudGoal { flex: 1; text-shadow: 0 2px 3px #000, 0 0 8px rgba(0,0,0,.7); }
#hudMain { font-size: 26px; line-height: 1; }
#hudSub { font-family: Arial, sans-serif; font-weight: 700; font-size: 13px; margin-top: 4px; }
#map { width: 108px; height: 108px; border-radius: 12px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.25); flex: none; }
#street { position: absolute; top: calc(122px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap; }
#streetName { display: inline-block; background: #0b6e3c; border: 2px solid #fff; border-radius: 6px; padding: 3px 12px; font-size: 16px; letter-spacing: 1px; box-shadow: 0 3px 8px rgba(0,0,0,.5); }
#streetNext { font-family: Arial, sans-serif; font-weight: 700; font-size: 12px; margin-top: 4px; text-shadow: 0 1px 3px #000; }
#banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: clamp(22px, 7vw, 40px); text-shadow: 0 3px 0 #000, 0 0 16px rgba(0,0,0,.7); opacity: 0; transition: opacity .25s; color: var(--acc); padding: 0 12px; }
#banner.show { opacity: 1; }
#count { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: clamp(56px, 20vw, 120px); color: var(--acc); text-shadow: 0 5px 0 #000; }
#speedo { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(34px + env(safe-area-inset-bottom)); text-align: center; text-shadow: 0 2px 4px #000; }
#speedo b { display: block; font-size: 34px; line-height: 1; }
#speedo span { font-size: 11px; letter-spacing: 2px; }
#keyhint { position: absolute; bottom: 8px; left: 12px; right: 12px; text-align: center; font-family: Arial, sans-serif; font-size: 12px; opacity: .8; text-shadow: 0 1px 2px #000; }
#touch { position: absolute; left: 0; right: 0; bottom: 0; display: none; justify-content: space-between; padding: 0 12px calc(14px + env(safe-area-inset-bottom)); }
body.touch #touch { display: flex; }
body.touch #keyhint { display: none; }
body.touch #speedo { bottom: calc(118px + env(safe-area-inset-bottom)); }
#touch .tl, #touch .tr { display: flex; gap: 10px; align-items: flex-end; }
.tb { pointer-events: auto; width: 76px; height: 76px; border-radius: 18px; background: rgba(0,0,0,.42); border: 2px solid rgba(255,255,255,.55) !important; font-size: 26px; color: #fff; touch-action: none; }
.tb.on { background: rgba(255,210,63,.55); }
.tb.gas { width: 84px; height: 100px; font-size: 18px; background: rgba(25,163,91,.55); }
.tb.brk { font-size: 13px; height: 70px; background: rgba(200,50,40,.45); }
.tb.gas.on { background: rgba(60,230,130,.85); } .tb.brk.on { background: rgba(255,80,60,.85); }

@media (orientation: landscape) and (max-height: 500px) {
  .sheet { max-height: 100%; left: auto; width: min(460px, 55%); top: 0; background: linear-gradient(90deg, rgba(12,10,8,0), rgba(12,10,8,.92) 12%); padding-top: 14px; justify-content: center; }
  .sheet.tall { max-height: 100%; }
  #street { top: calc(10px + env(safe-area-inset-top)); }
  body.touch #speedo { bottom: 14px; }
  .logo .l1 { font-size: 54px; } .logo .l2 { font-size: 40px; } .logo .l3 { font-size: 46px; }
  .carname { font-size: 22px; } .restitle { font-size: 26px; }
}

.hero { width: min(240px, 52vw, 30vh); aspect-ratio: 1; object-fit: cover; border-radius: 18px; border: 3px solid var(--acc); box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.briefrow { display: flex; gap: 12px; align-items: flex-start; max-width: 460px; text-align: left; }
.face { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--acc); flex: none; }
@media (orientation: landscape) and (max-height: 500px) { .hero { display: none; } #title .logo .l1 { font-size: 40px; } #title .logo .l2 { font-size: 30px; } #title .logo .l3 { font-size: 34px; } #title { gap: 8px; } }
