/* 酒桌派对 — 深紫派对风，手机优先，大字大按钮 */
:root {
  --bg0: #0d0618;
  --bg1: #1b0a2f;
  --panel: rgba(24, 12, 42, 0.88);
  --line: rgba(255, 230, 255, 0.14);
  --text: #f8f3ff;
  --muted: #cbbddd;
  --pink: #ff4f9a;
  --pink-2: #ff7ab3;
  --purple: #8b6cff;
  --gold: #ffd166;
  --cyan: #3ee0c8;
  --rose: #fb7185;
  --ok: #6ee7b7;
  --danger: #ff6b7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}
body {
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; }
img, svg { max-width: 100%; display: block; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 108, 255, 0.35), transparent 60%),
    radial-gradient(700px 480px at 110% 10%, rgba(255, 79, 154, 0.28), transparent 55%),
    radial-gradient(600px 400px at 50% 120%, rgba(255, 209, 102, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 55%);
}

.view {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hidden { display: none !important; }

h1, h2, h3 { margin: 0; letter-spacing: 0.02em; }
h1 { font-size: clamp(2.1rem, 8vw, 2.8rem); line-height: 1.15; }
h2 { font-size: 1.25rem; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: none;
  font-size: 0.82rem;
}
.lead { margin: 10px 0 0; color: var(--muted); font-size: 1.05rem; }
.hint { margin: 0; color: var(--muted); text-align: center; font-size: 0.92rem; }
.tiny { margin: 0; color: var(--muted); font-size: 0.85rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.age-panel { margin-top: auto; margin-bottom: auto; }
.age-notes {
  margin: 16px 0 22px;
  padding-left: 1.1em;
  color: var(--muted);
}
.age-notes li { margin: 6px 0; }

.home-hero { margin-top: 8vh; }
.home-foot {
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.stack-btns { display: flex; flex-direction: column; gap: 12px; }
.btn {
  min-height: 56px;
  padding: 14px 22px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.btn-xl { min-height: 68px; font-size: 1.28rem; }
.btn-sm { min-height: 44px; font-size: 1rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--pink), #c84bff 70%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 79, 154, 0.28);
}
.btn-primary:active { transform: translateY(1px); }
.btn-secondary {
  background: linear-gradient(135deg, #3a1d73, var(--purple));
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--text);
}
.btn-text {
  background: transparent;
  min-height: 40px;
  padding: 6px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}
.btn-text.danger { color: var(--danger); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.topbar {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 8px;
}
.topbar h2 { text-align: center; }
.topbar .tiny { grid-column: 1; }

.field { display: flex; flex-direction: column; gap: 8px; font-weight: 650; }
.field input {
  min-height: 56px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: rgba(8, 4, 16, 0.45);
  outline: none;
  font-size: 1.15rem;
}
.field input:focus { border-color: var(--purple); }
.field-label { margin: 4px 0 0; font-weight: 700; }

.tier-grid { display: flex; flex-direction: column; gap: 10px; }
.tier {
  text-align: left;
  background: rgba(8, 4, 16, 0.4);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tier strong { font-size: 1.15rem; }
.tier span { color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.tier.on {
  border-color: var(--pink);
  background: linear-gradient(135deg, rgba(255, 79, 154, 0.22), rgba(139, 108, 255, 0.16));
  box-shadow: 0 0 0 1px rgba(255, 79, 154, 0.4);
}
.tier.locked { opacity: 0.78; }
.tier.locked span { color: var(--gold); }

.tier-pill {
  align-self: center;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.14);
  color: var(--gold);
  font-weight: 700;
}

.code-board {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
}
.code-digits {
  margin: 0 0 12px;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  color: #fff;
}
.qr-box {
  width: 210px;
  height: 210px;
  margin: 0 auto 12px;
  padding: 12px;
  background: #fff;
  border-radius: 16px;
  color: #111;
}
.qr-box svg { width: 100%; height: 100%; }

.players-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.players-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
}
.player-list li:first-child { border-top: 0; }
.tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 108, 255, 0.25);
  color: #e6dcff;
}
.tag.me { background: rgba(255, 79, 154, 0.25); color: #ffd4e8; }
.offline { opacity: 0.5; }

.sticky-actions { margin-top: auto; }
.card-stage { flex: 1; display: flex; align-items: center; }
.play-card {
  width: 100%;
  min-height: 42vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%),
    linear-gradient(160deg, #2a1254, #1a0b33 70%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.play-card[data-card-type="truth"] { box-shadow: 0 18px 50px rgba(139, 108, 255, 0.28); }
.play-card[data-card-type="dare"] { box-shadow: 0 18px 50px rgba(251, 113, 133, 0.28); }
.play-card[data-card-type="drink"] { box-shadow: 0 18px 50px rgba(255, 209, 102, 0.22); }
.play-card[data-card-type="interact"] { box-shadow: 0 18px 50px rgba(62, 224, 200, 0.22); }

.card-type {
  position: absolute;
  top: 18px;
  left: 22px;
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  color: var(--gold);
}
.play-card[data-card-type="truth"] .card-type { color: #d2b6ff; }
.play-card[data-card-type="dare"] .card-type { color: #ff9ab0; }
.play-card[data-card-type="drink"] .card-type { color: var(--gold); }
.play-card[data-card-type="interact"] .card-type { color: var(--cyan); }

.card-text {
  margin: 28px 0 0;
  font-size: clamp(1.35rem, 5.4vw, 1.8rem);
  font-weight: 750;
  line-height: 1.45;
  word-break: break-word;
}
.card-seq {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.player-chips li {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.player-chips li.current {
  background: rgba(255, 79, 154, 0.2);
  border-color: var(--pink);
}
.punish-foot {
  margin: 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(6, 2, 14, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#turn-overlay { background: #16031f; }
.turn-flash {
  margin: 0;
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 40px rgba(255, 79, 154, 0.8);
  animation: pulse 0.9s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(0.96); opacity: 0.85; } to { transform: scale(1.04); opacity: 1; } }

.scan-frame { width: min(420px, 100%); text-align: center; }
#scan-video {
  width: 100%;
  border-radius: 20px;
  background: #000;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.scan-tip { color: #fff; margin: 12px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(92vw, 420px);
  background: #2a1238;
  border: 1px solid var(--line);
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

@media (min-width: 720px) {
  .view { padding-top: calc(32px + var(--safe-top)); }
  .btn { min-height: 58px; }
}

#view-game .topbar {
  grid-template-columns: auto 1fr auto;
  column-gap: 10px;
}
#view-game .topbar .tiny {
  white-space: nowrap;
}
#view-game .topbar h2 {
  font-size: 1.15rem;
}
