* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #111;
  color: var(--text-hi);
  font-family: "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  min-height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 32px;
}
.chrome {
  width: min(720px, 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.chrome h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.chrome .hint { color: var(--text-dim); font-size: 12px; }
.chrome-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chrome button, .chrome a.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: #1a2224;
  color: var(--text-hi);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.chrome button.on { background: var(--accent); color: #08120a; font-weight: 700; }
.stage-wrap {
  width: min(var(--phone-w), 100%);
  max-height: 92vh;
}
.phone {
  width: 720px;
  height: 1280px;
  transform-origin: top center;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

.header {
  position: absolute; left: 0; right: 0; top: 18px;
  height: 48px; display: flex; align-items: center; padding: 0 24px;
  z-index: 5;
}
.logo {
  width: 40px; height: 40px; border-radius: 11px; background: var(--accent);
  color: #050f0a; font-weight: 800; display: grid; place-items: center;
}
.brand { margin-left: 12px; font-size: 22px; font-weight: 800; }
.diff {
  margin-left: auto; background: rgba(8,14,16,0.86);
  border-radius: 12px; padding: 6px 12px; font-size: 13px; color: var(--text);
}

.page { position: absolute; left: 0; right: 0; top: 78px; bottom: 110px; }
.home-stage {
  position: absolute; left: 0; right: 0; top: 0; height: 420px;
}
#homeTrack { width: 100%; height: 100%; display: block; }
#homeCar {
  position: absolute; left: 50%; top: 46%; width: 220px; height: 240px;
  transform: translate(-50%, -50%); pointer-events: none;
}
.home-copy { position: absolute; left: 28px; right: 28px; top: 318px; }
.home-copy h2 { margin: 0; font-size: 36px; }
.home-copy p { margin: 6px 0 0; font-size: 15px; color: var(--text); }

.mode-rail {
  position: absolute; left: 28px; right: 28px; top: 430px;
  display: flex; gap: 8px;
}
.mode-rail button {
  flex: 1; height: 36px; border: 0; border-radius: 12px;
  background: #10181a; color: #d2e0d6; font-weight: 700; cursor: pointer;
}
.mode-rail button.on { background: var(--accent); color: #081205; }

.choice-row {
  position: absolute; left: 22px; right: 22px; top: 478px; height: 118px;
  display: grid; grid-template-columns: 1fr 1fr 56px; gap: 8px;
}
.choice, .rand {
  background: #0a1012; border-radius: 14px; border: 1px solid rgba(186,255,26,0.12);
  padding: 12px; cursor: pointer; color: var(--text-hi);
}
.choice small, .daily small { color: var(--text-dim); }
.choice.on { outline: 2px solid var(--accent); }
.rand {
  display: grid; place-items: center; font-size: 24px; color: var(--accent); font-weight: 800;
}

.daily {
  position: absolute; left: 22px; right: 22px; top: 606px; height: 56px;
  border-radius: 14px; background: #14110a; border: 1px solid rgba(255,214,120,0.35);
  display: flex; align-items: center; justify-content: center;
  color: #ffd678; font-weight: 700; cursor: pointer; font-size: 14px;
}

.launch {
  position: absolute; left: 22px; right: 22px; bottom: 16px; height: 72px;
  border: 0; border-radius: 18px; background: var(--accent); color: #081205;
  font-size: 26px; font-weight: 800; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.launch span { font-size: 12px; font-weight: 600; color: #23440a; }

.list {
  padding: 8px 26px 12px; overflow: auto; height: 100%;
}
.kicker { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.list h2 { margin: 8px 0 18px; font-size: 36px; }
.event, .stat {
  display: flex; align-items: center; gap: 12px;
  background: rgba(8,24,30,0.96); border-radius: 18px;
  padding: 14px 16px; margin-bottom: 12px; cursor: pointer;
  border: 1px solid rgba(186,255,26,0.12);
}
.event .tag {
  width: 60px; height: 60px; border-radius: 15px;
  display: grid; place-items: center; color: #050e0c; font-weight: 800;
}
.event .grow, .stat .grow { flex: 1; }
.event h3, .stat h3 { margin: 0; font-size: 18px; }
.event p, .stat p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.event .arrow { font-size: 27px; color: #b4cdd4; }
.hero { font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; margin: 8px 0 12px; }

.garage { padding: 4px 26px; height: 100%; overflow: auto; }
.garage-hero { display: flex; gap: 8px; align-items: flex-start; }
.garage-hero canvas { width: 200px; height: 220px; }
.bars { margin: 8px 0 12px; }
.bar { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; color: var(--text-dim); }
.bar i {
  display: block; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #4d6a10);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chips span {
  border: 1px solid var(--accent); color: var(--accent);
  border-radius: 10px; padding: 4px 8px; font-size: 13px;
}
.car-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.car-card {
  background: #0c1416; border-radius: 14px; padding: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.car-card.on { border-color: var(--accent); }
.car-card canvas { width: 100%; height: 72px; }
.car-card .nm { font-size: 14px; font-weight: 700; }
.car-card .lk { font-size: 11px; color: var(--text-dim); }

.nav {
  position: absolute; left: 0; right: 0; bottom: 0; height: 110px;
  background: rgba(4,8,10,0.99); display: grid; grid-template-columns: repeat(4, 1fr);
  z-index: 6;
}
.nav button {
  border: 0; background: transparent; color: #58737c; font-size: 16px; font-weight: 700; cursor: pointer;
}
.nav button.on { color: var(--accent); }

.drawer {
  position: absolute; left: 0; right: 0; bottom: 110px; top: 120px;
  background: rgba(6,10,12,0.96); z-index: 8; padding: 16px 18px 20px;
  overflow: auto;
}
.drawer h3 { margin: 0 0 12px; }
.track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.track-card {
  background: #10181a; border-radius: 14px; overflow: hidden; cursor: pointer;
  border: 1px solid transparent;
}
.track-card.on { border-color: var(--accent); }
.track-card .meta { padding: 8px 10px 10px; }
.track-card .meta b { display: block; font-size: 15px; }
.track-card .meta span { color: var(--text-dim); font-size: 12px; }

/* race */
#race { position: absolute; inset: 0; }
#raceTrack { position: absolute; inset: 0; width: 100%; height: 100%; }
#raceCar { position: absolute; pointer-events: none; }
.hud-top {
  position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(10,14,16,0.82); border-radius: 16px; padding: 8px 16px;
  display: flex; gap: 14px; align-items: baseline; z-index: 4;
}
.hud-top .pos { font-size: 28px; font-weight: 800; }
.minimap {
  position: absolute; left: 18px; top: 96px; width: 140px; height: 140px;
  border-radius: 12px; overflow: hidden; border: 2px solid rgba(255,255,255,0.12); z-index: 4;
}
.hp {
  position: absolute; left: 50%; bottom: 168px; transform: translateX(-50%);
  width: 240px; z-index: 4;
}
.hp .fill { height: 10px; background: #39d980; border-radius: 6px; width: 80%; }
.drift {
  position: absolute; left: 50%; bottom: 196px; transform: translateX(-50%);
  width: 200px; height: 8px; background: #222; border-radius: 4px; z-index: 4;
}
.drift .fill { height: 100%; width: 35%; background: var(--gold); border-radius: 4px; }
.speed {
  position: absolute; left: 50%; bottom: 132px; transform: translateX(-50%);
  font-size: 20px; font-weight: 800; z-index: 4;
}
.pause-btn {
  position: absolute; z-index: 5; width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid #d0d8e0; background: rgba(16,20,24,0.8); color: #fff;
  font-size: 18px; cursor: pointer;
}
.side-hint {
  position: absolute; width: 18px; height: 90px; border-radius: 10px;
  background: rgba(255,255,255,0.08); z-index: 3; pointer-events: none;
}
.side-hint.on { background: var(--accent); }
.item-btn, .brake-btn {
  position: absolute; z-index: 5; border-radius: 50%; border: 3px solid #88c;
  color: #fff; font-weight: 800; cursor: pointer;
}
.item-btn { width: 128px; height: 128px; background: #0e121c; font-size: 16px; white-space: pre-line; }
.brake-btn { width: 80px; height: 80px; background: #962a2a; border-color: #ffa091; font-size: 15px; }
.quickbar {
  position: absolute; z-index: 5; display: flex; gap: 6px;
}
.quickbar button {
  width: 36px; height: 36px; border-radius: 50%; border: 0; color: #08120a; font-weight: 800; cursor: pointer;
}
.fan {
  position: absolute; z-index: 6; pointer-events: none;
}
.fan button {
  position: absolute; width: 68px; height: 68px; border-radius: 50%; border: 0;
  font-weight: 800; cursor: pointer; pointer-events: auto;
}

.overlay {
  position: absolute; inset: 0; background: rgba(8,12,20,0.67);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.card {
  width: 320px; background: #182030; border: 2px solid #78b4ff; border-radius: 20px;
  padding: 22px 18px 18px; text-align: center;
}
.card h2 { margin: 0 0 16px; font-size: 32px; }
.card button {
  width: 100%; margin: 6px 0; height: 44px; border: 0; border-radius: 12px;
  font-weight: 800; cursor: pointer; color: #fff;
}
.toggle { display: flex; justify-content: space-between; align-items: center; margin: 8px 4px; color: var(--text); font-size: 14px; }
.toggle b { color: var(--accent); }

.hitboxes { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.hitboxes .box {
  position: absolute; border: 1px dashed var(--accent); background: rgba(186,255,26,0.12);
  color: var(--accent); font-size: 11px; font-weight: 700; padding: 2px 4px;
}

.banner {
  position: absolute; left: 16px; right: 16px; top: 8px; z-index: 30;
  font-size: 11px; color: #08120a; background: var(--accent); text-align: center;
  border-radius: 8px; padding: 4px 8px; font-weight: 700;
}
