.road-game { display: flex; flex-direction: column; gap: 14px; max-width: 1280px; }
.seg { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; font-weight: 800; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }

.stage {
  position: relative; border-radius: 28px; overflow: hidden; background: #1A1C26;
  aspect-ratio: 16 / 9; max-height: calc(100svh - 96px); width: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
canvas { display: block; width: 100%; height: 100%; outline: none; }

.hud { position: absolute; left: 16px; right: 16px; top: 7%; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-left { display: flex; flex-wrap: wrap; gap: 8px; max-width: 37%; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(20,22,34,.62); color: #FFFFFF;
  border-radius: 14px; padding: 6px 12px; font-size: 16px; backdrop-filter: blur(4px);
}
.chip-label { font-size: 12px; font-weight: 800; color: #C9D2EE; text-transform: uppercase; letter-spacing: .6px; }
.lapbar { display: inline-block; width: 70px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.2); overflow: hidden; }
.lapbar i { display: block; height: 100%; width: 0; background: #FFE49A; border-radius: 999px; }

.toasts { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(90%, 520px); }
.toast {
  background: rgba(255,255,255,.95); color: var(--ink); border-radius: 16px; padding: 8px 16px;
  font-weight: 800; font-size: 16px; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.15);
  animation: toastIn .25s ease-out, toastOut .4s ease-in 2.2s forwards;
}
.toast.good { background: #E4FAF2; color: #0B6B4C; }
.toast.bad { background: #FFE6E0; color: #A6391A; }
.toast.info { background: #FFF3D1; color: #6A4300; }
.toast.big { font-family: var(--display); font-size: 22px; background: #22305A; color: #FFFFFF; }
@keyframes toastIn { from { transform: translateY(-8px) scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20,22,40,.55); overflow-y: auto; }
.panel-card {
  background: #FFFFFF; border-radius: 28px; padding: 22px 26px; max-width: 620px; width: 100%;
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.18);
}
.panel-card.small { max-width: 420px; }
.panel-card h1 { font-size: 40px; }
.panel-card h2 { font-size: 30px; }
.lead { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.5; }
.rules { list-style: none; margin: 4px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 14px; text-align: left; font-size: 14px; }
.rules li { display: flex; align-items: center; gap: 8px; }
.ico { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; }
.l-green { background: #36D27A; } .l-orange { background: #FFA53D; } .l-red { background: #FF4B4B; }
.ico.bump { border-radius: 6px; background: repeating-linear-gradient(90deg, #FFC83D 0 5px, #2B2B2B 5px 10px); }
.ico.school { border-radius: 4px; background: #FFD43B; transform: rotate(45deg) scale(.8); }
.ico.hwy { border-radius: 6px; background: #1F8A5B; }
.keys { margin: 0; font-size: 13px; color: var(--ink-soft); }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.strikes { display: inline-flex; gap: 4px; }
.strikes i { width: 14px; height: 14px; border-radius: 4px; background: #5FE1A0; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.strikes i.used { background: #FF4B4B; animation: strikePop .5s ease-out; }
@keyframes strikePop { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
.chip.mult { background: rgba(26,143,87,.85); }
.ico.walk { border-radius: 4px; background: repeating-linear-gradient(90deg, #FFFFFF 0 4px, #5A6075 4px 8px); }
.ico.crash { background: #FF4B4B; clip-path: polygon(50% 0, 62% 35%, 100% 30%, 70% 58%, 85% 100%, 50% 75%, 15% 100%, 30% 58%, 0 30%, 38% 35%); border-radius: 0; }
.tip { margin: 0; font-size: 14px; color: var(--ink-soft); }
@media (max-height: 900px) { .tip { display: none; } .road-game { gap: 8px; } .road-game.wrap { padding-top: 8px; padding-bottom: 8px; } }

.touch { position: absolute; left: 0; right: 0; bottom: 3%; display: none; justify-content: space-between; padding: 0 3%; pointer-events: none; }
.touch-l, .touch-r { display: flex; gap: 10px; pointer-events: auto; }
.tbtn {
  min-width: 64px; min-height: 64px; border-radius: 20px; border: 2px solid rgba(255,255,255,.5);
  background: rgba(20,22,34,.55); color: #FFFFFF; font-weight: 800; font-size: 18px; touch-action: none;
}
.tbtn.gas { background: rgba(26,143,87,.8); }
.tbtn.brake { background: rgba(196,60,60,.75); }
.tbtn.on { transform: scale(.94); background: rgba(255,255,255,.35); }
@media (pointer: coarse) { .touch { display: flex; } }

@media (max-width: 720px) {
  .stage { aspect-ratio: 4 / 5; max-height: calc(100svh - 120px); border-radius: 20px; }
  .chip { font-size: 13px; padding: 4px 8px; }
  .chip-label { font-size: 10px; }
  .lapbar { width: 44px; }
  .panel-card h1 { font-size: 30px; }
  .rules { font-size: 13px; }
  .tbtn { min-width: 54px; min-height: 54px; font-size: 15px; }
}
