:root {
  --ink: #070b12;
  --navy: #0e1624;
  --panel: #121c2c;
  --gold: #d7b36a;
  --gold-2: #f0d9a0;
  --ice: #e8eef6;
  --teal: #2bb5ad;
  --teal-dim: #1a6f6a;
  --fog: #8b93a3;
  --danger: #e07a5f;
  --line: rgba(232, 238, 246, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% -10%, #18263c 0%, var(--ink) 55%);
  color: var(--ice);
  font-family: var(--sans);
  font-weight: 380;
  letter-spacing: 0.01em;
  min-height: 100dvh;
  overflow: hidden;
}

.grain, .stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.grain {
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
}
.stars {
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(232,238,246,0.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 18%, rgba(215,179,106,0.35) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 62% 72%, rgba(43,181,173,0.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 80%, rgba(232,238,246,0.25) 50%, transparent 51%);
  animation: drift 80s linear infinite;
}
@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to { transform: translate3d(-2%, 1.5%, 0); }
}

#app { position: relative; z-index: 1; height: 100dvh; }
.view {
  height: 100dvh;
  padding: clamp(18px, 4vh, 48px) clamp(18px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.lobby, .reveal, .final { align-items: stretch; }

.mast { display: flex; align-items: baseline; gap: 14px; }
.mast.tight { margin-bottom: 18px; }
.mark {
  font-family: var(--serif);
  font-weight: 650;
  font-size: 22px;
  letter-spacing: 0.28em;
}
.mark-sub { color: var(--fog); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }

.lead {
  font-family: var(--serif);
  font-size: clamp(28px, 4.6vw, 58px);
  font-weight: 500;
  line-height: 1.12;
  max-width: 16ch;
  margin: 28px 0 12px;
}
.lead-sub { color: var(--fog); max-width: 42ch; margin: 0 0 36px; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--ice);
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 22px;
  border-radius: 999px;
  cursor: pointer;
}
.btn.gold { background: var(--gold); color: #1a1408; }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.kicker {
  color: var(--gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
}
.hint { color: var(--fog); }
.round-tag { color: var(--teal); letter-spacing: 0.2em; text-transform: uppercase; font-size: 13px; }

.city {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(42px, 9vw, 120px);
  line-height: 0.92;
  margin: 8px 0 0;
  max-width: 18ch;
}
.city.sm { font-size: clamp(28px, 5vw, 64px); }
.city.phone { font-size: clamp(32px, 12vw, 56px); }
.country { color: var(--fog); margin: 8px 0 22px; font-size: clamp(16px, 2vw, 22px); }

.sheet { background: rgba(7,11,18,0.55); }
.sheet-card {
  margin: auto;
  width: min(420px, 100%);
  background: var(--navy);
  border: 1px solid var(--line);
  padding: 28px;
  border-radius: 18px;
}
.sheet-card h2 { font-family: var(--serif); margin-top: 0; }
.sheet-card label { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; color: var(--fog); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.sheet-card input[type="text"],
.sheet-card input[type="number"] {
  background: #0a111c;
  border: 1px solid var(--line);
  color: var(--ice);
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.lobby {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.1fr;
  gap: 40px;
  align-items: center;
}
.qr {
  width: min(52vh, 420px);
  aspect-ratio: 1;
  background: #f4efe4;
  padding: 14px;
  border-radius: 12px;
}
.qr svg { width: 100%; height: 100%; display: block; }
.code-lg {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: 0.18em;
  margin: 12px 0 4px;
  color: var(--gold-2);
}
.join-url { color: var(--fog); font-size: 14px; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; margin: 12px 0 20px; }
.chip {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  animation: pop 0.35s ease;
}
.chip.off { opacity: 0.45; }
@keyframes pop {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.ring-wrap { position: relative; width: 148px; height: 148px; margin: 8px 0 16px; }
.ring { width: 148px; height: 148px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-fg {
  fill: none;
  stroke: var(--gold);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.2s linear;
}
.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 42px;
}
.ring-wrap.pulse .ring-num { animation: pulse 0.7s ease-in-out infinite; }
@keyframes pulse {
  50% { transform: scale(1.08); color: var(--gold); }
}
.waiting { color: var(--fog); letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; }

.globe { width: min(720px, 100%); height: auto; display: block; }
.true-fix { color: var(--teal); letter-spacing: 0.08em; }
.reveal-rows { list-style: none; padding: 0; margin: 16px 0; max-height: 28vh; overflow: auto; }
.reveal-rows li {
  display: grid;
  grid-template-columns: 2ch 1fr auto auto;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.podium { display: flex; align-items: flex-end; gap: 12px; height: 180px; margin: 18px 0; }
.pod {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
  padding: 12px 8px 8px;
  border-radius: 10px 10px 0 0;
}
.pod.p1 { height: 100%; background: linear-gradient(180deg, rgba(215,179,106,0.2), var(--panel)); }
.pod.p2 { height: 78%; }
.pod.p3 { height: 62%; }
.board { list-style: none; padding: 0; margin: 0 0 18px; max-height: 30vh; overflow: auto; }
.board li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }

.player {
  justify-content: flex-start;
  align-items: stretch;
  max-width: 480px;
  margin: 0 auto;
  width: min(480px, 100%);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack input {
  width: 100%;
  background: #0a111c;
  border: 1px solid var(--line);
  color: var(--ice);
  font: inherit;
  font-size: 22px;
  padding: 12px;
  border-radius: 12px;
}
.coord { margin: 10px 0 16px; }
.coord-label { color: var(--fog); letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; margin: 0 0 8px; }
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: center; }
.step {
  height: 64px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ice);
  font-size: 32px;
  cursor: pointer;
}
.step-val {
  font-family: var(--serif);
  font-size: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.seg-btn {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ice);
  letter-spacing: 0.16em;
  cursor: pointer;
}
.seg-btn.on { background: var(--teal-dim); border-color: var(--teal); }
.big-stat { font-family: var(--serif); font-size: 42px; margin: 8px 0; }

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--gold);
  color: var(--ice);
  padding: 10px 16px;
  border-radius: 999px;
}

@media (max-aspect-ratio: 4/3) {
  .lobby { grid-template-columns: 1fr; }
  .city { font-size: clamp(36px, 8vw, 84px); }
}
@media (max-width: 720px) {
  .lobby { grid-template-columns: 1fr; overflow: auto; }
  body { overflow: auto; }
  .view { height: auto; min-height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .stars, .chip, .ring-wrap.pulse .ring-num { animation: none; }
  .ring-fg { transition: none; }
}
