@font-face {
  font-family: "Cafe24Ssurround";
  src: url("../assets/fonts/Cafe24Ssurround-v2.0.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 900;
}

:root {
  color-scheme: dark;
  --navy: #061426;
  --navy-soft: #10263b;
  --yellow: #ffc51b;
  --yellow-dark: #f39700;
  --green: #087549;
  --green-dark: #034a35;
  --red: #f04444;
  --white: #fffdf4;
  --muted: #adbed0;
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--white);
  font-family: "Cafe24Ssurround", Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
  background: #030913;
}

button,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.game-layout {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.game-ad[hidden] { display: none !important; }
.game-ad {
  overflow: hidden;
  line-height: 0;
  background: rgba(8, 25, 42, 0.86);
}
.game-ad-label {
  color: rgba(210, 225, 237, 0.68);
  font-family: system-ui, sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 10px;
}
.game-ad-mobile { display: none; }
.game-ad[data-adfit-fluid] .kakao_ad_area { width: 100% !important; max-width: 100%; }

.game-shell {
  position: relative;
  width: min(100vw, 480px);
  height: var(--app-height, 100dvh);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.75);
  isolation: isolate;
}

.utility-menu-toggle {
  position: absolute;
  z-index: 130;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  width: 44px;
  height: 44px;
  padding: 10px;
  place-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  color: white;
  background: rgba(4, 21, 36, 0.84);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.utility-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 160ms ease, opacity 160ms ease;
}
.utility-menu-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.utility-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.utility-menu-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.utility-menu {
  position: absolute;
  z-index: 129;
  top: max(64px, calc(env(safe-area-inset-top) + 54px));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  width: min(292px, calc(100% - 24px));
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 20px;
  background: rgba(4, 18, 32, 0.96);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px);
}
.utility-menu[hidden] { display: none; }
.utility-menu-heading { padding: 4px 7px 8px; }
.utility-menu-heading strong { color: #86ddfa; font-size: 10px; letter-spacing: 0.15em; }
.utility-menu-item {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: white;
  text-align: left;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.utility-menu-item span { color: #9eb3c3; font-size: 11px; }
.utility-menu-item strong { color: var(--yellow); font-size: 13px; }
.utility-menu-item strong.is-off { color: #8796a2; }
.utility-menu-link { background: linear-gradient(135deg, rgba(8, 117, 73, 0.5), rgba(5, 69, 55, 0.7)); }
.utility-menu-link strong { color: #a8f3d2; }
.utility-menu-toggle:focus-visible,
.utility-menu-item:focus-visible,
.contact-card button:focus-visible { outline: 3px solid #77e2ff; outline-offset: 2px; }

.contact-modal {
  position: absolute;
  z-index: 145;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(1, 8, 17, 0.82);
  backdrop-filter: blur(6px);
}
.contact-modal[hidden] { display: none; }
.contact-card {
  position: relative;
  width: min(100%, 350px);
  padding: 27px 22px 22px;
  border: 2px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, #143e5c, #071827);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}
.contact-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  color: #d9e8f3;
  font-size: 24px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.contact-eyebrow { margin: 0; color: #78dcfb; font-size: 9px; letter-spacing: 0.18em; }
.contact-card h2 { margin: 8px 0 7px; color: var(--yellow); font-size: 26px; }
.contact-card > p:not(.contact-eyebrow, .contact-copy-status) { margin: 0 0 14px; color: #c4d5e2; font-size: 12px; line-height: 1.55; }
.contact-card code {
  display: block;
  padding: 13px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: clamp(13px, 4vw, 16px);
  background: rgba(1, 9, 17, 0.52);
  user-select: all;
}
.contact-copy-button {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  color: #17202a;
  font-weight: 900;
  background: var(--yellow);
  cursor: pointer;
}
.contact-copy-status { min-height: 17px; margin: 9px 0 0; color: #8df0c3; font-size: 10px; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.is-active { display: flex; }

.menu-screen {
  align-items: center;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(180deg, #72d8f8 0 43%, #60b751 43% 68%, #1a2b32 68%);
}

.menu-screen::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(1, 19, 40, 0.02), rgba(1, 12, 28, 0.22) 52%, rgba(1, 8, 18, 0.88));
  pointer-events: none;
}

.menu-sky,
.sky { position: absolute; inset: 0; overflow: hidden; }

.menu-cloud,
.cloud {
  position: absolute;
  width: 82px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 24px -13px 0 3px rgba(255, 255, 255, 0.88), 50px -2px 0 rgba(255, 255, 255, 0.88);
}

.cloud-one { top: 12%; left: -12px; transform: scale(0.74); }
.cloud-two { top: 19%; right: 27px; transform: scale(0.55); }

.menu-hill {
  position: absolute;
  top: 38%;
  width: 310px;
  height: 180px;
  border-radius: 50% 50% 0 0;
  background: #4b9e43;
}

.hill-one { left: -140px; transform: rotate(8deg); }
.hill-two { right: -130px; background: #397e39; transform: rotate(-8deg); }

.menu-road {
  position: absolute;
  bottom: -18%;
  left: 50%;
  width: 75%;
  height: 72%;
  background: #303941;
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
}

.menu-road::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent 49%, #ffd858 49% 51%, transparent 51%);
  opacity: 0.9;
}

.menu-content {
  position: relative;
  z-index: 3;
  display: flex;
  width: min(86%, 380px);
  flex-direction: column;
  align-items: center;
  margin-top: -8vh;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: #ffe277;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.18em;
}

.title-art {
  display: block;
  width: 100%;
  max-height: 210px;
  margin: -10px 0 -18px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.46));
}

.menu-copy {
  margin: 0 0 18px;
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 850;
  line-height: 1.45;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.mode-stack { display: grid; width: 100%; gap: 10px; }

.primary-button,
.secondary-button {
  min-height: 62px;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 11px 18px;
  border: 0;
  border-radius: 15px;
  color: #161b21;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(174, 98, 0, 0.38), 0 10px 24px rgba(0, 0, 0, 0.26);
  background: linear-gradient(180deg, #ffe151, var(--yellow));
}

.primary-button:active { transform: translateY(2px); }

.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.sound-button:focus-visible,
.typing-form input:focus-visible,
.typing-form button:focus-visible { outline: 3px solid white; outline-offset: 2px; }

.secondary-button {
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 24, 43, 0.82);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 8px 20px rgba(0, 0, 0, 0.2);
}

.primary-button span:not(.button-icon),
.secondary-button span:not(.button-icon) { display: grid; gap: 1px; text-align: left; }

.primary-button small,
.secondary-button small { font-size: 10px; font-weight: 700; opacity: 0.72; }
.button-icon { font-size: 23px; }

.best-card {
  display: flex;
  width: 82%;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  background: rgba(4, 15, 28, 0.66);
}

.best-card strong { color: white; font-size: 15px; font-variant-numeric: tabular-nums; }

.menu-car {
  position: absolute;
  z-index: 2;
  right: -40px;
  bottom: 2.5%;
  width: 62%;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.5));
  transform: rotate(-5deg);
}

.race-screen {
  background: #5eb645;
}
.race-screen.is-active { display: block; }
.race-world { position: absolute; inset: 0; overflow: hidden; isolation: isolate; }
.race-world::before {
  position: absolute;
  z-index: 0;
  inset: -5%;
  content: "";
  background: url("../assets/images/race-background-v2.webp") center / cover no-repeat;
  transform: scale(1.01);
  will-change: transform, filter;
}
.race-world::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(106deg, transparent 0 34px, rgba(255, 255, 255, 0.28) 36px 38px, transparent 40px 72px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-18%);
}
.race-world.is-boosting::before { animation: backgroundRush 0.24s ease-in-out infinite alternate; filter: saturate(1.15) blur(0.7px); }
.race-world.is-boosting::after { opacity: 0.72; animation: speedLines 0.24s linear infinite; }

.sky { display: none; }

.sun {
  position: absolute;
  top: 12%;
  right: 10%;
  width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff3a2;
  box-shadow: 0 0 35px #fff8c8;
}

.cloud-a { top: 20%; left: 8%; transform: scale(0.62); }
.cloud-b { top: 34%; right: 8%; transform: scale(0.45); }

.mountain {
  position: absolute;
  bottom: -45px;
  width: 220px;
  height: 150px;
  background: #4c9e53;
  clip-path: polygon(0 100%, 42% 10%, 60% 56%, 73% 27%, 100% 100%);
}

.mountain-a { left: -25px; }
.mountain-b { right: -45px; transform: scaleX(-1); background: #3f8e47; }

.tree-line {
  position: absolute;
  right: -3%;
  bottom: 0;
  left: -3%;
  height: 43px;
  background: radial-gradient(circle at 12px 25px, #257536 0 18px, transparent 19px) 0 0 / 37px 44px;
}

.race-hud {
  position: absolute;
  z-index: 20;
  top: max(13px, env(safe-area-inset-top));
  right: 68px;
  left: 14px;
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: start;
  gap: 9px;
}

.rank-chip,
.timer-block {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(4, 21, 36, 0.72);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(9px);
}

.rank-chip { display: grid; padding: 7px 8px; border-radius: 14px; }
.rank-chip strong { color: var(--yellow); font-size: 20px; font-style: italic; line-height: 1; }
.rank-chip span { color: #d5e2eb; font-size: 10px; }

.timer-block { display: grid; justify-items: center; padding: 7px 12px; border-radius: 14px; }
.timer-block strong { font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.timer-block span { margin-top: 3px; color: #c6d4e2; font-size: 9px; font-weight: 800; letter-spacing: 0.1em; }

.combo-hud {
  position: absolute;
  z-index: 21;
  top: max(72px, calc(env(safe-area-inset-top) + 62px));
  right: 130px;
  left: 14px;
  padding: 7px 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 13px;
  background: rgba(4, 21, 36, 0.66);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
  opacity: 0.78;
  backdrop-filter: blur(8px);
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
}
.combo-copy { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.combo-copy strong { color: white; font-size: 12px; }
.combo-copy span { color: #9fb1c0; font-size: 8px; }
.nitro-track { height: 5px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.16); }
.nitro-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #31c9ff, #ffe04e, #ff7a29); transform: scaleX(0); transform-origin: left; transition: transform 180ms ease; }
.combo-hud.is-active { border-color: rgba(255, 224, 78, 0.72); opacity: 1; }
.combo-hud.is-nitro { border-color: white; box-shadow: 0 0 22px rgba(49, 201, 255, 0.92), inset 0 0 14px rgba(255, 224, 78, 0.28); animation: nitroHud 0.16s ease-in-out infinite alternate; }
.combo-hud.is-nitro .combo-copy strong,
.combo-hud.is-nitro .combo-copy span { color: #ffe04e; }

.countdown-overlay {
  position: absolute;
  z-index: 60;
  inset: 0;
  display: grid;
  padding: 84px 24px 28px;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, rgba(26, 101, 151, 0.44), rgba(2, 12, 23, 0.9) 67%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  backdrop-filter: blur(4px);
}
.countdown-overlay.is-visible { opacity: 1; visibility: visible; }
.countdown-card {
  width: min(100%, 350px);
  justify-self: center;
  padding: 22px 20px 20px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 25px;
  text-align: center;
  background: linear-gradient(180deg, rgba(12, 45, 70, 0.95), rgba(4, 18, 32, 0.97));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(49, 201, 255, 0.08);
}
.countdown-eyebrow { margin: 0; color: #7fe4ff; font-size: 10px; letter-spacing: 0.18em; }
.countdown-number {
  display: block;
  min-height: 104px;
  color: var(--yellow);
  font-size: 94px;
  line-height: 1.08;
  text-shadow: 0 7px 0 #a85b00, 0 0 28px rgba(255, 197, 27, 0.65);
}
.countdown-number.is-popping { animation: countdownPop 0.38s cubic-bezier(0.16, 1.4, 0.45, 1); }
.countdown-overlay.is-go .countdown-number { color: #60f2ae; font-size: 52px; line-height: 1.85; text-shadow: 0 6px 0 #087549, 0 0 30px rgba(96, 242, 174, 0.8); }
.countdown-card h2 { margin: 0; color: white; font-size: 24px; }
.countdown-description { margin: 9px 0 13px; color: #d7e8f3; font-size: 13px; line-height: 1.5; }
.countdown-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.countdown-rules span { padding: 7px 6px; border-radius: 999px; color: #11212d; font-size: 9px; }
.countdown-rule-hard { background: #ffe04e; }
.countdown-rule-easy { color: white !important; background: #e26d43; }
.countdown-tip { margin: 12px 0 0; color: #98adbd; font-size: 9px; }

.sign-zone {
  position: absolute;
  z-index: 7;
  top: 31%;
  left: 39%;
  display: grid;
  width: min(72%, 346px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  transform: translateX(-50%);
  transition: opacity 160ms ease, transform 160ms ease;
}

.sign-zone::before {
  position: absolute;
  z-index: 2;
  top: -17px;
  right: -12px;
  left: -12px;
  height: 13px;
  border: 3px solid #4b2c12;
  border-radius: 999px;
  content: "";
  background: linear-gradient(180deg, #c28a3d, #765020 58%, #4b2c12);
  box-shadow: 0 4px 7px rgba(0, 0, 0, 0.35);
}
.sign-zone::after {
  position: absolute;
  z-index: 1;
  top: -10px;
  right: -8px;
  bottom: -35px;
  left: -8px;
  content: "";
  background: linear-gradient(90deg, #563315 0 8px, transparent 8px calc(50% - 5px), #563315 calc(50% - 5px) calc(50% + 5px), transparent calc(50% + 5px) calc(100% - 8px), #563315 calc(100% - 8px));
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.35));
}

.sign-copy {
  position: relative;
  z-index: 3;
  display: grid;
  height: 112px;
  grid-template-rows: 34px 27px 1fr;
  align-items: center;
  justify-items: center;
  padding: 12px 8px 8px;
  border: 4px solid #cbd5c2;
  border-radius: 10px;
  outline: 5px solid #593515;
  color: white;
  font-weight: 950;
  line-height: 1;
  background: linear-gradient(180deg, #137046, #07583b 72%, #064934);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12), 0 8px 12px rgba(0, 0, 0, 0.34);
  text-shadow: 0 2px 0 #053726;
}

.sign-copy span { max-width: 100%; overflow: hidden; font-size: clamp(17px, 5vw, 24px); text-overflow: ellipsis; white-space: nowrap; }
.sign-copy strong { font-size: 25px; }
.sign-copy small {
  padding: 4px 7px;
  border-radius: 999px;
  color: #10202b;
  font-size: 7px;
  font-weight: 950;
  text-shadow: none;
  background: #dce5ea;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
.sign-copy small.route-hint-shortcut { background: #ffe04e; }
.sign-copy small.route-hint-detour { color: white; background: #e26d43; }
.sign-left,
.sign-right { left: auto; right: auto; }

.road {
  display: none;
  position: absolute;
  z-index: 3;
  top: 38%;
  bottom: 0;
  left: 50%;
  width: 112%;
  overflow: hidden;
  background: linear-gradient(90deg, #a6a7a0 0 2%, #f1eee0 2% 3%, #333c42 3% 97%, #f1eee0 97% 98%, #a6a7a0 98%);
  clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
}

.road::after {
  position: absolute;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(180deg, transparent 0 49px, rgba(255, 255, 255, 0.065) 50px 52px);
  animation: roadRush 0.36s linear infinite;
}

.road-fork {
  position: absolute;
  z-index: 2;
  top: -18%;
  width: 55%;
  height: 61%;
  border-top: 8px solid #faf3d6;
  background: #333c42;
}

.road-fork-left { left: 8%; transform: rotate(-33deg); }
.road-fork-right { right: 8%; transform: rotate(33deg); }

.lane-line {
  position: absolute;
  z-index: 3;
  top: -20%;
  left: 50%;
  width: 8px;
  height: 44px;
  border-radius: 2px;
  background: #f5d34f;
  animation: laneRush 0.7s linear infinite;
}
.lane-two { animation-delay: -0.23s; }
.lane-three { animation-delay: -0.46s; }

.junction-meter {
  position: absolute;
  z-index: 10;
  top: 27.8%;
  left: 39%;
  width: 62%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 20, 31, 0.38);
  transform: translateX(-50%);
}
.junction-meter span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #ffeb75, var(--yellow-dark)); transform-origin: left; }

.car-area {
  position: absolute;
  z-index: 15;
  bottom: clamp(124px, 17vh, 165px);
  left: 42%;
  width: min(46%, 220px);
  transform: translateX(-50%);
  transition: transform 330ms ease;
}

.race-car {
  display: block;
  width: 100%;
  filter: drop-shadow(0 18px 11px rgba(0, 0, 0, 0.52));
  animation: engineVibration 0.16s linear infinite alternate;
}

.typing-form {
  position: absolute;
  z-index: 5;
  bottom: 88%;
  left: 50%;
  display: grid;
  width: min(145%, 300px);
  grid-template-columns: 1fr 45px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  background: #08131d;
  box-shadow: 0 10px 23px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
}

.typing-form::after {
  position: absolute;
  bottom: -9px;
  left: 50%;
  width: 16px;
  height: 16px;
  content: "";
  background: #08131d;
  transform: translateX(-50%) rotate(45deg);
}

.typing-form input {
  min-width: 0;
  height: 46px;
  padding: 0 13px;
  border: 0;
  color: white;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  background: transparent;
}
.typing-form input::placeholder { color: #8c9aa7; font-size: 12px; font-weight: 700; }
.typing-form input[aria-disabled="true"] { color: #ff9a91; caret-color: transparent; }
.typing-form button { position: relative; z-index: 1; border: 0; color: #161b21; font-size: 24px; font-weight: 950; background: var(--yellow); cursor: pointer; }
.typing-form button:disabled { color: #7c858b; background: #4b555c; }

.engine-message {
  position: absolute;
  z-index: 6;
  bottom: 116%;
  left: 50%;
  min-width: 190px;
  color: #ff554b;
  font-size: 17px;
  font-weight: 950;
  text-align: center;
  text-shadow: 0 2px 8px black;
  transform: translateX(-50%);
}

.exhaust {
  position: absolute;
  z-index: -1;
  bottom: 0;
  width: 32px;
  height: 38px;
  border-radius: 50%;
  background: rgba(229, 235, 230, 0.64);
  filter: blur(5px);
  animation: exhaustPuff 0.55s ease-out infinite;
}
.exhaust-left { left: 22%; }
.exhaust-right { right: 22%; animation-delay: -0.28s; }

.race-world.turn-left .car-area { transform: translateX(-73%) rotate(-6deg); }
.race-world.turn-right .car-area { transform: translateX(-27%) rotate(6deg); }
.race-world.is-boosting .race-car { animation: boostCar 0.14s linear infinite alternate; filter: saturate(1.2) drop-shadow(0 24px 12px rgba(0, 0, 0, 0.58)); }
.race-world.is-boosting .exhaust { width: 42px; height: 68px; background: rgba(190, 230, 255, 0.82); animation-duration: 0.2s; }
.race-world.is-nitro::before { animation: nitroBackgroundRush 0.1s linear infinite alternate; filter: saturate(1.35) blur(1.2px); }
.race-world.is-nitro::after { opacity: 1; background: repeating-linear-gradient(102deg, transparent 0 25px, rgba(61, 216, 255, 0.54) 27px 30px, transparent 32px 54px, rgba(255, 224, 78, 0.46) 56px 59px, transparent 61px 82px); animation-duration: 0.12s; }
.race-world.is-nitro .race-car { animation: nitroCar 0.08s linear infinite alternate; filter: saturate(1.35) drop-shadow(0 0 18px rgba(49, 201, 255, 0.95)) drop-shadow(0 28px 12px rgba(0, 0, 0, 0.62)); }
.race-world.is-nitro .exhaust { width: 52px; height: 92px; background: linear-gradient(180deg, #fff, #46d9ff 36%, rgba(255, 224, 78, 0.55)); filter: blur(4px); }
.race-world.is-braking .race-car { animation: brakeCar 0.12s ease-out 3; }
.race-world.is-braking .sign-zone { transform: translateX(-50%) scale(1.035); }
.race-world.is-stalled .race-car { animation: stallShake 0.14s linear 4; filter: grayscale(0.28) drop-shadow(0 18px 11px rgba(0, 0, 0, 0.52)); }
.race-world.is-stalled .road::after,
.race-world.is-stalled .lane-line { animation-play-state: paused; }
.race-world.is-stalled .exhaust { opacity: 0; animation-play-state: paused; }

.minimap {
  position: absolute;
  z-index: 22;
  top: max(82px, calc(env(safe-area-inset-top) + 72px));
  right: 7px;
  width: 112px;
  height: min(58vh, 430px);
  padding: 9px 7px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  background: rgba(4, 14, 20, 0.69);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

.minimap-topline { position: relative; z-index: 2; display: flex; align-items: start; justify-content: space-between; color: #aab7c0; font-size: 7px; letter-spacing: 0.08em; }
.minimap-topline strong { display: grid; gap: 2px; }
.minimap-topline small { color: #9aabb7; font-size: 6px; font-weight: 750; letter-spacing: 0; }
.minimap-topline span { color: white; font-weight: 950; }
.map-lines { position: absolute; top: 34px; right: 4px; bottom: 5px; width: calc(100% - 8px); height: calc(100% - 39px); overflow: visible; }
.map-route {
  fill: none;
  stroke: #77848c;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  transition: opacity 180ms ease, stroke 180ms ease, stroke-width 180ms ease;
}
.map-route.is-skipped { opacity: 0.1; }
.map-route-shortcut { stroke-width: 3; }
.map-route-detour { stroke-width: 4; }
.map-route.is-chosen { stroke: #399eff; stroke-width: 4.8; opacity: 0.95; }
.map-route.is-active { stroke: var(--yellow); stroke-width: 6; stroke-dasharray: 5 4; animation: mapRouteDrive 0.35s linear infinite; }
.map-route.is-completed { stroke: #399eff; stroke-width: 4.8; opacity: 1; }
.map-route.is-auto { stroke: #ff8651; }
.map-node { fill: #dce5ea; stroke: #192a35; stroke-width: 1.5; }
.map-player { fill: #3b9cff; stroke: white; stroke-width: 2.4; filter: drop-shadow(0 2px 3px #000); }
.map-start-label { fill: #7f909d; font-size: 6px; font-weight: 900; letter-spacing: 0.06em; }
.map-finish-label { fill: white; font-size: 20px; filter: drop-shadow(0 2px 2px #000); }

.result-screen {
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 38px 25px;
  text-align: center;
  background: radial-gradient(circle at 50% 21%, #184a70, #071727 44%, #030914 100%);
}
.result-screen.is-active { display: flex; }
.result-flag { width: 74px; margin-bottom: 5px; filter: drop-shadow(0 8px 9px rgba(0, 0, 0, 0.4)); }
.result-screen h2 { margin: 8px 0 2px; color: var(--yellow); font-size: clamp(38px, 10vw, 52px); letter-spacing: -0.07em; text-shadow: 0 5px 0 #8b4b00; }
.record-message { min-height: 23px; margin: 9px 0 20px; color: #d1deea; font-weight: 800; }
.result-time { display: grid; width: min(100%, 340px); padding: 16px; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 18px; background: rgba(1, 9, 17, 0.54); }
.result-time span { color: #a8b7c5; font-size: 9px; font-weight: 900; letter-spacing: 0.16em; }
.result-time strong { margin-top: 3px; font-size: 36px; font-variant-numeric: tabular-nums; }
.result-stats { display: grid; width: min(100%, 380px); grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 12px 0 22px; }
.result-stats div { padding: 10px 5px; border-radius: 13px; background: rgba(255, 255, 255, 0.08); }
.result-stats dt { color: #93a7b9; font-size: 9px; }
.result-stats dd { margin: 3px 0 0; font-size: 16px; font-weight: 950; }
.result-retry { width: min(100%, 340px); }
.text-button { margin-top: 14px; padding: 10px 16px; border: 0; color: #c8d3dc; font-weight: 800; text-decoration: underline; background: transparent; cursor: pointer; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti::before,
.confetti::after { position: absolute; inset: -20% 0 0; content: ""; background-image: radial-gradient(#ffc51b 0 4px, transparent 5px), radial-gradient(#ff594e 0 3px, transparent 4px), radial-gradient(#4ed28d 0 3px, transparent 4px); background-position: 20px 20px, 70px 10px, 120px 50px; background-size: 130px 115px; animation: confettiFall 5s linear infinite; }
.confetti::after { animation-delay: -2.5s; transform: translateX(36px); }

.toast {
  position: absolute;
  z-index: 100;
  top: max(84px, calc(env(safe-area-inset-top) + 78px));
  left: 50%;
  max-width: 86%;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  background: rgba(3, 14, 25, 0.9);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -9px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes roadRush { to { background-position-y: 52px; } }
@keyframes laneRush { from { transform: translate(-50%, -80px) scale(0.3); } to { transform: translate(-50%, 610px) scale(3); } }
@keyframes engineVibration { to { transform: translateY(1.5px); } }
@keyframes backgroundRush { from { transform: scale(1.04) translateY(-0.4%); } to { transform: scale(1.1) translateY(1.8%); } }
@keyframes nitroBackgroundRush { from { transform: scale(1.08) translateY(-1%); } to { transform: scale(1.18) translateY(3%); } }
@keyframes speedLines { from { transform: translateY(-30%); } to { transform: translateY(30%); } }
@keyframes boostCar { from { transform: translateY(1px) scale(1.01); } to { transform: translateY(-4px) scale(1.06); } }
@keyframes nitroCar { from { transform: translateY(2px) scale(1.05); } to { transform: translateY(-7px) scale(1.12); } }
@keyframes nitroHud { to { transform: scale(1.025); } }
@keyframes countdownPop { from { opacity: 0; transform: scale(1.8); } to { opacity: 1; transform: scale(1); } }
@keyframes brakeCar { 35% { transform: translateY(7px) scaleY(0.94); } 70% { transform: translateY(-2px) scaleY(1.03); } }
@keyframes stallShake { 25% { transform: translateX(-5px) rotate(-1deg); } 75% { transform: translateX(5px) rotate(1deg); } }
@keyframes exhaustPuff { from { transform: translateY(-5px) scale(0.4); opacity: 0.7; } to { transform: translateY(35px) scale(1.5); opacity: 0; } }
@keyframes confettiFall { to { transform: translateY(115px) rotate(6deg); } }
@keyframes mapRouteDrive { to { stroke-dashoffset: -9; } }

@media (min-width: 620px) {
  body { padding: 18px 0; background: radial-gradient(circle at center, #17344f, #030913 70%); }
  .game-shell { height: calc(100dvh - 36px); max-height: 900px; border: 4px solid #244e72; border-radius: 34px; }
}

@media (max-height: 700px) {
  .menu-content { margin-top: -3vh; transform: scale(0.9); }
  .menu-car { width: 49%; }
  .combo-hud { top: 62px; }
  .sign-zone { top: 29%; width: 70%; }
  .sign-copy { height: 96px; grid-template-rows: 29px 22px 1fr; padding: 9px 7px 7px; }
  .car-area { bottom: 78px; width: 39%; }
  .minimap { top: 70px; width: 96px; height: min(61vh, 330px); }
  .typing-form { bottom: 85%; }
}

body.mobile-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body.mobile-viewport .game-shell {
  position: fixed;
  top: var(--viewport-offset-top, 0px);
  left: calc(50% + var(--viewport-offset-left, 0px));
  height: var(--app-height, 100dvh);
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  transform: translateX(-50%);
}

@media (max-width: 619px) {
  body.mobile-ad-compact { --mobile-ad-space: calc(60px + env(safe-area-inset-bottom)); }
  body.mobile-ad-banner { --mobile-ad-space: calc(110px + env(safe-area-inset-bottom)); }
  body.has-mobile-ad .screen.is-active { bottom: var(--mobile-ad-space); }
  body.has-mobile-ad .game-ad-mobile:not([hidden]) {
    position: absolute;
    z-index: 125;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    width: 100%;
    height: var(--mobile-ad-space);
    place-items: center;
    align-content: start;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(5, 19, 33, 0.97);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.24);
  }
  body.has-mobile-ad .game-ad-mobile-compact { grid-template-rows: 10px 50px; }
  body.has-mobile-ad .game-ad-mobile-banner { grid-template-rows: 10px 100px; }
}

body.keyboard-open .game-shell { height: var(--app-height, 100dvh); }
body.keyboard-open .race-hud { top: 4px; right: 92px; left: 7px; grid-template-columns: 1fr; }
body.keyboard-open .rank-chip,
body.keyboard-open .timer-block span { display: none; }
body.keyboard-open .timer-block { justify-items: start; padding: 5px 9px; }
body.keyboard-open .timer-block strong { font-size: 15px; }
body.keyboard-open .combo-hud { top: 37px; right: 91px; left: 7px; padding: 4px 7px 5px; }
body.keyboard-open .combo-copy strong { font-size: 9px; }
body.keyboard-open .combo-copy span { font-size: 6px; }
body.keyboard-open .nitro-track { height: 3px; margin-top: 3px; }
body.keyboard-open .countdown-overlay { padding: 7px; }
body.keyboard-open .countdown-card { width: min(100%, 285px); padding: 9px 10px 10px; border-radius: 16px; }
body.keyboard-open .countdown-eyebrow { font-size: 7px; }
body.keyboard-open .countdown-number { min-height: 54px; font-size: 52px; line-height: 1; }
body.keyboard-open .countdown-overlay.is-go .countdown-number { font-size: 36px; line-height: 1.45; }
body.keyboard-open .countdown-card h2 { font-size: 17px; }
body.keyboard-open .countdown-description { margin: 4px 0 6px; font-size: 9px; line-height: 1.35; }
body.keyboard-open .countdown-rules { gap: 4px; }
body.keyboard-open .countdown-rules span { padding: 4px; font-size: 6px; }
body.keyboard-open .countdown-tip { margin-top: 6px; font-size: 6px; }
body.keyboard-open .sign-zone { top: 28%; left: 39%; width: 68%; gap: 8px; transform: translateX(-50%) scale(0.82); transform-origin: top center; }
body.keyboard-open .sign-copy { height: 94px; grid-template-rows: 28px 22px 1fr; padding: 9px 6px 6px; }
body.keyboard-open .sign-copy span { font-size: clamp(13px, 4.6vw, 18px); }
body.keyboard-open .sign-copy strong { margin-top: 2px; font-size: 18px; }
body.keyboard-open .sign-copy small { margin-top: 2px; padding: 2px 5px; font-size: 6px; }
body.keyboard-open .junction-meter { top: 23%; left: 38%; width: 42%; }
body.keyboard-open .car-area { bottom: 8px; left: 37%; width: min(34%, 145px); }
body.keyboard-open .typing-form { bottom: 76%; width: min(185%, 250px); grid-template-columns: 1fr 39px; border-width: 2px; }
body.keyboard-open .typing-form input { height: 38px; font-size: 16px; }
body.keyboard-open .typing-form button { font-size: 20px; }
body.keyboard-open .engine-message { bottom: 112%; min-width: 170px; font-size: 14px; }
body.keyboard-open .minimap { top: 4px; right: 5px; width: 80px; height: calc(100% - 9px); padding: 6px 4px; border-radius: 14px; }
body.keyboard-open .minimap-topline { font-size: 6px; }
body.keyboard-open .minimap-topline small { display: none; }
body.keyboard-open .map-lines { top: 24px; height: calc(100% - 28px); }
body.keyboard-open .utility-menu-toggle { top: 5px; right: 5px; width: 38px; height: 38px; padding: 8px; border-radius: 12px; }
body.keyboard-open .utility-menu { top: 48px; right: 5px; width: min(280px, calc(100% - 10px)); }
body.keyboard-open .contact-modal { padding: 7px; }
body.keyboard-open .contact-card { width: min(100%, 310px); padding: 18px 14px 12px; border-radius: 18px; }
body.keyboard-open .contact-card h2 { margin: 3px 0; font-size: 19px; }
body.keyboard-open .contact-card > p:not(.contact-eyebrow, .contact-copy-status) { margin-bottom: 6px; font-size: 9px; }
body.keyboard-open .contact-card code { padding: 8px 6px; font-size: 12px; }
body.keyboard-open .contact-copy-button { margin-top: 6px; padding: 8px; }
body.keyboard-open .contact-copy-status { min-height: 12px; margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
