:root {
  --bg: #071428;
  --ink: #f4f7ff;
  --muted: #9db4d4;
  --gold: #ffd56a;
  --blue: #3ea7ff;
  --red: #ff4d6d;
  --ok: #7dffb3;
  --you: #ffd56a;
  --them: #7ad4ff;
  --thumb-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #02060e;
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: min(100%, 390px);
  height: min(100dvh, 844px);
  margin: 0 auto;
  background:
    radial-gradient(120% 70% at 50% 110%, #12305a 0%, transparent 52%),
    linear-gradient(180deg, #12325c 0%, var(--bg) 46%, #040b16 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.spot {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(46px);
  pointer-events: none;
  opacity: 0.4;
}
.spot-a { top: -50px; left: -30px; background: #ffc14a; }
.spot-b { top: 10%; right: -60px; background: #2f7dff; }
.spot-c { bottom: 16%; left: 18%; background: #7a3cff; opacity: 0.26; }

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 6px;
  gap: 8px;
}
.hud-cell { text-align: center; }
.hud-cell:first-child { text-align: left; }
.hud-cell:last-child { text-align: right; }
.hud-k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hud-cell span:last-child {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
}
.hud-title h1 {
  font-size: 18px;
  letter-spacing: 0.16em;
  text-shadow: 0 0 18px rgba(255, 213, 106, 0.45);
}
.hud-title p {
  font-size: 11px;
  color: var(--blue);
  letter-spacing: 0.18em;
}

.scoreboard {
  position: relative;
  z-index: 4;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 0 12px 8px;
}
.scoreboard li {
  background: rgba(244, 247, 255, 0.06);
  border: 1px solid rgba(255, 213, 106, 0.18);
  border-radius: 12px;
  padding: 6px 4px 7px;
  text-align: center;
}
.scoreboard .who {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.scoreboard .pts {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 800;
}
.scoreboard [data-who="you"] .pts { color: var(--you); }
.scoreboard [data-who="them"] .pts { color: var(--them); }
.scoreboard .pot-cell .pts { color: #fff; }
.scoreboard li.lead { box-shadow: 0 0 0 1px var(--gold); }

#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 14px 8px;
  gap: 8px;
}
.screen[hidden] { display: none; }

.plaque {
  width: 100%;
  background: rgba(4, 11, 22, 0.55);
  border: 1px solid rgba(255, 213, 106, 0.28);
  border-radius: 20px;
  padding: 18px 16px 16px;
  box-shadow: inset 0 0 40px rgba(62, 167, 255, 0.08);
}
.neon {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.36em;
  color: var(--gold);
  margin-bottom: 10px;
  text-shadow: 0 0 12px rgba(255, 213, 106, 0.7);
}
.lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 10px;
}
.rules {
  list-style: none;
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}
.rules li {
  font-size: 13px;
  color: var(--muted);
  padding-left: 16px;
  position: relative;
}
.rules li::before {
  content: "◆";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 10px;
  top: 3px;
}
.best-line {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.best-line strong { color: var(--gold); }

.survey-k {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold);
}
#question {
  width: 100%;
  text-align: center;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.feud-board {
  width: 100%;
  list-style: none;
  display: grid;
  gap: 6px;
}
.slot {
  display: grid;
  grid-template-columns: 28px 1fr 44px;
  align-items: center;
  min-height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1a4a8a, #0d2a58);
  border: 1px solid rgba(255, 213, 106, 0.28);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.slot .num {
  text-align: center;
  font-weight: 800;
  color: var(--gold);
  font-size: 16px;
}
.slot .ans {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.slot .n {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--gold);
}
.slot.hidden .ans { color: transparent; text-shadow: none; }
.slot.hidden .n { color: transparent; }
.slot.hidden .ans::after {
  content: "—";
  color: rgba(244, 247, 255, 0.35);
}
.slot.revealed {
  background: linear-gradient(180deg, #f7e7b0, #e8c25a);
  color: #2a1604;
  border-color: #ffe7a0;
}
.slot.revealed .num,
.slot.revealed .n { color: #7a3d00; }
.slot.flash { animation: pop 0.35s ease; }
@keyframes pop {
  0% { transform: scale(0.96); filter: brightness(1.4); }
  100% { transform: scale(1); }
}

.strikes {
  display: flex;
  gap: 10px;
  min-height: 36px;
}
.strikes span {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 900;
  color: rgba(255, 77, 109, 0.22);
  background: rgba(255, 77, 109, 0.08);
  border: 1px solid rgba(255, 77, 109, 0.16);
}
.strikes span.on {
  color: #fff;
  background: var(--red);
  border-color: #ff8aa0;
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.45);
}

.host {
  font-size: 14px;
  color: var(--gold);
  text-align: center;
  min-height: 2.6em;
  line-height: 1.4;
}

.reveal-k {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--muted);
}
.reveal-tag {
  font-size: 28px;
  font-weight: 800;
  color: var(--ok);
}
.reveal-tag.miss { color: var(--red); }
.reveal-tag.steal { color: var(--them); }
.round-score {
  font-size: 14px;
  color: var(--muted);
}
.round-score strong { color: var(--gold); }

.final-board {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}
.final-board li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(244, 247, 255, 0.06);
}
.final-board li.you { box-shadow: 0 0 0 1px var(--gold); }
.result-tag {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
}

.dock {
  position: relative;
  z-index: 6;
  padding: 6px 12px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, transparent, rgba(4, 11, 22, 0.75) 18%, #040b16);
}
.dock[hidden] { display: none; }

#guess-form {
  display: grid;
  gap: 8px;
}
#guess-form[hidden] { display: none; }
#guess-input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(255, 213, 106, 0.28);
  border-radius: 14px;
  background: rgba(244, 247, 255, 0.08);
  color: var(--ink);
  font-size: 18px;
  text-align: center;
  outline: none;
}
#guess-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 213, 106, 0.18);
}
#guess-input:disabled { opacity: 0.45; }

.thumb {
  width: 100%;
  height: var(--thumb-h);
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffd56a, #ff9a2e);
  color: #3a1608;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: 0 8px 20px rgba(255, 154, 46, 0.28);
}
.thumb:active { transform: scale(0.98); }
.thumb[hidden] { display: none; }
.thumb:disabled { opacity: 0.45; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-height: 700px) {
  #question { font-size: 16px; }
  .slot { min-height: 36px; }
  .thumb { height: 52px; font-size: 18px; }
}
