* {
  box-sizing: border-box;
}

#world-3d { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; background: #dce9ed url("assets/skyway-world-v2.webp") center center / cover no-repeat; }
#stage { z-index: 1; }
.hud, #coach, #pause-button, .overlay { z-index: 3; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1f2120;
  color: #fbf3e4;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

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

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 70px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.chip {
  min-width: 84px;
  padding: 6px 12px 7px;
  border-radius: 16px;
  background: rgb(42 44 42 / 0.86);
  border: 1px solid #46443e;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.chip .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d9cfbd;
}

.chip strong {
  font-size: clamp(18px, 3.6vmin, 26px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.chip-coin strong {
  color: #ffc857;
}

.chip-stage strong {
  color: #27d6c1;
}

.hud-tag {
  align-self: center;
}

@media (max-width: 480px) {
  .chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 5px 9px 6px;
  }
  .hud-tag {
    display: none;
  }
}

.icon-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid #46443e;
  background: rgb(42 44 42 / 0.86);
  color: #fbf3e4;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.pause-icon {
  width: 16px;
  height: 18px;
  border-left: 5px solid currentColor;
  border-right: 5px solid currentColor;
}

.icon-btn:focus-visible,
.btn:focus-visible,
.paint:focus-visible {
  outline: 3px solid #c6f432;
  outline-offset: 3px;
}

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgb(31 33 32 / 0.55);
}

.card {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: clamp(18px, 4.5vmin, 32px) clamp(18px, 4vmin, 30px);
  border-radius: 28px;
  background: rgb(42 44 42 / 0.95);
  border: 1px solid #46443e;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vmin, 14px);
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(36px, 10vmin, 62px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #27d6c1;
  background: linear-gradient(90deg, #27d6c1, #7fd3ff 50%, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title.small {
  font-size: clamp(30px, 8vmin, 50px);
}

.card p {
  margin: 0;
}

.goal {
  font-size: clamp(15px, 3.4vmin, 18px);
  color: #fbf3e4;
  max-width: 34ch;
  line-height: 1.35;
}

.hint {
  font-size: 14px;
  color: #d9cfbd;
  line-height: 1.6;
}

.hint kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid #3a4250;
  border-bottom-width: 3px;
  background: #363836;
  color: #fbf3e4;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.sub {
  font-size: 13px;
  color: #d9cfbd;
  min-height: 1em;
}

.score-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.score-big > span {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d9cfbd;
}

.score-big strong {
  font-size: clamp(40px, 11vmin, 64px);
  font-weight: 900;
  color: #ffc857;
  font-variant-numeric: tabular-nums;
}

.breakdown {
  font-size: 15px;
  color: #d9cfbd;
}

.best {
  font-size: 16px;
  color: #fbf3e4;
}

.best strong {
  color: #27d6c1;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #b9f24a;
  color: #1f2120;
  font-size: 13px;
  font-weight: 900;
}

.btn {
  min-width: 170px;
  min-height: 52px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  background: #ee5e24;
  color: #15130f;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 0 #b8400f;
  transition: transform 0.08s ease;
}

.btn:hover {
  background: #8552f7;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #b8400f;
}

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

.mode-row .btn {
  flex: 1 1 150px;
  min-width: 0;
  padding-left: 18px;
  padding-right: 18px;
}

.btn.btn-alt {
  background: #363836;
  border: 1px solid #3a4250;
  box-shadow: 0 6px 0 #46443e;
}

.btn.btn-alt:hover {
  background: #2a3140;
}

.btn.btn-alt:active {
  box-shadow: 0 3px 0 #46443e;
}

.mode-tag {
  padding: 2px 12px;
  border-radius: 999px;
  background: #27d6c1;
  color: #1f2120;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.unlock {
  padding: 6px 14px;
  border-radius: 14px;
  background: #363836;
  border: 1px solid #3a4250;
  color: #fbf3e4;
  font-size: 15px;
  font-weight: 800;
}

/* ---------- Paint picker ---------- */

.paints {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.paint-label {
  font-size: 13px;
  font-weight: 800;
  color: #d9cfbd;
}

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

.paint {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #3a4250;
  border-radius: 14px;
  background: #363836;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.paint .car-chip {
  width: 16px;
  height: 26px;
  border-radius: 6px 6px 5px 5px;
  box-shadow: inset 0 -5px 0 var(--trim);
  background: linear-gradient(90deg, var(--body) 0 34%, var(--stripe) 34% 46%, var(--body) 46% 54%, var(--stripe) 54% 66%, var(--body) 66%);
}

.paint[aria-pressed="true"] {
  border-color: #fbf3e4;
  background: #2a3140;
}

.paint:disabled {
  cursor: not-allowed;
}

.paint:disabled .car-chip {
  opacity: 0.25;
}

.paint .lock {
  position: absolute;
  inset: auto 0 2px 0;
  font-size: 10px;
  font-weight: 900;
  color: #d9cfbd;
}

@media (max-height: 460px) {
  .paints,
  .goal {
    display: none;
  }
  .card {
    gap: 6px;
    padding: 14px 22px;
  }
  .btn {
    min-height: 46px;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

/* Skyline Club: native type, precise driving surface, readable cream controls. */
@font-face{font-family:Inter;src:url(assets/inter.woff2) format("woff2");font-weight:100 900;font-display:swap}
@font-face{font-family:"Space Grotesk";src:url(assets/space-grotesk.woff2) format("woff2");font-weight:300 700;font-display:swap}
html,body{background:#e9d6bd;color:#243c45;font-family:Inter,system-ui,sans-serif}
.overlay{background:#f8ebd175;backdrop-filter:blur(3px)}
.card{background:#fff8ec;border:1px solid #fffdf6;box-shadow:0 6px 0 #253c4533,0 22px 55px #31454a25;color:#243c45;max-width:480px;padding:24px;gap:12px}
.start-card{padding:0;overflow:hidden;display:block}.cover{display:block;width:100%;height:145px;object-fit:cover;object-position:center 64%}.card-content{padding:20px 26px;display:flex;flex-direction:column;align-items:center;gap:10px}
.eyebrow{font-size:9px;font-weight:800;letter-spacing:.15em;color:#536b72}.title{font-family:"Space Grotesk",Inter,sans-serif;font-weight:700;letter-spacing:-.05em;background:none;color:#243c45;font-size:clamp(34px,8vmin,52px)}.title.small{font-size:clamp(29px,7vmin,42px)}
.goal{font-size:15px;color:#243c45}.hint,.sub,.breakdown,.best,.paint-label{color:#536b72}.hint{font-size:12px}.sub{font-size:10px;min-height:0}.hint kbd{background:#f0ede2;color:#243c45;border-color:#d8d9ce}.score-big>span{color:#536b72}.score-big strong{color:#2551bd;font-family:"Space Grotesk",Inter,sans-serif}.best strong{color:#243c45}.badge{background:#daedb5;color:#30411f}
.gesture-guide{display:flex;align-items:center;justify-content:center;gap:15px;width:100%;padding:10px 12px;border-radius:14px;background:#eeeede;font-size:11px;color:#536b72}.gesture-guide span{display:flex;flex-direction:column;gap:4px}.gesture-guide b{font:700 14px "Space Grotesk",sans-serif;color:#2551bd;letter-spacing:.07em}.gesture-guide i{font-style:normal;color:#7c8e8a}
.btn{min-height:47px;padding:10px 16px;border-radius:14px;border:1px solid #da512a;background:#ff7845;color:#243a3c;box-shadow:0 4px 0 #b84624;font:700 14px Inter,sans-serif}.btn:hover{background:#ff8d5d}.btn:active{box-shadow:0 1px 0 #b84624}.btn.btn-alt{background:#f3efe3;color:#243c45;border-color:#d9d6c7;box-shadow:0 4px 0 #d4cfbe}.btn.btn-alt:hover{background:#e8e6d8}.btn.btn-alt:active{box-shadow:0 1px 0 #d4cfbe}.mode-row{gap:10px}.mode-row .btn{flex:1 1 120px;min-width:0}.btn:focus-visible,.icon-btn:focus-visible,.paint:focus-visible,summary:focus-visible{outline:3px solid #285be3;outline-offset:3px}
.chip,.icon-btn{background:#fff8ec;color:#243c45;border:1px solid #d8d7c6;box-shadow:0 3px 0 #243c4529}.chip .label{color:#536b72;font-size:10px}.chip strong{font-family:"Space Grotesk",sans-serif;font-weight:700}.chip-coin strong{color:#925b19}.chip-stage strong{color:#2551bd}.mode-tag{background:#dfebfc;color:#234d9c}.unlock{background:#e7eddb;color:#344d39;border-color:#c8d7c0}
.paint-panel{width:100%;font-size:11px;color:#536b72}.paint-panel summary{cursor:pointer;padding:5px}.paints{margin-top:8px}.paint{width:39px;height:39px;background:#e8e9dd;border-color:#d2d6c9;border-radius:12px}.paint[aria-pressed="true"]{border-color:#285be3;background:#e4ebfb}.paint .lock{color:#4d6266}.paint:disabled .car-chip{opacity:.3}
.coach{position:fixed;bottom:max(9px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(420px,calc(100% - 24px));padding:9px 12px;background:#fff8ec;border:1px solid #ded8c9;border-radius:16px;box-shadow:0 3px 0 #243c4529;text-align:center;pointer-events:none}.coach p{margin:0 0 4px;font-size:12px;font-weight:700}.coach>span{font-size:10px;color:#536b72}.progress{margin-top:5px;height:3px;border-radius:3px;background:#d8d9ca;overflow:hidden}.progress>span{display:block;height:100%;background:#3766d7;width:0}
@media(max-height:560px){.cover{height:62px}.card-content{gap:7px;padding:13px 18px}.title{font-size:35px}.gesture-guide{padding:7px 10px;gap:12px}.gesture-guide b{font-size:12px}.goal{font-size:13px}.hint{font-size:11px}.btn{min-height:44px}.card{gap:9px}.score-big strong{font-size:38px}}
@media(max-height:360px){.cover{display:none}.card-content{gap:5px;padding:10px 20px}.gesture-guide{padding:5px}.sub{font-size:9px}.title{font-size:30px}}
@media(prefers-reduced-motion:reduce){.overlay{backdrop-filter:none}.btn{transition:none}}

.title{-webkit-text-fill-color:currentColor;background-clip:border-box;-webkit-background-clip:border-box}.goal{display:block}.paints{display:flex}
