/* =========================================================
   METRO SURF — UI
   ========================================================= */
:root {
  --orange: #ff7a2f;
  --orange-2: #ffb02e;
  --gold: #ffc82e;
  --cyan: #4ee7ff;
  --green: #5ee29b;
  --ink: #070a13;
  --panel: rgba(11, 15, 27, .82);
  --line: rgba(255, 255, 255, .11);
  --text: #eef3fb;
  --muted: #93a0b6;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Arial Black", "Helvetica Neue", Impact, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #05070e;
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font-family: inherit; }
svg { display: block; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, #16213f 0%, #070a13 60%);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
#vignette {
  background:
    radial-gradient(ellipse at 50% 46%, transparent 48%, rgba(2, 4, 12, .42) 100%),
    linear-gradient(0deg, rgba(2, 4, 12, .35) 0%, transparent 22%);
}
#speedfx {
  opacity: 0;
  z-index: 6;
  transition: opacity .35s linear;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 26%, rgba(3, 7, 22, .62) 100%),
    repeating-linear-gradient(90deg, rgba(150, 210, 255, .035) 0 1px, transparent 1px 4px);
  mix-blend-mode: normal;
}

#flash {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  background: #fff;
}
#flash.crash { animation: flashCrash .3s ease-out; }
#flash.soft { animation: flashSoft .24s ease-out; }

@keyframes flashCrash {
  0% { opacity: .75; background: #ffd9a0; }
  35% { opacity: .25; background: #ff6a2a; }
  100% { opacity: 0; }
}
@keyframes flashSoft {
  0% { opacity: .45; background: #8ef4ff; }
  100% { opacity: 0; }
}

.hidden { display: none !important; }

/* boot / loading */
#boot {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(80% 60% at 50% 35%, rgba(255, 138, 47, .12), transparent 65%),
    #070a13;
  transition: opacity .5s ease, visibility .5s;
}
#boot.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: .26em;
  color: #fff;
}
.boot-mark i { width: 4px; height: 18px; background: linear-gradient(180deg, var(--orange-2), var(--orange)); transform: skewX(-12deg); }
.boot-title { font-size: 26px; font-weight: 900; letter-spacing: .42em; color: var(--orange-2); margin-left: .42em; }
.boot-bar { width: 190px; height: 3px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.boot-bar b { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, var(--orange-2), var(--orange)); border-radius: 4px; animation: bootSlide 1.1s ease-in-out infinite; }
@keyframes bootSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}
.boot-text { font-size: 10px; letter-spacing: .16em; color: rgba(255, 255, 255, .38); }

/* =========================================================
   HUD
   ========================================================= */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  padding: 24px 28px;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.hud-left { display: flex; flex-direction: column; gap: 2px; }
.score-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(255, 255, 255, .55);
}
.score-row { display: flex; align-items: center; gap: 12px; }
#score {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.1vw, 48px);
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 0 30px rgba(255, 140, 60, .35);
}
.best-row {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .45);
  margin-top: 3px;
}
.best-row b { color: #ffcf6a; font-variant-numeric: tabular-nums; }

.mult-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #ffb02e, #ff6a2a);
  color: #1a0d02;
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  font-weight: 900;
  padding: 5px 9px;
  border-radius: 3px 9px 3px 9px;
  box-shadow: 0 4px 16px rgba(255, 110, 40, .45);
  transform: skewX(-6deg);
  animation: badgePulse 1.1s ease-in-out infinite;
}
.mult-badge b {
  font-family: var(--font-ui);
  font-size: 10px;
  font-style: normal;
  background: rgba(0, 0, 0, .22);
  padding: 2px 4px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
@keyframes badgePulse {
  0%, 100% { transform: skewX(-6deg) scale(1); }
  50% { transform: skewX(-6deg) scale(1.06); }
}

.hud-mid {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.coin-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 10px;
  border-radius: 999px;
  background: rgba(8, 11, 20, .72);
  border: 1px solid rgba(255, 200, 46, .28);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.coin-pill svg { width: 22px; height: 22px; filter: drop-shadow(0 0 6px rgba(255, 200, 46, .45)); }
#coins {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  color: #ffd75a;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  display: inline-block;
}
#coins.pop { animation: coinPop .22s ease-out; }
@keyframes coinPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.28); color: #fff6c9; }
  100% { transform: scale(1); }
}
.dist-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .62);
  background: rgba(8, 11, 20, .5);
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 4px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}
.dist-pill em { font-style: normal; opacity: .5; margin-left: 4px; }

.hud-right { display: flex; gap: 10px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(8, 11, 20, .62);
  color: rgba(255, 255, 255, .82);
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color .18s, border-color .18s, transform .18s, background .18s;
  pointer-events: auto;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { color: var(--orange-2); border-color: rgba(255, 176, 46, .55); background: rgba(20, 18, 22, .8); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }

/* power-up chips */
#powerups {
  position: absolute;
  left: 28px;
  top: 158px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.pup {
  --c: #fff;
  position: relative;
  width: 172px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 8px 8px;
  background: rgba(8, 11, 20, .7);
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid var(--c);
  border-radius: 4px 12px 4px 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .26);
  animation: pupIn .28s cubic-bezier(.2, .9, .2, 1.2) both;
}
@keyframes pupIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
.pup[data-type="magnet"] { --c: #ff4d6d; }
.pup[data-type="double"] { --c: #ffc82e; }
.pup[data-type="jetpack"] { --c: #39d0ff; }
.pup[data-type="sneaker"] { --c: #a7ff4d; }
.pup-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--c);
}
.pup-icon svg { width: 15px; height: 15px; fill: currentColor; }
.pup-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #fff;
}
.pup-time {
  margin-left: auto;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--c);
}
.pup-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.pup-bar b {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
  transition: width .1s linear;
}

/* hoverboard button */
#boardBtn {
  position: absolute;
  right: 26px;
  bottom: 26px;
  z-index: 12;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 1px solid rgba(255, 176, 46, .45);
  background: radial-gradient(circle at 50% 35%, rgba(48, 38, 24, .95), rgba(10, 13, 22, .92));
  color: #ffcf6a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45), inset 0 1px rgba(255, 255, 255, .12), 0 0 0 6px rgba(255, 176, 46, .05);
  transition: transform .15s, box-shadow .2s, border-color .2s;
  pointer-events: auto;
}
#boardBtn:active { transform: scale(.94); }
#boardBtn .bb-icon { width: 28px; height: 28px; }
#boardBtn .bb-icon svg { width: 28px; height: 28px; fill: currentColor; }
#boardBtn .bb-text { font-size: 10px; font-weight: 900; letter-spacing: .12em; color: #ffe0a3; }
#boardBtn b {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--orange-2);
  color: #1b0d01;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
  font-variant-numeric: tabular-nums;
}
#boardBtn.active {
  border-color: rgba(78, 231, 255, .85);
  color: var(--cyan);
  box-shadow: 0 0 40px rgba(78, 231, 255, .4), inset 0 0 24px rgba(78, 231, 255, .2);
  animation: boardGlow 1.2s ease-in-out infinite;
}
#boardBtn.active .bb-text { color: #bdf6ff; }
#boardBtn.disabled { opacity: .45; filter: grayscale(.6); }
@keyframes boardGlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* hint */
.hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 14;
  max-width: calc(100vw - 32px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(8, 11, 20, .74);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, .76);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s, transform .4s;
  white-space: nowrap;
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }
.hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  border-bottom-width: 2px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
}
.hint i { width: 1px; height: 12px; background: rgba(255, 255, 255, .16); }
.hint-touch { display: none; }

/* toast */
.toast {
  position: absolute;
  left: 50%;
  top: 124px;
  z-index: 25;
  transform: translate(-50%, -10px);
  padding: 10px 22px;
  border-radius: 6px;
  background: rgba(9, 13, 24, .92);
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid var(--orange-2);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-left-color: #ff4d5e; color: #ffd7db; }
.toast.coin { border-left-color: var(--gold); color: #ffe9a3; }
.toast.power { border-left-color: var(--cyan); color: #c8f7ff; }
.toast.board { border-left-color: var(--cyan); color: #c8f7ff; }
.toast.save { border-left-color: var(--green); color: #c8ffdf; }

#missionToast {
  position: absolute;
  top: 96px;
  right: 28px;
  z-index: 25;
  width: 318px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 6px 18px 6px 18px;
  background: linear-gradient(135deg, rgba(24, 30, 44, .97), rgba(10, 14, 24, .97));
  border: 1px solid rgba(94, 226, 155, .3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
#missionToast.show { opacity: 1; transform: translateX(0); }
#missionToast .mt-icon {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(94, 226, 155, .13);
  color: var(--green);
}
#missionToast svg { width: 19px; height: 19px; fill: currentColor; }
#missionToast b { display: block; font-size: 12px; color: #d9ffe9; letter-spacing: .06em; }
#missionToast span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }

/* intro & GO */
#introBubble {
  position: absolute;
  left: 17%;
  bottom: 40%;
  z-index: 16;
  padding: 12px 20px;
  background: #fffdf4;
  color: #16120c;
  border-radius: 16px 16px 16px 3px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .06em;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  transform: rotate(-5deg) scale(.6);
  opacity: 0;
  pointer-events: none;
}
#introBubble::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -12px;
  border-width: 12px 12px 0 0;
  border-style: solid;
  border-color: #fffdf4 transparent transparent transparent;
  transform: rotate(8deg);
}
#introBubble b { color: #ff5a2a; }
#introBubble span { margin-left: 4px; }
#introBubble.show { animation: bubbleIn 2.1s cubic-bezier(.2, .9, .2, 1) both; }
@keyframes bubbleIn {
  0% { opacity: 0; transform: rotate(-10deg) scale(.6); }
  12% { opacity: 1; transform: rotate(-5deg) scale(1.06); }
  20% { transform: rotate(-4deg) scale(1); }
  82% { opacity: 1; transform: rotate(-4deg) scale(1); }
  100% { opacity: 0; transform: rotate(-6deg) translateY(-10px); }
}

#goText {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 20;
  transform: translate(-50%, -50%) scale(.7);
  font-family: var(--font-display);
  font-size: clamp(80px, 17vw, 230px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.02em;
  color: transparent;
  background: linear-gradient(180deg, #fffbe6 0%, #ffd23f 38%, #ff6a2a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 10px 40px rgba(255, 110, 40, .55));
  opacity: 0;
  pointer-events: none;
}
#goText.show { animation: goPop .85s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes goPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2) rotate(-8deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-4deg); }
  70% { opacity: 1; transform: translate(-50%, -52%) scale(1.02) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1.08) rotate(0); }
}

/* =========================================================
   MENU
   ========================================================= */
.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
}
.menu-screen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: screenIn .5s ease both;
}
@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.menu-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 7, 15, .95) 0%, rgba(4, 7, 15, .82) 31%, rgba(4, 7, 15, .26) 60%, rgba(4, 7, 15, .58) 100%),
    linear-gradient(0deg, rgba(4, 7, 15, .92) 0%, rgba(4, 7, 15, .12) 34%, transparent 60%);
}
.menu-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
  opacity: .55;
}

.menu-topbar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
}
.brand-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: .22em;
  color: rgba(255, 255, 255, .92);
}
.brand-mini i {
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  box-shadow: 0 0 12px rgba(255, 130, 40, .7);
  transform: skewX(-12deg);
}
.brand-mini span {
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 10px;
  letter-spacing: .18em;
  color: rgba(255, 255, 255, .42);
  margin-left: 2px;
}
.menu-actions { display: flex; gap: 10px; }

.menu-content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 10px 44px 54px 52px;
  min-height: 0;
}
.menu-panel {
  width: min(520px, 44vw);
  flex: 0 0 auto;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .32em;
  color: rgba(255, 255, 255, .5);
}
.eyebrow i {
  width: 26px;
  height: 2px;
  background: var(--orange);
  box-shadow: 0 0 10px rgba(255, 122, 47, .8);
}
.logo {
  margin: 12px 0 2px;
  font-family: var(--font-display);
  font-size: clamp(54px, 7vw, 106px);
  line-height: .9;
  letter-spacing: -.045em;
  font-style: italic;
  font-weight: 900;
  transform: skewX(-3deg);
  text-transform: uppercase;
}
.logo-main {
  display: block;
  color: #f6f9ff;
  text-shadow: 0 6px 0 rgba(5, 8, 16, .4), 0 22px 60px rgba(0, 0, 0, .3);
}
.logo-sub {
  display: block;
  margin-left: .38em;
  background: linear-gradient(178deg, #fff5cc 4%, #ffc82e 42%, #ff7a2f 86%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 26px rgba(255, 120, 40, .32));
  letter-spacing: -.02em;
}
.logo-cn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .34em;
  color: #fff;
}
.logo-cn i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--orange-2);
  border-left: 1px solid rgba(255, 255, 255, .18);
  padding-left: 12px;
  transform: translateY(1px);
}
.tagline {
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  letter-spacing: .03em;
}

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  width: min(336px, 100%);
  height: 58px;
  padding: 0 20px;
  border: 0;
  border-radius: 4px 20px 4px 20px;
  background: linear-gradient(100deg, #ffc82e 0%, #ff9a2e 38%, #ff6a2a 100%);
  color: #1d0f02;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .1em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(255, 100, 40, .32), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .16s ease, box-shadow .2s, filter .2s;
  pointer-events: auto;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -30%;
  width: 30%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(18deg);
  transition: left .55s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 50px rgba(255, 100, 40, .42), inset 0 1px 0 rgba(255, 255, 255, .7); }
.btn-primary:hover::after { left: 120%; }
.btn-primary:active { transform: translateY(0) scale(.985); }
.btn-primary .play-ic {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(20, 9, 0, .16);
  font-size: 13px;
  padding-left: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.btn-primary small {
  margin-left: auto;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18em;
  color: rgba(29, 15, 2, .52);
  border: 1px solid rgba(29, 15, 2, .2);
  padding: 4px 6px;
  border-radius: 4px;
}

.stats-strip {
  width: min(336px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 24px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.stats-strip span {
  display: block;
  font-size: 9px;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .38);
  font-weight: 700;
  margin-bottom: 3px;
}
.stats-strip b {
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: .01em;
}
.stats-strip div:nth-child(2) b { color: var(--gold); }

.controls {
  display: flex;
  gap: 24px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  width: min(360px, 100%);
}
.ctrl { display: flex; flex-direction: column; gap: 7px; }
.ctrl div { display: flex; gap: 4px; }
.ctrl kbd {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  border-bottom-width: 2px;
  color: rgba(255, 255, 255, .85);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
}
.ctrl p {
  margin: 0;
  font-size: 9px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .35);
}

.menu-side {
  width: 334px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: flex-end;
  padding-bottom: 8px;
}
.side-card {
  background: linear-gradient(160deg, rgba(15, 20, 34, .88), rgba(8, 11, 21, .8));
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px 22px 6px 22px;
  padding: 18px 18px 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32), inset 0 1px rgba(255, 255, 255, .05);
}
.card-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 8px;
}
.card-title span { font-size: 15px; font-weight: 900; letter-spacing: .16em; }
.card-title small { font-size: 8px; letter-spacing: .24em; color: rgba(255, 255, 255, .32); font-weight: 800; }
.card-title i { flex: 1; height: 1px; background: rgba(255, 255, 255, .1); }
.mission {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 9px;
  border-top: 1px solid rgba(255, 255, 255, .055);
}
.mission:first-child { border-top: 0; }
.m-icon {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255, 176, 46, .1);
  color: var(--orange-2);
}
.m-icon svg { width: 15px; height: 15px; fill: currentColor; }
.m-body { flex: 1; min-width: 0; }
.m-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.m-top b { font-size: 11px; letter-spacing: .04em; color: #e9eef8; }
.m-top span { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.m-text { font-size: 9px; color: rgba(255, 255, 255, .36); margin: 2px 0 5px; }
.m-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.m-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ff9a2e, #ffd23f); transition: width .5s ease; }
.m-check {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: var(--green);
  color: #062014;
  font-size: 10px;
  font-weight: 900;
}
.mission.done { opacity: .62; }
.mission.done .m-check { display: grid; }
.mission.done .m-bar i { background: var(--green); }
.mission.done .m-top b { color: var(--green); }
.side-tip {
  font-size: 10px;
  line-height: 1.75;
  color: rgba(255, 255, 255, .44);
  padding: 13px 15px;
  background: rgba(255, 176, 46, .055);
  border: 1px solid rgba(255, 176, 46, .17);
  border-left: 3px solid rgba(255, 176, 46, .72);
  border-radius: 4px 12px 4px 12px;
}
.side-tip b { display: block; color: #ffcf7a; font-size: 9px; letter-spacing: .2em; margin-bottom: 4px; }
.side-tip p { margin: 0; }

.menu-footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px 18px 52px;
  font-size: 9px;
  letter-spacing: .16em;
  color: rgba(255, 255, 255, .24);
}

/* =========================================================
   OVERLAYS / PANELS
   ========================================================= */
.overlay {
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  background: rgba(4, 7, 15, .6);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  animation: screenIn .25s ease both;
}
.panel {
  position: relative;
  width: min(430px, 94vw);
  padding: 32px 34px 28px;
  background: linear-gradient(160deg, rgba(19, 25, 41, .98), rgba(8, 11, 21, .98));
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px 28px 6px 28px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .68), inset 0 1px rgba(255, 255, 255, .07);
  overflow: hidden;
  animation: panelIn .34s cubic-bezier(.2, .9, .25, 1.1) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 84px; height: 3px;
  background: linear-gradient(90deg, var(--orange-2), var(--orange));
  box-shadow: 0 0 18px rgba(255, 130, 40, .6);
}
.panel-eyebrow {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .32em;
  color: var(--orange-2);
  text-transform: uppercase;
}
.panel h2 {
  margin: 8px 0 6px;
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.05;
  font-style: italic;
  letter-spacing: -.02em;
}
.panel-sub { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.panel .btn-primary { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-ghost {
  flex: 1;
  height: 44px;
  border-radius: 4px 12px 4px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .035);
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
  pointer-events: auto;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 176, 46, .45); color: #fff; }
.btn-ghost:active { transform: scale(.98); }

.pause-panel { width: min(390px, 94vw); }
.sound-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 10px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .35);
}
.sound-row .icon-btn { width: 34px; height: 34px; }
.sound-row .icon-btn svg { width: 15px; height: 15px; }

.over-panel { width: min(450px, 94vw); }
.over-panel h2 { color: #fff; }
.record {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 2px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 200, 46, .16), rgba(255, 122, 47, .16));
  border: 1px solid rgba(255, 200, 46, .45);
  color: #ffe28a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .2em;
  animation: recordPulse 1.2s ease-in-out infinite;
}
@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 46, .26); }
  50% { box-shadow: 0 0 0 8px rgba(255, 200, 46, 0); }
}
.final-score {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 18px 0 14px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.final-score span { font-size: 10px; letter-spacing: .2em; color: var(--muted); font-weight: 700; }
.final-score b {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  font-style: italic;
  letter-spacing: -.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(255, 150, 60, .4);
}
.over-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 4px 14px 4px 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.over-grid div {
  background: rgba(11, 15, 27, .92);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.over-grid span { font-size: 9px; letter-spacing: .14em; color: rgba(255, 255, 255, .36); font-weight: 700; }
.over-grid b { font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; }
.over-grid div:nth-child(1) b { color: var(--gold); }
.over-panel .icon-btn { flex: 0 0 44px; width: 44px; height: 44px; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #05070e;
  color: #fff;
  font-size: 14px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1120px) {
  .menu-side { display: none; }
  .menu-panel { width: min(560px, 58vw); }
  .menu-content { padding-right: 52px; }
}
@media (max-width: 820px) {
  .menu-topbar { padding: calc(14px + env(safe-area-inset-top)) 18px 14px; }
  .menu-content { padding: 0 18px calc(30px + env(safe-area-inset-bottom)); align-items: flex-end; }
  .menu-panel { width: 100%; padding-bottom: 2px; }
  .btn-primary small { display: none; }
  .menu-bg {
    background:
      linear-gradient(0deg, rgba(4, 7, 15, .97) 22%, rgba(4, 7, 15, .74) 54%, rgba(4, 7, 15, .08) 100%);
  }
  .logo { font-size: clamp(50px, 14.2vw, 78px); }
  .logo-cn { margin: 8px 0 8px; font-size: 16px; letter-spacing: .3em; }
  .eyebrow { font-size: 9px; letter-spacing: .24em; }
  .tagline { display: none; }
  .stats-strip { margin-top: 16px; padding-top: 12px; }
  .controls { display: none; }
  .btn-primary { width: 100%; height: 52px; font-size: 16px; padding: 0 16px; }
  .menu-footer { display: none; }
  .menu-actions .icon-btn { width: 38px; height: 38px; }

  #hud { padding: 12px 14px; }
  .score-label { font-size: 8px; letter-spacing: .2em; }
  #score { font-size: 30px; }
  .score-row { gap: 7px; }
  .best-row { font-size: 8px; }
  .hud-mid { top: 10px; gap: 4px; }
  .coin-pill { padding: 4px 10px 4px 7px; gap: 5px; }
  .coin-pill svg { width: 17px; height: 17px; }
  #coins { font-size: 16px; }
  .dist-pill { font-size: 9px; padding: 2px 9px; }
  .mult-badge { font-size: 12px; padding: 4px 7px; }
  .hud-right .icon-btn { width: 36px; height: 36px; }
  #powerups { left: 16px; top: 118px; gap: 6px; }
  .pup { width: 138px; min-height: 36px; padding: 4px 8px 7px 6px; gap: 6px; }
  .pup-icon { width: 22px; height: 22px; }
  .pup-icon svg { width: 13px; height: 13px; }
  .pup-label { font-size: 9px; }
  .pup-time { font-size: 10px; }
  #boardBtn { width: 72px; height: 72px; right: 16px; bottom: 18px; }
  #boardBtn .bb-icon, #boardBtn .bb-icon svg { width: 24px; height: 24px; }
  #boardBtn .bb-text { font-size: 8px; }
  .hint { bottom: 106px; padding: 7px 14px; font-size: 10px; max-width: calc(100vw - 36px); white-space: normal; text-align: center; justify-content: center; line-height: 1.5; }
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
  .toast { top: 104px; font-size: 11px; padding: 8px 14px; }
  #missionToast { top: 84px; right: 12px; width: 272px; padding: 10px 12px; }
  #missionToast .mt-icon { width: 30px; height: 30px; flex-basis: 30px; }
  #introBubble { left: 12%; bottom: 46%; font-size: 15px; padding: 10px 14px; }
  .panel { padding: 26px 22px 22px; }
  .panel h2 { font-size: 30px; }
  .final-score b { font-size: 38px; }
}
@media (hover: none) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
  .hint { bottom: 104px; }
}
@media (max-height: 520px) {
  .menu-topbar { padding: 8px 16px; }
  .menu-content { padding: 0 24px calc(14px + env(safe-area-inset-bottom)); align-items: center; }
  .menu-panel { width: min(520px, 56vw); }
  .logo { font-size: clamp(36px, 9vw, 54px); }
  .logo-cn, .tagline, .stats-strip, .controls, .menu-side, .menu-footer { display: none; }
  .eyebrow { font-size: 8px; }
  .btn-primary { height: 44px; font-size: 14px; margin-top: 12px; }
  .btn-primary .play-ic { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; }
  #hud { padding: 8px 12px; }
  #powerups { top: 96px; }
  #introBubble { bottom: 34%; }
  #boardBtn { width: 64px; height: 64px; bottom: 12px; right: 12px; }
  .hint { bottom: 86px; }
  .panel { max-height: 94vh; overflow-y: auto; padding: 18px 20px 16px; }
  .panel h2 { font-size: 26px; }
}

@media (max-height: 720px) and (min-width: 821px) {
  .logo { font-size: clamp(48px, 6vw, 76px); }
  .tagline { display: none; }
  .controls { display: none; }
  .menu-content { padding-top: 0; }
  .menu-side { align-self: center; }
  .side-tip { display: none; }
}
@media (max-height: 620px) {
  .menu-topbar { padding: 12px 18px; }
  .menu-content { padding-bottom: 12px; }
  .logo { font-size: 48px; }
  .logo-cn { display: none; }
  .stats-strip { margin-top: 12px; }
  .panel { padding: 20px 20px 18px; }
  .over-grid { margin-bottom: 12px; }
  .final-score { margin: 10px 0; padding: 8px 0; }
}
