/* BYAHE! — jeepney rush: chrome-and-airbrush HUD */
@font-face {
  font-family: 'Titan';
  src: url('../vendor/fonts/titan-one.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('../vendor/fonts/rubik.woff2') format('woff2');
  font-weight: 400 800; font-style: normal; font-display: swap;
}
:root {
  --yellow: #ffd23d; --red: #d92c3e; --blue: #1a3a8a; --green: #37d06a;
  --ink: #101018; --panel: rgba(12, 12, 24, 0.78);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a14; }
body {
  font-family: 'Rubik', 'Arial Black', Arial, sans-serif;
  color: #fff; user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- overlays ---------- */
#haze {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 3;
  background: linear-gradient(180deg, transparent 55%, rgba(255, 210, 120, 0.25) 78%, rgba(255, 160, 60, 0.35) 100%);
  mix-blend-mode: screen;
  animation: hazeWob 3.2s ease-in-out infinite alternate;
}
@keyframes hazeWob { from { transform: translateY(0) scaleY(1); } to { transform: translateY(-6px) scaleY(1.04); } }
#panic-vignette {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 4;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(217, 30, 50, 0.55) 100%);
  transition: opacity .2s;
}
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 8; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud.hidden { display: none; }
#hud > * { pointer-events: none; }

#hud-topleft { position: absolute; top: 10px; left: 14px; }
#hud-time {
  font-family: 'Titan', 'Arial Black', sans-serif;
  font-size: clamp(34px, 5.5vw, 58px); line-height: 1;
  color: var(--yellow); text-shadow: 3px 3px 0 #1a1a1a, -1px -1px 0 #1a1a1a, 0 0 18px rgba(255, 210, 61, .4);
}
#hud-time.panic { color: #ff4a5a; animation: pulse .5s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.09); } }
#lowtime-tag {
  font-family: 'Titan', sans-serif; color: #ff4a5a; font-size: clamp(14px, 2vw, 20px);
  text-shadow: 2px 2px 0 #1a1a1a; animation: pulse .4s infinite alternate;
}
#hud-topright { position: absolute; top: 10px; right: 14px; text-align: right; }
#hud-money {
  font-family: 'Titan', sans-serif; font-size: clamp(26px, 4vw, 44px); color: #7dff9e;
  text-shadow: 3px 3px 0 #1a1a1a, 0 0 16px rgba(60, 255, 130, .35);
}
#hud-best { font-size: clamp(10px, 1.4vw, 14px); color: #aab; font-weight: 700; letter-spacing: 1px; }
.icon-btns { margin-top: 6px; display: flex; gap: 6px; justify-content: flex-end; }
.icon-btns button {
  pointer-events: auto; width: 38px; height: 38px; border-radius: 10px;
  background: var(--panel); color: #fff; border: 2px solid rgba(255,255,255,.25);
  font-size: 17px; cursor: pointer;
}
.icon-btns button:active { transform: scale(.92); }

/* arrow + distance */
#arrow-wrap { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); text-align: center; }
#hud-arrow { width: clamp(56px, 7vw, 84px); filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); transition: transform .06s linear; }
#hud-dist {
  font-family: 'Titan', sans-serif; font-size: clamp(18px, 2.6vw, 28px); color: #fff;
  text-shadow: 2px 2px 0 #1a1a1a; margin-top: -6px;
}
#hud-dest { font-size: clamp(10px, 1.5vw, 15px); font-weight: 800; letter-spacing: 1px; text-shadow: 1px 1px 0 #000; }

/* fare panel */
#fare-panel {
  position: absolute; top: 110px; right: 14px; width: clamp(160px, 22vw, 230px);
  background: var(--panel); border: 2px solid rgba(255,255,255,.2); border-radius: 12px;
  padding: 10px 12px; font-size: clamp(11px, 1.4vw, 14px);
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.fare-row { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; }
.fare-row span { color: #99a; font-weight: 700; font-size: .82em; letter-spacing: .5px; }
.fare-row b { font-weight: 800; }
.fare-row.dest b { font-size: 1.05em; }
#tip-bar { height: 8px; border-radius: 5px; background: #332; margin: 6px 0 4px; overflow: hidden; }
#tip-fill { height: 100%; width: 100%; background: var(--green); border-radius: 5px; transition: width .15s; }
#fare-bonus { text-align: right; color: #7adfff; font-weight: 800; font-size: .85em; }

/* combo announcements */
#combo-stack {
  position: absolute; left: 14px; top: 32%; display: flex; flex-direction: column; gap: 6px;
  max-width: 46vw;
}
.ann {
  background: var(--panel); border-left: 5px solid var(--yellow); border-radius: 8px;
  padding: 7px 14px; transform: translateX(-120%); animation: annIn .18s cubic-bezier(.2,1.6,.4,1) forwards;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.ann.out { opacity: 0; transform: translateX(-30%); transition: all .35s; }
.ann-t { font-family: 'Titan', sans-serif; font-size: clamp(16px, 2.4vw, 26px); display: block; text-shadow: 2px 2px 0 #000; }
.ann-s { font-size: clamp(10px, 1.4vw, 14px); color: #ccd; font-weight: 700; }
.ann.big .ann-t { font-size: clamp(22px, 3.4vw, 38px); }
@keyframes annIn { to { transform: translateX(0); } }
#combo-mult {
  position: absolute; left: 14px; top: 26%;
  font-family: 'Titan', sans-serif; font-size: clamp(20px, 3vw, 34px); color: #7adfff;
  text-shadow: 3px 3px 0 #000; animation: pulse .35s infinite alternate;
}

/* speech bubble */
#speech-bubble {
  position: absolute; bottom: 24%; left: 50%; transform: translateX(-50%) scale(.8);
  background: #fff; color: #181828; border-radius: 14px; padding: 8px 16px;
  font-size: clamp(12px, 1.7vw, 16px); font-weight: 600; max-width: 74vw; text-align: center;
  opacity: 0; transition: all .15s; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#speech-bubble::after {
  content: ''; position: absolute; bottom: -8px; left: 50%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: #fff; border-bottom: 0;
}
#speech-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
#speech-name { display: block; font-size: .72em; font-weight: 800; color: #b3121f; letter-spacing: .5px; }

/* minimap */
#minimap {
  position: absolute; left: 14px; bottom: 14px; width: clamp(110px, 16vw, 160px); height: clamp(110px, 16vw, 160px);
  border: 3px solid rgba(255,255,255,.28); border-radius: 10px; background: #10121a;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}

/* speed */
#speed-box {
  position: absolute; right: 18px; bottom: 16px; text-align: right;
  font-family: 'Titan', sans-serif;
}
#hud-speed { font-size: clamp(30px, 4.6vw, 52px); color: #fff; text-shadow: 3px 3px 0 #1a1a1a; }
#speed-box .unit { font-size: clamp(11px, 1.4vw, 15px); color: #99a; margin-left: 4px; }

#hint-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  font-size: clamp(9px, 1.2vw, 12px); color: rgba(255,255,255,.55); font-weight: 700; letter-spacing: .4px;
  text-shadow: 1px 1px 0 #000;
}
body.touch #hint-bar { display: none; }

/* ---------- touch UI ---------- */
#touch-ui { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#touch-ui.hidden { display: none; }
#tc-steer { position: absolute; left: 12px; bottom: 18px; display: flex; gap: 12px; }
#tc-pedals { position: absolute; right: 12px; bottom: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#touch-ui button {
  pointer-events: auto; border: 3px solid rgba(255,255,255,.35); border-radius: 16px;
  background: var(--panel); color: #fff; font-family: 'Titan', sans-serif;
  font-size: clamp(18px, 4.5vw, 26px); padding: 0; touch-action: none;
  box-shadow: 0 5px 0 rgba(0,0,0,.45);
}
#tc-steer button { width: clamp(64px, 17vw, 96px); height: clamp(64px, 17vw, 96px); border-radius: 50%; font-size: clamp(24px, 6vw, 36px); }
#tc-pedals button { width: clamp(64px, 17vw, 96px); height: clamp(52px, 13vw, 72px); }
#tc-gas { background: rgba(20, 110, 50, .8); }
#tc-brake { background: rgba(150, 30, 40, .8); }
#tc-hb { background: rgba(180, 120, 20, .8); font-size: clamp(14px, 3.5vw, 20px) !important; }
#tc-horn { background: rgba(40, 60, 160, .8); }
#touch-ui button.on { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.45); filter: brightness(1.3); }
body.touch #minimap { left: 12px; bottom: 118px; width: 96px; height: 96px; }
body.touch #speed-box { bottom: 130px; }
body.touch #fare-panel { top: 96px; width: 150px; font-size: 11px; }
body.touch #speech-bubble { bottom: 42%; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20; display: none;
  align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(ellipse at center, rgba(10, 10, 26, 0.25) 0%, rgba(8, 8, 20, 0.78) 100%);
}
.screen.show { display: flex; }
.screen h2 { font-family: 'Titan', sans-serif; font-size: clamp(34px, 7vw, 72px); color: var(--yellow); text-shadow: 4px 4px 0 #1a1a1a; }

/* title */
#screen-title { justify-content: flex-start; padding-top: 5vh; background: linear-gradient(180deg, rgba(10,10,26,.15) 0%, rgba(10,10,26,.72) 78%); }
.title-art { text-align: center; }
.title-kicker { font-size: clamp(10px, 1.6vw, 15px); letter-spacing: 3px; color: #7adfff; font-weight: 800; text-shadow: 1px 1px 0 #000; }
.logo {
  font-family: 'Titan', sans-serif; font-size: clamp(64px, 15vw, 150px); line-height: .95;
  background: linear-gradient(180deg, #fff8d0 10%, var(--yellow) 45%, #e86a1a 75%, #b3121f 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(4px 5px 0 #1a1a1a) drop-shadow(0 0 26px rgba(255, 160, 40, .35));
}
.logo-bang { -webkit-text-fill-color: #d92c3e; }
.title-sub {
  font-family: 'Titan', sans-serif; font-size: clamp(14px, 3vw, 28px); color: #fff;
  letter-spacing: 6px; text-shadow: 2px 2px 0 #1a1a1a, 0 0 14px rgba(122, 216, 255, .5);
}
.title-card {
  margin-top: 3vh; background: var(--panel); border: 2px solid rgba(255,255,255,.22); border-radius: 18px;
  padding: 18px 26px; text-align: center; max-width: min(92vw, 480px); box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.ctl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font-size: clamp(11px, 1.6vw, 14px); text-align: left; color: #ccd; }
.ctl-grid b { color: var(--yellow); }
.tagline { margin: 12px 0; font-size: clamp(11px, 1.6vw, 14px); color: #aab; line-height: 1.5; }
#btn-start, #btn-again, #btn-resume {
  font-family: 'Titan', sans-serif; font-size: clamp(20px, 3.4vw, 30px); cursor: pointer;
  background: linear-gradient(180deg, #ffe27a, #e8a02a); color: #3a1a00; border: 3px solid #7a4a00;
  border-radius: 14px; padding: 10px 34px; box-shadow: 0 6px 0 #5a3500, 0 10px 24px rgba(0,0,0,.5);
}
#btn-start:active, #btn-again:active, #btn-resume:active { transform: translateY(4px); box-shadow: 0 2px 0 #5a3500; }
.title-best { margin-top: 10px; font-family: 'Titan', sans-serif; color: #7dff9e; font-size: clamp(13px, 2vw, 18px); text-shadow: 2px 2px 0 #000; }
.footnote { margin-top: 6px; font-size: 10px; color: #778; }

/* countdown */
#screen-count { background: transparent; pointer-events: none; }
#count-num {
  font-family: 'Titan', sans-serif; font-size: clamp(90px, 22vw, 220px); color: var(--yellow);
  text-shadow: 6px 6px 0 #1a1a1a, 0 0 40px rgba(255, 210, 61, .5);
}
#count-num.pop { animation: countPop .9s ease-out; }
@keyframes countPop { 0% { transform: scale(1.7); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 100% { transform: scale(.92); opacity: 1; } }

/* pause */
.pause-card, .over-card {
  background: var(--panel); border: 2px solid rgba(255,255,255,.22); border-radius: 20px;
  padding: 26px 40px; text-align: center; max-width: min(92vw, 460px); box-shadow: 0 12px 44px rgba(0,0,0,.55);
}
.pause-sub { color: #99a; margin: 4px 0 18px; font-weight: 600; }
#btn-resume { display: block; width: 100%; margin-bottom: 10px; font-size: clamp(16px, 2.6vw, 22px); }
#btn-quit.ghost {
  font-family: 'Titan', sans-serif; font-size: clamp(13px, 2vw, 16px); cursor: pointer;
  background: transparent; color: #f88; border: 2px solid #a55; border-radius: 12px; padding: 8px 20px;
}
.pause-hint { margin-top: 14px; font-size: 10px; color: #778; }

/* results */
#over-title { color: #ff5a5a; }
.rank {
  font-family: 'Titan', sans-serif; font-size: clamp(70px, 14vw, 130px); line-height: 1;
  margin: 6px auto; width: clamp(100px, 18vw, 160px); height: clamp(100px, 18vw, 160px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px; border: 5px solid; text-shadow: 3px 3px 0 rgba(0,0,0,.4);
}
.rank-S { color: #ffd23d; border-color: #ffd23d; background: rgba(255,210,61,.12); box-shadow: 0 0 34px rgba(255,210,61,.4); }
.rank-A { color: #7dff9e; border-color: #7dff9e; background: rgba(60,255,130,.1); }
.rank-B { color: #7adfff; border-color: #7adfff; background: rgba(122,223,255,.1); }
.rank-C { color: #c8a8ff; border-color: #c8a8ff; background: rgba(200,168,255,.1); }
.rank-D { color: #ffb86a; border-color: #ffb86a; background: rgba(255,184,106,.1); }
.rank-E { color: #aaa; border-color: #aaa; background: rgba(170,170,170,.1); }
#rank-title { font-family: 'Titan', sans-serif; font-size: clamp(16px, 3vw, 26px); color: #fff; letter-spacing: 2px; }
#new-best {
  margin: 8px 0 0; font-family: 'Titan', sans-serif; color: var(--yellow);
  font-size: clamp(14px, 2.4vw, 20px); animation: pulse .5s infinite alternate;
}
#results { margin: 16px 0; text-align: left; }
.res-row { display: flex; justify-content: space-between; gap: 30px; padding: 3px 0; font-size: clamp(12px, 1.8vw, 15px); }
.res-row span { color: #99a; font-weight: 700; letter-spacing: .5px; }
.res-row b { font-weight: 800; }
.res-row.big b { font-family: 'Titan', sans-serif; font-size: 1.7em; color: #7dff9e; }
#btn-again { width: 100%; }

/* small screens */
@media (max-width: 720px) {
  #arrow-wrap { top: 4px; }
  #hud-arrow { width: 46px; }
  #hud-time { font-size: 30px; }
  #hud-money { font-size: 22px; }
  #combo-stack { top: 30%; max-width: 60vw; }
  .ctl-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 480px) {
  .title-card { margin-top: 1vh; padding: 10px 18px; }
  .logo { font-size: clamp(48px, 11vh, 90px); }
  #screen-title { padding-top: 2vh; }
}
