/* 霓虹夜行 · NEON DRIVE */
:root {
  --ink: #f6efff;
  --muted: #a992c8;
  --dim: #6f5c90;
  --cyan: #4be8ff;
  --pink: #ff3d92;
  --violet: #8b5cff;
  --amber: #ffbf6b;
  --panel: rgba(13, 8, 30, 0.72);
  --line: rgba(168, 130, 255, 0.22);
  --font: "Inter", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05030f;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  touch-action: manipulation;
}

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 100%, #3a0f38 0%, rgba(20, 8, 34, 0) 62%),
    radial-gradient(90% 60% at 50% 42%, #2a1148 0%, #0a0620 55%, #04020c 100%);
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- atmosphere ---------- */
.fx-vignette,
.fx-scan,
.fx-speed {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.fx-vignette {
  background:
    radial-gradient(120% 90% at 50% 52%, rgba(0, 0, 0, 0) 42%, rgba(4, 2, 12, 0.55) 82%, rgba(3, 1, 8, 0.86) 100%),
    linear-gradient(to bottom, rgba(8, 3, 22, 0.5) 0%, rgba(0, 0, 0, 0) 28%);
  mix-blend-mode: multiply;
}

.fx-scan {
  opacity: 0.22;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.055) 0px,
    rgba(255, 255, 255, 0.055) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: overlay;
}

.fx-speed {
  opacity: 0;
  transition: opacity 160ms linear;
  background:
    radial-gradient(45% 40% at 50% 55%, rgba(75, 232, 255, 0.14), rgba(75, 232, 255, 0) 70%),
    radial-gradient(60% 55% at 50% 52%, rgba(0, 0, 0, 0) 38%, rgba(139, 92, 255, 0.16) 78%, rgba(0, 0, 0, 0.4) 100%);
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(14px, 3vw, 34px) max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  transition: opacity 420ms ease;
}

.hud.is-live { opacity: 1; }

.hud-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hud-top {
  align-items: flex-start;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.7);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat--center { text-align: center; }
.stat--end { text-align: right; align-items: flex-end; }

.stat-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: rgba(169, 146, 200, 0.85);
  white-space: nowrap;
}

.stat-value {
  font-family: var(--mono);
  font-size: clamp(20px, 4.6vw, 30px);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 22px rgba(139, 92, 255, 0.75);
}

.stat-value em {
  font-style: normal;
  font-size: 0.5em;
  margin-left: 4px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.stat-value--dim { color: rgba(214, 196, 244, 0.7); text-shadow: none; }

.hud-bottom {
  align-items: flex-end;
  gap: 18px;
}

.console {
  display: flex;
  align-items: flex-end;
  gap: clamp(12px, 2.4vw, 22px);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(18, 10, 38, 0.62), rgba(8, 4, 20, 0.34));
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.speed {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.speed-num {
  font-family: var(--mono);
  font-size: clamp(38px, 8.4vw, 58px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #fdf8ff;
  text-shadow: 0 0 26px rgba(75, 232, 255, 0.5);
}

.speed-unit {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.energy {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: clamp(110px, 26vw, 168px);
  padding-bottom: 4px;
}

.energy-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.energy-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.combo {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(75, 232, 255, 0.8);
  transition: transform 160ms ease, color 200ms ease;
}

.combo.is-hot {
  color: var(--pink);
  text-shadow: 0 0 16px rgba(255, 61, 146, 0.9);
  transform: scale(1.16);
}

.energy-track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.energy-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #37d7ff, #8b5cff 55%, #ff4fa3);
  box-shadow: 0 0 16px rgba(97, 176, 255, 0.75);
  transition: width 120ms linear, filter 200ms ease;
}

.energy-fill.is-low {
  background: linear-gradient(90deg, #ff8a5b, #ff3d92);
  filter: saturate(1.2);
  animation: pulse 700ms ease-in-out infinite;
}

.energy-ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(5, 3, 15, 0.55) 0 1px, rgba(5, 3, 15, 0) 1px 12.5%);
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid rgba(168, 130, 255, 0.18);
  background: rgba(10, 6, 24, 0.45);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: rgba(206, 188, 235, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(168, 130, 255, 0.3);
  color: #e7dbff;
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- touch ---------- */
.touch {
  display: none;
  gap: 10px;
  align-items: center;
  padding-bottom: 2px;
}

.tbtn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(168, 130, 255, 0.35);
  background: linear-gradient(160deg, rgba(34, 18, 66, 0.72), rgba(12, 6, 28, 0.6));
  color: #efe4ff;
  font-size: 20px;
  font-family: var(--font);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 90ms ease, background 120ms ease, border-color 120ms ease;
}

.tbtn:active,
.tbtn.is-on {
  transform: scale(0.94);
  border-color: rgba(75, 232, 255, 0.7);
  background: linear-gradient(160deg, rgba(60, 30, 110, 0.9), rgba(20, 10, 44, 0.85));
}

.tbtn--boost {
  width: 78px;
  height: 78px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #d9fbff;
  border-color: rgba(75, 232, 255, 0.45);
  box-shadow: 0 0 26px rgba(75, 232, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ---------- toasts ---------- */
.toasts {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  font-family: var(--mono);
  font-size: clamp(13px, 2.6vw, 16px);
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: 99px;
  color: #eafcff;
  background: rgba(12, 8, 30, 0.55);
  border: 1px solid rgba(75, 232, 255, 0.35);
  box-shadow: 0 0 24px rgba(75, 232, 255, 0.25);
  white-space: nowrap;
  animation: toastIn 220ms ease both, toastOut 420ms ease 900ms both;
}

.toast--pink {
  color: #ffe6f2;
  border-color: rgba(255, 61, 146, 0.45);
  box-shadow: 0 0 24px rgba(255, 61, 146, 0.28);
}

.toast--amber {
  color: #fff3df;
  border-color: rgba(255, 191, 107, 0.45);
  box-shadow: 0 0 24px rgba(255, 191, 107, 0.25);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-14px); }
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(70% 60% at 50% 38%, rgba(58, 20, 74, 0.55), rgba(5, 3, 16, 0.86) 72%),
    rgba(5, 3, 16, 0.55);
  backdrop-filter: blur(7px) saturate(1.1);
  -webkit-backdrop-filter: blur(7px) saturate(1.1);
  animation: fadeIn 320ms ease both;
  overflow-y: auto;
}

.overlay--start {
  background:
    radial-gradient(80% 65% at 50% 30%, rgba(96, 26, 96, 0.42), rgba(4, 2, 14, 0.82) 70%),
    linear-gradient(to bottom, rgba(4, 2, 14, 0.55), rgba(4, 2, 14, 0.9));
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  width: min(100%, 560px);
  padding: clamp(22px, 5vw, 40px);
  border-radius: 24px;
  border: 1px solid rgba(168, 130, 255, 0.22);
  background: linear-gradient(165deg, rgba(24, 13, 46, 0.86), rgba(8, 5, 20, 0.9));
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(139, 92, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(75, 232, 255, 0.65), rgba(255, 61, 146, 0.65), transparent);
  opacity: 0.75;
}

.panel--small { width: min(100%, 440px); }

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.34em;
  color: rgba(169, 146, 200, 0.85);
  text-transform: uppercase;
}

.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1;
}

.title-cn {
  font-size: clamp(38px, 10vw, 62px);
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(100deg, #fff 0%, #ffd6e9 38%, #bde9ff 68%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 61, 146, 0.35)) drop-shadow(0 0 44px rgba(75, 232, 255, 0.25));
}

.title-en {
  font-family: var(--mono);
  font-size: clamp(10px, 2.4vw, 12px);
  letter-spacing: 0.62em;
  color: var(--cyan);
  text-indent: 0.62em;
  opacity: 0.9;
}

.lede {
  margin: 18px 0 0;
  font-size: clamp(13px, 3.2vw, 14.5px);
  line-height: 1.85;
  color: rgba(222, 208, 245, 0.86);
}

.rules {
  list-style: none;
  margin: 22px 0 0;
  padding: 16px 18px;
  display: grid;
  gap: 10px;
  border-radius: 16px;
  border: 1px solid rgba(168, 130, 255, 0.14);
  background: rgba(8, 5, 22, 0.5);
  text-align: left;
  font-size: clamp(12px, 2.9vw, 13.5px);
  line-height: 1.6;
  color: rgba(206, 190, 232, 0.9);
}

.rules li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rules li span:not(.rule-dot) {
  color: #fff;
  font-weight: 600;
  padding: 0 2px;
}

.rule-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.rule-dot--cyan { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.rule-dot--pink { background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.rule-dot--amber { background: var(--amber); box-shadow: 0 0 12px var(--amber); }

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

.btn {
  appearance: none;
  border: 1px solid transparent;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.btn--primary {
  color: #10051f;
  background: linear-gradient(100deg, #7cf3ff, #b09bff 52%, #ff9ec9);
  box-shadow: 0 14px 34px rgba(139, 92, 255, 0.35), 0 0 30px rgba(75, 232, 255, 0.22);
}

.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(139, 92, 255, 0.45); }
.btn--primary:active { transform: translateY(1px) scale(0.99); }

.btn--ghost {
  color: #e3d7ff;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(168, 130, 255, 0.3);
}

.btn--ghost:hover { background: rgba(255, 255, 255, 0.08); }

.best-line {
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.best-line strong {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.panel-title {
  margin: 0;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.result {
  margin: 22px 0 0;
  display: grid;
  gap: 1px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(168, 130, 255, 0.16);
  background: rgba(168, 130, 255, 0.12);
}

.result > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(10, 6, 26, 0.86);
}

.result dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.result dd {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(16px, 4vw, 19px);
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .hint { display: none; }
  .touch { display: flex; }
  .hud-bottom { align-items: flex-end; }
  .console { padding: 10px 12px; gap: 10px; border-radius: 14px; }
  .speed-unit { display: none; }
  .energy { width: 92px; }
  .toasts { top: 20%; }
}

@media (max-width: 400px) {
  .console { flex: 1; }
  .energy { width: 74px; }
}

@media (hover: none) and (pointer: coarse) {
  .hint { display: none; }
  .touch { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: toastOut 420ms ease 900ms both; }
  .energy-fill.is-low { animation: none; }
  .overlay { animation: none; }
}
