:root {
  color-scheme: light;
  --ink: #151a1c;
  --muted: #667174;
  --paper: #f1f4ef;
  --panel: #ffffff;
  --line: #d6ded8;
  --asphalt: #323a3d;
  --asphalt-2: #252c2f;
  --stripe: rgba(255, 255, 255, 0.68);
  --amber: #f0b33f;
  --red: #df4f45;
  --blue: #357dc2;
  --green: #3f9b77;
  --violet: #7560a8;
  --shadow: 0 18px 44px rgba(21, 26, 28, 0.14);
  --radius: 8px;
  font-family:
    "Microsoft JhengHei",
    "Noto Sans TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 26, 28, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(21, 26, 28, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(21, 26, 28, 0.08);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--asphalt);
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand h1 {
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.toolstrip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.menu-link-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  font-size: 0.86rem;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.icon-button:hover,
.icon-button:focus-visible,
.menu-link-button:hover,
.menu-link-button:focus-visible {
  border-color: var(--amber);
  color: #8a5a00;
  transform: translateY(-1px);
  outline: none;
}

.icon-button:disabled {
  cursor: not-allowed;
  color: #a4adb0;
  background: #eef1ee;
  transform: none;
}

.icon-button.is-on {
  border-color: #d8b349;
  color: #7a5810;
  background: #fff5cf;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.volume-control {
  width: 122px;
  min-height: 44px;
  padding: 5px 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
}

.volume-control input {
  width: 100%;
  accent-color: var(--amber);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.play-stage,
.command-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.play-stage {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lot-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.lot-strip div,
.score-block,
.trip-stats div {
  min-width: 0;
}

.lot-strip span,
.score-block span,
.trip-stats span,
.meter-head span,
.panel-title span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.lot-strip strong,
.score-block strong,
.trip-stats strong,
.meter-head strong,
.panel-title strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.2;
}

.lot-wrap {
  position: relative;
  width: min(100%, 730px);
  margin: 0 auto;
  padding: 31px;
}

.parking-lot {
  --size: 6;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  gap: var(--board-gap, 8px);
  aspect-ratio: 1;
  padding: var(--board-pad, 12px);
  border: 4px solid #1d2325;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(21, 26, 28, 0.08), rgba(21, 26, 28, 0.2)),
    var(--board-bg, url("assets/parking-lot-board.png")) center / cover no-repeat,
    var(--asphalt);
  overflow: visible;
}

.bay {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background:
    linear-gradient(90deg, var(--stripe) 0 2px, transparent 2px calc(100% - 2px), var(--stripe) calc(100% - 2px)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.35) 0 2px, transparent 2px calc(100% - 2px), rgba(255, 255, 255, 0.35) calc(100% - 2px));
  opacity: 0.5;
}

.bay.is-turn {
  opacity: 0.95;
  background:
    radial-gradient(circle, rgba(240, 179, 63, 0.95), rgba(240, 179, 63, 0.24) 56%, transparent 58%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.48),
    0 0 16px rgba(240, 179, 63, 0.42);
}

.bay.is-corner-turn {
  opacity: 0.96;
  background:
    radial-gradient(circle, rgba(53, 125, 194, 0.96), rgba(53, 125, 194, 0.28) 56%, transparent 58%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.06));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 16px rgba(53, 125, 194, 0.45);
}

.bay.is-stop {
  opacity: 0.98;
  background:
    radial-gradient(circle, rgba(223, 79, 69, 0.95), rgba(223, 79, 69, 0.32) 52%, transparent 58%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 16px rgba(223, 79, 69, 0.42);
}

.bay.is-turn span,
.bay.is-corner-turn span,
.bay.is-stop span {
  display: grid;
  place-items: center;
  width: 56%;
  height: 56%;
  border-radius: 999px;
  color: #171d1f;
  background: rgba(255, 255, 255, 0.82);
  font-weight: 1000;
  font-size: clamp(0.62rem, 2vw, 1.2rem);
  line-height: 1;
}

.bay.is-corner-turn span {
  color: #ffffff;
  background: rgba(15, 55, 92, 0.84);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.bay.is-stop span {
  border-radius: 8px;
  color: #ffffff;
  background: #cf3028;
  font-size: clamp(0.58rem, 1.7vw, 1rem);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.vehicle {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(0, 0, 0, 0.08)),
    var(--vehicle-color);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 15px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  overflow: visible;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.vehicle:hover,
.vehicle:focus-visible {
  transform: translateY(-3px);
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 14px 24px rgba(0, 0, 0, 0.34);
}

.vehicle-img {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.28));
  transform-origin: center;
  transform: scale(var(--vehicle-img-scale, 0.7));
}

.vehicle[data-dir="right"] .vehicle-img {
  transform: rotate(90deg) scale(var(--vehicle-img-cross-scale, 0.82));
}

.vehicle[data-dir="down"] .vehicle-img {
  transform: rotate(180deg) scale(var(--vehicle-img-scale, 0.7));
}

.vehicle[data-dir="left"] .vehicle-img {
  transform: rotate(-90deg) scale(var(--vehicle-img-cross-scale, 0.82));
}

.vehicle.is-large-vehicle .vehicle-img {
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  transform: scale(var(--large-vehicle-y-scale, 1.08));
}

.vehicle.is-large-vehicle[data-dir="right"] .vehicle-img {
  transform: rotate(90deg) scale(var(--large-vehicle-x-scale, 2.78));
}

.vehicle.is-large-vehicle[data-dir="down"] .vehicle-img {
  transform: rotate(180deg) scale(var(--large-vehicle-y-scale, 1.08));
}

.vehicle.is-large-vehicle[data-dir="left"] .vehicle-img {
  transform: rotate(-90deg) scale(var(--large-vehicle-x-scale, 2.78));
}

.vehicle-face {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 5px;
  width: clamp(22px, 3vw, 30px);
  height: clamp(22px, 3vw, 30px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(12, 17, 19, 0.72);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
}

.vehicle.is-large-vehicle .vehicle-face {
  top: -12px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: clamp(26px, 3.3vw, 36px);
  height: clamp(26px, 3.3vw, 36px);
  background: rgba(12, 17, 19, 0.86);
}

.vehicle-arrow {
  font-size: clamp(0.8rem, 1.9vw, 1.16rem);
}

.parking-lot[data-size="10"] .vehicle-face,
.parking-lot[data-size="11"] .vehicle-face {
  top: 4px;
  right: 4px;
  width: clamp(18px, 2.4vw, 25px);
  height: clamp(18px, 2.4vw, 25px);
}

.parking-lot[data-size="10"] .vehicle.is-large-vehicle .vehicle-face,
.parking-lot[data-size="11"] .vehicle.is-large-vehicle .vehicle-face {
  top: -10px;
  left: 50%;
  right: auto;
  width: clamp(22px, 2.8vw, 30px);
  height: clamp(22px, 2.8vw, 30px);
}

.parking-lot[data-size="10"] .vehicle-arrow,
.parking-lot[data-size="11"] .vehicle-arrow {
  font-size: clamp(0.7rem, 1.5vw, 0.95rem);
}

.vehicle.is-exiting {
  z-index: 8;
  pointer-events: none;
}

.vehicle.is-blocked {
  animation: shake 280ms ease;
  filter: saturate(1.18);
}

.vehicle.is-hint {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 0 4px rgba(240, 179, 63, 0.75),
    0 15px 28px rgba(0, 0, 0, 0.38);
}

.exit-sign {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  color: #1e2a20;
  background: var(--amber);
  font-size: 0.76rem;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(21, 26, 28, 0.22);
}

.exit-north {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.exit-east {
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
}

.exit-south {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.exit-west {
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
}

.status-line {
  min-height: 36px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #3b2f09;
  background: #fff3cf;
  font-weight: 700;
}

.command-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-block,
.trip-stats div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.score-block strong {
  font-size: 1.7rem;
}

.meter-stack,
.manifest,
.achievements {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meter-head,
.panel-title,
.manifest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meter {
  height: 12px;
  border-radius: 999px;
  background: #e6ece8;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  transition: width 220ms ease;
}

.trip-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.manifest-list {
  display: block;
}

.countdown-card {
  min-height: 132px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(51, 133, 255, 0.12), rgba(255, 184, 61, 0.16)),
    #fbfcfb;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.countdown-number {
  color: #12171b;
  font-size: clamp(3.1rem, 6vw, 5.2rem);
  line-height: 0.95;
  font-weight: 950;
}

.countdown-label {
  color: #12171b;
  font-size: 1.02rem;
  font-weight: 900;
}

.countdown-sub {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.badge-card {
  min-width: 0;
  min-height: 128px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcfb;
  display: grid;
  grid-template-rows: auto auto 1fr;
  justify-items: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.badge-card:hover,
.badge-card:focus-visible {
  border-color: var(--amber);
  box-shadow: 0 8px 18px rgba(21, 26, 28, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.badge-card.is-locked {
  color: #737d80;
  cursor: default;
  opacity: 0.72;
}

.badge-card.is-locked:hover,
.badge-card.is-locked:focus-visible {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.badge-art {
  width: 62px;
  height: 62px;
}

.badge-art img,
.badge-toast-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.badge-card.is-locked .badge-art img {
  filter: grayscale(1) opacity(0.56);
}

.badge-name {
  max-width: 100%;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.badge-condition {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.badge-card.is-earned .badge-condition {
  color: #7a5810;
}

.badge-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: min(420px, calc(100% - 28px));
  padding: 12px;
  border: 1px solid #d8c27a;
  border-radius: var(--radius);
  background: rgba(255, 252, 240, 0.98);
  box-shadow: 0 18px 44px rgba(21, 26, 28, 0.18);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.badge-toast[hidden] {
  display: none;
}

.badge-toast-art {
  width: 72px;
  height: 72px;
}

.badge-toast-copy {
  min-width: 0;
}

.badge-toast-copy span,
.badge-toast-copy strong,
.badge-toast-copy p {
  display: block;
}

.badge-toast-copy span {
  color: #8a5a00;
  font-size: 0.78rem;
  font-weight: 900;
}

.badge-toast-copy strong {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.25;
}

.badge-toast-copy p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.download-badge-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #c79629;
  border-radius: var(--radius);
  color: #5a3900;
  background: #ffd76d;
  font-weight: 900;
  cursor: pointer;
}

.download-badge-button:hover,
.download-badge-button:focus-visible {
  background: #ffc94b;
  outline: none;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  padding: 20px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(240, 179, 63, 0.26), transparent 34%),
    rgba(8, 13, 15, 0.72);
}

.intro-overlay[hidden] {
  display: none;
}

.intro-panel {
  width: min(960px, 100%);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.36);
}

.intro-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 6px;
  object-fit: cover;
  background: #101719;
}

.intro-copy {
  padding: 14px 4px 6px;
  text-align: center;
}

.intro-copy span {
  color: #8a5a00;
  font-size: 0.8rem;
  font-weight: 950;
}

.intro-copy h2 {
  margin: 4px 0 4px;
  color: var(--ink);
  font-size: clamp(1.45rem, 4vw, 2.6rem);
  line-height: 1.15;
}

.intro-copy p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.intro-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 4px 2px;
}

.level-complete,
.game-over {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: 18px;
  background: rgba(21, 26, 28, 0.48);
  display: grid;
  place-items: center;
}

.level-complete[hidden],
.game-over[hidden] {
  display: none;
}

.level-complete-panel {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 215, 109, 0.24), rgba(53, 125, 194, 0.14)),
    #ffffff;
  box-shadow: 0 28px 60px rgba(21, 26, 28, 0.28);
  text-align: center;
}

.complete-kicker {
  color: #8a5a00;
  font-size: 0.82rem;
  font-weight: 900;
}

.level-complete-panel h2 {
  margin: 8px 0 6px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.level-complete-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.complete-stats {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.complete-stats div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.complete-stats span,
.complete-stats strong {
  display: block;
}

.complete-stats span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.complete-stats strong {
  margin-top: 2px;
  font-size: 1.28rem;
}

.level-complete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.complete-next-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid #c79629;
  border-radius: var(--radius);
  color: #3e2a04;
  background: #ffd76d;
  font-weight: 950;
  cursor: pointer;
}

.complete-next-button:hover,
.complete-next-button:focus-visible {
  background: #ffc94b;
  outline: none;
}

.game-over-panel {
  width: min(620px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(223, 79, 69, 0.18), rgba(53, 125, 194, 0.1)),
    #ffffff;
}

.leaderboard-form {
  margin: 16px 0 12px;
  text-align: left;
}

.leaderboard-form label,
.leaderboard-title span,
.leaderboard-title strong {
  font-weight: 950;
}

.leaderboard-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.86rem;
}

.leaderboard-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.leaderboard-input-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcfb;
  font: inherit;
  font-weight: 850;
}

.leaderboard-input-row input:focus-visible {
  border-color: #357dc2;
  outline: 3px solid rgba(53, 125, 194, 0.16);
}

.save-score-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #2f6ea9;
  border-radius: var(--radius);
  color: #ffffff;
  background: #357dc2;
  font-weight: 950;
  cursor: pointer;
}

.save-score-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.save-score-button:not(:disabled):hover,
.save-score-button:not(:disabled):focus-visible {
  background: #286ca9;
  outline: none;
}

.leaderboard-status {
  min-height: 18px;
  margin: 6px 0 0;
  color: #47636f;
  font-size: 0.78rem;
  font-weight: 850;
}

.earned-preview,
.leaderboard-panel {
  margin-top: 12px;
  text-align: left;
}

.leaderboard-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--ink);
}

.leaderboard-title strong {
  color: #7a5810;
  font-size: 0.86rem;
}

.earned-badge-strip {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.earned-badge-thumb,
.leaderboard-badge-thumb {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  overflow: hidden;
}

.earned-badge-thumb {
  width: 42px;
  height: 42px;
}

.leaderboard-badge-thumb {
  width: 28px;
  height: 28px;
}

.earned-badge-thumb img,
.leaderboard-badge-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.leaderboard-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(251, 252, 251, 0.76);
  font-size: 0.84rem;
  font-weight: 850;
  text-align: center;
}

.leaderboard-list {
  max-height: 285px;
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 252, 251, 0.92);
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #ffffff;
  background: #151a1c;
  font-weight: 950;
}

.leaderboard-player {
  min-width: 0;
}

.leaderboard-player strong,
.leaderboard-player span {
  display: block;
}

.leaderboard-player strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-player span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 820;
}

.leaderboard-score {
  min-width: 82px;
  text-align: right;
}

.leaderboard-score strong,
.leaderboard-score span {
  display: block;
}

.leaderboard-score strong {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 1000;
}

.leaderboard-score span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
}

.leaderboard-badges {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.leaderboard-badge-more {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 7px;
  color: var(--muted);
  background: #eef2f0;
  font-size: 0.74rem;
  font-weight: 950;
}

.game-over-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.end-game-button,
.menu-return-button {
  min-height: 46px;
  border: 1px solid #bac5c9;
  border-radius: var(--radius);
  color: var(--ink);
  background: #eef2f0;
  font-weight: 950;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.menu-return-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.end-game-button:hover,
.end-game-button:focus-visible,
.menu-return-button:hover,
.menu-return-button:focus-visible {
  background: #dfe7e3;
  outline: none;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 12px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolstrip {
    width: 100%;
    justify-content: space-between;
  }

  .volume-control {
    flex: 1 1 140px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .command-panel {
    order: -1;
  }
}

@media (max-width: 560px) {
  .brand h1 {
    font-size: 1.22rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .lot-wrap {
    padding: 25px;
  }

  .parking-lot {
    gap: min(var(--board-gap, 5px), 5px);
    padding: min(var(--board-pad, 8px), 8px);
  }

  .score-row,
  .trip-stats {
    grid-template-columns: 1fr 1fr;
  }

  .badge-toast {
    right: 14px;
    bottom: 14px;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .badge-toast-art {
    width: 58px;
    height: 58px;
  }

  .intro-overlay {
    padding: 10px;
  }

  .intro-panel {
    padding: 10px;
  }

  .intro-actions {
    grid-template-columns: 1fr;
  }

  .level-complete-actions,
  .game-over-actions {
    grid-template-columns: 1fr;
  }

  .volume-control {
    width: 100%;
    order: 10;
  }

  .download-badge-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}
