:root {
  --font: "Arial Black", "Segoe UI Black", Impact, system-ui, sans-serif;
  --body: "Segoe UI", system-ui, sans-serif;
  --ink: #120a04;
  --yellow: #ffcf3a;
  --cyan: #45f0ff;
  --pink: #ff3fd2;
  --panel: none;
  --button: none;
  --ol: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 1.5px 1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px -1.5px 0 var(--ink), 0 3px 0 rgba(0,0,0,0.6);
  --ol3: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 5px 0 rgba(0,0,0,0.65);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; overflow: hidden; font-family: var(--body); color: #fff; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.disp { font-family: var(--font); font-weight: 900; text-shadow: var(--ol); letter-spacing: 0.02em; }
.num { font-family: var(--font); font-weight: 900; text-shadow: var(--ol); font-variant-numeric: tabular-nums; }

.panel {
  border: 18px solid transparent;
  border-image-source: var(--panel);
  border-image-slice: 60 fill;
  border-image-width: 18px;
  border-image-repeat: stretch;
  background: rgba(14, 14, 24, 0.82);
}
.has-art .panel { background: transparent; }
.btn {
  appearance: none; -webkit-appearance: none; cursor: pointer; color: #fff; font-size: 18px;
  min-height: 48px; min-width: 120px; padding: 6px 26px;
  border: 14px solid transparent; border-image-source: var(--button); border-image-slice: 45% 30% fill; border-image-width: 22px 34px;
  background: #b8901c; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 90ms ease-out, filter 120ms;
}
.has-art .btn { background: transparent; }
.btn:hover, .btn:focus-visible { filter: brightness(1.15) drop-shadow(0 0 8px rgba(255, 207, 58, 0.7)); transform: translateY(-2px); outline: none; }
.btn:active { transform: translateY(1px) scale(0.95); }

#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%); }
#hurt { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255,0,0,0) 40%, rgba(255,20,20,0.6) 100%); transition: opacity 0.4s; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hudLeft { position: absolute; left: calc(10px + env(safe-area-inset-left, 0px)); top: 8px; padding: 2px 10px; display: flex; flex-direction: column; gap: 2px; }
#hudLeft .row { display: flex; align-items: center; gap: 6px; }
#hudLeft .ico { width: 30px; height: 30px; filter: drop-shadow(0 2px 2px #000); }
#money { font-size: 26px; color: var(--yellow); min-width: 80px; }
#money.bump { animation: bump 0.3s ease-out; }
#badges img { width: 26px; height: 26px; filter: drop-shadow(0 2px 2px #000); transition: transform 0.3s, opacity 0.3s; }
#badges img.lost { opacity: 0.18; filter: grayscale(1); transform: scale(0.8); }
#combo { position: absolute; left: calc(18px + env(safe-area-inset-left, 0px)); top: 112px; font-size: 20px; color: var(--cyan); opacity: 0; transition: opacity 0.2s; }
#combo.on { opacity: 1; animation: pop 0.25s cubic-bezier(.34,1.56,.64,1); }
#clockBox { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); padding: 0 16px; text-align: center; min-width: 140px; transition: opacity 0.2s; }
#clock { font-size: 28px; color: #fff; line-height: 1.15; }
#clockBar { width: 110px; height: 7px; margin: 1px auto 3px; background: rgba(0,0,0,0.6); border: 1px solid rgba(69,240,255,0.6); border-radius: 4px; overflow: hidden; }
#clockBar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* car tags */
#tags, #floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 4px; will-change: transform; }
.tag .bar { width: 64px; height: 8px; border-radius: 4px; background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.5); overflow: hidden; }
.tag .bar i { display: block; height: 100%; width: 100%; background: #4cff7a; }
.tag .prompt { display: none; white-space: nowrap; font-family: var(--font); font-weight: 900; font-size: 16px; padding: 4px 12px; border-radius: 10px; background: rgba(10, 10, 20, 0.85); border: 2px solid var(--cyan); box-shadow: 0 0 12px rgba(69,240,255,0.6); text-shadow: var(--ol); }
.tag.target .prompt { display: block; animation: pop 0.2s cubic-bezier(.34,1.56,.64,1); }
.tag .prompt b { color: var(--yellow); }
.tag .prompt em { font-style: normal; color: #ff9d3a; }
.float { position: absolute; transform: translate(-50%, -50%); font-family: var(--font); font-weight: 900; font-size: 26px; white-space: nowrap; text-shadow: var(--ol3); animation: floatUp 1.3s ease-out forwards; }
.float.money { color: var(--yellow); font-size: 30px; }
.float.bad { color: #ff4a4a; }
.float.info { color: var(--cyan); font-size: 22px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 30% { transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }

/* mini-game */
#mini { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: min(640px, 66vw); display: flex; gap: 10px; align-items: center; padding: 2px 8px; animation: miniIn 0.22s cubic-bezier(.34,1.56,.64,1); }
@keyframes miniIn { from { transform: translateX(-50%) scale(0.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#miniThumb { width: 92px; height: 92px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(69,240,255,0.25), rgba(0,0,0,0) 70%); }
#miniThumb img { max-width: 100%; max-height: 100%; filter: drop-shadow(0 0 6px rgba(69,240,255,0.6)); }
#miniBody { flex: 1 1 auto; min-width: 0; }
#miniName { font-size: 22px; color: var(--yellow); line-height: 1.1; }
#miniAct { font-size: 15px; font-weight: 700; margin: 2px 0 4px; text-shadow: 0 1px 2px #000; line-height: 1.25; }
#miniCv { width: 100%; height: 52px; display: block; }
#miniHint { font-size: 15px; font-weight: 800; color: var(--cyan); text-shadow: 0 1px 2px #000; margin-top: 2px; }
#miniResult { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 46px; pointer-events: none; opacity: 0; white-space: nowrap; }
#miniResult.show { animation: slam 0.5s cubic-bezier(.34,1.56,.64,1) forwards; }
#miniResult.perfect { color: var(--yellow); }
#miniResult.good { color: #6dff8f; }
#miniResult.fail { color: #ff4a4a; }
@keyframes slam { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.4) rotate(-6deg); } 60% { opacity: 1; transform: translate(-50%, -50%) scale(0.92) rotate(-6deg); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-6deg); } }

/* banner + subtitle */
#banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-5deg); font-size: clamp(36px, 8vw, 84px); color: var(--yellow); text-shadow: var(--ol3), 0 0 24px rgba(255,180,40,0.6); white-space: nowrap; pointer-events: none; padding: 6px 40px; background: linear-gradient(90deg, rgba(0,0,0,0), rgba(10,8,4,0.75) 20%, rgba(10,8,4,0.75) 80%, rgba(0,0,0,0)); }
#banner.show { animation: bannerIn 0.45s cubic-bezier(.34,1.56,.64,1); }
#banner.bad { color: #ff4a4a; }
@keyframes bannerIn { 0% { transform: translate(-50%, -50%) rotate(-5deg) scale(3); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-5deg) scale(1); opacity: 1; } }
#subtitle { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); max-width: min(760px, 80vw); padding: 6px 16px; border-radius: 10px; background: rgba(0,0,0,0.65); font-size: 17px; font-weight: 700; text-align: center; line-height: 1.35; text-shadow: 0 1px 2px #000; pointer-events: none; z-index: 30; }

/* help */
#help { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); z-index: 20; padding: 12px; }
.helpBox { width: min(560px, 92vw); max-height: 96%; overflow: auto; padding: 6px 18px 10px; text-align: center; animation: miniIn2 0.28s cubic-bezier(.34,1.56,.64,1); }
@keyframes miniIn2 { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.helpTitle { font-size: 30px; color: var(--yellow); margin-bottom: 6px; }
.helpRow { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font); font-weight: 900; font-size: 22px; text-shadow: var(--ol); margin: 4px 0; }
.helpRow img { width: 42px; height: 42px; }
.helpBox p { margin: 6px 0; font-size: 16px; font-weight: 700; line-height: 1.4; text-shadow: 0 1px 2px #000; }
#helpOk { margin-top: 6px; font-size: 20px; min-width: 200px; }

/* title */
#title { position: absolute; inset: 0; z-index: 10; cursor: pointer; overflow: hidden; }
#titleBg { position: absolute; inset: -3%; background: #05040c url("../assets/title-bg.webp") center / cover no-repeat; animation: kenburns 24s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.06) translate(-1%, 1%); } }
#title::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(4,3,12,0.55), rgba(4,3,12,0) 55%), linear-gradient(0deg, rgba(4,3,12,0.6), rgba(4,3,12,0) 30%); }
#logo { position: absolute; z-index: 2; left: 5%; top: 7%; width: min(46%, 640px); max-height: 38%; object-fit: contain; object-position: left center; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.7)); opacity: 0; }
#logo.in { animation: logoIn 0.65s cubic-bezier(.34,1.56,.64,1) forwards, float 4s ease-in-out 0.7s infinite; }
@keyframes logoIn { 0% { opacity: 0; transform: translateY(-60px) scale(1.25); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-6px); opacity: 1; } }
#lbBtn { position: absolute; z-index: 2; left: 6%; top: 50%; font-size: 17px; }
#lbBtn svg { flex: 0 0 auto; }
#pressStart { position: absolute; z-index: 2; left: 50%; bottom: 9%; transform: translateX(-50%); font-size: clamp(18px, 2.6vw, 30px); color: #fff; white-space: nowrap; animation: pulse 1.6s ease-in-out infinite; padding: 6px 22px; background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,0.55) 25%, rgba(0,0,0,0.55) 75%, rgba(0,0,0,0)); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); } 50% { opacity: 0.55; transform: translateX(-50%) scale(0.96); } }

/* intro */
#intro { position: absolute; inset: 0; z-index: 40; background: #000 url("../assets/title-bg.webp") center / cover no-repeat; }
#introVideo { width: 100%; height: 100%; object-fit: cover; display: block; background: transparent; }
#skipBtn { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); font-size: 16px; min-width: 100px; }

/* while a mini-game panel is up, the clock steps aside (it sits in the same spot on small screens) */
#hud:has(~ #mini:not(.hidden)) #clockBox { opacity: 0; }

/* phones held sideways: a compact HUD and mini-game panel so the lot and the car stay in view */
@media (max-height: 520px) {
  .panel { border-width: 13px; border-image-width: 13px; }
  #hudLeft { top: 6px; padding: 0 6px; gap: 1px; }
  #hudLeft .ico { width: 22px; height: 22px; }
  #money { font-size: 19px; min-width: 66px; }
  #badges img { width: 20px; height: 20px; }
  #combo { top: 78px; font-size: 16px; }
  #clockBox { top: 4px; min-width: 108px; padding: 0 10px; }
  #clock { font-size: 20px; }
  #clockBar { width: 84px; height: 5px; margin-bottom: 2px; }
  #mini { top: 4px; width: min(540px, calc(100vw - 360px)); min-width: 300px; gap: 6px; padding: 0 4px; }
  #miniThumb { width: 52px; height: 52px; }
  #miniName { font-size: 16px; }
  #miniAct { font-size: 12px; margin: 1px 0 2px; line-height: 1.2; }
  #miniCv { height: 36px; }
  #miniHint { font-size: 12px; margin-top: 0; }
  #miniResult { font-size: 32px; }
  .tag .prompt { font-size: 13px; padding: 3px 8px; }
  .float { font-size: 20px; }
  .float.money { font-size: 22px; }
  .float.info { font-size: 17px; }
  #subtitle { font-size: 14px; bottom: 4%; padding: 4px 12px; max-width: min(560px, 62vw); }
  .helpBox { width: min(560px, 80vw); padding: 2px 12px 6px; }
  .helpTitle { font-size: 21px; margin-bottom: 2px; }
  .helpRow { font-size: 16px; margin: 2px 0; }
  .helpRow img { width: 30px; height: 30px; }
  .helpBox p { font-size: 13px; margin: 3px 0; line-height: 1.3; }
  #helpOk { font-size: 16px; min-height: 44px; margin-top: 2px; }
  #lbBtn { font-size: 15px; min-height: 44px; }
  #skipBtn { min-height: 44px; font-size: 15px; }
}
