:root {
  --bg: #04060d;
  --ink: #e9effb;
  --muted: #93a5c2;
  --line: rgba(150, 180, 220, 0.14);
  --warm: #ffd0a1;
  --warm-strong: #ffb46e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.touch { -webkit-tap-highlight-color: transparent; }

#app { position: fixed; inset: 0; overflow: hidden; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.1s ease;
}
#scene.is-live { opacity: 1; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(2, 4, 10, 0) 42%, rgba(2, 4, 10, 0.55) 100%),
    linear-gradient(180deg, rgba(3, 6, 14, 0.55) 0%, rgba(3, 6, 14, 0) 22%),
    linear-gradient(0deg, rgba(3, 6, 14, 0.5) 0%, rgba(3, 6, 14, 0) 20%);
}

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; z-index: 8; pointer-events: none; }

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(205, 220, 243, 0.72);
}

.hud-place { display: flex; align-items: center; gap: 10px; }
.hud-count { color: rgba(255, 208, 161, 0.85); letter-spacing: 0.08em; }
.live-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255, 208, 161, 0.9);
  box-shadow: 0 0 10px rgba(255, 190, 120, 0.8);
}
.hud-time {
  font-variant-numeric: tabular-nums;
  color: rgba(205, 220, 243, 0.6);
}

.hud-hint {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(190, 205, 230, 0.45);
  white-space: nowrap;
}

.toast {
  position: absolute;
  left: 50%; top: 16%;
  transform: translate(-50%, -10px);
  padding: 12px 22px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: rgba(255, 233, 209, 0.95);
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid rgba(255, 206, 154, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.prompt {
  position: absolute;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(255, 220, 180, 0.9);
  border: 1px solid rgba(255, 206, 154, 0.22);
  border-radius: 999px;
  background: rgba(10, 15, 26, 0.6);
  backdrop-filter: blur(8px);
}

/* ---------- firework pickup ---------- */
.firework-btn {
  position: absolute;
  left: 50%; bottom: 148px;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: auto;
  padding: 11px 26px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: #ffe6c2;
  border: 1px solid rgba(255, 196, 107, 0.55);
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 196, 107, 0.32), rgba(14, 11, 9, 0.88) 72%);
  box-shadow: 0 0 26px rgba(255, 170, 80, 0.3);
  cursor: pointer;
  animation: fireworkGlow 2.4s ease-in-out infinite;
}
.firework-btn:active { transform: translateX(-50%) scale(0.96); }
@keyframes fireworkGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 170, 80, 0.22); }
  50% { box-shadow: 0 0 34px rgba(255, 170, 80, 0.45); }
}

/* ---------- mobile controls ---------- */
.mobile-controls {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 26px 34px;
  pointer-events: none;
}
.mobile-controls[hidden] { display: none; }
.stick {
  position: relative;
  width: 118px; height: 118px;
  border-radius: 50%;
  background: rgba(220, 235, 255, 0.035);
  border: 1px solid rgba(180, 205, 240, 0.14);
  pointer-events: auto;
  touch-action: none;
}
.stick-ring {
  position: absolute; inset: 26px;
  border-radius: 50%;
  border: 1px dashed rgba(180, 205, 240, 0.12);
}
.stick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 235, 212, 0.9), rgba(255, 190, 130, 0.55));
  box-shadow: 0 6px 20px rgba(255, 170, 90, 0.18);
  opacity: 0.75;
  transition: transform 0.08s linear;
}
.touch-actions { display: flex; gap: 14px; pointer-events: auto; }
.round-btn {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(180, 205, 240, 0.18);
  background: rgba(12, 18, 30, 0.6);
  color: rgba(210, 224, 245, 0.8);
  font-size: 12px;
  letter-spacing: 0.1em;
  backdrop-filter: blur(8px);
}
.round-btn:active { background: rgba(255, 206, 154, 0.16); color: var(--warm); }

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.screen.visible { opacity: 1; visibility: visible; }
.screen[hidden] { display: none; }

.kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.52em;
  text-transform: uppercase;
  color: rgba(154, 176, 212, 0.72);
}

/* boot */
.boot {
  background: radial-gradient(ellipse at 50% 45%, #0a1120 0%, #04060d 65%);
  z-index: 40;
}
.boot-inner { text-align: center; }
.boot-title {
  margin: 22px 0 26px;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-weight: 400;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.18em;
  color: #eef3ff;
}
.dots i { opacity: 0.25; animation: blink 1.6s infinite; }
.dots i:nth-child(2) { animation-delay: 0.25s; }
.dots i:nth-child(3) { animation-delay: 0.5s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 40% { opacity: 0.95; } }

.boot-bar {
  width: 220px; height: 1px;
  margin: 0 auto;
  background: rgba(200, 220, 255, 0.1);
  overflow: hidden;
}
.boot-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, rgba(255, 206, 154, 0.3), rgba(255, 206, 154, 0.95));
  transition: width 0.5s ease;
}
.boot-note {
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: rgba(150, 172, 205, 0.45);
}

/* entry */
.entry {
  flex-direction: column;
  background:
    radial-gradient(ellipse at 22% 12%, rgba(38, 60, 100, 0.35), rgba(4, 6, 13, 0) 58%),
    radial-gradient(ellipse at 82% 88%, rgba(28, 46, 82, 0.28), rgba(4, 6, 13, 0) 55%),
    linear-gradient(180deg, #04060d 0%, #060a14 100%);
  overflow-y: auto;
  padding: 40px 0;
}
.entry-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 84px);
  align-items: center;
  width: min(1180px, 92vw);
  margin: auto;
}
.brand { padding-right: 12px; }
.brand-title {
  margin: 20px 0 26px;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-weight: 400;
  font-size: clamp(54px, 7.4vw, 96px);
  line-height: 1;
  letter-spacing: 0.12em;
  color: #f6f9ff;
  text-shadow: 0 0 60px rgba(120, 160, 230, 0.22);
}
.brand-sub {
  margin: 0;
  font-size: 15px;
  line-height: 2.1;
  color: #9fc3d3;
  color: #9fb0cc;
  letter-spacing: 0.06em;
}
.brand-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 34px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(140, 160, 190, 0.6);
}
.brand-facts span { position: relative; }
.brand-facts span + span::before {
  content: "";
  position: absolute;
  left: -10px; top: 50%;
  width: 1px; height: 9px;
  margin-top: -4px;
  background: rgba(140, 160, 190, 0.25);
}

.panel {
  width: 100%;
  max-width: 470px;
  justify-self: end;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(9, 14, 25, 0.55);
  backdrop-filter: blur(20px);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
}

.preview-box {
  position: relative;
  height: 336px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 72%, #182642 0%, #080d18 68%);
  border: 1px solid rgba(140, 170, 210, 0.08);
}
#preview { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.preview-meta {
  position: absolute;
  left: 18px; bottom: 16px;
  pointer-events: none;
}
.preview-name {
  margin: 0 0 4px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 19px;
  letter-spacing: 0.1em;
  color: #f4ead9;
}
.preview-desc {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(160, 180, 210, 0.62);
}
.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(160, 180, 210, 0.5);
  background: rgba(6, 10, 18, 0.5);
  transition: opacity 0.4s ease;
}
.preview-loading.hidden { opacity: 0; pointer-events: none; }

.chars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 14px;
}
.char-btn {
  padding: 9px 4px;
  border: 1px solid rgba(140, 170, 210, 0.12);
  border-radius: 9px;
  background: transparent;
  color: rgba(150, 170, 200, 0.7);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.char-btn:hover { border-color: rgba(255, 206, 154, 0.3); color: rgba(240, 226, 206, 0.9); }
.char-btn.active {
  border-color: rgba(255, 206, 154, 0.5);
  background: rgba(255, 206, 154, 0.06);
  color: #ffd9ae;
}

.name-row { margin-top: 18px; }
.name-row label {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: rgba(150, 170, 200, 0.55);
}
.name-input { display: flex; align-items: center; gap: 12px; }
.name-input input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid rgba(150, 180, 220, 0.16);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 0.3s ease;
}
.name-input input::placeholder { color: rgba(150, 170, 200, 0.35); }
.name-input input:focus { border-bottom-color: rgba(255, 206, 154, 0.5); }
#randomName {
  width: 34px; height: 34px;
  flex: none;
  border: 1px solid rgba(255, 206, 154, 0.22);
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 206, 154, 0.8);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
}
#randomName:hover { background: rgba(255, 206, 154, 0.08); }

.primary {
  width: 100%;
  height: 48px;
  margin-top: 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 226, 187, 0.97), rgba(244, 195, 136, 0.92));
  color: #1c1308;
  font-size: 13px;
  letter-spacing: 0.3em;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 14px 44px rgba(255, 180, 100, 0.16);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 18px 52px rgba(255, 180, 100, 0.24); }
.primary:disabled { opacity: 0.6; transform: none; cursor: default; }

.fine {
  margin: 14px 0 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(140, 160, 190, 0.42);
}

/* 备案信息 */
.site-footer {
  margin: 26px auto 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(140, 160, 190, 0.52);
}
.site-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(140, 160, 190, 0.26);
  padding-bottom: 1px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.site-footer a:hover { color: var(--warm); border-color: rgba(255, 208, 161, 0.45); }

/* modal */
.modal { background: rgba(3, 5, 11, 0.72); backdrop-filter: blur(8px); }
.modal-card {
  width: min(520px, 88vw);
  padding: 44px 40px 36px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(9, 14, 25, 0.9);
  box-shadow: 0 40px 140px rgba(0, 0, 0, 0.6);
}
.modal-card h2 {
  margin: 20px 0 16px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.08em;
  color: #f4f7ff;
}
.modal-sub {
  margin: 0;
  font-size: 13px;
  line-height: 2;
  color: rgba(160, 180, 210, 0.7);
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}
.ghost {
  height: 44px;
  border: 1px solid rgba(180, 205, 240, 0.16);
  border-radius: 10px;
  background: transparent;
  color: rgba(200, 216, 240, 0.8);
  font-size: 12px;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.25s ease;
}
.ghost:hover { border-color: rgba(255, 206, 154, 0.35); color: var(--warm); }
.text {
  height: 40px;
  border: none;
  background: transparent;
  color: rgba(140, 160, 190, 0.45);
  font-size: 11px;
  letter-spacing: 0.16em;
  cursor: pointer;
}
.text:hover { color: rgba(200, 216, 240, 0.8); }
.queue-info {
  margin: 18px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(255, 208, 161, 0.7);
}

/* ending */
.ending { background: #04060d; z-index: 45; }
.ending-inner { text-align: center; max-width: 520px; padding: 0 24px; }
.ending-inner h1 {
  margin: 22px 0 20px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-weight: 400;
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: 0.1em;
}
.ending-inner .ghost { margin-top: 34px; width: 220px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .hud-hint { display: none; }
  .entry-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    width: min(560px, 90vw);
    padding: 32px 0 48px;
  }
  .brand { padding: 0; text-align: center; }
  .brand-title { font-size: clamp(46px, 12vw, 64px); margin: 14px 0 18px; }
  .brand-sub { font-size: 13px; line-height: 1.9; }
  .brand-facts { justify-content: center; margin-top: 20px; }
  .panel { justify-self: center; max-width: 100%; padding: 18px; }
  .preview-box { height: 270px; }
  .char-btn { font-size: 10px; letter-spacing: 0; }
  .entry .kicker { letter-spacing: 0.3em; }
  .site-footer { margin-top: 0; }
}

@media (max-height: 640px) and (min-width: 901px) {
  .preview-box { height: 250px; }
  .brand-title { font-size: 64px; }
}
