/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: #1a1a2e; color: #e0e0e0; min-height: 100vh; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
#nav {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.5rem; background: #16213e; border-bottom: 1px solid #0f3460;
}
.brand { font-size: 1.2rem; font-weight: 700; color: #e94560; }
#nav-user { margin-left: auto; font-size: .9rem; color: #a8a8b3; }
.nav-admin-link { font-size: .85rem; color: #a8a8b3; text-decoration: none; padding: .25rem .6rem; border: 1px solid #0f3460; border-radius: 4px; margin-left: .75rem; }
.nav-admin-link:hover { color: #e0e0e0; border-color: #e94560; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
button {
  cursor: pointer; border: none; border-radius: 6px;
  padding: .5rem 1.2rem; font-size: .9rem; transition: opacity .15s;
}
button:hover { opacity: .85; }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: #e94560; color: #fff; }
.btn-create-game { background: #16a34a; color: #fff; padding: .5rem 1.2rem; font-size: .9rem; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; transition: opacity .15s; }
.btn-create-game:hover { opacity: .85; }
.btn-secondary{ background: #0f3460; color: #e0e0e0; }
.btn-sm       { padding: .3rem .75rem; font-size: .8rem; }
.hidden       { display: none !important; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-box {
  max-width: 380px; margin: 4rem auto; background: #16213e;
  border-radius: 10px; padding: 2rem; box-shadow: 0 4px 20px #0005;
}
.form-box h2 { margin-bottom: 1.5rem; color: #e94560; text-align: center; }
.form-group  { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .3rem; font-size: .85rem; }
.form-label-row { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .3rem; }
.form-label-row label { margin-bottom: 0; }
.form-group input {
  width: 100%; padding: .5rem .75rem; border-radius: 6px;
  border: 1px solid #0f3460; background: #1a1a2e; color: #e0e0e0; font-size: .95rem;
}
.form-group input:focus { outline: none; border-color: #e94560; }
.form-error { color: #e94560; font-size: .85rem; margin-top: .5rem; min-height: 1.2em; }
.form-link  { text-align: center; margin-top: 1rem; font-size: .85rem; }
.form-link a { color: #e94560; cursor: pointer; }

/* Google sign-in button — follows Google branding guidelines */
.form-divider {
  text-align: center; color: #a8a8b3; font-size: .8rem;
  margin: .9rem 0; position: relative;
}
.form-divider::before, .form-divider::after {
  content: ''; position: absolute; top: 50%; width: 42%;
  height: 1px; background: #0f3460;
}
.form-divider::before { left: 0; }
.form-divider::after  { right: 0; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .55rem 1rem; border-radius: 6px;
  background: #fff; color: #3c4043; font-size: .9rem; font-weight: 500;
  border: 1px solid #dadce0; text-decoration: none; cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.btn-google:hover { box-shadow: 0 1px 4px #0003; background: #f8f8f8; }
.google-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Lobby ────────────────────────────────────────────────────────────────── */
.lobby-wrap { max-width: 100%; margin: 2rem auto; padding: 0 1rem; }
.lobby-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.lobby-header h2 { margin: 0; }
.lobby-tabs { display: flex; gap: .25rem; background: #0f3460; border-radius: 8px; padding: .25rem; }
.lobby-tab {
  background: transparent; color: #a8a8b3; border-radius: 6px;
  padding: .35rem 1rem; font-size: .88rem; font-weight: 600; transition: background .15s, color .15s;
}
.lobby-tab:hover { background: #16213e; color: #e0e0e0; }
.lobby-tab.active { background: #e94560; color: #fff; }
.lobby-actions { display: flex; gap: .75rem; margin-bottom: 1.5rem; }
.lobby-table { width: 100%; border-collapse: collapse; }
.lobby-table th, .lobby-table td {
  text-align: left; padding: .65rem 1rem; border-bottom: 1px solid #0f3460;
}
.lobby-table th { color: #a8a8b3; font-size: .8rem; text-transform: uppercase; }
/* Clickable player names */
.player-link { color: #93c5fd; cursor: pointer; text-decoration: underline dotted; }
.player-link:hover { color: #bfdbfe; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-loading { color: #a8a8b3; padding: 1.5rem 0; }
.lb-table { width: 100%; border-collapse: collapse; font-size: .87rem; margin-top: .5rem; }
.lb-table th {
  text-align: left; padding: .4rem .6rem; color: #a8a8b3;
  font-size: .76rem; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid #0f3460;
}
.lb-table td { padding: .55rem .6rem; border-bottom: 1px solid #0f346044; vertical-align: middle; }
.lb-row:last-child td { border-bottom: none; }
.lb-row.lb-me { background: #0f346033; }
.lb-medal { font-size: 1.15rem; text-align: center; width: 2rem; }
.lb-name  { font-weight: 600; }
.lb-you   { color: #a8a8b3; font-size: .78rem; font-weight: 400; }
.lb-pts   { font-weight: 700; }
.lb-total { color: #fbbf24; }
.lb-gp    { color: #34d399; }
.lb-sp    { color: #f59e0b; }
.lb-wl    { color: #a8a8b3; }
.lb-dealt { color: #f59e0b; }
.lb-taken { color: #e94560; }
.lb-sub   { color: #a8a8b3; font-size: .8em; }

/* ── Player profile modal ─────────────────────────────────────────────────── */
.profile-overlay {
  position: fixed; inset: 0; background: #000a;
  display: flex; align-items: center; justify-content: center; z-index: 300;
  animation: fadeIn .2s ease;
}
.profile-box {
  background: #16213e; border-radius: 12px; padding: 1.75rem 2rem;
  max-width: 700px; width: 95vw; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 8px 32px #0009;
}
.profile-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.profile-title  { font-size: 1.15rem; font-weight: 700; color: #e0e0e0; margin: 0; }
.profile-close  { font-size: .9rem; }
.profile-loading { color: #a8a8b3; }
/* Summary stat cards */
.profile-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem;
  margin-bottom: 1.5rem;
}
.ps-card {
  background: #0f3460; border-radius: 8px; padding: .75rem .9rem; text-align: center;
}
.ps-val { font-size: 1.15rem; font-weight: 700; color: #fbbf24; }
.ps-lbl { font-size: .75rem; color: #a8a8b3; margin-top: .2rem; }
.ps-sub { color: #6b7280; font-size: .85em; }
/* Game history table */
.profile-games-title {
  font-size: .8rem; font-weight: 700; color: #a8a8b3; text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: .5rem;
}
.profile-games-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.profile-games-table th {
  text-align: left; padding: .35rem .5rem; color: #a8a8b3;
  font-size: .74rem; font-weight: 600; border-bottom: 1px solid #0f3460;
}
.profile-games-table td { padding: .45rem .5rem; border-bottom: 1px solid #0f346044; vertical-align: middle; }
.profile-games-table tr:last-child td { border-bottom: none; }
.profile-win td { color: #fbbf24; }
.pg-gp  { color: #34d399; font-weight: 600; }
.pg-sp  { color: #f59e0b; font-weight: 600; }
.pg-tot { color: #fbbf24; font-weight: 700; }
.pg-dealt { color: #f59e0b; }
.pg-taken { color: #e94560; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: #0008;
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box {
  background: #16213e; border-radius: 10px; padding: 2rem; min-width: 320px;
}
.modal-box h3 { margin-bottom: 1.2rem; }
.form-group-check { margin-bottom: .75rem; }
.check-label { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.check-label input[type="checkbox"] { accent-color: #7c3aed; width: 1rem; height: 1rem; cursor: pointer; }
.form-hint { font-size: .78rem; color: #a8a8b3; margin-top: .3rem; line-height: 1.4; }

/* ── Inline checkbox options row ─────────────────────────────────────────── */
.check-options-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.check-option { flex: 0 0 calc(50% - .25rem); max-width: 40%; display: flex; align-items: center; gap: .35rem; }
.help-icon { font-size: .7rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid #a8a8b3; background: transparent; color: #a8a8b3; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.help-icon:focus { outline: none; box-shadow: 0 0 0 2px #7c3aed88; }
#help-dialog-popup { position: fixed; z-index: 200; background: #1a2a4a; border: 1px solid #2a4a7c; border-radius: 6px; padding: .6rem .8rem; font-size: .82rem; color: #e0e0e0; max-width: 260px; line-height: 1.5; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
#help-dialog-popup.hidden { display: none; }

/* ── Table view ───────────────────────────────────────────────────────────── */
.game-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 46px); /* subtract nav height */
  max-width: 900px;
  margin: 0 auto;
  padding: .5rem 1rem .5rem;
  box-sizing: border-box;
  overflow: hidden;
}
.game-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 0; margin-top: .4rem; flex-shrink: 0;}
.game-header h2 { flex: 1; font-size: 1.1rem; margin: 0; }
.seats-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .4rem; flex-shrink: 0;
}
.seat-chip {
  background: #0f3460; border-radius: 20px; padding: .3rem .9rem; font-size: .85rem;
}
.seat-chip.me { background: #e94560; }
.play-area {
  background: #0f3460; border-radius: 10px; padding: 1rem;
  margin-top: 1rem; margin-bottom: 1.5rem;
}
.play-area-label { color: #a8a8b3; font-size: .85rem; }
.play-area-label-row { color: #a8a8b3; font-size: .85rem; margin-bottom: .75rem; }
.played-cards-row {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-end;
}
/* Played cards are slightly smaller and non-interactive */
.played-cards-row .card {
  width: 44px; height: 64px; font-size: .7rem; cursor: default;
  transform: none !important; box-shadow: none;
  opacity: .75;
}
.played-cards-row .card:hover { transform: none !important; box-shadow: none; opacity: .75; }
/* Latest card is full size and highlighted */
.played-cards-row .card.latest-played {
  width: 56px; height: 80px; font-size: .75rem;
  opacity: 1; box-shadow: 0 0 0 3px #e94560, 0 4px 12px #0006;
}
.hand-label { color: #a8a8b3; font-size: .85rem; margin-bottom: .5rem; }
.hand { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  width: 56px; height: 80px; border-radius: 6px;
  background: #fff; color: #222; border: 2px solid #ccc;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: .75rem; font-weight: 700;
  cursor: pointer; transition: transform .1s, box-shadow .1s; user-select: none;
  position: relative;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 6px 14px #0006; }
.card.disabled { cursor: not-allowed; opacity: .5; transform: none; }
.card.must-play { box-shadow: 0 0 0 3px #f59e0b, 0 4px 10px #0004; }
.card.must-play:hover { box-shadow: 0 0 0 3px #f59e0b, 0 6px 14px #0006; }

/* Chain penalty card highlights */
.card.chain-snip   { box-shadow: 0 0 0 3px #facc15, 0 0 10px 4px #facc1599, 0 4px 10px #0004; }
.card.chain-snap   { box-shadow: 0 0 0 3px #f97316, 0 0 10px 4px #f9731699, 0 4px 10px #0004; }
.card.chain-snorem { box-shadow: 0 0 0 3px #ef4444, 0 0 10px 4px #ef444499, 0 4px 10px #0004; }

.card.face-up.hearts, .card.face-up.diamonds { color: #cc0000; }
.lives { font-size: .85rem; color: #e94560; }
.dealer-badge { font-size: .75rem; background: #3b82f6; color: #fff; border-radius: 4px; padding: 1px 5px; margin-left: 3px; }
/* Rank top-left, suit bottom-right — sized relative to card height via vh */
.card-rank,
.card-suit {
  position: absolute;
  font-weight: 700;
  line-height: 1;
}
/* Default sizes for non-ring cards */
.card-rank { top: .2rem;  left: .25rem; font-size: .85rem; }
.card-suit  { bottom: .2rem; right: .25rem; font-size: 1rem; }

/* ── Status badge ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 4px; font-size: .75rem;
}
.badge-waiting    { background: #0f3460; }
.badge-in-progress{ background: #1a5c2e; }
.badge-finished   { background: #3a3a3a; }
.badge-topcardule      { background: #7c3aed; font-size: .72rem; }
.badge-bonuslife       { background: #065f46; font-size: .72rem; }
.badge-bonuslife-spent { background: #3a3a3a; font-size: .72rem; }
.badge-turbomode       { background: #b45309; font-size: .72rem; }

/* ── Scoreboard overlay ───────────────────────────────────────────────────── */
.scoreboard-overlay {
  position: fixed; inset: 0; background: #000a;
  display: flex; align-items: center; justify-content: center; z-index: 200;
  animation: fadeIn .2s ease;
}
.scoreboard-box {
  background: #16213e; border-radius: 12px; padding: 2rem 2.5rem;
  max-width: 640px; width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px #0008; position: relative;
}
.sb-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; color: #a8a8b3; font-size: 1.4rem;
  cursor: pointer; line-height: 1; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.sb-close:hover { color: #e0e0e0; background: #0f3460; }
.sb-title    { color: #e94560; text-align: center; margin-bottom: .25rem; }
.sb-subtitle { text-align: center; color: #a8a8b3; font-size: .85rem; margin-bottom: 1.25rem; }
.sb-table {
  width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: .5rem;
}
.sb-table th {
  text-align: left; padding: .4rem .6rem; color: #a8a8b3;
  font-size: .78rem; font-weight: 600; border-bottom: 1px solid #0f3460;
}
.sb-table td { padding: .5rem .6rem; border-bottom: 1px solid #0f3460; vertical-align: middle; }
.sb-row:last-child td { border-bottom: none; }
.sb-medal  { font-size: 1.2rem; text-align: center; width: 2.2rem; }
.sb-name   { font-weight: 600; }
.sb-lives  { white-space: nowrap; }
.sb-stat   { color: #f59e0b; white-space: nowrap; }
.sb-taken  { color: #e94560; }
.sb-total  { color: #a8a8b3; font-size: .8em; }
.sb-row.sb-rank-1 .sb-name { color: #fbbf24; }
/* lives-mini used in both dialogs */
.lives-mini { letter-spacing: .05em; }

/* ── Turn countdown ───────────────────────────────────────────────────────── */
.turn-countdown { font-size: .9rem; color: #f59e0b; font-weight: 600; margin-left: .75rem; }
.turn-countdown.hidden { display: none; }

/* ── Chain action labels (Snip / Snap / Snorem) ───────────────────────────── */
.chain-action   { font-weight: 700; }
.chain-snipped  { color: #f59e0b; }   /* amber  — first match  */
.chain-snapped  { color: #f97316; }   /* orange — second match */
.chain-snoremed { color: #e94560; }   /* red    — third match  */
.away-mode-row { display: none; }
.away-mode-label { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: #a8a8b3; cursor: pointer; user-select: none; }
.away-mode-label input[type="checkbox"] { accent-color: #3b82f6; width: 1rem; height: 1rem; cursor: pointer; }
.btn-away { padding: .3rem .75rem; border-radius: 6px; border: none; font-size: .8rem; font-weight: 600; cursor: pointer; background: #dc2626; color: #fff; transition: background .15s; }
.btn-away:hover { background: #b91c1c; }
.btn-away.btn-away--on { background: #16a34a; }
.btn-away.btn-away--on:hover { background: #15803d; }
.autoplay-toast {
  background: #1e3a5f; border: 1px solid #3b82f6; border-radius: 6px;
  color: #93c5fd; font-size: .85rem; padding: .4rem .9rem;
  margin: .5rem 0; text-align: center;
}
.autoplay-toast.hidden { display: none; }

/* ── Round-starting overlay ───────────────────────────────────────────────── */
.round-starting-overlay {
  position: fixed; inset: 0; background: #000b;
  display: flex; align-items: center; justify-content: center; z-index: 150;
  animation: fadeIn .2s ease;
}
.round-starting-box {
  background: #16213e; border: 1px solid #0f3460;
  border-radius: 14px; padding: 2rem 2.5rem;
  max-width: 580px; width: 95vw; max-height: 85vh; overflow-y: auto;
  text-align: center; box-shadow: 0 8px 32px #0008; position: relative;
}
.rs-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; color: #a8a8b3; font-size: 1.4rem;
  cursor: pointer; line-height: 1; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.rs-close:hover { color: #e0e0e0; background: #0f3460; }
.round-starting-title {
  font-size: 1.4rem; font-weight: 700; color: #e0e0e0; margin-bottom: .5rem; margin-top: 1rem;
}
.round-starting-countdown {
  font-size: 2.5rem; font-weight: 700; color: #e94560; line-height: 1;
}
/* Round stats section inside the round-starting dialog */
.rs-stats-section { margin-bottom: .75rem; }
.rs-stats-title {
  font-size: .9rem; font-weight: 700; color: #a8a8b3;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem;
}
.rs-stats-table {
  width: 100%; border-collapse: collapse; font-size: .84rem; text-align: left;
}
.rs-stats-table th {
  padding: .35rem .5rem; color: #a8a8b3; font-size: .75rem; font-weight: 600;
  border-bottom: 1px solid #0f3460;
}
.rs-stats-table td { padding: .45rem .5rem; border-bottom: 1px solid #0f346044; vertical-align: middle; }
.rs-stats-table tr:last-child td { border-bottom: none; }
.rs-player { font-weight: 600; }
.rs-lives  { white-space: nowrap; }
.rs-dealt  { color: #f59e0b; white-space: nowrap; }
.rs-taken  { color: #e94560; white-space: nowrap; }
.rs-total  { color: #a8a8b3; font-size: .8em; }
.rs-elim-badge {
  display: inline-block; background: #3a3a3a; color: #a8a8b3;
  font-size: .7rem; padding: .05rem .35rem; border-radius: 3px; margin-left: .3rem;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
/* Direction-aware slide-in keyframes for played cards */
@keyframes cardSlideInDown  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes cardSlideInUp    { from { opacity: 0; transform: translateY(10px);  } to { opacity: 1; transform: none; } }
@keyframes cardSlideInLeft  { from { opacity: 0; transform: translateX(10px);  } to { opacity: 1; transform: none; } }
@keyframes cardSlideInRight { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* Ring layout fills remaining vertical space */
#game-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Grid layout (shared) ─────────────────────────────────────────────────── */
.game-cell {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: .25rem;
}

.game-cell--info {
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  font-size: .82rem;
  color: #e0e0e0;
  text-align: center;
  padding: .5rem;
}

.game-cell.active-turn {
  outline: 2px solid #e94560;
  outline-offset: -2px;
  border-radius: 4px;
}

.game-cell.seat-elim { opacity: .45; }

.game-cell .seat-label {
  font-size: .78rem;
  color: #a8a8b3;
  text-align: center;
  margin-bottom: .2rem;
}

.game-cell .played-cards,
.game-cell .unplayed-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 2px;
  justify-content: center;
}

/* Cards wrap: controls played vs unplayed relative position per orientation */
.game-cell .cards-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: nowrap;
}

/* ── Landscape grid layout ────────────────────────────────────────────────── */
@media (orientation: landscape) {
  .game-grid {
    display: grid;
    grid-template-columns: repeat(10, 10vw);
    grid-template-rows: repeat(4, 23vh);
    width: 100vw;
    overflow: hidden;
    background: #0a1628;
  }

  .game-header-row {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    padding: 0 .75rem;
    overflow: hidden;
    border-bottom: 1px solid #1a3a5c;
  }

  .game-cell .card { height: 16vh; width: calc(16vh * 0.7); }
  .game-cell .card .card-rank,
  .game-cell .card .card-suit { font-size: 5.6vh; }
  .game-cell .card .card-rank { top: .1rem; left: .1rem; }
  .game-cell .card .card-suit { bottom: .1rem; right: .1rem; }
  .played-cards .card.face-up:first-of-type { margin-left: 1.5em }
}

/* ── Portrait grid layout ─────────────────────────────────────────────────── */
@media (orientation: portrait) {
  .game-grid {
    display: grid;
    grid-template-columns: repeat(10, 10vw);
    grid-template-rows: repeat(4, 23vh);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #0a1628;
  }

  .game-header-row {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    padding: 0 .75rem;
    overflow: hidden;
    border-bottom: 1px solid #1a3a5c;
  }

  .game-cell .cards-wrap { flex-direction: column-reverse; }
  .game-cell .card { height: 14.3vw; width: 10vw; }
  .game-cell .card .card-rank,
  .game-cell .card .card-suit { font-size: 5vw; }

  .game-cell .card.face-down { margin-left: -1.5em }
  .played-cards .card.face-up { margin-left: -1.5em }
}


/* ── Ring table layout (legacy — retained for reference) ──────────────────── */
.game-ring-container {
  position: relative;
  flex: 1;
  --ring-size: min(clamp(260px, 90vw, 680px), calc(100vh - 156px));
  width: var(--ring-size);
  max-width: var(--ring-size);
  max-height: var(--ring-size);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: visible;
}

/* 1.2 – each seat is positioned within the ring container */
.ring-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  /* transform-origin at centre of the seat element for rotation */
  transform-origin: center center;
}

.ring-seat[data-direction="up"]  {
  margin-top: 2em; /* offset from centre to bottom edge (6 o'clock) */;
}

.ring-seat[data-direction="down"] {
  margin-bottom: 2em; /* offset from centre to top edge (12 o'clock) */;
}


/* Active turn highlight */
.ring-seat.active-turn .seat-label {
  color: #fbbf24;
  font-weight: 700;
}
.ring-seat.active-turn {
  filter: drop-shadow(0 0 8px #fbbf2488);
}

.seat-label {
  font-size: .75rem;
  color: #a8a8b3;
  white-space: nowrap;
  text-align: center;
  order: 0; /* label above cards by default */
}
.seat-lives-inline {
  font-size: .7rem;
  color: #e94560;
}
/* Bottom seat (6 o'clock): label goes below the cards */
[data-direction="up"] .seat-label {
  order: 2;
}
.seat-elim {
  opacity: 0.35;
  text-decoration: line-through;
}

/* 1.3 – unplayed/played card rows */
.ring-unplayed-cards,
.ring-played-cards {
  display: flex;
  flex-direction: row;
  gap: 3px;
  align-items: center;
  min-height: 11.5vh;
  min-width: 30px;
}
/* unplayed hand: centred */
.ring-unplayed-cards {
  justify-content: center;
}
/* played row: aligns from start */
.ring-played-cards {
  justify-content: flex-start;
}

/* Cards wrapper — controls which side of the unplayed row played cards appear on */
.ring-cards-wrapper {
  display: flex;
  flex-direction: column; /* default: played row below unplayed (top/12 o'clock seat) */
  gap: 4px;
  align-items: center;
}
/* Bottom seat (6 o'clock): centre is above → played row above unplayed */
[data-direction="up"] .ring-cards-wrapper {
  flex-direction: column-reverse;
}
/* Right seat (3 o'clock): centre is to the left → played row left of unplayed */
[data-direction="left"] .ring-cards-wrapper {
  flex-direction: row-reverse;
  align-items: flex-start;
}
/* Left seat (9 o'clock): centre is to the right → played row right of unplayed */
[data-direction="right"] .ring-cards-wrapper {
  flex-direction: row;
  align-items: flex-start;
}

/* 1.4 – face-down card back */
.card.face-down {
  background: #1a3a6e;
  border: 2px solid #2d5a9e;
  cursor: default;
  color: transparent;
  background-image: repeating-linear-gradient(
    45deg,
    #1e4080 0px, #1e4080 4px,
    #16316b 4px, #16316b 8px
  );
}
.card.face-down:hover { transform: none; box-shadow: none; }

/* 1.5 – face-up card (already styled by .card, add explicit white bg) */
.card.face-up {
  background: #fff;
  color: #222;
}

/* 1.6 – interactive own cards */
.card.interactive {
  cursor: pointer;
}
/* Interactive hover in unplayed row: lift */
.ring-unplayed-cards .card.interactive:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 14px #0006;
}
/* Non-ring interactive hover unchanged */
.card.interactive:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 14px #0006;
}
/* face-down cards: no lift on hover */
.ring-seat .card.face-down {
  transform: none;
}
/* 1.3 – played cards: no transform transition (prevents interference); direction-aware slide-in */
.ring-played-cards .card {
  width: 8.6vh;
  height: 11.5vh;
  font-size: 0;
  transition: none;
  animation: cardSlideInDown 250ms ease-in-out; /* default: top seat */
}
/* Direction-scoped animation overrides */
[data-direction="up"]    .ring-played-cards .card { animation-name: cardSlideInUp; }
[data-direction="left"]  .ring-played-cards .card { animation-name: cardSlideInLeft; }
[data-direction="right"] .ring-played-cards .card { animation-name: cardSlideInRight; }
.ring-played-cards .card .card-rank { font-size: 4.6vh; top: .15vh; left: .3vh; }
.ring-played-cards .card .card-suit { font-size: 4.6vh; bottom: .15vh; right: .3vh; }

.card.face-up:not(.interactive):hover {
  transform: none;
  box-shadow: none;
}
/* Played cards in ring are smaller */
/* (size, no-transition, and slide-in animation — see rule above) */

/* Unplayed card size in ring */
.ring-unplayed-cards .card {
  width: 8.6vh;
  height: 11.5vh;
  font-size: 0;
}
.ring-unplayed-cards .card .card-rank { font-size: 4.6vh; top: .15vh; left: .3vh; }
.ring-unplayed-cards .card .card-suit { font-size: 4.6vh; bottom: .15vh; right: .3vh; }

/* Centre play area info label */
.ring-centre {
  text-align: center;
  pointer-events: none;
  margin: 1em;
  min-height: 4em;
}
.ring-centre-label {
  font-size: .75rem;
  color: #a8a8b3;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ring-centre-chain {
  font-size: .8rem;
  font-weight: 700;
  margin-top: .25rem;
}

/* ─── Admin page ─────────────────────────────────────────────────────────── */
.admin-page { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; }
.admin-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.admin-header h2 { margin: 0; font-size: 1.4rem; }
.admin-back { font-size: .85rem; padding: .3rem .75rem; }
.admin-section { margin-bottom: 2rem; }
.admin-section h3 { margin: 0 0 .75rem; font-size: 1rem; color: #a8a8b3; text-transform: uppercase; letter-spacing: .05em; }
.admin-section-hdr { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.admin-section-hdr h3 { margin: 0; font-size: 1rem; color: #a8a8b3; text-transform: uppercase; letter-spacing: .05em; }
.admin-msg { font-size: .85rem; min-height: 1.2em; margin-bottom: .5rem; }
.admin-msg-ok  { color: #4ade80; }
.admin-msg-err { color: #e94560; }
.admin-loading { color: #a8a8b3; font-size: .9rem; padding: .5rem 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th { padding: .45rem .6rem; color: #a8a8b3; font-size: .75rem; font-weight: 600; border-bottom: 1px solid #0f3460; text-align: left; }
.admin-table td { padding: .5rem .6rem; border-bottom: 1px solid #0f346044; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn-sm { padding: .25rem .55rem; font-size: .78rem; }
.btn-warn { background: #b45309; color: #fff; border: none;  }
.btn-warn:hover { background: #d97706; }
.btn-danger { background: #991b1b; color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #16a34a; color: #fff; border: none; }
.btn-success:hover { opacity: .85; }
.btn-muted { background: #2a2a3c; color: #a8a8b3; border: none; }
.btn-muted:hover { opacity: .85; }

/* ── Post-game scoreboard section ─────────────────────────────────────────── */
.sb-post-game {
  display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap;
  margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid #0f3460;
}
.rematch-cancelled-note { font-size: .85rem; color: #a8a8b3; align-self: center; }

/* ── Rematch lobby toast ──────────────────────────────────────────────────── */
.rematch-toast {
  position: fixed; bottom: 4rem; left: 50%; transform: translateX(-50%);
  background: #16213e; border: 1px solid #1a4a8a; border-radius: 8px;
  padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem;
  box-shadow: 0 4px 20px #0008; z-index: 2000; max-width: 90vw;
}
.rematch-toast-msg { color: #e0e0e0; font-size: .9rem; }
.rematch-countdown { color: #a8a8b3; font-size: .8rem; }

/* ── Generic toast ────────────────────────────────────────────────────────── */
.generic-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #16213e; border: 1px solid #1a4a8a; border-radius: 6px;
  padding: .5rem 1rem; color: #e0e0e0; font-size: .875rem;
  box-shadow: 0 2px 12px #0006; z-index: 3000; pointer-events: none;
}

/* ── Series badge ─────────────────────────────────────────────────────────── */
.series-badge {
  display: inline-block; background: #7c3aed; color: #fff;
  font-size: .7rem; padding: .1rem .4rem; border-radius: 4px;
  font-weight: 600; vertical-align: middle; margin-left: .25rem;
}

/* ── Series scoreboard ────────────────────────────────────────────────────── */
.series-section-hdr {
  color: #a8a8b3; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .05em; margin: .75rem 0 .4rem; font-weight: 600;
}

/* ── Admin Pause / Resume nav button ──────────────────────────────────────── */
.btn-pause {
  background: #f97316; color: #fff; border: none; border-radius: 4px;
  padding: .3rem .75rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn-pause:hover { background: #ea6a05; }
.btn-resume {
  background: #22c55e; color: #fff; border: none; border-radius: 4px;
  padding: .3rem .75rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn-resume:hover { background: #16a34a; }

/* ── Pause banner (shown to all players while game is paused) ─────────────── */
.pause-banner {
  background: #92400e; color: #fef3c7; border: 1px solid #f59e0b;
  border-radius: 6px; padding: .6rem 1rem; margin-bottom: .75rem;
  font-size: .95rem; text-align: center; font-weight: 500;
}

/* ── Paused status badge ──────────────────────────────────────────────────── */
.badge-paused {
  background: #f97316; color: #fff; font-size: .72rem; font-weight: 700;
  padding: .15rem .5rem; border-radius: 4px; vertical-align: middle;
}
