/* ══════════════════════════════════════
   SHARED DESIGN TOKENS
══════════════════════════════════════ */

:root {
  --bg: #0e1a12;
  --felt: #163d22;
  --felt2: #1a4828;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.10);
  --border: rgba(255,255,255,0.10);
  --text: #f0f4f0;
  --muted: #7a9e82;
  --gold: #f5c842;
  --accent: #4ade80;
  --danger: #f87171;
  --warning: #fb923c;
  --info: #67c7ff;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --r: 14px;
}

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

html, body {
  height: 100%;
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── SCREENS ── */

.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* ══════════════════════════════════════
   HOME SCREEN
══════════════════════════════════════ */

#homeScreen {
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #1e3a28 0%, #0e1a12 60%, #070f0a 100%);
}

.home-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 5rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 4px 24px rgba(245,200,66,0.35);
}

.home-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
  width: 100%;
  max-width: 380px;
}

.home-tile {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 10px;
  background: var(--panel);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.home-tile:active {
  transform: scale(0.96);
}

.home-tile.game {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.07);
}

.home-tile.score {
  border-color: rgba(245,200,66,0.3);
  background: rgba(245,200,66,0.07);
}

.home-tile-icon {
  font-size: 2rem;
  line-height: 1;
}

.home-tile-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  margin-top: 6px;
  color: var(--text);
}

.home-tile-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.home-version {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 28px;
  opacity: 0.6;
}

/* ══════════════════════════════════════
   SHARED COMPONENTS (used by both screens)
══════════════════════════════════════ */

.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 0;
  flex-shrink: 0;
}

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

/* Back button with text label on mode picker */

#sbModeBack {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  height: auto;
  padding: 9px 24px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 24px;
}

.screen-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  flex: 1;
}

/* shared overlay / sheet */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8,16,10,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.overlay.hidden {
  display: none;
}

.sheet {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(160deg, #1e3a28, #0e1a12);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.sheet h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 1;
}

.sheet p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
  font-size: 0.9rem;
}

.field-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.field-input, .field-select {
  width: 100%;
  padding: 11px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 12px;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: #0e1a12;
}

.btn-ghost {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(248,113,113,0.15);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.25);
}

.btn-accent {
  background: rgba(74,222,128,0.15);
  color: var(--accent);
  border: 1px solid rgba(74,222,128,0.25);
}

.btn-warning {
  background: rgba(251,146,60,0.15);
  color: var(--warning);
  border: 1px solid rgba(251,146,60,0.25);
}

.btn-info {
  background: rgba(103,199,255,0.15);
  color: var(--info);
  border: 1px solid rgba(103,199,255,0.25);
}

/* toast */

.toast-wrap {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(14,26,18,0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease, toastOut 0.25s ease 3s forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* tag / pill */

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.tag.carry {
  color: var(--gold);
  border-color: rgba(245,200,66,0.3);
  background: rgba(245,200,66,0.1);
}

.tag.deal {
  color: var(--muted);
}

.tag.remain {
  color: var(--accent);
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.08);
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════
   GAME SCREEN STYLES
══════════════════════════════════════ */

#topbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 10px 0;
  flex-shrink: 0;
  width: 100%;
}

.score-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(6px,2vw,10px) clamp(6px,2vw,12px);
  text-align: center;
}

.score-chip.you {
  border-color: rgba(74,222,128,0.35);
  background: rgba(74,222,128,0.07);
}

.score-chip.leader {
  border-color: rgba(245,200,66,0.4);
}

.score-chip.winner-top {
  border-color: rgba(245,200,66,0.7);
  background: rgba(245,200,66,0.1);
}

.chip-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.3rem, 4.2vw, 1.8rem);
  color: var(--text);
  line-height: 1;
}

.chip-score.leading {
  color: var(--gold);
}

#statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  flex-shrink: 0;
  gap: 8px;
  width: 100%;
}

.status-left {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.status-right {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

#hands-area {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 10px;
  flex-shrink: 0;
  width: 100%;
}

.hand-slot {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: var(--r);
  padding: clamp(6px,2vw,10px) clamp(4px,1.5vw,8px);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: clamp(95px,26vw,130px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hand-slot.active {
  border-color: rgba(74,222,128,0.5);
  background: rgba(74,222,128,0.06);
}

.hand-slot.full {
  border-color: rgba(74,222,128,0.25);
}

.hand-slot.invalid {
  border-color: rgba(248,113,113,0.4);
  background: rgba(248,113,113,0.05);
}

.hand-num {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hand-type {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  min-height: 16px;
  line-height: 1.2;
}

.hand-type.none {
  color: var(--muted);
  font-weight: 400;
}

.hand-type.invalid-type {
  color: var(--danger);
}

.hand-cards-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  flex: 1;
}

.hand-card-pip {
  font-size: 0.92rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid rgba(255,255,255,0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.1s;
  color: #111111;
}

.hand-card-pip:active {
  background: #f0f0f0;
}

.hand-card-pip.red {
  color: #c81e1e;
}

.hand-card-pip.spade {
  color: #111111;
}

.hand-card-pip.club {
  color: #111111;
}

.hand-card-pip .pip-x {
  color: #aaaaaa;
  font-size: 0.6rem;
}

#cards-area {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 6px;
  -webkit-overflow-scrolling: touch;
}

#cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.card {
  aspect-ratio: 0.72;
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 6px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transition: transform 0.12s, border-color 0.12s;
  position: relative;
}

.card:active {
  transform: scale(0.95);
}

.card.red {
  color: #c81e1e;
}

.card .c-corner {
  font-size: clamp(1.2rem, 3.8vw, 1.45rem);
  font-weight: 900;
  line-height: 1;
}

.card .c-suit {
  font-size: clamp(2rem, 6.5vw, 2.6rem);
  text-align: center;
  line-height: 1;
}

.card .c-bot {
  font-size: clamp(1.2rem, 3.8vw, 1.45rem);
  font-weight: 900;
  line-height: 1;
  align-self: flex-end;
  transform: rotate(180deg);
}

#play-area {
  padding: 6px 0 calc(16px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

#playBtn {
  width: calc(100% - 48px);
  max-width: 420px;
  padding: clamp(12px,3.5vw,16px);
  background: var(--gold);
  color: #0e1a12;
  border: 0;
  border-radius: 16px;
  margin: 0 auto;
  font: inherit;
  font-size: clamp(0.9rem,2.8vw,1.1rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}

#playBtn:active {
  transform: scale(0.97);
}

#playBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#autoBtn {
  padding: 14px 16px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

/* game reveal overlay */

#revealOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8,16,10,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  padding: 10px 10px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto;
}

#revealOverlay.hidden {
  display: none;
}

.reveal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2px;
  flex-shrink: 0;
}

.reveal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--gold);
}

.reveal-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.round-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px;
  flex-shrink: 0;
}

.round-block.winning {
  border-color: rgba(74,222,128,0.4);
  background: rgba(74,222,128,0.05);
}

.round-block.carry {
  border-color: rgba(245,200,66,0.35);
  background: rgba(245,200,66,0.05);
}

.round-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.round-rows {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 6px;
}

.player-result {
  border-radius: 10px;
  padding: 7px 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  font-size: 0.72rem;
}

.player-result.winner {
  background: rgba(74,222,128,0.1);
  border-color: rgba(74,222,128,0.4);
}

.player-result.cancelled {
  background: rgba(245,200,66,0.08);
  border-color: rgba(245,200,66,0.3);
}

.player-result.ignored {
  opacity: 0.45;
}

.pr-name {
  font-weight: 700;
  font-size: 0.72rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr-kind {
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--accent);
}

.pr-kind.cancelled-kind {
  color: var(--gold);
}

.pr-kind.no-hand {
  color: var(--muted);
  font-weight: 400;
}

.pr-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  margin-top: 3px;
}

.pr-badge.win {
  background: var(--accent);
  color: #0e1a12;
}

.pr-badge.cancel {
  background: var(--gold);
  color: #0e1a12;
}

.round-outcome {
  font-size: 0.8rem;
  margin-top: 8px;
  font-weight: 500;
  color: var(--text);
}

/* game end overlay */

.end-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  color: var(--gold);
  line-height: 1;
}

.end-msg {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.confetti-row {
  display: flex;
  gap: 5px;
  margin: 14px 0;
}

.confetti-row span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--gold);
  animation: cFloat 1.4s ease-in-out infinite;
}

.confetti-row span:nth-child(even) {
  animation-delay: 0.3s;
  background: var(--accent);
}

@keyframes cFloat {
  0%, 100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(2.5);
  }
}

@keyframes dealIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card.deal-in {
  animation: dealIn 0.06s ease both;
}

@keyframes cardExit {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}

.card.removing {
  animation: cardExit 0.08s ease forwards;
  pointer-events: none;
}

/* fan reveal */

.all-hands-section {
  margin-top: 8px;
}

.all-hands-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.player-hands-row {
  margin-bottom: 10px;
}

.player-hands-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.player-hands-label .plabel-name {
  color: var(--text);
}

.player-hands-label .plabel-badge {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(74,222,128,0.15);
  color: var(--accent);
  border: 1px solid rgba(74,222,128,0.3);
}

.player-hands-label .plabel-badge.you-badge {
  background: rgba(103,199,255,0.15);
  color: #67c7ff;
  border-color: rgba(103,199,255,0.3);
}

.plabel-badge.deal-badge {
  background: rgba(74,222,128,0.12);
  color: var(--accent);
  border-color: rgba(74,222,128,0.25);
}

.hands-fan-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.hand-fan-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 4px 6px;
}

.hand-fan-wrap.hfw-win {
  border-color: rgba(74,222,128,0.45);
  background: rgba(74,222,128,0.06);
}

.hand-fan-wrap.hfw-cancel {
  border-color: rgba(245,200,66,0.35);
  background: rgba(245,200,66,0.05);
}

.hand-fan-wrap.hfw-none {
  opacity: 0.5;
}

.hand-fan-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.hand-fan-type {
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 6px;
  min-height: 13px;
  color: var(--accent);
}

.hand-fan-type.hft-none {
  color: var(--muted);
  font-weight: 400;
}

.hand-fan-type.hft-win {
  color: var(--accent);
}

.hand-fan-type.hft-cancel {
  color: var(--gold);
}

.fan-cards {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 52px;
  position: relative;
}

.fan-card {
  position: absolute;
  width: 32px;
  height: 46px;
  background: white;
  border-radius: 6px;
  border: 1.5px solid rgba(0,0,0,0.12);
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  font-size: 0.75rem;
  font-weight: 900;
  color: #111;
  transform-origin: bottom center;
  top: 4px;
  left: 50%;
}

.fan-card.red {
  color: #c81e1e;
}

.fan-card.fc-bonus {
  border-color: var(--gold, #f5c842);
  box-shadow: 0 0 8px 2px rgba(245,200,66,0.55), 0 3px 8px rgba(0,0,0,0.35);
}

.fc-bonus-star {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--gold, #f5c842);
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(245,200,66,0.8);
}

.fan-card .fc-top {
  line-height: 1;
  font-size: 0.75rem;
}

.fan-card .fc-suit {
  font-size: 1.1rem;
  line-height: 1;
}

.fan-card:nth-child(1) {
  margin-left: -50px;
  transform: rotate(-12deg);
  z-index: 1;
}

.fan-card:nth-child(2) {
  margin-left: -18px;
  transform: rotate(0deg);
  z-index: 2;
}

.fan-card:nth-child(3) {
  margin-left: 14px;
  transform: rotate(12deg);
  z-index: 3;
}

.hf-icon {
  font-size: 0.55rem;
}

.result-score-bar {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.rsb-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 6px;
  text-align: center;
  position: relative;
}

.rsb-chip.rsb-you {
  border-color: rgba(103,199,255,0.35);
  background: rgba(103,199,255,0.07);
}

.rsb-chip.rsb-lead {
  border-color: rgba(245,200,66,0.45);
  background: rgba(245,200,66,0.08);
}

.rsb-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rsb-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1;
  margin-top: 1px;
}

.rsb-chip.rsb-lead .rsb-score {
  color: var(--gold);
}

.rsb-chip .rpip-row {
  margin-top: 5px;
  gap: 3px;
}

.rsb-chip .rpip {
  width: 7px;
  height: 7px;
}

.rsb-crown {
  font-size: 0.75rem;
  position: absolute;
  top: -8px;
  right: 6px;
}

/* ══════════════════════════════════════
   SCOREBOARD SCREEN STYLES
══════════════════════════════════════ */

#scoreScreen {
  position: relative;
  overflow: hidden;
}

#scoreScreen .screen-header {
  justify-content: space-between;
}

#scoreContent {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 10px 0;
}

.sb-board {
  display: grid;
  gap: 10px;
}

.sb-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: background 0.25s, border-color 0.25s;
}

.sb-card.sb-winner {
  background: rgba(74,222,128,0.08);
  border: 2px solid rgba(74,222,128,0.5);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.12), var(--shadow);
}

.sb-dealer-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--gold);
  color: #0e1a12;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
}

.sb-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sb-name-input {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--border);
  border-radius: 0;
  padding: 5px 4px;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  outline: none;
  min-width: 0;
  flex: 1;
}

.sb-score-wrap {
  text-align: right;
  min-width: 90px;
}

.sb-points {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--text);
}

.sb-target {
  font-size: 0.72rem;
  color: var(--muted);
}

.sb-stepper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.sb-step-btn {
  font-size: 1.8rem;
  height: 58px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}

.sb-step-btn:active {
  transform: scale(0.96);
}

.sb-mini {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.sb-mini strong {
  color: var(--text);
}

.sb-new-game-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 0;
  background: rgba(74,222,128,0.15);
  color: var(--accent);
  border: 1px solid rgba(74,222,128,0.25);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

/* scoreboard bottom bar */

#scoreBottomBar {
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

#fullHouseBtn {
  padding: 13px 14px;
  border-radius: 12px;
  border: 0;
  background: rgba(248,113,113,0.15);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.25);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

#sbMenuBtn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sb-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 8px 10px;
}

/* scoreboard menu panel */

.sb-menu-panel {
  position: absolute;
  top: 52px;
  right: 10px;
  background: linear-gradient(160deg, #1e3a28, #0e1a12);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
  width: min(260px, 90vw);
  z-index: 30;
  display: none;
}

.sb-menu-panel.show {
  display: block;
}

.sb-menu-panel .btn {
  width: 100%;
  margin-bottom: 6px;
  display: block;
  text-align: left;
}

.sb-menu-panel .btn:last-child {
  margin-bottom: 0;
}

.sb-menu-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.sb-menu-select {
  flex: 1;
  padding: 10px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

/* scoreboard crash effect */

.sb-crash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  pointer-events: none;
  opacity: 1;
  transition: opacity 1s ease;
}

.sb-crash-overlay[hidden] {
  display: none;
}

.sb-crash-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(56px, 14vw, 120px);
  letter-spacing: 0.04em;
  color: var(--gold);
  text-shadow: 0 6px 24px rgba(245,200,66,0.5);
  animation: crashPop 0.9s ease forwards;
}

@keyframes crashPop {
  0% {
    transform: scale(0.6) rotate(-6deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(2deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes sbShake {
  0%, 100% {
    transform: none;
  }
  20% {
    transform: translate(-5px,2px);
  }
  40% {
    transform: translate(4px,-2px);
  }
  60% {
    transform: translate(-3px,2px);
  }
  80% {
    transform: translate(3px,-1px);
  }
}

.sb-shake {
  animation: sbShake 500ms ease;
}

/* scoreboard confetti */

.sb-confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.sb-confetti i {
  position: absolute;
  font-style: normal;
  animation: sbFall linear forwards;
}

@keyframes sbFall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.9;
  }
}

/* full house modal */

.fh-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.fh-backdrop[hidden] {
  display: none;
}

.fh-modal {
  background: linear-gradient(160deg, #1e3a28, #0e1a12);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 320px;
  width: calc(100% - 32px);
}

.fh-modal h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.fh-modal p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.fh-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* how to play */

.htp-modal {
  background: linear-gradient(160deg, #1e3a28, #0e1a12);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 380px;
  width: calc(100% - 32px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.htp-modal h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.htp-body {
  flex: 1;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.htp-body strong {
  color: var(--text);
}

.htp-body em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 380px) {
  .sb-points {
    font-size: 2rem;
  }
}

@media (max-width: 380px) {
  .sb-stepper {
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .sb-step-btn {
    height: 52px;
  }
}

/* ── WIN BANNER ── */

.win-banner {
  background: linear-gradient(135deg, rgba(245,200,66,0.18), rgba(74,222,128,0.10));
  border: 1px solid rgba(245,200,66,0.45);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
  text-align: center;
}

.win-banner-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  line-height: 1;
}

.win-banner-detail {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.win-banner-scores {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.wbs {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}

.wbs.wbs-winner {
  background: rgba(245,200,66,0.15);
  border-color: rgba(245,200,66,0.45);
  color: var(--gold);
}

.rsb-chip.rsb-winner {
  border-color: rgba(245,200,66,0.6);
  background: rgba(245,200,66,0.12);
}

.rsb-chip.rsb-winner .rsb-score {
  color: var(--gold);
}

/* ══════════════════════════════════════
   ANIMATED REVEAL
══════════════════════════════════════ */

#revealOverlay {
  overflow-y: auto;
}

.reveal-round-header {
  text-align: center;
  padding: 2px 0 4px;
  flex-shrink: 0;
}

.reveal-round-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.reveal-round-outcome {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  min-height: 14px;
  transition: color 0.3s;
}

.reveal-round-outcome.outcome-win {
  color: var(--accent);
}

.reveal-round-outcome.outcome-carry {
  color: var(--gold);
}

.reveal-round-outcome.outcome-bonus {
  color: var(--gold);
  font-weight: 700;
  animation: bonusPop 0.35s ease;
}

@keyframes bonusPop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Player reveal cards — 2x2 grid */

.reveal-players-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 6px;
  row-gap: 12px;
  flex-shrink: 0;
  margin-top: 10px;
}

.reveal-player-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 8px;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s ease, border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.reveal-player-card.visible {
  opacity: 1;
  transform: none;
}

.reveal-player-card.rpc-winner {
  border-color: rgba(74,222,128,0.6);
  background: rgba(74,222,128,0.09);
  box-shadow: 0 0 0 1px rgba(74,222,128,0.2), 0 6px 20px rgba(74,222,128,0.12);
}

.reveal-player-card.rpc-cancelled {
  border-color: rgba(245,200,66,0.4);
  background: rgba(245,200,66,0.06);
}

.reveal-player-card.rpc-ignored {
  opacity: 0.45;
}

.rpc-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rpc-name-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}

.rpc-name-badge.badge-win {
  background: var(--accent);
  color: #0e1a12;
}

.rpc-name-badge.badge-cancel {
  background: var(--gold);
  color: #0e1a12;
}

.rpc-hand-type {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  min-height: 16px;
}

.rpc-hand-type.rht-none {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}

/* Round progress dots */

.reveal-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 2px 0;
  flex-shrink: 0;
}

.rp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--panel2);
  border: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}

.rp-dot.active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.2);
}

.rp-dot.done-win {
  background: var(--accent);
  border-color: var(--accent);
}

.rp-dot.done-carry {
  background: rgba(245,200,66,0.4);
  border-color: rgba(245,200,66,0.4);
}

/* Score bar during reveal */

.reveal-scores-bar {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 5px;
  flex-shrink: 0;
}

.rscore-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  transition: background 0.4s, border-color 0.4s;
}

.rscore-chip.you {
  border-color: rgba(103,199,255,0.3);
}

.rscore-chip.scoring {
  background: rgba(74,222,128,0.12);
  border-color: rgba(74,222,128,0.5);
  animation: scoreFlash 0.5s ease;
}

@keyframes scoreFlash {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.rscore-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rscore-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.2rem, 7vw, 3rem);
  color: var(--text);
  line-height: 1;
}

.rscore-chip.winner-chip .rscore-val {
  color: var(--gold);
}

.rscore-chip.chip-eleven {
  background: rgba(245,200,66,0.12);
  border-color: rgba(245,200,66,0.55);
  animation: elevenPop 0.45s ease;
}

.rscore-chip.chip-eleven .rscore-val {
  color: var(--gold);
}

.rscore-chip.sweep-pulse {
  animation: sweepPulse 0.7s ease infinite;
}

.arr-pulse {
  animation: arrPulse 1s ease infinite;
}

@keyframes arrPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245,200,66,0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(245,200,66,0.3);
  }
}

@keyframes sweepPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245,200,66,0);
    border-color: var(--border);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(245,200,66,0.25);
    border-color: rgba(245,200,66,0.6);
  }
}

.rpip-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.rpip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.rpip.rpip-won {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.15);
}

.rpip.rpip-carry {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.15);
  opacity: 0.7;
}

.rpip.rpip-bonus {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.15);
}

@keyframes elevenPop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.18);
  }
  65% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

/* Continue button during reveal */

/* reveal-continue-btn removed */

.reveal-continue-btn-unused {
  padding: 11px;
  background: var(--gold);
  color: #0e1a12;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-top: 2px;
}

.reveal-continue-btn.visible {
  opacity: 1;
}

@keyframes winnerPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(74,222,128,0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(74,222,128,0);
  }
}

.rpc-winner-pulse {
  animation: winnerPulse 1s ease 2;
}

.hand-order-warn {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--danger);
  margin-top: 2px;
  line-height: 1.2;
}

/* ── ONLINE TILE ── */

.home-tile.online {
  border-color: rgba(103,199,255,0.3);
  background: rgba(103,199,255,0.07);
}

/* ── ONLINE SHARED ── */

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 12px 0;
}

.error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 6px;
  min-height: 18px;
}

.code-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 6px;
}

.code-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.8rem;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-align: center;
  padding: 12px;
  background: rgba(245,200,66,0.08);
  border: 1px solid rgba(245,200,66,0.3);
  border-radius: 14px;
}

.code-input {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

.players-list {
  display: grid;
  gap: 8px;
}

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

.player-slot.filled {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.06);
}

.player-slot.empty {
  opacity: 0.45;
  border-style: dashed;
}

.slot-name {
  font-weight: 700;
  flex: 1;
  font-size: 0.95rem;
}

.slot-you {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 700;
}

.slot-host {
  font-size: 0.65rem;
  color: var(--gold);
  font-weight: 700;
}

.waiting-msg {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.wait-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  transition: background 0.3s, border-color 0.3s;
}

.wait-chip.submitted {
  background: rgba(74,222,128,0.1);
  border-color: rgba(74,222,128,0.4);
}

.wait-chip-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.wait-chip-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--text);
  line-height: 1.1;
  margin-top: 2px;
}

.wait-chip-status {
  font-size: 0.7rem;
  margin-top: 3px;
  color: var(--muted);
}

.wait-chip.submitted .wait-chip-status {
  color: var(--accent);
}

/* ── ONLINE PANEL SYSTEM ── */

.online-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.online-panel-active {
  display: flex !important;
}

.online-panel-hidden {
  display: none !important;
}

/* Home panel specific */

#onlineHomePanel.online-panel-active {
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 0;
  overflow-y: auto;
}

/* Lobby panel */

#onlineLobbyPanel.online-panel-active {
  padding: 14px;
  gap: 10px;
  overflow-y: auto;
}

/* Game panel */

#onlineGamePanel.online-panel-active {
  overflow: hidden;
}

/* Fixed overlays */

.online-fixed-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(8,16,10,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
}

.reveal-overlay-style {
  z-index: 40;
  background: rgba(8,16,10,0.96);
  align-items: stretch;
  justify-content: flex-start;
  padding: 10px 10px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto;
}

.online-overlay-active {
  display: flex !important;
}

/* ── ONLINE SCREEN STRUCTURE ── */

#onlineScreen {
  flex-direction: column;
  overflow: hidden;
}

#onlineContainer {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#onlineWaitingOverlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(8,16,10,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
}

#onlineRevealOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8,16,10,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-direction: column;
  padding: 10px 10px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto;
}

/* ══════════════════════════════════════
   CRASH ANIMATION OVERLAY
══════════════════════════════════════ */

#crashAnim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8,16,10,0.97);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#crashAnim.show {
  opacity: 1;
}

#crashAnim.hide {
  opacity: 0;
}

.ca-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(245,200,66,0.3) 0%, transparent 65%);
  animation: caBg 0.7s ease-out forwards;
}

@keyframes caBg {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  60% {
    opacity: 1;
    transform: scale(1.3);
  }
  to {
    opacity: 0.7;
    transform: scale(1);
  }
}

.ca-word {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(5rem, 24vw, 9rem);
  color: var(--gold);
  letter-spacing: 0.06em;
  line-height: 1;
  z-index: 2;
  text-shadow: 0 0 40px rgba(245,200,66,0.9), 0 0 100px rgba(245,200,66,0.5);
  animation: caWord 0.5s cubic-bezier(0.15,1.5,0.5,1) 0.05s both;
}

@keyframes knockPop {
  0% {
    transform: scale(0) rotate(-6deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.15) rotate(2deg);
    opacity: 1;
  }
  80% {
    transform: scale(0.95) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes caWord {
  from {
    opacity: 0;
    transform: scale(4) rotate(-5deg);
  }
  70% {
    opacity: 1;
    transform: scale(0.9) rotate(1deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.ca-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  color: var(--text);
  letter-spacing: 0.14em;
  z-index: 2;
  margin-top: 6px;
  animation: caFadeUp 0.4s ease 0.55s both;
}

.ca-sub {
  font-size: 0.88rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  z-index: 2;
  margin-top: 4px;
  animation: caFadeUp 0.4s ease 0.72s both;
}

@keyframes caFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ca-suit {
  position: absolute;
  font-size: 1.8rem;
  z-index: 3;
  animation: caSuit var(--d) ease-out var(--dl) both;
  opacity: 0;
}

@keyframes caSuit {
  0% {
    opacity: 1;
    transform: translate(0,0) rotate(0deg) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x),var(--y)) rotate(var(--r)) scale(0.3);
  }
}

/* ══════════════════════════════════════
   DESKTOP / LARGE SCREEN LAYOUT
   Cap to phone-width column, centred
══════════════════════════════════════ */

@media (min-width: 600px) {
  body {
    align-items: center;
    background: #070f0a;
  }
}

/* Centre a phone-sized column */

@media (min-width: 600px) {
  #homeScreen, #gameScreen, #scoreScreen, #onlineScreen {
    max-width: 480px;
    width: 100%;
    box-shadow: 0 0 80px rgba(0,0,0,0.6);
    background: var(--bg);
    position: relative;
  }
}

/* Game screen: more cards per row so they're smaller */

@media (min-width: 600px) {
  #cards-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
}

/* Slightly tighter card text at desktop sizes */

@media (min-width: 600px) {
  .card .c-corner {
    font-size: 1.2rem;
  }
}

@media (min-width: 600px) {
  .card .c-suit {
    font-size: 2rem;
  }
}

@media (min-width: 600px) {
  .card .c-bot {
    font-size: 1.2rem;
  }
}

/* Reveal overlays should also stay within the column */

@media (min-width: 600px) {
  #revealOverlay, #gameMenuOverlay, #endOverlay, #onlineRevealOverlay, #onlineWaitingOverlay, #crashAnim {
    align-items: center;
  }
}

@media (min-width: 600px) {
  #revealOverlay > *, #onlineRevealOverlay > * {
    width: 100%;
    max-width: 480px;
  }
}

@media (min-width: 900px) {
  #homeScreen, #gameScreen, #scoreScreen, #onlineScreen {
    max-width: 520px;
  }
}

@media (min-width: 900px) {
  #cards-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (min-width: 900px) {
  #revealOverlay > *, #onlineRevealOverlay > * {
    max-width: 520px;
  }
}

/* ══════════════════════════════════════
   HOME HOW TO PLAY
══════════════════════════════════════ */

.home-htp-btn {
  margin-top: 20px;
  padding: 9px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s;
}

.home-htp-btn:hover {
  border-color: rgba(245,200,66,0.4);
  color: var(--gold);
}

.home-install-btn {
  margin-top: 10px;
  padding: 10px 22px;
  background: rgba(245,200,66,0.12);
  border: 1.5px solid rgba(245,200,66,0.45);
  border-radius: 22px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.home-install-btn:hover {
  background: rgba(245,200,66,0.22);
  border-color: rgba(245,200,66,0.7);
}

.home-install-btn.hidden {
  display: none;
}

.install-tip {
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid rgba(245,200,66,0.35);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  line-height: 1.7;
  cursor: pointer;
  animation: fadeIn 0.25s ease;
}

.htp-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8,16,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 16px 0;
  overflow-y: auto;
  transition: opacity 0.25s ease;
}

.htp-overlay.hidden {
  display: none;
}

.htp-sheet {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  background: linear-gradient(160deg, #1a3322, #0e1a12);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  animation: htpSlideUp 0.3s cubic-bezier(0.32,0.72,0,1) both;
  margin-bottom: 16px;
}

@keyframes htpSlideUp {
  from {
    transform: translateY(-16px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.htp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.htp-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.htp-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.htp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.htp-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.htp-section-body {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.htp-section-body strong {
  color: var(--text);
}

.htp-rankings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.htp-rank {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.htp-rank strong {
  color: var(--text);
}

.htp-rank-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(245,200,66,0.12);
  border: 1px solid rgba(245,200,66,0.3);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.htp-got-it {
  margin: 0 16px calc(16px + env(safe-area-inset-bottom));
  padding: 13px;
  background: var(--gold);
  color: #0e1a12;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   LIVE SCOREBOARD
══════════════════════════════════════ */

.lsb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.lsb-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  flex: 1;
}

.lsb-code {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.2em;
}

.lsb-back {
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.lsb-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lsb-player {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.lsb-player.lsb-winner {
  border-color: rgba(245,200,66,0.5);
  background: rgba(245,200,66,0.08);
}

.lsb-player.lsb-lead {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.05);
}

.lsb-name-wrap {
  flex: 1;
  min-width: 0;
}

.lsb-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lsb-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  width: 100%;
  padding: 2px 0;
  outline: none;
}

.lsb-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 2px;
  display: inline-block;
}

.lsb-badge.dealer {
  background: rgba(103,199,255,0.15);
  color: #67c7ff;
  border: 1px solid rgba(103,199,255,0.3);
}

.lsb-badge.winner {
  background: rgba(245,200,66,0.15);
  color: var(--gold);
  border: 1px solid rgba(245,200,66,0.35);
}

.lsb-score-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lsb-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--text);
  line-height: 1;
  min-width: 2rem;
  text-align: center;
}

.lsb-player.lsb-winner .lsb-score {
  color: var(--gold);
}

.lsb-step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.1s;
}

.lsb-step:active {
  background: var(--panel);
}

.lsb-step.hidden {
  visibility: hidden;
  pointer-events: none;
}

.lsb-footer {
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lsb-members {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 12px;
  flex-shrink: 0;
}

.lsb-member-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}

.lsb-member-chip.scorer {
  border-color: rgba(245,200,66,0.4);
  color: var(--gold);
}

.lsb-member-chip.offline {
  opacity: 0.4;
}

.lsb-scorer-badge {
  font-size: 0.72rem;
  color: var(--gold);
  text-align: center;
  padding: 2px 0 4px;
}

.lsb-action-row {
  display: flex;
  gap: 8px;
}

.lsb-btn {
  flex: 1;
  padding: 11px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.lsb-btn.gold {
  background: var(--gold);
  color: #0e1a12;
  border-color: var(--gold);
}

.lsb-btn.danger {
  color: var(--danger);
  border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.06);
}

/* Setup sheet */

.lsb-setup {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
}

.lsb-setup-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.lsb-setup-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: -6px;
}

.lsb-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.lsb-field {
  width: 100%;
  padding: 11px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.lsb-player-setup {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lsb-player-setup input {
  flex: 1;
  padding: 9px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

/* Join sheet */

.lsb-join {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 10px;
}

.lsb-join-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--gold);
  letter-spacing: 0.06em;
}

/* ── LIVE SB SETUP REDESIGN ── */

.lsb-setup-input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.lsb-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.08);
  color: var(--danger);
  font-size: 0.7rem;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.lsb-add-player-btn {
  margin-top: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 9px;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.lsb-create-btn {
  padding: 12px 22px;
  background: var(--gold);
  color: #0e1a12;
  border: 0;
  border-radius: 11px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.lsb-join-link {
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lsb-join-link:hover {
  color: var(--text);
}

/* ── SCOREBOARD MODE PICKER ── */

.sb-mode-tile {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 12px;
  background: var(--panel);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.sb-mode-tile:active {
  transform: scale(0.96);
}

#sbModeStandard {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.07);
}

#sbModeLive {
  border-color: rgba(245,200,66,0.3);
  background: rgba(245,200,66,0.07);
}

.sb-mode-icon {
  font-size: 2rem;
  line-height: 1;
}

.sb-mode-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  margin-top: 6px;
  color: var(--text);
}

.sb-mode-desc {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* ── SCOREBOARD MODE LAYOUT ── */

#sbModePicker {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 0;
  background: linear-gradient(160deg,#1a3322,#0e1a12 60%,#070f0a);
}

.sb-hidden {
  display: none !important;
}

/* ── ONLINE GAME PANEL — matches local layout ── */

#onlineCardsGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

#onlineTopbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 10px 0;
  flex-shrink: 0;
  width: 100%;
}

#onlineHandsArea {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 10px;
  flex-shrink: 0;
  width: 100%;
}

/* Desktop responsive — matches #cards-grid breakpoints */

@media (min-width: 600px) {
  #onlineCardsGrid {
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
}

@media (min-width: 900px) {
  #onlineCardsGrid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* ── CELEBRATION SELFIE ── */

@keyframes selfieFlashIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes selfieFlashOut {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* ── ACTIVE GAMES COUNT ── */

.home-active-games {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-top: 8px;
  padding: 4px 12px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 999px;
}

/* ── HAND SWAP ── */

.hand-num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.hand-swap-btn {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 0.7rem;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.hand-swap-btn:active {
  background: rgba(255,255,255,0.12);
}

.hand-swap-btn.swap-pending {
  background: rgba(103,199,255,0.2);
  border-color: rgba(103,199,255,0.5);
  color: #67c7ff;
}

/* ── BUILD VERSION ── */

.home-build-ver {
  font-size: 0.6rem;
  color: var(--muted);
  opacity: 0.35;
  margin-top: 6px;
  letter-spacing: 0.08em;
}

/* ── WAITING ANIMATION ── */

.waiting-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0 8px;
}

.waiting-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.7;
  animation: waitBounce 1.2s ease-in-out infinite;
}

.waiting-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.waiting-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes waitBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

