:root {
  --ink: #f6f1e7;
  --muted: #b7c3cf;
  --bg: #121820;
  --card: #1c2836;
  --card2: #243446;
  --line: rgba(246, 241, 231, 0.08);
  --coral: #ff6b57;
  --coral-deep: #e24b38;
  --gold: #ffc857;
  --battle: #0b1016;
  --mint: #3ddec9;
  --blue: #7eb6ff;
  --danger: #ff8b7a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0c1117; color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: transparent; border: 0; }
.phone {
  width: min(440px, 100%);
  min-height: 100%;
  margin: 0 auto;
  background:
    radial-gradient(800px 320px at 10% -10%, rgba(255, 107, 87, 0.28), transparent 55%),
    radial-gradient(600px 280px at 110% 8%, rgba(61, 222, 201, 0.16), transparent 50%),
    var(--bg);
  position: relative;
  overflow: hidden;
}
.view { display: none; min-height: 100vh; padding: 22px 18px 28px; }
.view.on { display: block; }
.battle.on { display: flex; flex-direction: column; padding: 10px 10px 12px; height: 100vh; min-height: 100vh; }

h1 { font-size: 34px; line-height: 1.15; margin: 8px 0; letter-spacing: 0.04em; }
h2 { margin: 0 0 8px; font-size: 22px; }
p { color: var(--muted); line-height: 1.55; }
.kicker { color: var(--gold); letter-spacing: 0.18em; font-size: 12px; margin: 0; }

.splash-mark {
  width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center;
  background: conic-gradient(from 120deg, var(--coral), #ffd166, var(--mint), var(--coral));
  color: #1a120e; font-size: 48px; font-weight: 800; margin: 22vh auto 18px;
  box-shadow: var(--shadow);
}
#view-splash { text-align: center; }
#view-splash h1 { font-size: 40px; }
.bar { height: 8px; border-radius: 99px; background: #2a3646; overflow: hidden; margin: 28px auto 0; width: 68%; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coral), var(--gold)); transition: width .3s; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 30%), var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.player-card { display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.avatar {
  width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center;
  font-weight: 800; color: #24180f; flex: none; position: relative;
}
.frame-silver { box-shadow: 0 0 0 3px #d5dde6; }
.frame-gold { box-shadow: 0 0 0 3px var(--gold); }
.frame-platinum { box-shadow: 0 0 0 3px #d7ecff; animation: pulse 1.6s infinite; }
.frame-diamond { box-shadow: 0 0 0 3px #8ee7ff, 0 0 16px #67e8f9; }
.frame-master { box-shadow: 0 0 0 3px #c4b5fd; }
.frame-king { box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--coral); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px #fff; } }
.name { font-size: 20px; font-weight: 750; }
.tier { color: var(--gold); font-weight: 700; }
.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.flame { color: #ff8a3d; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.mode {
  text-align: left; border: 0; border-radius: 18px; padding: 14px; background: var(--card2); min-height: 92px;
}
.mode b { display: block; font-size: 17px; margin-bottom: 6px; }
.mode span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.mode.main { background: linear-gradient(160deg, #ff7a66, #e44836); color: white; }
.mode.main span { color: rgba(255,255,255,.86); }
.links { display: flex; gap: 8px; margin-top: 12px; }
.links button, .ghost, .tiny {
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink);
}
.primary, .danger {
  width: 100%; border: 0; border-radius: 16px; padding: 14px 16px; font-weight: 750; margin-top: 10px;
}
.primary { background: var(--coral); color: white; }
.danger { background: #3a2a32; color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.banner {
  margin-top: 12px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 200, 87, 0.12); border: 1px solid rgba(255, 200, 87, 0.28); color: #ffe7ad;
}

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.code { font-size: 40px; letter-spacing: 0.18em; font-weight: 800; margin: 6px 0; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seat { min-height: 92px; }
.slot-empty { color: var(--muted); display: grid; place-items: center; min-height: 72px; }
label.field { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; }
select, input[type="text"], input[type="number"] {
  width: 100%; margin-top: 6px; background: #121a24; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.checks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.checks button { background: #121a24; }
.checks button.on { background: rgba(61, 222, 201, 0.16); border-color: var(--mint); color: var(--mint); }

.radar {
  width: 140px; height: 140px; margin: 24px auto; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.25); position: relative;
}
.radar i {
  position: absolute; inset: 18px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,87,.9), transparent 68%);
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-note { text-align: center; }

.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.who { background: var(--card); border-radius: 14px; padding: 8px; min-height: 52px; font-size: 13px; }
.who b { display: block; font-size: 18px; }
.who.right { text-align: right; }
.timer {
  min-width: 72px; text-align: center; font-size: 28px; font-weight: 800; color: var(--gold);
}
.timer.pause { color: var(--mint); }
.stage { position: relative; flex: 1; min-height: 0; margin: 8px 0; border-radius: 16px; overflow: hidden; background: var(--battle); }
#board { width: 100%; height: 100%; display: block; touch-action: none; }
.scroller { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; }
.scroller button, .props button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 10px; white-space: nowrap; font-size: 13px;
}
.props { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.props button { border-radius: 12px; min-height: 46px; }
.props button:disabled { opacity: 0.35; }
#bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble {
  position: absolute; left: 12px; top: 10px; background: rgba(18, 24, 32, 0.88);
  border: 1px solid rgba(255,255,255,.12); padding: 8px 12px; border-radius: 14px; animation: pop .25s ease;
}
.sticker { position: absolute; font-size: 42px; animation: pop .25s ease; filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.entrance {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 10, 16, 0.45);
  font-size: 28px; font-weight: 800; letter-spacing: 0.08em;
}
.wait-banner { background: rgba(255, 200, 87, 0.16); color: #ffe7ad; border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wait-banner button { width: auto; margin: 0; padding: 8px 10px; }

.board-row, .shop-item, .theme-card {
  display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.rank-no { width: 28px; color: var(--gold); font-weight: 800; }
.me-row { background: rgba(255, 107, 87, 0.08); border-radius: 12px; padding-left: 8px; }
.theme-card canvas { width: 92px; height: 64px; border-radius: 10px; background: #0e1620; flex: none; }
.lock { opacity: 0.55; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button.on { background: var(--coral); border-color: transparent; }
.mask { position: absolute; inset: 0; background: rgba(5, 8, 12, 0.72); display: grid; place-items: center; padding: 20px; z-index: 5; }
.dialog { background: var(--card); border-radius: 20px; padding: 18px; width: min(360px, 100%); }
#toasts { position: absolute; top: 10px; left: 12px; right: 12px; z-index: 6; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: rgba(20, 16, 14, 0.92); border: 1px solid rgba(255,200,87,.35); color: var(--ink); border-radius: 12px; padding: 10px 12px; }
.announce { position: absolute; top: 0; left: 0; right: 0; z-index: 4; background: #3a2a12; color: #ffe7ad; text-align: center; padding: 8px 12px; font-size: 13px; }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.avatars button { width: 46px; height: 46px; border-radius: 14px; border: 2px solid transparent; }
.avatars button.on { border-color: white; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: #121a24; border-radius: 14px; padding: 10px; }
.stat b { display: block; font-size: 20px; }
