.car-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 48px;
}

.hero {
  padding: 52px 20px 12px;
}

.section-subtitle,
.drive-hint {
  margin: 0;
  color: #cfd8ff;
  font-size: 1rem;
  text-align: center;
  padding: 0 16px;
}

.drive-hint {
  color: #ffd166;
  font-size: 0.95rem;
}

.toast {
  margin: 0;
  min-height: 1.3em;
  color: #06d6a0;
  font-weight: bold;
  text-align: center;
}

.viewport {
  position: relative;
  width: min(96vw, 720px);
  height: min(52vh, 460px);
  min-height: 300px;
  overflow: hidden;
  background: #4f7d3f;
  user-select: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sky {
  display: none;
}

.hud {
  position: absolute;
  z-index: 4;
  inset: 10px 10px auto 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.minimap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(30, 50, 40, 0.55);
  overflow: hidden;
}

.mm-north {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: #ffd166;
  font-weight: bold;
}

.minimap-car {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 12px solid #ef476f;
  margin-left: -5px;
  margin-top: -8px;
  transform-origin: 50% 70%;
}

.mm-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: -3px;
  margin-top: -3px;
}

.mm-dot.pad {
  background: #ffd166;
}

.mm-dot.tree {
  background: #22aa44;
  width: 4px;
  height: 4px;
}

.speed-meter,
.gear-meter,
.score-meter,
.phase-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(20, 24, 40, 0.55);
  color: #e8ecff;
  font-size: 0.72rem;
}

.speed-meter strong,
.gear-meter strong,
.score-meter strong,
.phase-meter strong {
  font-size: 1.25rem;
  color: #ffd166;
  line-height: 1.1;
}

.score-meter strong.low {
  color: #ef476f;
}

.mm-dot.gate {
  background: #ffd166;
  width: 7px;
  height: 7px;
}

.mm-dot.gate.next {
  background: #06d6a0;
  box-shadow: 0 0 6px #06d6a0;
}

.mm-dot.gate.done {
  background: #94a3b8;
}

.mm-dot.finish {
  background: #4d7cff;
  width: 8px;
  height: 8px;
}

.camera {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.ground {
  position: absolute;
  width: 2400px;
  height: 2400px;
  left: 0;
  top: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.06) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(0, 0, 0, 0.05) 0 2px, transparent 3px),
    repeating-linear-gradient(0deg, transparent 0 48px, rgba(255, 255, 255, 0.04) 48px 49px),
    repeating-linear-gradient(90deg, transparent 0 48px, rgba(255, 255, 255, 0.04) 48px 49px),
    #5a8f45;
  box-shadow: inset 0 0 0 28px #4a7538;
}

.course-pad {
  position: absolute;
  background: #5c6673;
  border: 4px solid #94a3b8;
  border-radius: 12px;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.route-line {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
}

.mm-route {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mm-route-seg {
  position: absolute;
  height: 2px;
  background: #4d7cff;
  opacity: 0.85;
  transform-origin: center center;
}

.gate {
  position: absolute;
  height: 20px;
  background: rgba(255, 209, 102, 0.35);
  border: 3px dashed #ffd166;
  border-radius: 6px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  z-index: 3;
}

.gate.next {
  background: rgba(6, 214, 160, 0.4);
  border-color: #06d6a0;
  border-style: solid;
  box-shadow: 0 0 12px rgba(6, 214, 160, 0.5);
}

.gate.done {
  background: rgba(148, 163, 184, 0.25);
  border-color: #94a3b8;
  opacity: 0.55;
}

.gate-num {
  font-weight: bold;
  font-size: 0.85rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cone {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 18px solid #ef476f;
  z-index: 3;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.25));
}

.cone::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 10px;
  height: 3px;
  background: #fff;
}

.cone.hit {
  opacity: 0.25;
  transform: scale(0.7) rotate(25deg);
}

.parking.finish-pad {
  border-color: #4d7cff;
}

.parking.finish-pad::after {
  content: "★";
  color: rgba(77, 124, 255, 0.85);
}

.license-card {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(86%, 320px);
  padding: 22px 18px 16px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff8e7, #f1e4c5);
  border: 3px solid #c4a574;
  color: #3b2f1a;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.license-card[hidden] {
  display: none !important;
}

.license-stamp {
  margin: 0 0 6px;
  color: #ef476f;
  font-weight: bold;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.license-card.fail {
  background: linear-gradient(160deg, #fde8e8, #f5d0d0);
  border-color: #ef476f;
}

.license-card.fail .license-stamp {
  color: #b91c1c;
}

.license-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.license-score {
  margin: 0 0 6px;
  font-size: 1rem;
}

.license-name {
  margin: 0 0 14px;
  color: #6b5a3c;
  font-size: 0.95rem;
}

.license-close {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #c4a574;
  background: #fff;
  color: #3b2f1a;
  cursor: pointer;
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.road-h,
.road-v {
  position: absolute;
  background: #4a5568;
  box-shadow: inset 0 0 0 2px #64748b;
}

.road-h {
  height: 110px;
}

.road-v {
  width: 110px;
}

.road-line {
  position: absolute;
  background: repeating-linear-gradient(
    90deg,
    #f8fafc 0 18px,
    transparent 18px 36px
  );
  height: 4px;
  left: 8%;
  right: 8%;
  top: 50%;
  margin-top: -2px;
  opacity: 0.85;
}

.road-v .road-line {
  background: repeating-linear-gradient(
    0deg,
    #f8fafc 0 18px,
    transparent 18px 36px
  );
  width: 4px;
  height: auto;
  left: 50%;
  right: auto;
  top: 8%;
  bottom: 8%;
  margin-left: -2px;
  margin-top: 0;
}

.parking {
  position: absolute;
  width: 140px;
  height: 100px;
  background: #64748b;
  border: 3px solid #ffd166;
  border-radius: 6px;
  box-sizing: border-box;
}

.parking::after {
  content: "P";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 2rem;
  color: rgba(255, 209, 102, 0.7);
}

.tree-flat {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #4ade80, #15803d);
  margin-left: -14px;
  margin-top: -14px;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.18);
}

.building-top {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 4px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
}

.building-top.red {
  background: linear-gradient(135deg, #f87171, #b91c1c);
}

.building-top.blue {
  background: linear-gradient(135deg, #60a5fa, #1d4ed8);
  width: 64px;
  height: 64px;
}

.building-top.yellow {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  width: 48px;
  height: 48px;
}

.sign-top {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  border: 3px solid #fff;
  box-sizing: border-box;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.car-shadow {
  position: absolute;
  width: 40px;
  height: 56px;
  margin-left: -20px;
  margin-top: -28px;
  border-radius: 40%;
  background: rgba(0, 0, 0, 0.35);
  z-index: 4;
}

.car {
  position: absolute;
  width: 44px;
  height: 72px;
  left: 0;
  top: 0;
  transform-origin: 50% 50%;
  z-index: 5;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
}

.car-body {
  position: absolute;
  inset: 8px 4px 8px 4px;
  background: linear-gradient(180deg, #ef476f, #c1121f);
  border-radius: 10px 10px 8px 8px;
  box-shadow: inset 0 -3px 0 #7f1d1d;
}

.car-cabin {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 14px;
  height: 22px;
  background: linear-gradient(180deg, #bae6fd, #7dd3fc);
  border-radius: 6px 6px 4px 4px;
}

.car-hood {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 6px;
  height: 14px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 0 0 6px 6px;
}

.car-light {
  position: absolute;
  bottom: 4px;
  width: 8px;
  height: 5px;
  border-radius: 2px;
  background: #fef08a;
}

.car-light-l { left: 4px; }
.car-light-r { right: 4px; }

.car-wheel {
  position: absolute;
  width: 10px;
  height: 16px;
  background: #1e293b;
  border-radius: 3px;
  border: 1px solid #94a3b8;
  box-sizing: border-box;
}

.wheel-fl { left: -2px; top: 12px; }
.wheel-fr { right: -2px; top: 12px; }
.wheel-rl { left: -2px; bottom: 10px; }
.wheel-rr { right: -2px; bottom: 10px; }

.dashboard {
  width: min(96vw, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.dash-lcd {
  display: flex;
  gap: 24px;
  color: #cfd8ff;
  font-size: 0.95rem;
}

.dash-lcd strong {
  color: #ffd166;
}

.gear-row {
  display: flex;
  gap: 8px;
}

.gear-btn {
  width: 56px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #e8ecff;
  font-size: 1.15rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
}

.btn-main {
  display: block;
  line-height: 1.1;
}

/* .btn-key 기본형은 공통 style.css 로 이동 */

.gear-btn.active .btn-key {
  color: rgba(255, 209, 102, 0.9);
}

.gear-btn.active {
  border-color: #ffd166;
  background: rgba(255, 209, 102, 0.25);
  color: #ffd166;
}

.gear-btn[data-gear="R"].active {
  border-color: #ef476f;
  background: rgba(239, 71, 111, 0.25);
  color: #ef476f;
}

.gear-caption {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}

.keys-hint {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  text-align: center;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  width: 100%;
}

.steer-panel,
.pedal-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pedal-panel {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 280px;
}

.steer-wheel {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 10px solid #cbd5e1;
  background: radial-gradient(circle at 50% 50%, #334155 0 28%, transparent 29%);
  box-shadow: inset 0 0 0 4px #64748b;
  position: relative;
  transition: transform 0.08s linear;
}

.steer-hub {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: #94a3b8;
}

.steer-btns {
  display: flex;
  gap: 12px;
}

.hold-btn {
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #e8ecff;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.hold-btn:active,
.hold-btn.is-held {
  background: rgba(255, 209, 102, 0.3);
  border-color: #ffd166;
}

.steer-btn {
  width: 72px;
  height: 58px;
  border-radius: 14px;
  font-size: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.pedal {
  width: 120px;
  height: 92px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pedal .btn-key {
  font-size: 0.68rem;
}

.pedal-brake {
  background: rgba(239, 71, 111, 0.2);
  border-color: rgba(239, 71, 111, 0.5);
}

.pedal-brake.is-held {
  background: rgba(239, 71, 111, 0.45);
}

.pedal-gas {
  background: rgba(6, 214, 160, 0.2);
  border-color: rgba(6, 214, 160, 0.5);
}

.pedal-gas.is-held {
  background: rgba(6, 214, 160, 0.45);
}

.ctrl-label {
  margin: 0;
  width: 100%;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

.restart-btn {
  margin-top: 4px;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #e8ecff;
  font-size: 1rem;
  cursor: pointer;
}

.restart-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 520px) {
  .gear-btn {
    width: 46px;
    height: 46px;
  }

  .pedal {
    width: 96px;
    height: 76px;
    font-size: 0.9rem;
  }

  .steer-btn {
    width: 56px;
  }
}
