@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

:root {
  --bg: #08090c;
  --bg-2: #0c0e13;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f1f4f9;
  --muted: #9aa4b4;
  --faint: #66707f;
  --accent: #e6b64a;
  --accent-hi: #ffd97a;
  --accent-deep: #b8861f;
  --violet: #8b7bff;
  --win: #3ad18a;
  --win-hi: #7fe9b6;
  --lose: #ff5c66;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --display: "Space Grotesk", system-ui, sans-serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------- Background layers ---------- */
.bg-aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.bg-aurora span {
  position: absolute; display: block;
  width: 60vw; height: 60vw; border-radius: 50%;
  filter: blur(100px); opacity: 0.3; will-change: transform;
}
.bg-aurora span:nth-child(1) { background: var(--accent); top: -20vw; left: -12vw; animation: drift1 24s var(--ease) infinite; }
.bg-aurora span:nth-child(2) { background: var(--violet); bottom: -24vw; right: -14vw; opacity: 0.26; animation: drift2 28s var(--ease) infinite; }
.bg-aurora span:nth-child(3) { background: var(--win); top: 34vh; right: 22vw; opacity: 0.13; animation: drift3 32s var(--ease) infinite; }
@keyframes drift1 { 50% { transform: translate(15vw, 11vh) scale(1.18); } }
@keyframes drift2 { 50% { transform: translate(-13vw, -9vh) scale(1.22); } }
@keyframes drift3 { 50% { transform: translate(-17vw, 7vh) scale(0.88); } }

/* Fine film grain for texture */
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- Type ---------- */
.wordmark {
  font-family: var(--display);
  font-weight: 700; letter-spacing: 0.16em; font-size: 1.5rem;
}
.wordmark span {
  margin-left: 0.16em;
  background: linear-gradient(90deg, var(--accent) 0%, #fff 45%, var(--accent-hi) 55%, var(--accent) 100%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
}
.wordmark.sm { font-size: 1.05rem; }
@keyframes shimmer { to { background-position: 220% center; } }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  appearance: none; border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 22px; font-size: 0.95rem; font-weight: 650; letter-spacing: 0.01em;
  cursor: pointer; color: var(--text); background: var(--glass);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.25s var(--ease), opacity 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--glass-2); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; border-radius: 16px; }
.btn-primary {
  color: #1a1305; border-color: transparent;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent) 60%, var(--accent-deep));
  box-shadow: 0 8px 26px -10px rgba(230, 182, 74, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px rgba(230, 182, 74, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
}
.btn-primary:hover::after { animation: sweep 0.85s var(--ease); }
@keyframes sweep { from { left: -80%; } to { left: 140%; } }
.btn-lg.btn-primary { animation: breathe 3.4s var(--ease) infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 8px 26px -10px rgba(230, 182, 74, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
  50% { box-shadow: 0 16px 40px -8px rgba(230, 182, 74, 1), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger-ghost { background: transparent; color: var(--lose); border-color: rgba(255, 92, 102, 0.32); }
.btn-danger-ghost:hover { border-color: var(--lose); background: rgba(255, 92, 102, 0.08); }

/* ---------- Glass panel mixin (applied per element) ---------- */
.gate-card, .verdict-banner, .score-duel, .bd-col, .howto {
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- Age gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50; padding: 16px;
  background: rgba(5, 6, 9, 0.72); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  animation: fade 0.5s var(--ease);
}
.gate-card { max-width: 540px; padding: 40px; border-radius: 24px; animation: rise 0.6s var(--ease); }
.gate-card .wordmark { margin-bottom: 20px; }
.tagline { color: var(--muted); margin-bottom: 24px; font-size: 1.02rem; }
.gate-rules { list-style: none; margin-bottom: 24px; }
.gate-rules li { position: relative; padding-left: 24px; margin-bottom: 11px; }
.gate-rules li::before {
  content: ""; position: absolute; left: 2px; top: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px 1px rgba(230, 182, 74, 0.7);
}
/* Profile fields */
.gate-fields { display: flex; flex-direction: column; gap: 13px; margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.field-optional { text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 500; font-size: 0.75rem; margin-left: 4px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass); color: var(--text);
  font-size: 0.98rem; font-family: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--glass-2); box-shadow: 0 0 0 3px rgba(230, 182, 74, 0.14); }
#walletInput { font-family: var(--display); letter-spacing: 0.01em; }
.field-error { color: var(--lose); font-size: 0.85rem; min-height: 1.1em; }

.wallet-chip {
  font-family: var(--display); font-size: 0.7rem; color: var(--accent-hi);
  background: rgba(230, 182, 74, 0.13); border: 1px solid rgba(230, 182, 74, 0.32);
  padding: 1px 7px; border-radius: 6px; margin-left: 8px; letter-spacing: 0.02em; white-space: nowrap;
}
.wallet-chip:empty { display: none; }

.gate-check { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 26px; color: var(--muted); cursor: pointer; }
.gate-check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; }
.gate-check a { color: var(--accent); text-decoration: none; }
.gate-check a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.app { max-width: 1140px; margin: 0 auto; padding: 20px 18px 40px; animation: fade 0.5s var(--ease); }
.topbar { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; }
.status { flex: 1; color: var(--muted); font-size: 0.92rem; min-height: 1.2em; transition: color 0.2s; }
.timer {
  font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: 1.35rem; color: var(--accent);
  padding: 5px 15px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass); backdrop-filter: blur(8px);
  opacity: 0; transform: scale(0.9); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
#app[data-screen="battle"] .timer, #app[data-screen="judging"] .timer { opacity: 1; transform: scale(1); }

/* ---------- Layout ---------- */
#app[data-screen="lobby"] .stage, #app[data-screen="searching"] .stage { max-width: 900px; margin-inline: auto; }
#app[data-screen="lobby"] .tile-local { aspect-ratio: 16 / 10; }
.howto { max-width: 900px; margin: 22px auto 0; border-radius: 22px; }

.stage { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; transition: filter 0.5s var(--ease); }
#app[data-screen="lobby"] .stage, #app[data-screen="searching"] .stage { grid-template-columns: 1fr; }
/* On verdict, the cameras stay LIVE behind the modal (you still hear your
   opponent); the modal's backdrop-filter blurs them. */
#app[data-screen="verdict"] .stage { pointer-events: none; }

/* ---------- Camera tiles ---------- */
.tile {
  position: relative; background: #05060a; border-radius: 22px; overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 20px 50px -28px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.4s var(--ease);
}
/* Animated gradient border ring */
.tile::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; z-index: 2;
  background: conic-gradient(from var(--angle), rgba(255,255,255,0.16), rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.03) 75%, rgba(255,255,255,0.16));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.tile-local::before { animation: spin-border 8s linear infinite; }
#app[data-screen="lobby"] .tile-local::before,
#app[data-screen="battle"] .tile-local::before {
  background: conic-gradient(from var(--angle), var(--accent), transparent 30%, transparent 70%, var(--accent-hi));
}
#app[data-screen="battle"] .tile-remote::before {
  background: conic-gradient(from var(--angle), var(--violet), transparent 30%, transparent 70%, var(--violet));
  animation: spin-border 8s linear infinite;
}
@keyframes spin-border { to { --angle: 360deg; } }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile-local video { transform: scaleX(-1); }
.tile-remote { opacity: 0; transform: scale(0.98); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }
#app[data-screen="connecting"] .tile-remote, #app[data-screen="battle"] .tile-remote, #app[data-screen="judging"] .tile-remote, #app[data-screen="verdict"] .tile-remote { opacity: 1; transform: scale(1); }
#app[data-screen="lobby"] .tile-remote, #app[data-screen="searching"] .tile-remote { display: none; }
#app[data-screen="battle"] .tile-local { box-shadow: 0 0 40px -6px rgba(230, 182, 74, 0.45), 0 20px 50px -28px rgba(0, 0, 0, 0.9); }

.tile-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
}
.tile-label { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 0.95rem; }
.tile-label .loc { color: var(--muted); font-weight: 500; }
.tile-label .loc::before { content: "·"; margin: 0 7px; color: var(--faint); }
.dot-you, .dot-them { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-you { background: var(--accent); box-shadow: 0 0 9px 1px rgba(230, 182, 74, 0.8); }
.dot-them { background: var(--violet); box-shadow: 0 0 9px 1px rgba(139, 123, 255, 0.8); }
.rec-badge {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; color: #fff;
  background: var(--lose); padding: 4px 9px; border-radius: 7px; opacity: 0; transition: opacity 0.3s;
  box-shadow: 0 0 16px -2px rgba(255, 92, 102, 0.8);
}
.rec-badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: middle; animation: blink 1.2s infinite; }
#app[data-screen="battle"] .rec-badge { opacity: 1; }

/* Scrims */
.scrim {
  position: absolute; inset: 0; z-index: 4; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: rgba(6, 7, 11, 0.6); backdrop-filter: blur(4px);
}
.scrim-text { color: var(--text); font-weight: 600; letter-spacing: 0.01em; transition: opacity 0.2s var(--ease); }
#app[data-screen="searching"] #searchScrim { display: flex; animation: fade 0.35s var(--ease); }
#app[data-screen="judging"] #judgeScrim { display: flex; animation: fade 0.35s var(--ease); }
.radar { width: 78px; height: 78px; border-radius: 50%; border: 2px solid rgba(230, 182, 74, 0.35); position: relative; overflow: hidden; }
.radar::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0deg, rgba(230, 182, 74, 0.6) 60deg, transparent 90deg); animation: spin 1.6s linear infinite; }
.radar span { position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 12px 2px rgba(230, 182, 74, 0.9); animation: blink 1.2s infinite; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }

/* VS badge */
.vs-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.4); z-index: 6;
  font-family: var(--display); font-weight: 700; font-size: 2rem; letter-spacing: 0.04em; color: #1a1305;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-deep));
  width: 74px; height: 74px; border-radius: 50%; display: none; align-items: center; justify-content: center;
  box-shadow: 0 12px 36px -8px rgba(230, 182, 74, 0.95), inset 0 2px 0 rgba(255, 255, 255, 0.5); opacity: 0;
}
#app[data-screen="connecting"] .vs-badge, #app[data-screen="battle"] .vs-badge { display: flex; animation: clash 0.65s var(--ease) forwards; }
#app[data-screen="battle"] .vs-badge { animation: clash 0.65s var(--ease) forwards, floaty 3s var(--ease) 0.65s infinite; }
@keyframes clash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-30deg); } 60% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(7deg); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); } }
@keyframes floaty { 50% { transform: translate(-50%, -58%) scale(1.05); } }

/* ---------- How to win ---------- */
.howto { padding: 26px; display: none; align-self: start; }
#app[data-screen="lobby"] .howto { display: block; animation: rise 0.55s var(--ease) 0.05s both; }
.howto h2 { font-family: var(--display); font-size: 1.15rem; margin-bottom: 18px; letter-spacing: 0.01em; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 15px; }
.steps li { display: flex; gap: 14px; }
.steps .step-n {
  flex: 0 0 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(230,182,74,0.18), rgba(230,182,74,0.08));
  border: 1px solid rgba(230, 182, 74, 0.25);
  color: var(--accent-hi); font-family: var(--display); font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.steps li div { font-size: 0.94rem; color: var(--muted); }
.steps li strong { color: var(--text); font-weight: 650; }
.howto-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.86rem; }

/* ---------- Controls ---------- */
.controls { display: flex; gap: 12px; justify-content: center; padding-top: 24px; }
#app[data-screen="verdict"] .controls { display: none; }

/* ---------- Verdict (modal over blurred live cameras) ---------- */
.verdict { display: none; }
#app[data-screen="verdict"] .verdict {
  display: flex; position: fixed; inset: 0; z-index: 45;
  align-items: flex-start; justify-content: center;
  padding: clamp(16px, 4vh, 48px) 16px; overflow-y: auto;
  background: radial-gradient(1100px 520px at 50% -5%, rgba(20, 18, 12, 0.4), rgba(6, 7, 11, 0.56));
  backdrop-filter: blur(16px) saturate(1.1) brightness(0.72);
  -webkit-backdrop-filter: blur(16px) saturate(1.1) brightness(0.72);
  animation: fade 0.4s var(--ease);
}
.verdict-modal {
  width: 100%; max-width: 920px; margin: auto 0;
  display: flex; flex-direction: column; gap: 16px;
  animation: modalIn 0.55s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.verdict-banner {
  position: relative; text-align: center; padding: 32px 22px 26px; border-radius: 24px;
  animation: rise 0.55s var(--ease) both; overflow: hidden;
}
.verdict-banner::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
.crown { color: var(--accent); display: none; margin-bottom: 8px; filter: drop-shadow(0 4px 14px rgba(230, 182, 74, 0.6)); }
.crown.show { display: inline-block; animation: crownDrop 0.75s var(--ease) 0.1s both; }
@keyframes crownDrop { 0% { opacity: 0; transform: translateY(-26px) scale(0.5) rotate(-14deg); } 60% { opacity: 1; transform: translateY(5px) scale(1.18) rotate(5deg); } 100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); } }
.verdict-result { font-family: var(--display); font-size: clamp(1.9rem, 5vw, 2.9rem); font-weight: 700; letter-spacing: 0.01em; }
.verdict-result.win { background: linear-gradient(180deg, var(--win-hi), var(--win)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 4px 20px rgba(58, 209, 138, 0.4)); animation: popBounce 0.65s var(--ease) both; }
.verdict-result.lose { color: var(--lose); font-size: clamp(2.2rem, 6vw, 3.4rem); text-shadow: 0 4px 26px rgba(255, 92, 102, 0.45); animation: shake 0.55s var(--ease) both; }
.verdict-result.tie { color: var(--accent); animation: popBounce 0.65s var(--ease) both; }
@keyframes popBounce { 0% { opacity: 0; transform: scale(0.5); } 55% { opacity: 1; transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 18% { transform: translateX(-10px); } 36% { transform: translateX(9px); } 54% { transform: translateX(-6px); } 72% { transform: translateX(5px); } 88% { transform: translateX(-2px); } }
.verdict-reason { color: var(--muted); margin-top: 10px; max-width: 660px; margin-inline: auto; }

.score-duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin-top: 16px; padding: 26px; border-radius: 22px; animation: rise 0.55s var(--ease) 0.08s both; }
.score-side { text-align: center; transition: transform 0.45s var(--ease); }
.score-side.win { transform: scale(1.07); }
.score-who { color: var(--muted); font-weight: 600; margin-bottom: 8px; font-size: 0.92rem; }
.score-num { font-family: var(--display); font-size: clamp(2.6rem, 8vw, 3.8rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; display: inline-block; animation: numPop 0.55s var(--ease) both; }
.score-side.win .score-num { background: linear-gradient(180deg, var(--win-hi), var(--win)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: numPop 0.55s var(--ease) both, pulseWin 1.8s var(--ease) 1s infinite; }
@keyframes numPop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseWin { 50% { filter: drop-shadow(0 0 26px rgba(58, 209, 138, 0.55)); } }
.score-max { font-size: 1.15rem; color: var(--faint); font-weight: 600; margin-left: 3px; -webkit-text-fill-color: var(--faint); }
.score-bar { height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin: 14px auto 9px; max-width: 230px; }
.score-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width 1.1s var(--ease); position: relative; }
.score-side.win .score-bar i { background: linear-gradient(90deg, var(--win), var(--win-hi)); }
.score-side.lose .score-bar i { background: linear-gradient(90deg, #616b7a, #8b95a5); }
.score-total { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.score-vs { font-family: var(--display); color: var(--faint); font-weight: 700; letter-spacing: 0.1em; }

.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.bd-col { border-radius: 20px; padding: 20px; animation: rise 0.55s var(--ease) 0.14s both; }
.bd-col h3 { font-family: var(--display); font-size: 1rem; margin-bottom: 14px; }
.items { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.item {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid transparent;
  opacity: 0; transform: translateY(8px);
  animation: itemPop 0.45s var(--ease) forwards;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.item:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.06); }
@keyframes itemPop { 0% { opacity: 0; transform: translateY(10px) scale(0.96); } 70% { opacity: 1; transform: translateY(-2px) scale(1.01); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.item.decisive { border-color: rgba(230, 182, 74, 0.45); background: linear-gradient(180deg, rgba(230,182,74,0.1), rgba(230,182,74,0.03)); box-shadow: 0 0 24px -10px rgba(230, 182, 74, 0.7); }
.item.uncounted { opacity: 0.55; }
.item-main { min-width: 0; }
.item-name { font-weight: 650; }
.item-name .tag { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.07em; color: var(--accent-hi); border: 1px solid rgba(230, 182, 74, 0.45); border-radius: 6px; padding: 1px 6px; margin-left: 9px; vertical-align: middle; }
.item-name .tag.muted { color: var(--muted); border-color: var(--line-2); }
.item-sub { color: var(--muted); font-size: 0.83rem; margin-top: 3px; }
.item-sub .repl { color: var(--lose); }
.item-val { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--display); }
.item-val.struck { text-decoration: line-through; color: var(--faint); font-weight: 600; }
.items-empty { color: var(--faint); font-size: 0.9rem; padding: 10px 2px; }

.fine-print { color: var(--faint); font-size: 0.8rem; text-align: center; margin-top: 4px; }
.verdict-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 12px; padding-bottom: 8px; }
.cta-hint { color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 7px; }
.cta-hint::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--win); box-shadow: 0 0 10px 1px rgba(58, 209, 138, 0.8); animation: blink 1.6s infinite; }
.foot { text-align: center; color: var(--faint); padding-top: 28px; font-size: 0.85rem; }
.foot a { color: var(--faint); text-decoration: none; }
.foot a:hover { color: var(--muted); }
.foot span { margin: 0 8px; }

/* ---------- Battle-start flash ---------- */
.flash {
  position: fixed; inset: 0; z-index: 55; display: none;
  align-items: center; justify-content: center; pointer-events: none;
}
.flash.show { display: flex; }
.flash span {
  font-family: var(--display); font-weight: 700; font-size: clamp(4rem, 18vw, 11rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 40px rgba(230, 182, 74, 0.6));
  animation: goBurst 1s var(--ease) forwards;
}
@keyframes goBurst { 0% { opacity: 0; transform: scale(0.4); } 30% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1.14); } 100% { opacity: 0; transform: scale(1.5); } }

/* ---------- Keyframes ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Small buttons / mono / icon ---------- */
.btn-sm { padding: 7px 13px; font-size: 0.85rem; border-radius: 10px; }
.mono { font-family: var(--display); }
.icon-btn { background: transparent; border: 0; color: var(--muted); font-size: 0.95rem; cursor: pointer; padding: 4px 9px; border-radius: 8px; line-height: 1; }
.icon-btn:hover { color: var(--text); background: var(--glass); }

/* ---------- Right rail (live leaderboard) ---------- */
.ranks-toggle { display: none; }
.rail {
  position: fixed; top: 0; right: 0; width: 330px; height: 100vh; z-index: 30;
  display: flex; flex-direction: column; padding: 18px 14px;
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.92), rgba(8, 9, 13, 0.95));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-left: 1px solid var(--line);
  box-shadow: -22px 0 64px -34px rgba(0, 0, 0, 0.9);
}
@media (min-width: 1080px) { body { padding-right: 330px; } }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rail-title { font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.06em; }
.rail-title span { color: var(--accent); }
.rail > .rail-head .icon-btn { display: none; }

.rail-pot {
  text-align: center; padding: 18px 16px; border-radius: 16px; margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(230, 182, 74, 0.13), rgba(230, 182, 74, 0.03));
  border: 1px solid rgba(230, 182, 74, 0.26);
}
.pot-sol { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--accent-hi); }
.pot-unit { font-size: 0.9rem; color: var(--muted); margin-left: 5px; font-weight: 600; }
.pot-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 5px; }
.pot-next { color: var(--text); font-size: 0.85rem; margin-top: 10px; }
.pot-next .mono { color: var(--accent); font-weight: 700; }

.rail-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 11px; background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent; animation: rise 0.4s var(--ease) both;
}
.rank-row.top1 { border-color: rgba(230, 182, 74, 0.5); background: linear-gradient(180deg, rgba(230,182,74,0.1), rgba(230,182,74,0.03)); }
.rank-row.top2 { border-color: rgba(198, 202, 214, 0.32); }
.rank-row.top3 { border-color: rgba(196, 140, 90, 0.34); }
.rank-n { font-family: var(--display); font-weight: 700; color: var(--muted); text-align: center; font-size: 0.9rem; }
.rank-row.top1 .rank-n { color: var(--accent); }
.rank-who { min-width: 0; }
.rank-name { font-weight: 650; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-wallet { font-size: 0.7rem; color: var(--accent-hi); text-decoration: none; }
.rank-wallet:hover { text-decoration: underline; }
.rank-share { text-align: right; }
.rank-pct { font-family: var(--display); font-weight: 700; font-size: 0.92rem; }
.rank-sol { font-size: 0.7rem; color: var(--muted); }
.rail-empty { color: var(--faint); font-size: 0.85rem; text-align: center; padding: 26px 8px; line-height: 1.6; }
.rail-payouts-btn { margin-top: 12px; width: 100%; }

@media (max-width: 1079px) {
  .rail { transform: translateX(100%); transition: transform 0.35s var(--ease); box-shadow: none; }
  .rail.open { transform: translateX(0); box-shadow: -22px 0 64px -24px rgba(0, 0, 0, 0.9); }
  .rail > .rail-head .icon-btn { display: inline-flex; }
  .ranks-toggle { display: inline-flex; }
}

/* ---------- Payouts modal ---------- */
.pay { display: none; position: fixed; inset: 0; z-index: 48; align-items: flex-start; justify-content: center; padding: clamp(16px, 4vh, 48px) 16px; overflow-y: auto; background: rgba(6, 7, 11, 0.62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fade 0.35s var(--ease); }
.pay.open { display: flex; }
.pay-modal { position: relative; width: 100%; max-width: 620px; margin: auto 0; padding: 30px 28px; border-radius: 22px;
  background: linear-gradient(180deg, var(--glass-2), var(--glass)); backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.85); animation: modalIn 0.5s var(--ease); }
.pay-close { position: absolute; top: 14px; right: 14px; }
.pay-head { text-align: center; margin-bottom: 20px; }
.pay-title { font-family: var(--display); font-weight: 700; font-size: 1.7rem; }
.pay-next { color: var(--muted); margin-top: 6px; }
.pay-next .mono { color: var(--accent); font-weight: 700; }
.pay-explain { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 16px 16px; margin-bottom: 20px; }
.pay-explain h3 { font-family: var(--display); font-size: 1rem; margin-bottom: 11px; }
.pay-explain ol { margin-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.pay-explain strong { color: var(--text); }
.pay-list-head { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 9px; }
.pay-list { display: flex; flex-direction: column; gap: 10px; }
.pay-batch { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.pay-batch-head { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 0.88rem; }
.pay-who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-amt { font-family: var(--display); font-weight: 700; color: var(--accent-hi); white-space: nowrap; }
.pay-link { color: var(--accent); text-decoration: none; font-size: 0.8rem; white-space: nowrap; }
.pay-link:hover { text-decoration: underline; }
.pay-link.muted { color: var(--faint); text-decoration: none; }
.pay-empty { color: var(--faint); font-size: 0.9rem; text-align: center; padding: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .stage { grid-template-columns: 1fr; }
  .breakdown { grid-template-columns: 1fr; }
  .score-num { font-size: 2.8rem; }
  .gate-card { padding: 28px; }
}
