:root {
  --bg: #020d1d;
  --bg2: #051827;
  --panel: rgba(17, 34, 52, 0.8);
  --panel-strong: rgba(7, 18, 30, 0.9);
  --line: rgba(120, 170, 220, 0.18);
  --cyan: #4ee3dd;
  --cyan-2: #7fe9f6;
  --cyan-3: #2ec4d8;
  --text: #eff7ff;
  --muted: #a2b8cb;
  --success: #7af0d0;
  --danger: #ff7b7d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top, #0f2140 0%, var(--bg) 40%, var(--bg2) 100%);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button,
input,
select { -webkit-tap-highlight-color: transparent; }
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan-2);
  outline-offset: 3px;
}

.app-shell {
  width: min(1200px, calc(100vw - 36px));
  margin: 12px auto 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 4px 14px;
}
.topbar-brand {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 6px 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.menu-wrap {
  position: relative;
}
.menu-wrap.hidden {
  display: none !important;
}
.menu-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 22, 33, 0.72);
}
.menu-toggle span {
  width: 19px;
  height: 2px;
  background: var(--cyan-2);
  transition: transform 180ms ease, opacity 180ms ease;
}
.menu-panel {
  position: absolute;
  top: 50px;
  right: 0;
  z-index: 10;
  display: grid;
  width: min(220px, calc(100vw - 28px));
  min-width: 0;
  max-width: calc(100vw - 28px);
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 19, 31, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}
.menu-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.nav-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  padding: 10px 14px;
  border-radius: 999px;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms var(--ease-out);
}
.menu-panel .nav-link {
  width: 100%;
  text-align: left;
  border-radius: 8px;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(56, 142, 166, 0.1);
  transform: translateY(-1px);
}
.nav-link:active { transform: translateY(1px) scale(0.98); }
}
.nav-link.active {
  background: rgba(56, 142, 166, 0.15);
  border-color: rgba(76, 221, 242, 0.25);
  color: var(--text);
}

.screen { display: none; }
.screen.visible { display: block; }
.hidden { display: none !important; }

.auth-card,
.panel-card,
.game-frame {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.auth-card {
  width: min(560px, 100%);
  margin: 70px auto 30px;
  padding: 0;
  text-align: center;
}

.auth-logo {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 6.3rem);
  letter-spacing: -0.08em;
}

.auth-tabs {
  display: inline-flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  margin: 22px auto 20px;
}
.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: color 180ms ease, background 180ms ease, transform 180ms var(--ease-out);
}
.auth-tab:hover { color: var(--text); }
.auth-tab:active { transform: scale(0.96); }
.auth-tab.active {
  background: rgba(103, 219, 240, 0.15);
  color: var(--text);
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}
.auth-form label,
.bot-controls label,
.create-game-box label {
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}
.auth-form input,
.bot-controls input,
.bot-controls select,
.create-game-box select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 35, 0.85);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
}
.primary-btn {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--cyan), var(--cyan-3));
  color: #02151f;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 15px 18px;
  box-shadow: 0 10px 28px rgba(46, 196, 216, 0.32);
  transition: transform 180ms var(--ease-out), box-shadow 180ms ease, filter 180ms ease;
}
.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(46, 196, 216, 0.42);
}
.primary-btn:active { transform: translateY(1px) scale(0.985); }
.primary-btn.is-loading {
  pointer-events: none;
  opacity: 0.72;
}
.primary-btn.is-loading::after {
  content: ' ...';
  letter-spacing: 0.2em;
}
.muted { color: var(--muted); }
.admin-shell { width: min(980px, calc(100vw - 36px)); margin: 10vh auto; }
.admin-login, .admin-panel { padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7, 19, 31, 0.88); box-shadow: var(--shadow); }
.admin-login { width: min(420px, 100%); margin-inline: auto; display: grid; gap: 14px; }
.admin-login h1, .admin-heading h1 { margin: 0; letter-spacing: 0.05em; }
.admin-login input { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 22, 35, .85); color: var(--text); }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.admin-count { color: var(--cyan-2); font-size: .75rem; letter-spacing: .12em; }
.admin-player-list { display: grid; gap: 8px; }
.admin-player { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 15px; border-bottom: 1px solid rgba(123, 230, 255, .1); cursor: pointer; }
.admin-player > div:first-child { display: grid; gap: 4px; }
.admin-player span { color: var(--muted); font-size: .82rem; }
.admin-actions { display: flex; gap: 8px; }
.admin-leaderboard { margin-top: 28px; }
.admin-leader-row { display: grid; grid-template-columns: 44px 1fr 80px; gap: 12px; padding: 11px 8px; border-bottom: 1px solid rgba(123, 230, 255, .1); }
.admin-detail { margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 17, 28, .7); }
.admin-detail h2 { margin: 5px 0; }
.admin-detail p { color: var(--muted); }
.admin-detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; color: var(--muted); font-size: .75rem; }
.admin-detail-stats strong { display: block; color: var(--text); font-size: 1.2rem; margin-top: 4px; }

.auth-message {
  min-height: 20px;
  color: #ff7a7a;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.auth-message.visible {
  opacity: 1;
}

.panel-card {
  padding: 22px 24px;
  margin-top: 18px;
}
.how-to-play-panel { max-width: 700px; margin-inline: auto; }
.how-to-play-list { display: grid; gap: 8px; }
.how-to-play-list p {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid rgba(123, 230, 255, 0.08);
  color: var(--muted);
}
.how-to-play-list strong { color: var(--cyan-2); font-size: 1.1rem; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.eyebrow {
  color: var(--cyan-2);
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.06em;
}
.mode-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 680px;
}
.mode-card {
  text-align: left;
  color: var(--text);
  background: linear-gradient(180deg, rgba(18,42,59,0.9), rgba(10,18,28,0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  min-height: 82px;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 220ms var(--ease-out), border-color 220ms ease, box-shadow 220ms ease;
}
.mode-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 20%, rgba(127, 233, 246, 0.08) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 600ms var(--ease-in-out);
}
.mode-card:hover {
  border-color: rgba(127, 233, 246, 0.46);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26), inset 0 0 0 1px rgba(127, 233, 246, 0.08);
  transform: translateY(-4px) scale(1.008);
}
.mode-card:hover::after { transform: translateX(120%); }
.mode-card:active { transform: translateY(-1px) scale(0.99); }
.mode-card-locked {
  opacity: 0.42;
  filter: grayscale(0.75);
  cursor: not-allowed;
}
.mode-card-locked:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}
.mode-icon {
  font-size: 2.8rem;
  display: grid;
  place-items: center;
  filter: grayscale(1);
  color: var(--cyan-2);
  opacity: 0.9;
  transition: transform 220ms var(--ease-out);
}
.mode-title {
  font-size: clamp(1.15rem, 1.8vw, 1.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}
.mode-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.mode-copy {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.86rem;
}

.bot-controls,
.create-game-box {
  display: grid;
  gap: 18px;
}

.game-list {
  display: grid;
  gap: 12px;
}
.online-refresh-note {
  margin: -4px 0 14px;
  font-size: 0.8rem;
}
.online-room-search {
  width: 100%;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 22, 35, 0.85);
  color: var(--text);
  padding: 11px 13px;
}
.room-countdown {
  min-width: 42px;
  color: var(--cyan-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.room-countdown.urgent {
  color: #ff9c9f;
  animation: roomCountdownPulse 650ms ease-in-out infinite alternate;
}
@keyframes roomCountdownPulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}
.game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(9, 19, 33, 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.game-meta {
  display: grid;
  gap: 4px;
}
.game-meta strong {
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}
.game-actions { display: flex; align-items: center; gap: 12px; }
.join-btn {
  border: 1px solid rgba(122, 240, 208, 0.35);
  background: rgba(71, 214, 186, 0.08);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  transition: transform 180ms var(--ease-out), background 180ms ease, border-color 180ms ease;
}
.join-btn:hover {
  background: rgba(71, 214, 186, 0.18);
  border-color: rgba(122, 240, 208, 0.7);
  transform: translateY(-2px);
}
.join-btn:active { transform: translateY(1px) scale(0.97); }

.game-frame {
  text-align: center;
  padding: 26px 18px 18px;
}
.status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.status-row > div {
  background: rgba(10, 21, 32, 0.75);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  transition: border-color 220ms ease, background 220ms ease, transform 220ms var(--ease-out);
}
.status-row > div:last-child { border-color: rgba(127, 233, 246, 0.34); }
.status-row > div.timer-warning {
  border-color: rgba(255, 193, 94, 0.72);
  background: rgba(92, 57, 22, 0.32);
  color: #ffd58a;
  animation: timerPulse 900ms ease-in-out infinite alternate;
}
.status-row > div.timer-critical {
  border-color: rgba(255, 123, 125, 0.76);
  background: rgba(92, 28, 36, 0.34);
  color: #ffb2b2;
}
.eyebrow.small {
  display: block;
  font-size: 0.7rem;
  margin-bottom: 5px;
}
.game-topbar {
  position: relative;
  min-height: 108px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 18px;
  margin-bottom: 28px;
}
.game-topbar > .coin-hud { justify-self: start; }
.game-topbar > .exit-btn { justify-self: end; }
.round-hud {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.round-hud > strong:not(.round-countdown) { font-size: 1.35rem; }
.game-phase {
  min-height: 16px;
  color: var(--cyan-2);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  transition: opacity 700ms ease, transform 700ms var(--ease-out);
}
.online-player-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  max-width: 300px;
  margin: 4px auto 0;
}
.online-player-list span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid rgba(123, 230, 255, 0.16);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
}
.round-countdown {
  margin-top: 8px;
  font-size: clamp(3.6rem, 9vw, 6rem);
  line-height: 0.8;
  letter-spacing: -0.08em;
  color: var(--cyan-2);
  text-shadow: 0 0 26px rgba(127, 233, 246, 0.28);
}
.coin-hud {
  justify-self: end;
  display: grid;
  justify-items: end;
  gap: 4px;
  padding-top: 8px;
}
.coin-hud strong { font-size: 1.5rem; }
.exit-btn,
.danger-btn {
  border: 1px solid rgba(255, 123, 125, 0.56);
  background: rgba(103, 29, 39, 0.35);
  color: #ffb2b2;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  transition: transform 180ms var(--ease-out), background 180ms ease, border-color 180ms ease;
}
.exit-btn:hover,
.danger-btn:hover {
  background: rgba(143, 40, 53, 0.56);
  border-color: rgba(255, 145, 148, 0.8);
  transform: translateY(-2px);
}
.exit-btn:active,
.danger-btn:active { transform: translateY(1px) scale(0.98); }
.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 190px));
  justify-content: center;
  gap: 18px;
  max-height: 420px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 850ms ease;
}
.board-stage {
  display: grid;
  height: 420px;
  overflow: visible;
}
.board-stage > .choice-grid,
.board-stage > .reveal-box {
  grid-area: 1 / 1;
}
.choice-grid.revealing {
  opacity: 0;
  transform: none;
  pointer-events: none;
}
.choice-grid.starting {
  opacity: 0.18;
  pointer-events: none;
  filter: blur(2px);
}
.choice-grid.returning {
  animation: choicesReturn 850ms ease both;
}
.choice-grid.returning .choice-card {
  animation: choiceFlipBack 850ms var(--ease-in-out) both;
}
.choice-grid.revealing .choice-card {
  animation: choiceFlipAway 700ms var(--ease-in-out) both;
}
.choice-card {
  min-height: 230px;
  border-radius: 22px;
  border: 1px solid rgba(82, 188, 255, 0.28);
  background: linear-gradient(180deg, rgba(17, 35, 46, 0.9), rgba(9, 19, 29, 0.95));
  color: var(--text);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(122, 240, 208, 0.06);
}
.choice-card {
  position: relative;
  overflow: hidden;
  transition: transform 220ms var(--ease-out), border-color 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}
.choice-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: border-color 220ms ease, transform 220ms var(--ease-out);
}
.choice-card:hover {
  border-color: rgba(127, 233, 246, 0.7);
  transform: translateY(-6px);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.28), inset 0 0 24px rgba(78, 227, 221, 0.07);
}
.choice-card:hover::before {
  border-color: rgba(127, 233, 246, 0.2);
  transform: scale(0.97);
}
.choice-card:active { transform: translateY(-1px) scale(0.985); }
.choice-card.selected {
  border-color: rgba(122, 240, 208, 0.8);
  box-shadow: 0 0 0 2px rgba(122, 240, 208, 0.2), inset 0 0 0 1px rgba(122, 240, 208, 0.4);
  transform: translateY(-6px);
}
.choice-card.selected::before { border-color: rgba(122, 240, 208, 0.42); }
.choice-grid.locked .choice-card {
  pointer-events: none;
  filter: saturate(0.65);
}
.choice-label {
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.08em;
}
.choice-stake {
  position: absolute;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffe28a;
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms ease, transform 500ms var(--ease-out);
}
.choice-card.selected .choice-stake { opacity: 1; transform: translateY(0); }

.reveal-box {
  position: relative;
  margin-top: 0;
  padding: 18px 16px 12px;
  border-radius: 16px;
  border: 0;
  background: transparent;
  overflow: hidden;
  animation: revealIn 700ms var(--ease-out) both;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 850ms ease, transform 850ms var(--ease-out);
  z-index: 2;
}
.reveal-box.closing { opacity: 0; transform: translateY(20px); }
.reveal-header {
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  letter-spacing: -0.06em;
  margin-bottom: 12px;
}
.reveal-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.column-lane {
  position: relative;
  min-height: 180px;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 10px 10px 12px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.column-lane.winner {
  border-color: rgba(122, 240, 208, 0.75);
  box-shadow: 0 0 0 1px rgba(122, 240, 208, 0.3);
  transform: translateY(-2px);
  animation: winnerGlow 900ms ease-in-out infinite alternate;
}
.column-lane.loser { opacity: 0.82; }
.lane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.lane-players {
  display: grid;
  gap: 6px;
  align-content: flex-start;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: none;
}
.lane-players::-webkit-scrollbar { display: none; }
.lane-pot {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
  color: #ffe28a;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 700ms ease, transform 700ms var(--ease-out);
}
.pot-coin {
  display: inline-flex;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #f5ca4d;
  text-shadow: 0 0 12px rgba(245, 202, 77, 0.65);
}
.lane-pot strong {
  display: inline-block;
  min-width: 1.5ch;
  line-height: 1;
}
.column-lane.winner .lane-pot { opacity: 1; transform: translateY(0); }
.lane-pot.pot-collected {
  opacity: 0;
  transform: translateY(-10px) rotateX(90deg);
  transition: opacity 700ms ease, transform 850ms var(--ease-in-out);
}
.coin-icon,
.player-coin {
  color: #f5ca4d;
  text-shadow: 0 0 12px rgba(245, 202, 77, 0.65);
}
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 5px 7px;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(123, 230, 255, 0.08);
  color: var(--text);
  font-size: 0.7rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms var(--ease-out), border-color 700ms ease;
}
.player-row.visible { opacity: 1; transform: translateY(0); }
.player-row.you {
  color: #ff9c9f;
  border-bottom-color: rgba(255, 123, 125, 0.65);
  background: rgba(103, 29, 39, 0.12);
}
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-reward {
  color: #ffe28a;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 850ms ease, transform 850ms var(--ease-out);
}
.player-row.paid .player-reward { opacity: 1; transform: translateY(0); }
.player-row.paid .player-coin { opacity: 0; }
.player-row.coin-in-flight .player-coin,
.player-row.payout-pending .player-coin { opacity: 0; }
.player-chip {
  background: rgba(92, 189, 233, 0.12);
  border: 1px solid rgba(123, 230, 255, 0.2);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.66rem;
  color: var(--text);
  letter-spacing: 0.04em;
}
.reveal-summary {
  display: grid;
  gap: 10px;
}
.payout-line { font-size: 1.2rem; }
.coin-flight-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}
.coin-token {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff4bc, #f5ca4d 50%, #d7a928 100%);
  box-shadow: 0 0 18px rgba(245, 202, 77, 0.7);
  border: 1px solid rgba(255,255,255,0.5);
  z-index: 4;
  will-change: transform, opacity;
  transition: transform 1.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 650ms ease;
  opacity: 1;
  display: block;
}
.coin-token.disperse { transition-duration: 1.8s; }

.round-history {
  margin-top: 34px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 900ms ease, transform 900ms var(--ease-out);
}
.round-history.visible { opacity: 1; transform: translateY(0); }
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.history-row {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(123, 230, 255, 0.08);
  color: var(--text);
}
.history-labels {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.final-results-panel {
  width: min(720px, 100%);
  margin: 40px auto;
}
.final-rankings-list {
  display: grid;
  gap: 2px;
  margin: 24px 0;
}
.final-ranking-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(123, 230, 255, 0.1);
  color: var(--text);
  animation: revealIn 600ms var(--ease-out) both;
}
.final-ranking-row > span { min-width: 0; overflow-wrap: anywhere; }
.final-ranking-row.you {
  color: #ff9c9f;
  background: rgba(103, 29, 39, 0.16);
}
.final-ranking-row .coin-icon { font-size: 0.8em; }
.no-winner-card { text-align: center; }

.leaderboard-row {
  display: grid;
  grid-template-columns: 90px 1fr 120px;
  gap: 16px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
.leaderboard-row.header {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.profile-panel {
  width: min(900px, 100%);
  margin: 28px auto;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(14, 39, 55, 0.82), rgba(5, 15, 25, 0.96));
  border: 1px solid rgba(127, 233, 246, 0.16);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}
.profile-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 30px;
  background: linear-gradient(110deg, rgba(78, 227, 221, 0.1), transparent 58%);
  border-bottom: 1px solid rgba(123, 230, 255, 0.1);
}
.profile-header h2 {
  margin: 5px 0 3px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.06em;
}
.profile-header .muted { margin: 0; }
.profile-badge {
  margin-left: auto;
  align-self: flex-start;
  padding: 7px 10px;
  border: 1px solid rgba(122, 240, 208, 0.35);
  border-radius: 999px;
  color: var(--success);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.profile-actions {
  display: flex;
  justify-content: flex-end;
  padding: 18px 30px 0;
}
.secondary-btn {
  border: 1px solid var(--line);
  background: rgba(12, 22, 33, 0.7);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  letter-spacing: 0.08em;
  font-weight: 700;
  transition: transform 180ms var(--ease-out), border-color 180ms ease, background 180ms ease;
}
.secondary-btn:hover {
  border-color: rgba(127, 233, 246, 0.5);
  background: rgba(31, 66, 83, 0.7);
  transform: translateY(-2px);
}
.secondary-btn:active { transform: translateY(1px) scale(0.98); }
.secondary-btn.small {
  padding: 8px 12px;
  font-size: 0.7rem;
}
.secondary-btn.danger {
  border-color: rgba(255, 122, 122, 0.35);
  color: #ffb2b2;
}
.settings-panel {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(8, 18, 28, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}
.profile-picture-message {
  padding: 0 14px 10px;
  font-size: 0.78rem;
}
.profile-avatar {
  position: relative;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 25%, rgba(127, 233, 246, 0.46), rgba(22, 93, 119, 0.55) 55%, rgba(5, 21, 34, 0.9));
  border: 2px solid rgba(127, 233, 246, 0.48);
  box-shadow: 0 0 0 7px rgba(78, 227, 221, 0.06), 0 0 28px rgba(78, 227, 221, 0.2);
  font-size: 2.4rem;
  font-weight: 900;
}
.profile-picture,
.user-avatar,
.roster-avatar { object-fit: cover; border-radius: 50%; }
.profile-picture { width: 100%; height: 100%; }
.user-avatar { width: 24px; height: 24px; flex: 0 0 24px; }
.avatar-fallback { display: inline-grid; place-items: center; color: var(--text); background: rgba(127, 233, 246, 0.16); border: 1px solid rgba(127, 233, 246, 0.35); font-size: 0.66rem; font-weight: 900; }
.profile-avatar i {
  position: absolute;
  right: 3px;
  bottom: 5px;
  width: 15px;
  height: 15px;
  border: 3px solid #071522;
  border-radius: 50%;
  background: var(--success);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 16, 0.72);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 36px));
  background: rgba(7, 19, 31, 0.98);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 22px;
  box-shadow: var(--shadow);
  animation: modalIn 280ms var(--ease-out) both;
}
.start-card,
.exit-card { text-align: center; }
.start-card { position: relative; }
.start-close { position: absolute; top: 12px; right: 12px; }
.start-card h3,
.exit-card h3 { margin: 8px 0 12px; font-size: 1.7rem; letter-spacing: -0.05em; }
.start-player-count { color: var(--muted); letter-spacing: 0.1em; }
.start-player-count strong { color: var(--text); }
.start-countdown {
  margin: 24px 0 12px;
  color: var(--cyan-2);
  font-size: clamp(5rem, 15vw, 8rem);
  line-height: 0.8;
  font-weight: 900;
  letter-spacing: -0.1em;
  text-shadow: 0 0 34px rgba(127, 233, 246, 0.35);
  transition: opacity 950ms ease, transform 950ms var(--ease-out);
}
.start-card.leaving { opacity: 0; transform: translateY(18px) scale(0.98); transition: opacity 950ms ease, transform 950ms var(--ease-out); }
.exit-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  transition: transform 180ms var(--ease-out), border-color 180ms ease, background 180ms ease;
}
.modal-close:hover {
  border-color: rgba(127, 233, 246, 0.6);
  background: rgba(78, 227, 221, 0.1);
  transform: rotate(90deg);
}
.modal-form {
  display: grid;
  gap: 18px;
}
.modal-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}
.modal-form input,
.modal-form select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 35, 0.85);
  color: var(--text);
  padding: 12px 14px;
}
.modal-form input[type='range'] {
  accent-color: var(--cyan);
  padding: 0;
}
.room-code-box {
  display: grid;
  gap: 8px;
  text-align: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 31, 45, 0.7);
}
.room-code-box strong {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.18em;
}
.room-host-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.room-timer {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--cyan-2);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  padding: 22px 30px 30px;
}
.stat-item {
  position: relative;
  min-height: 104px;
  background: rgba(5, 17, 28, 0.7);
  border: 1px solid rgba(123, 230, 255, 0.11);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  transition: transform 180ms var(--ease-out), border-color 180ms ease, background 180ms ease;
}
.stat-item:hover {
  transform: translateY(-3px);
  border-color: rgba(127, 233, 246, 0.4);
  background: rgba(12, 38, 52, 0.78);
}
.stat-item strong { color: var(--text); font-size: 1.4rem; letter-spacing: -0.06em; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes revealIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes winnerGlow {
  from { box-shadow: 0 0 0 1px rgba(122, 240, 208, 0.25), 0 0 12px rgba(122, 240, 208, 0.08); }
  to { box-shadow: 0 0 0 1px rgba(122, 240, 208, 0.46), 0 0 26px rgba(122, 240, 208, 0.2); }
}
@keyframes timerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.025); }
}
@keyframes choicesReturn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes choiceFlipAway {
  from { opacity: 1; transform: rotateX(0); }
  to { opacity: 0; transform: rotateX(88deg); }
}
@keyframes choiceFlipBack {
  from { opacity: 0; transform: rotateX(-88deg); }
  to { opacity: 1; transform: rotateX(0); }
}

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

@media (max-width: 820px) {
  .topbar { display: flex; justify-content: space-between; align-items: center; }
  .mode-grid, .stats-grid { grid-template-columns: 1fr; }
  .choice-grid { gap: 12px; }
  .status-row { grid-template-columns: 1fr; }
  .brand-wrap { justify-content: center; }
  .profile-header { padding: 24px 20px; }
  .profile-actions { padding-inline: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px 20px 24px; }
  .game-topbar { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .game-topbar .coin-hud,
  .game-topbar .exit-btn { align-self: start; }
  .coin-hud strong { font-size: 1.15rem; }
  .exit-btn { padding: 9px 10px; }
}
