:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #22223b;
  --border: #333355;
  --accent: #7b61ff;
  --accent-glow: rgba(123, 97, 255, 0.3);
  --text: #e8e8f0;
  --text-muted: #6b6b8a;
  --heart: #e84393;
  --heart-lost: #3a1a2e;
  --dot: #7b61ff;
  --dot-lost: #2a2a3e;
  --green: #00d68f;
  --yellow: #f5c842;
  --orange: #f59142;
  --red: #f54242;
  --gold: #ffd700;
  --radius: 12px;
}

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

html { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Game views: centered column */
#layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 0;
}

#app {
  flex: 1 1 0;
  min-width: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
}

#history {
  width: 260px;
  flex-shrink: 0;
  padding: 16px 16px 16px 0;
  align-self: flex-start;
  position: sticky;
  top: 16px;
}

/* Landing page: full viewport width, nav edge-to-edge */
#layout[data-phase="lobby-list"] {
  max-width: 100%;
}

#layout[data-phase="lobby-list"] #app {
  max-width: 100%;
  padding: 0;
  gap: 0;
}

/* Lobby room: centered column with max-width */
#layout[data-phase="lobby-room"] {
  max-width: 700px;
  margin: 0 auto;
}

/* Nav inside #app for in-game/lobby-room phases: break out of #app's 16px padding.
   Lobby-list has padding:0 on #app so needs no correction. */
#layout:not([data-phase="lobby-list"]) #app .main-nav {
  margin: -16px -16px 4px;
}

@media (max-width: 760px) {
  #layout { flex-direction: column; align-items: stretch; }
  #history { width: 100%; padding: 0 16px 16px; position: static; }
  #app { flex: none; }
}

/* Landscape phone: column layout, compact spacing, sticky action card */
@media (orientation: landscape) and (max-height: 500px) {
  #layout { flex-direction: column; align-items: stretch; }
  #history { width: 100%; padding: 0 16px 16px; position: static; }
  #app { gap: 8px; padding: 8px 16px 0; min-height: unset; flex: none; }

  .score-area { padding: 10px 16px; }
  .score-value { font-size: 3rem; }
  .score-label { margin-bottom: 0; }

  .game-actions-card {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: var(--surface2);
    border-top: 2px solid var(--accent);
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    padding: 10px 16px;
    margin: 0 -16px;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
  }
}

/* ═══ Penalty Callout ════════════════════════════ */
.penalty-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: pc-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pc-pop {
  from { opacity: 0; transform: scale(0.9) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pc-bust {
  background: rgba(245, 66, 66, 0.12);
  border: 1px solid rgba(245, 66, 66, 0.4);
}

.pc-bigloss {
  background: rgba(245, 196, 66, 0.1);
  border: 1px solid rgba(245, 196, 66, 0.35);
}

.pc-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.pc-body {
  flex: 1;
  min-width: 0;
}

.pc-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.pc-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pc-dice {
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 2px;
}

.pc-eq {
  font-size: 0.95rem;
  color: var(--text);
}

.pc-eq strong {
  font-size: 1.1rem;
  color: var(--red);
}

.pc-reason {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 20px;
}

.pc-penalty {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.pc-bust .pc-penalty { color: var(--red); }
.pc-bigloss .pc-penalty { color: var(--yellow); }

/* ═══ Tiebreak Callouts ══════════════════════════ */
.tiebreak-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(130, 90, 240, 0.1);
  border: 1px solid rgba(130, 90, 240, 0.35);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: pc-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tc-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.tc-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.tc-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tiebreak-winner-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(80, 200, 120, 0.1);
  border: 1px solid rgba(80, 200, 120, 0.4);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: pc-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.twc-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.twc-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.twc-roll {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.twc-num {
  font-weight: 700;
  color: var(--text);
}

.tb-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tb-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  transition: background 0.15s;
}

.tb-player-row.tb-active {
  background: rgba(130, 90, 240, 0.12);
  border: 1px solid rgba(130, 90, 240, 0.3);
}

.tb-player-row.tb-done {
  opacity: 0.85;
}

.tb-name {
  flex: 1;
  font-weight: 500;
}

.tb-die-result {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1.3rem;
}

.tb-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.tb-pending {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tb-rolling {
  font-style: italic;
}

/* ═══ Pause Banner ═══════════════════════════════ */
.pause-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(60, 100, 220, 0.1);
  border: 1px solid rgba(60, 100, 220, 0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  animation: pc-pop 0.2s ease;
}

.pb-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.pb-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.pb-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-more {
  display: none;
  align-items: center;
  gap: 6px;
  position: relative;
}

.header-more-btn {
  opacity: 0.55;
  font-size: 1rem;
  padding: 8px;
  line-height: 1;
  letter-spacing: 2px;
}
.header-more-btn:hover { opacity: 1; }

.header-more-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}

.header-pause-btn {
  opacity: 0.55;
  font-size: 0.75rem;
  line-height: 1;
}

.header-pause-btn:hover { opacity: 1; }

.header-end-series-btn { color: var(--danger, #e05); }
.header-end-series-btn.confirming { opacity: 1; color: var(--danger, #e05); font-weight: 600; }

/* ═══ Disconnected Player ════════════════════════ */
.disconnected-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: 4px;
  vertical-align: middle;
}

.player-disconnected {
  opacity: 0.55;
}

/* ═══ Rejoin Card ════════════════════════════════ */
.rejoin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(130, 90, 240, 0.08);
  border: 1px solid rgba(130, 90, 240, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.rejoin-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rejoin-icon {
  font-size: 1.4rem;
}

.rejoin-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.rejoin-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══ Pause Series / Series Card ════════════════ */
.series-paused-card {
  text-align: center;
  padding: 24px 16px;
}

.sp-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.pause-series-row {
  text-align: center;
  padding: 4px 0 2px;
}

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.btn-link:hover { color: var(--text); }

.danger-link {
  color: #e05252;
}
.danger-link:hover { color: #c03838; }

.status-paused {
  background: rgba(200, 150, 0, 0.15);
  color: #c89600;
  border: 1px solid rgba(200, 150, 0, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-members {
  background: rgba(100, 180, 100, 0.15);
  color: #4caf70;
  border: 1px solid rgba(100, 180, 100, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.series-member-card {
  border-color: rgba(100, 180, 100, 0.3);
  background: rgba(100, 180, 100, 0.04);
}

.btn-danger {
  background: rgba(220, 60, 60, 0.12);
  color: #e05252;
  border: 1px solid rgba(220, 60, 60, 0.3);
}
.btn-danger:hover { background: rgba(220, 60, 60, 0.22); }

/* ═══ Series History ═════════════════════════════ */

.sh-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.sh-row:last-child { border-bottom: none; }

.sh-game {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
}

.sh-loser {
  font-weight: 600;
  color: var(--text);
}

/* ═══ Series Section ═════════════════════════════ */
.status-ended {
  background: rgba(120, 120, 120, 0.12);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.series-section {
  margin-bottom: 20px;
}

.series-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.series-row:hover { border-color: var(--border-hover, rgba(255,255,255,0.18)); }

.series-row-mine {
  border-color: rgba(var(--accent-rgb, 120, 90, 230), 0.4);
  background: rgba(var(--accent-rgb, 120, 90, 230), 0.04);
}

.series-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
}

.series-row-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.series-row-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-row-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.series-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.series-row-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.series-scoreboard {
  padding: 0 14px 12px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.sb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
}

.sb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.sb-row:last-child { border-bottom: none; }
.sb-row-me { font-weight: 600; }

.sb-avatar { font-size: 1rem; }
.sb-name { flex: 1; }
.sb-losses { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

.sb-player-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}
.sb-player-btn:hover { color: var(--accent); text-decoration-color: var(--accent); }

.rs-name-link {
  display: inline;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}
.rs-name-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ═══ Typography ═════════════════════════════════ */
h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ═══ Cards ══════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px var(--accent-glow);
}

.game-actions-card.my-turn {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent), 0 0 28px var(--accent-glow);
}

@keyframes turn-arrive {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  35%  { box-shadow: 0 0 0 6px rgba(123, 97, 255, 0.5), 0 0 36px rgba(123, 97, 255, 0.4); }
  100% { box-shadow: 0 0 0 1px var(--accent), 0 0 28px var(--accent-glow); }
}

.game-actions-card.turn-start {
  animation: turn-arrive 0.55s ease-out forwards;
}

@keyframes label-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.game-actions-card.turn-start .your-turn-label {
  animation: label-pop 0.4s cubic-bezier(0.17, 0.67, 0.5, 1.2) forwards;
}

/* ═══ Header ═════════════════════════════════════ */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.series-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.round-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

/* ═══ Players Grid ═══════════════════════════════ */
.players-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.player-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.player-card.active-turn {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 16px var(--accent-glow);
}

.player-card.eliminated {
  opacity: 0.4;
}

.player-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-name .you-badge {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lives-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.big-lives {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.big-life {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--heart);
  transition: color 0.3s;
}

.big-life.lost { color: var(--heart-lost); }


.small-lives {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.small-life {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  transition: background 0.3s;
  flex-shrink: 0;
}

.small-life.lost {
  background: var(--dot-lost);
}

.game-losses {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══ Score ══════════════════════════════════════ */
.score-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.score-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.score-value {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  transition: color 0.3s;
}

.score-safe { color: var(--green); }
.score-ok   { color: var(--yellow); }
.score-warn { color: var(--orange); }
.score-danger { color: var(--red); }

.score-warning-msg {
  font-size: 0.85rem;
  margin-top: 6px;
  color: var(--orange);
  font-weight: 600;
}

/* ═══ Streak Warnings ════════════════════════════ */
.streaks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.streak-badge {
  background: var(--surface2);
  border: 1px solid var(--orange);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--orange);
}

/* ═══ Dice ═══════════════════════════════════════ */
.dice-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dice-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.die {
  font-size: 3rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@keyframes diceCycle {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.18); }
}

.die.rolling-cycle {
  animation: diceCycle 0.08s ease-in-out infinite;
  color: var(--text-muted);
}

@keyframes diceSettle {
  0%   { transform: scale(1.3) rotate(-8deg); }
  55%  { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1)   rotate(0deg); }
}

.die.rolling-settle {
  animation: diceSettle 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.die.pair { color: var(--accent); }
.die.bust { color: var(--red); }
.die.penalty { color: var(--red); }

.roll-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.roll-label.ok { color: var(--text-muted); }
.roll-label.pair-label { color: var(--accent); }
.roll-label.bust-label { color: var(--red); font-weight: 700; }
.roll-label.penalty-label { color: var(--red); font-weight: 700; }
.roll-label.pass-label { color: var(--yellow); }

.commentary {
  margin-top: 8px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.75;
  letter-spacing: 0.01em;
}

.no-roll {
  color: var(--text-muted);
  font-style: italic;
  line-height: 3.5rem;
}

/* ═══ Actions ════════════════════════════════════ */

.your-turn-label {
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  padding: 16px 12px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  letter-spacing: 0.3px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-roll {
  background: var(--green);
  color: #0a1a12;
  font-weight: 700;
}
.btn-roll:hover { background: color-mix(in srgb, var(--green) 85%, white); }

.btn-danger {
  background: rgba(245, 66, 66, 0.15);
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-full { grid-column: span 2; width: 100%; }

.btn-gold {
  background: var(--gold);
  color: #111;
}

.waiting-label {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 12px;
}

.auto-start-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
}
.auto-start-toggle input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ═══ Log ════════════════════════════════════════ */
.log-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.log-area summary.log-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.log-area summary.log-title::after {
  content: '▸';
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.log-area[open] summary.log-title::after {
  transform: rotate(90deg);
}

.log-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  flex: 1;
}

.log-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  flex-shrink: 0;
}

.log-copy-btn:hover { opacity: 1; }

.log-area[open] .log-entries,
.log-entries {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 10px;
}

.log-entry {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
}

.log-entry:last-child { border-bottom: none; }
.log-entry.fresh { color: var(--text); }
.log-time { font-size: 0.72rem; color: var(--text-muted); opacity: 0.6; margin-right: 6px; font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 7.5em; }

.log-round-header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.log-roll-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.log-roll-die { font-size: 1rem; line-height: 1; flex-shrink: 0; }
.log-roll-player { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-roll-contrib { font-size: 0.75rem; color: var(--green); font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.log-roll-tag { font-size: 0.65rem; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.log-roll-tag.danger { background: rgba(255,80,80,.18); color: #ff6060; }
.log-roll-lives { font-size: 0.65rem; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; margin-left: auto; }

.log-section-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
  opacity: 0.5;
}

/* ═══ Lobby ══════════════════════════════════════ */
.input-field {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-muted); }

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.player-row .host-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.lobby-players-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.lobby-players-header h3 { margin: 0; }

.order-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.order-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reorder-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.reorder-arrows .reorder-btn {
  padding: 0 5px;
  font-size: 0.75rem;
  line-height: 1.4;
  min-width: 22px;
  color: var(--text-muted);
}
.reorder-arrows .reorder-btn:hover { color: var(--text); }
.reorder-placeholder { display: inline-block; width: 22px; }

/* ═══ Setup ══════════════════════════════════════ */
.setup-player-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 10px;
}

.setup-player-row.active-setup {
  border-color: var(--accent);
  background: rgba(123, 97, 255, 0.08);
}

.setup-player-row.done {
  opacity: 0.6;
}

.setup-roll-result {
  margin-left: auto;
  font-weight: 700;
  color: var(--gold);
}

.setup-pending {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══ Game End / Series End ══════════════════════ */
.outcome-screen {
  text-align: center;
  padding: 16px 0;
}

.outcome-screen h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.loser-name {
  color: var(--red);
  font-size: 1.3rem;
  font-weight: 800;
}

.scores-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.score-row.loser-row { border-color: var(--red); }

.score-losses {
  font-weight: 700;
  color: var(--text-muted);
}

/* ═══ Misc ═══════════════════════════════════════ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 360px) {
  .players-grid { grid-template-columns: 1fr; }
  .score-value { font-size: 4rem; }
  .die { font-size: 2.5rem; }
}

/* ═══ History Panel ═══════════════════════════════ */
.hist-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.hist-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.hist-round-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin: 10px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

.hist-round-label:first-of-type { margin-top: 0; }

.hist-table {
  width: 100%;
  border-collapse: collapse;
}

.hist-row td {
  padding: 2px 3px;
  vertical-align: middle;
  line-height: 1.4;
}

.hist-name {
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.hist-die {
  font-size: 1rem;
  text-align: center;
  width: 22px;
}

.hist-score {
  text-align: right;
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 28px;
  color: var(--text);
}

.hist-row.pair .hist-die   { color: var(--accent); }
.hist-row.pair .hist-score { color: var(--text-muted); }
.hist-row.bust .hist-die   { color: var(--red); }
.hist-row.bust .hist-score { color: var(--red); }
.hist-row.penalty .hist-die   { color: var(--red); }
.hist-row.penalty .hist-score { color: var(--red); }
.hist-row.pass-row .hist-die  { color: var(--text-muted); }
.hist-row.pass-row .hist-score { color: var(--yellow); }

/* ═══ Status Badges ══════════════════════════════ */
.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ═══ Create Form ════════════════════════════════ */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

/* ═══ Lobby Grid ═════════════════════════════════ */
.lobby-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.lobby-card:hover { border-color: var(--accent); }

.lobby-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.lobby-card-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lobby-players-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pw-join-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pw-join-row .input-field { flex: 1; padding: 10px; }
.pw-join-row .btn { padding: 10px 14px; white-space: nowrap; }

/* ═══ Lobby Room ═════════════════════════════════ */
.you-badge {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.host-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.founder-badge {
  font-size: 0.85em;
  margin-left: 4px;
  vertical-align: middle;
  display: inline-block;
}

/* ═══ Auth Screen ════════════════════════════════ */
.auth-error {
  color: var(--red);
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 8px;
  text-align: center;
}

.remember-me-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  cursor: pointer;
}
.remember-me-label input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.auth-switch {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ═══ Emoji Picker ═══════════════════════════════ */
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.emoji-opt {
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 6px;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s;
}

.emoji-opt:hover { background: var(--border); }
.emoji-opt.active { border-color: var(--accent); background: rgba(123,97,255,0.15); }

.selected-emoji {
  font-size: 2rem;
  text-align: center;
  padding: 4px 0;
}

.profile-avatar {
  font-size: 1.5rem;
  line-height: 1;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* ═══ Guest Badge ════════════════════════════════ */
.guest-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(123, 97, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(123, 97, 255, 0.4);
  white-space: nowrap;
}

/* ═══ Spectator Badge ════════════════════════════ */
.spectator-count-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Recent Series (dashboard) ──────────────────────────────── */
.rs-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rs-row {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rs-row-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.rs-lobby-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.rs-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rs-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rs-player {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px 2px 4px;
}

.rs-avatar { font-size: 0.9rem; }
.rs-name   { font-weight: 500; }
.rs-losses { color: var(--text-muted); font-size: 0.72rem; margin-left: 2px; }

.rs-guest-tag {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-left: 3px;
  opacity: 0.7;
}

/* ═══ Invite Link ════════════════════════════════ */
.invite-card { padding: 12px 16px; }

.invite-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.invite-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.invite-url {
  flex: 1;
  font-size: 0.8rem;
  padding: 10px 12px;
  color: var(--text-muted);
  cursor: default;
  user-select: all;
}

/* ═══ Edit Profile Modal ═════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-section {
  padding: 4px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 16px;
}

.input-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.pstat-tile {
  background: var(--card-bg-alt, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.pstat-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.pstat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.edit-success {
  color: var(--green);
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 8px;
  text-align: center;
  font-weight: 600;
}

/* ═══ Player Avatars ═════════════════════════════ */
.player-avatar {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

.player-avatar-sm {
  font-size: 1rem;
  margin-right: 4px;
  vertical-align: middle;
}

/* ═══ Main Landing Page ══════════════════════════ */
.main-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav bar */
.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 4vw, 64px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.3px;
}
.nav-brand-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.3px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nav-dice { font-size: 1.3rem; }
.nav-title { color: var(--text); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* Hero */
.hero-section {
  text-align: center;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 64px) clamp(28px, 4vw, 48px);
  background: radial-gradient(ellipse at 50% 0%, rgba(123,97,255,0.15) 0%, transparent 70%);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 8px;
  line-height: 1.1;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

/* Stats strip */
.stats-strip {
  display: flex;
  gap: 12px;
  padding: 0 clamp(20px, 4vw, 64px) 40px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.stat-card {
  flex: 1;
  min-width: 110px;
  max-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-count { color: #4ade80; }

.live-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* Two-column layout */
.main-columns {
  display: flex;
  gap: 24px;
  padding: 0 clamp(20px, 4vw, 64px) 40px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.col-lobbies { flex: 1 1 0; min-width: 0; }
.col-feed    { flex: 0 0 300px; min-width: 240px; }

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin: 0;
}

/* Feed */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.35;
}

.feed-live-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 1px;
  line-height: 1.4;
}

.feed-msg {
  color: var(--text);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.feed-time {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Auth modal box sizing */
.auth-modal-box {
  max-width: 380px;
  width: 100%;
}

/* Join lobby page */
.join-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 64px);
}

.join-card {
  width: 100%;
  max-width: 480px;
}

.join-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.join-lobby-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.join-meta {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.join-action {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.join-or {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.guest-signin-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.join-or .link {
  color: var(--accent);
  text-decoration: none;
}

.join-back-btn {
  margin-top: 14px;
}

.lobby-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
}

.status-open   { background: rgba(0,214,143,0.15); color: var(--green); border: 1px solid rgba(0,214,143,0.3); }
.status-active { background: rgba(245,196,66,0.15); color: var(--yellow); border: 1px solid rgba(245,196,66,0.3); }

/* Create lobby modal */
.create-lobby-modal-box {
  max-width: 420px;
  width: 100%;
}

/* Toggle switch */
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 2px;
}

.switch-label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* Rules modal */
.rules-modal-box {
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.rules-body {
  padding: 4px 0 8px;
}

.rules-section {
  margin-bottom: 18px;
}

.rules-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 6px;
}

.rules-section p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  margin: 0 0 6px;
}

.rules-section ul {
  margin: 4px 0 6px 18px;
  padding: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.rules-tip {
  background: rgba(123,97,255,0.12);
  border: 1px solid rgba(123,97,255,0.3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

/* Nav right group */
.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background 0.15s;
}
.nav-hamburger:hover span { background: var(--text); }

/* Responsive */
@media (max-width: 680px) {
  .main-columns { flex-direction: column; }
  .col-feed { flex: unset; min-width: unset; }
  .hero-title { font-size: 1.8rem; }
  .stats-strip { gap: 8px; }
  .stat-card { min-width: 80px; padding: 10px 12px; }
  .stat-value { font-size: 1.3rem; }
}

@media (max-width: 600px) {
  .nav-hamburger { display: flex; }

  .nav-right {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .nav-right.nav-open { display: flex; }

  .main-nav { position: relative; }

  .nav-link {
    padding: 11px 12px;
    font-size: 0.95rem;
    border-radius: 8px;
    text-align: left;
  }

  .nav-user-dropdown {
    padding: 6px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }

  .nav-profile-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
  }

  /* Sign in button full-width on mobile */
  .nav-right .btn-primary {
    margin: 6px 0 0;
    width: 100%;
  }

  /* User dropdown opens downward inside the mobile menu */
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: 1px solid var(--border);
    margin-top: 4px;
    border-radius: 8px;
  }
}

/* ── Player Profile Modal ────────────────────────────────────── */
.player-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.player-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}
.player-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
  flex-shrink: 0;
}
.player-modal-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.player-modal-close {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 8px;
}
.player-modal-close:hover { color: var(--text); }
.player-modal-box .player-profile-card {
  max-width: none;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 16px 20px 20px;
}

/* ── Player Profile Page ─────────────────────────────────────── */
.player-profile-card {
  max-width: 580px;
  margin: 24px auto 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 24px;
}

.player-profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.player-profile-avatar {
  font-size: 3.5rem;
  line-height: 1;
}

.player-profile-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

@media (max-width: 480px) {
  .profile-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.profile-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pscen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.pscen-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.pscen-table td {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.pscen-label { color: var(--text); min-width: 180px; }
.pscen-num   { color: var(--text-muted); width: 70px; }
.pscen-pct   { width: 140px; }

.pscen-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pscen-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
  min-width: 2px;
  max-width: 80px;
  flex-shrink: 0;
}

.pscen-pct-val {
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── Footer ──────────────────────────────────────────────────── */
.main-footer {
  text-align: center;
  padding: 48px 24px 36px;
  margin-top: 24px;
}

.footer-slogan {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.9;
  letter-spacing: 0.03em;
  opacity: 0.5;
}

/* ── Nav User Dropdown ───────────────────────────────────────── */
.nav-user-dropdown {
  position: relative;
}

.nav-profile-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.nav-profile-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.nav-chevron {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-left: 2px;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.nav-dropdown-item:hover {
  background: rgba(255,255,255,0.07);
}

.nav-dropdown-item--danger {
  color: #f87171;
}

.nav-dropdown-item--danger:hover {
  background: rgba(248,113,113,0.1);
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Players Page ────────────────────────────────────────────── */
.players-page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 64px) 48px;
  width: 100%;
  box-sizing: border-box;
}

.players-search-wrap { margin-bottom: 20px; }
.players-search-input { max-width: 300px; }

.pt-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.players-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  white-space: nowrap;
}

.players-table thead th {
  padding: 10px 14px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.players-table .pt-th-name { text-align: left; padding-left: 8px; }
.players-table .pt-th-win  { color: var(--text); }

.pt-row td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.pt-row:last-child td { border-bottom: none; }

.pt-row:hover td { background: rgba(255,255,255,0.03); }

.pt-avatar { font-size: 1.3rem; width: 44px; text-align: center; padding-right: 0; }

.pt-name { text-align: left; }

.pt-name-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.pt-name-btn:hover { color: var(--accent); text-decoration: underline; }

.pt-num {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pt-muted  { color: var(--text-muted); font-weight: 400; }
.pt-good   { color: #4ade80; }
.pt-mid    { color: #facc15; }
.pt-bad    { color: #f87171; }
.pt-winrate { font-weight: 700; }

.players-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.players-page-label { font-size: 0.85rem; color: var(--text-muted); }

/* Die outlook panel */
.die-outlook {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.outlook-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.outlook-die {
  font-size: 2rem;
  line-height: 1;
  transition: opacity 0.15s;
}

.outlook-die.outlook-safe    { opacity: 1; }
.outlook-die.outlook-bust    { opacity: 0.3; filter: grayscale(1); }
.outlook-die.outlook-penalty { opacity: 0.3; filter: grayscale(1); }

.outlook-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.outlook-label-safe { color: #4ade80; }
.outlook-label-bad  { color: #f87171; }

/* Previous rolls history row */
.prev-rolls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prev-roll-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  opacity: 0.55;
}

.prev-roll-die  { font-size: 1.8rem; line-height: 1; }
.prev-roll-val  { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ═══ Admin Panel ═══════════════════════════════════════════════ */
.admin-panel { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.admin-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 20px; }

.admin-msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; font-weight: 600; }
.admin-msg--ok    { background: rgba(74,222,128,0.12); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.admin-msg--error { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }

.admin-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table thead { background: rgba(255,255,255,0.04); }
.admin-table th { padding: 10px 14px; text-align: left; color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.admin-row-inactive td { opacity: 0.5; }

.admin-td-avatar { font-size: 1.5rem; width: 40px; }
.admin-email { font-size: 0.78rem; color: var(--text-muted); }
.admin-td-actions { white-space: nowrap; }

.admin-badge { display: inline-block; font-size: 0.72rem; padding: 2px 7px; border-radius: 20px; font-weight: 700; margin-right: 4px; }
.admin-badge.founder { background: rgba(250,204,21,0.15); color: #facc15; border: 1px solid rgba(250,204,21,0.3); }
.admin-badge.admin   { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }

.admin-status { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.admin-status.active   { background: rgba(74,222,128,0.12); color: #4ade80; }
.admin-status.inactive { background: rgba(248,113,113,0.12); color: #f87171; }

.admin-deactivate-btn { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.3); margin-right: 6px; }
.admin-deactivate-btn:hover { background: rgba(248,113,113,0.25); }
.admin-reset-btn { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--border); font-family: monospace; }
.admin-reset-btn:hover { background: rgba(255,255,255,0.1); }
.admin-reset-revealed { color: #facc15; border-color: rgba(250,204,21,0.4); background: rgba(250,204,21,0.08); letter-spacing: 0.05em; }
.admin-copy-btn { background: rgba(250,204,21,0.1); color: #facc15; border: 1px solid rgba(250,204,21,0.4); padding: 2px 7px; margin-left: 4px; }
.admin-copy-btn:hover { background: rgba(250,204,21,0.2); }

/* ═══ Mute Button ════════════════════════════════════════════════ */
.header-mute-btn { font-size: 1rem; padding: 8px; line-height: 1; opacity: 0.75; }
.header-mute-btn:hover { opacity: 1; }

/* ═══ Setup Summary Modal ════════════════════════════════════════ */
.setup-summary-modal { max-width: 360px; }
.summary-players { display: flex; flex-direction: column; gap: 10px; }
.summary-player-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
}
.summary-avatar { font-size: 1.4rem; flex-shrink: 0; }
.summary-name { flex: 1; font-weight: 600; font-size: 0.95rem; }
.summary-hearts { font-size: 1rem; color: #f87171; letter-spacing: 1px; }
.lives-empty { color: rgba(248,113,113,0.3); }
.at-risk-badge {
  font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  background: rgba(250,204,21,0.15); color: #facc15; border: 1px solid rgba(250,204,21,0.4);
  flex-shrink: 0;
}

/* ═══ Series Ended Modal ═════════════════════════════════════════ */
.series-ended-modal { max-width: 360px; }

/* ═══ Game Ring Layout ═══════════════════════════════════════════════ */
.game-ring {
  display: grid;
  grid-template-areas:
    "top    top    top"
    "left   score  right"
    "bottom bottom bottom";
  grid-template-columns: 1fr 128px 1fr;
  gap: 7px;
  align-items: center;
  margin: 10px 0;
}

.ring-top    { grid-area: top;    display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; }
.ring-left   { grid-area: left;   display: flex; justify-content: flex-end; }
.ring-right  { grid-area: right;  display: flex; justify-content: flex-start; }
.ring-score  { grid-area: score; }
.ring-bottom { grid-area: bottom; display: flex; justify-content: center; }

.game-ring .player-card {
  width: 176px;
  height: 124px;
  overflow: hidden;
  flex-shrink: 0;
  padding: 10px 11px;
}

.game-ring .player-name {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.game-ring .lives-row {
  gap: 3px;
}

.game-ring .big-life {
  font-size: 0.9rem;
}

.game-ring .game-losses {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* 3-state big hearts */
.big-life.lost {
  color: var(--heart);
  opacity: 0.42;
}

.big-life.never {
  color: rgba(255,255,255,0.18);
}

/* Roll badges on player cards */
.round-badges {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.round-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.72rem;
  line-height: 1;
}

.round-badge .rb-die { font-size: 0.88rem; opacity: 0.85; }
.round-badge .rb-val { color: var(--green); font-weight: 600; }
.round-badge.badge-bust .rb-val { color: var(--red); }

/* Ring score box */
.ring-score-box {
  background: var(--surface2);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  width: 128px;
  min-height: 92px;
  height: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 0 16px rgba(74,222,128,0.07);
}

@keyframes ring-glow {
  0%,100% { box-shadow: 0 0 14px rgba(74,222,128,.12); }
  50%      { box-shadow: 0 0 28px rgba(74,222,128,.42); }
}

.ring-score-box.rolling {
  border-color: rgba(74,222,128,0.7);
  animation: ring-glow .35s ease-in-out infinite;
}

.ring-score-box.settling {
  border-color: rgba(74,222,128,0.5);
  box-shadow: 0 0 20px rgba(74,222,128,.28);
  transition: border-color .6s, box-shadow .8s;
}

.ring-score-label {
  font-size: 0.6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: 1px;
}

.ring-score-num {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.ring-die-face {
  font-size: 2.4rem;
  line-height: 1.1;
  display: inline-block;
}

.ring-die-delta {
  font-size: 0.65rem;
  color: var(--green);
  font-weight: 700;
  margin-top: 3px;
}

.ring-streak {
  margin-top: 5px;
  font-size: 0.65rem;
}

/* Turn panel (merged die outlook + actions) */
.turn-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@keyframes quip-rise {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.2); }
  18%  { opacity: 1;   transform: translate(-50%, -65%)  scale(1.4); }
  55%  { opacity: 0.9; transform: translate(-50%, -90%)  scale(1.1); }
  100% { opacity: 0;   transform: translate(-50%, -150%) scale(1.0); }
}
.quip-float {
  position: fixed;
  pointer-events: none;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.85), 0 0 32px rgba(123,97,255,0.7);
  white-space: nowrap;
  z-index: 1000;
  animation: quip-rise 2.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes turn-panel-pulse {
  0%, 100% {
    box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(123,97,255,0.2);
    border-color: rgba(123,97,255,0.5);
  }
  50% {
    box-shadow: 0 0 0 3px var(--accent), 0 0 55px rgba(123,97,255,0.75), 0 0 20px rgba(123,97,255,0.5);
    border-color: rgba(123,97,255,1);
  }
}

.turn-panel.my-turn {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  animation: turn-panel-pulse 1.6s ease-in-out infinite;
}

.turn-panel.turn-start {
  animation: turn-arrive 0.55s ease-out forwards;
}

.turn-panel.turn-start .your-turn-label {
  animation: label-pop 0.4s cubic-bezier(0.17, 0.67, 0.5, 1.2) forwards;
}

.turn-panel .your-turn-label {
  font-size: 0.85rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  margin: 0;
}

/* Die outlook inside turn panel */
.turn-panel .die-outlook {
  display: flex;
  gap: 4px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  margin: 0;
}

.turn-panel .outlook-cell {
  flex: 1;
  text-align: center;
  padding: 5px 2px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: rgba(74,222,128,0.07);
}

.turn-panel .outlook-cell.bad {
  background: rgba(255,255,255,0.03);
}

.turn-panel .outlook-die {
  font-size: 1.2rem;
  line-height: 1;
}

.turn-panel .outlook-die.outlook-safe { color: var(--green); opacity: 1; filter: none; }
.turn-panel .outlook-die.outlook-bust { color: rgba(255,255,255,0.22); opacity: 1; filter: none; }

.outlook-delta { font-size: 0.62rem; font-weight: 700; color: var(--green); }
.outlook-delta.bad { color: rgba(255,255,255,0.3); }
.outlook-result { font-size: 0.58rem; color: rgba(74,222,128,0.7); }
.outlook-result.bad { color: rgba(255,255,255,0.22); }

.turn-panel .waiting-label { text-align: center; margin: 4px 0; }

/* ═══ Playing Phase: Full-height Pinned Layout ═══════════════════ */

#layout[data-phase="playing"] {
  height: 100dvh;
  overflow: hidden;
}

#layout[data-phase="playing"] #app {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  padding: 0;
  gap: 0;
  min-height: unset;
}

/* Nav: first fixed row — override the outward bleed margin */
#layout[data-phase="playing"] #app > .main-nav {
  flex: 0 0 auto;
  margin: 0 !important;
  border-bottom: 1px solid var(--border);
}

/* Game bar: full-width round info + action buttons */
.game-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 8px;
}

.game-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}

.game-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.game-bar-actions .header-more-btn {
  font-size: 1rem;
  padding: 8px;
  line-height: 1;
}

/* Scrollable content */
.play-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Game column: ring + log */
.play-col-game {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* History column: round history + series history */
.play-col-log {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}


/* History sidebar: hidden during playing (content is now inline in play-col-log) */
#layout[data-phase="playing"] #history {
  display: none;
}

/* Mobile history block: hidden on wide screens, shown when right column disappears */
.play-hist-mobile { display: none; }

/* Narrow / mobile: hide the right column, show inline history instead */
@media (max-width: 900px) {
  .play-col-log { display: none; }
  .play-hist-mobile { display: flex; flex-direction: column; gap: 12px; }
}

@media (max-width: 600px) {
  .header-actions { display: none; }
  .header-more { display: flex; }
  .pause-series-row { display: none; }
}
