/* =============================================================================
   Back Alley — Styles v0.4.0
   Lobby (parchment) + Game table (dark baize)
   ============================================================================= */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=IM+Fell+English:ital@0;1&display=swap');

:root {
  --felt:        #1a3d2b;
  --felt-dark:   #122d1f;
  --felt-light:  #235238;
  --felt-edge:   #0d2318;
  --gold:        #c8a84b;
  --gold-light:  #e8d5a3;
  --gold-dim:    #8b6914;
  --parchment:   #f0e6c8;
  --ink:         #1a0a00;
  --red:         #8b0000;
  --red-light:   #c0392b;
  --card-bg:     #faf7f0;
  --card-border: #d4c9a8;
  --card-shadow: rgba(0,0,0,0.5);
  --text-light:  #e8d5a3;
  --text-dim:    #8fad96;
  --active-glow: rgba(200,168,75,0.35);
}

body {
  min-height: 100vh;
  font-family: 'IM Fell English', Georgia, serif;
  background-color: #1a1008;
  background-image: url('/images/bg.jpg');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  color: #2c1a0e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Screen management ── */
.screen { display: none; }
.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Game screen overrides body layout */
.screen.game-screen.active {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  position: fixed;
  inset: 0;
  padding: 0;
  background:
    radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%);
  background-attachment: fixed;
  overflow: hidden;
}

/* Felt texture */
.screen.game-screen.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  pointer-events: none;
  z-index: 0;
}

/* Table edge ring */
.screen.game-screen.active::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(200,168,75,0.15);
  border-radius: 32px;
  pointer-events: none;
  z-index: 0;
}

/* ── Parchment card ── */
.card {
  background: linear-gradient(160deg, #f0e6c8 0%, #e8d5a3 40%, #d4b978 100%);
  border: 2px solid #8b6914;
  border-radius: 4px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 0 0 1px #c8a84b,
    0 8px 32px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
}

.card::before, .card::after {
  content: '♠';
  position: absolute;
  font-size: 1rem;
  color: #8b6914;
  opacity: 0.5;
}
.card::before { top: 0.6rem; left: 0.8rem; }
.card::after  { bottom: 0.6rem; right: 0.8rem; transform: rotate(180deg); }

/* ── Typography ── */
h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  font-weight: 600;
  text-align: center;
  color: #1a0a00;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  margin-bottom: 0.2rem;
}

h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  color: #1a0a00;
  margin-bottom: 1.5rem;
}

.subtitle {
  text-align: center;
  font-style: italic;
  color: #5c3d1a;
  font-size: 0.95rem;
  margin-bottom: 2rem;
  letter-spacing: 0.03em;
}

/* ── Form fields ── */
.field { margin-bottom: 1.2rem; }

label {
  display: block;
  font-size: 0.85rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: #5c3d1a;
  margin-bottom: 0.4rem;
}

input[type="text"], select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: rgba(255,255,255,0.45);
  border: 1px solid #8b6914;
  border-radius: 2px;
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 1rem;
  color: #1a0a00;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

input[type="text"]:focus, select:focus {
  border-color: #5c3d1a;
  background: rgba(255,255,255,0.65);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b6914' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

/* ── Buttons ── */
.button-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary, .btn-secondary, .btn-copy {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  padding: 0.7rem 1.2rem;
  transition: all 0.15s;
  flex: 1;
}

.btn-primary {
  background: #2c1a0e;
  color: #e8d5a3;
  border: 1px solid #8b6914;
}
.btn-primary:hover { background: #1a0a00; color: #f0e6c8; }

.btn-secondary {
  background: transparent;
  color: #2c1a0e;
  border: 1px solid #8b6914;
}
.btn-secondary:hover { background: rgba(0,0,0,0.08); }

.btn-primary.hidden { display: none; }

/* ── Room code display ── */
.room-code-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.08);
  border: 1px solid #8b6914;
  border-radius: 2px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.room-code-display .label {
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: #5c3d1a;
  white-space: nowrap;
}

.room-code-display .code {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: #1a0a00;
  flex: 1;
}

.btn-copy {
  flex: 0;
  white-space: nowrap;
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  background: transparent;
  color: #5c3d1a;
  border: 1px solid #8b6914;
}
.btn-copy:hover { background: rgba(0,0,0,0.08); }

/* ── Player list ── */
.player-list {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0,0,0,0.06);
  border-left: 3px solid #8b6914;
  font-size: 1rem;
}

.player-item .badge {
  font-size: 0.7rem;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: #8b6914;
  margin-left: auto;
}

/* ── Status & errors ── */
.status-msg {
  text-align: center;
  font-style: italic;
  color: #5c3d1a;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

.error {
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  background: rgba(120,0,0,0.1);
  border-left: 3px solid #8b0000;
  color: #5c0000;
  font-size: 0.9rem;
  font-style: italic;
}

/* ── Section label ── */
label.section-label {
  display: block;
  font-size: 0.8rem;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: #5c3d1a;
  margin-bottom: 0.6rem;
  margin-top: 0.2rem;
}

/* ── Variant checkboxes ── */
.variant-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.variant-row input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: #5c3d1a;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}

.variant-label {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  color: #1a0a00;
  cursor: pointer;
  line-height: 1.3;
}

.variant-desc {
  font-size: 0.78rem;
  font-style: italic;
  color: #7a5530;
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* ── Game length toggle ── */
#game-length-control {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: rgba(0,0,0,0.05);
  border: 1px solid #c8a84b;
  border-radius: 2px;
}

.toggle-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.btn-toggle {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  padding: 0.45rem 1.1rem;
  border: 1px solid #8b6914;
  border-radius: 2px;
  background: transparent;
  color: #5c3d1a;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-toggle.active {
  background: #2c1a0e;
  color: #e8d5a3;
  border-color: #2c1a0e;
}

.btn-toggle:hover:not(.active) { background: rgba(0,0,0,0.08); }

.toggle-desc { display: block; margin-top: 0.3rem; }

/* ── Mobile tweaks (lobby) ── */
@media (max-width: 480px) {
  .card { padding: 2rem 1.25rem; }
  h1    { font-size: 2rem; }
  .button-row { flex-direction: column; }
}

/* =============================================================================
   GAME TABLE STYLES
   ============================================================================= */

/* ── Opponent zones ── */
#opponents {
  position: relative;
  z-index: 1;
  padding: 12px 16px 0;
}

.opponent-zone { transition: all 0.3s ease; }

.opponent-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opponent-stats {
  display: flex;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: 'Crimson Text', Georgia, serif;
}

.opponent-stats .stat {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(200,168,75,0.2);
  border-radius: 3px;
  padding: 1px 5px;
}

.opponent-stats .stat.highlight {
  color: var(--gold);
  border-color: rgba(200,168,75,0.5);
}

.opp-card-back {
  width: 32px;
  height: 48px;
  border-radius: 4px;
  background: linear-gradient(135deg, #1a3a6a 0%, #0d2348 50%, #1a3a6a 100%);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 1px 1px 4px rgba(0,0,0,0.6);
}

.opponent-zone.active-turn .opponent-name { color: var(--gold); }

.opponent-zone.active-turn::after {
  content: '▼';
  font-size: 0.6rem;
  color: var(--gold);
  animation: pulse-down 1s ease-in-out infinite;
}

@keyframes pulse-down {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50%       { opacity: 0.4; transform: translateY(3px); }
}

/* ── Play area ── */
#play-area {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 8px 24px;
}

#trump-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(200,168,75,0.25);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 70px;
}

.trump-label {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.trump-suit { font-size: 1.6rem; line-height: 1; }
.trump-suit.hearts, .trump-suit.diamonds { color: var(--red-light); }
.trump-suit.spades,  .trump-suit.clubs   { color: var(--text-light); }
.trump-suit.none { color: var(--text-dim); font-size: 0.75rem; font-style: italic; }

#trick-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 130px;
  justify-content: center;
}

#trick-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-height: 90px;
}

.trick-card-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trick-card-slot .slot-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
}

#trick-status {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--text-dim);
  min-height: 1.2em;
  text-align: center;
  font-family: 'Crimson Text', Georgia, serif;
}

/* ── Playing cards ── */
.playing-card {
  width: 58px;
  height: 84px;
  border-radius: 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 2px 3px 8px var(--card-shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 5px;
  cursor: default;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.playing-card.red    { color: var(--red-light); }
.playing-card.black  { color: #1a0a00; }
.playing-card.blooper {
  background: linear-gradient(135deg, #1a0a2e 0%, #2d1060 50%, #1a0a2e 100%);
  color: #d4b8ff;
  border-color: #6a40c0;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.card-corner.bottom {
  transform: rotate(180deg);
  align-self: flex-end;
}

.card-rank {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
}

.card-suit-small { font-size: 0.65rem; line-height: 1; }

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0.15;
}

.playing-card.blooper .card-rank  { font-size: 0.65rem; color: #d4b8ff; }
.playing-card.blooper .card-center { font-size: 1rem; opacity: 0.5; color: #d4b8ff; }

/* Hand cards — larger */
#hand-cards .playing-card {
  width: 68px;
  height: 98px;
  cursor: pointer;
}

#hand-cards .playing-card .card-rank   { font-size: 1rem; }
#hand-cards .playing-card .card-center { font-size: 1.7rem; }

#hand-cards .playing-card.playable {
  border-color: var(--gold);
  box-shadow: 2px 3px 8px var(--card-shadow), 0 0 0 1px rgba(200,168,75,0.4);
}

#hand-cards .playing-card.not-playable {
  opacity: 0.45;
  cursor: not-allowed;
}

#hand-cards .playing-card.not-playable:hover { transform: none; }

/* ── Player bar ── */
#player-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(200,168,75,0.2);
  border-bottom: 1px solid rgba(200,168,75,0.1);
  font-family: 'Crimson Text', Georgia, serif;
}

.player-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 3px;
}

#player-stats { display: flex; gap: 12px; flex-wrap: wrap; }

.stat-item { font-size: 0.88rem; color: var(--text-dim); }
.stat-item strong { color: var(--text-light); font-variant-numeric: tabular-nums; }
.stat-item.sandbagged strong { color: #f0a070; }

#player-actions { display: flex; align-items: center; gap: 10px; }

.phase-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid rgba(200,168,75,0.3);
  color: var(--text-dim);
  background: rgba(0,0,0,0.3);
}

.phase-badge.bidding  { color: #f0c060; border-color: rgba(240,192,96,0.5); }
.phase-badge.playing  { color: #80d090; border-color: rgba(128,208,144,0.5); }
.phase-badge.scoring  { color: #a0b8ff; border-color: rgba(160,184,255,0.5); }
.phase-badge.your-turn {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(200,168,75,0.1);
  animation: badge-pulse 1.5s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 8px rgba(200,168,75,0.5); }
}

.btn-table {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 5px 14px;
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 2px;
  background: rgba(0,0,0,0.3);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-table:hover {
  background: rgba(200,168,75,0.15);
  border-color: var(--gold);
}

/* ── Hand container ── */
#hand-container {
  position: relative;
  z-index: 2;
  padding: 12px 20px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 130px;
}

#hand-cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: relative;
}

/* ── Bid panel ── */
#bid-panel {
  position: absolute;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(420px, 90vw);
}

#bid-panel-inner {
  background: linear-gradient(160deg, #2a1e0e 0%, #1a1008 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 0 0 1px rgba(200,168,75,0.15);
}

.bid-title {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 12px;
  text-align: center;
}

#bid-buttons { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }

.bid-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  padding: 7px 14px;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.12s;
  min-width: 44px;
  text-align: center;
}

.bid-btn:hover {
  background: rgba(200,168,75,0.2);
  border-color: var(--gold);
  color: #fff;
}

.bid-btn.board-bid {
  background: rgba(139,0,0,0.2);
  border-color: rgba(139,0,0,0.6);
  color: #f0a0a0;
}

.bid-btn.board-bid:hover {
  background: rgba(139,0,0,0.4);
  border-color: var(--red-light);
  color: #ffd0d0;
}

.bid-error {
  margin-top: 10px;
  font-size: 0.8rem;
  font-style: italic;
  color: #f0a0a0;
  text-align: center;
  font-family: 'Crimson Text', Georgia, serif;
}

/* ── Round banner ── */
#round-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  pointer-events: none;
}

#round-banner-inner {
  background: rgba(10,6,2,0.92);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 20px 40px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold-light);
  box-shadow: 0 0 40px rgba(200,168,75,0.3);
  animation: banner-in 0.3s ease-out;
}

@keyframes banner-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Score panel — slide-in from right, always available ── */
#score-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(340px, 92vw);
  height: 100vh;
  background: linear-gradient(160deg, #f0e6c8 0%, #e8d5a3 40%, #d4b978 100%);
  border-left: 2px solid var(--gold-dim);
  box-shadow: -8px 0 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(200,168,75,0.2);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#score-panel.open {
  transform: translateX(0);
}

#scorecard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(139,105,20,0.4);
  background: rgba(0,0,0,0.08);
  flex-shrink: 0;
}

#scorecard-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--ink);
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--gold-dim);
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
  line-height: 1;
}
.btn-close:hover { color: var(--ink); }

#scorecard-body {
  overflow-y: auto;
  padding: 14px 16px;
  flex: 1;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: var(--ink);
}

.score-table th {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 5px 6px;
  border-bottom: 1px solid rgba(139,105,20,0.3);
  text-align: center;
}
.score-table th:first-child { text-align: left; }

.score-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}
.score-table td:first-child { text-align: left; font-weight: 600; }
.score-table tr.current-round td { background: rgba(200,168,75,0.15); font-weight: 600; }
.score-table tr:last-child td { border-bottom: none; }

.score-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.score-total-card {
  flex: 1;
  min-width: 90px;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(139,105,20,0.3);
  border-radius: 3px;
  padding: 8px 10px;
  text-align: center;
}

.score-total-card .player-label {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-total-card .total-pts {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.score-total-card .total-bags {
  font-size: 0.68rem;
  color: #7a5530;
  margin-top: 2px;
}

/* ── Game over overlay ── */
#gameover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameover-modal {
  background: linear-gradient(160deg, #f0e6c8 0%, #e8d5a3 40%, #d4b978 100%);
  border: 2px solid var(--gold-dim);
  border-radius: 4px;
  padding: 32px 40px;
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 0 0 1px var(--gold), 0 24px 64px rgba(0,0,0,0.9);
}

#gameover-modal h2 { font-family: 'Cinzel', serif; font-size: 1.8rem; color: var(--ink); margin-bottom: 20px; }

#gameover-results { display: flex; flex-direction: column; gap: 8px; }

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0,0,0,0.07);
  border-radius: 3px;
  font-size: 0.95rem;
  color: var(--ink);
}

.result-row.winner {
  background: rgba(200,168,75,0.2);
  border: 1px solid rgba(200,168,75,0.5);
  font-weight: 600;
}

.result-rank { font-family: 'Cinzel', serif; font-size: 0.75rem; color: var(--gold-dim); width: 24px; }
.result-name { flex: 1; text-align: left; padding-left: 8px; }
.result-pts  { font-variant-numeric: tabular-nums; font-weight: 600; }
.result-bags { font-size: 0.72rem; color: #7a5530; margin-left: 8px; }

.gameover-scorecard-wrap {
  margin-top: 20px;
  text-align: left;
}

.gameover-scorecard-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
  text-align: center;
  border-top: 1px solid rgba(139,105,20,0.3);
  padding-top: 16px;
}

/* ── Bid confirmation ── */
.bid-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.bid-confirm-text {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold-light);
  letter-spacing: 0.05em;
}

.bid-confirm-text strong { color: #fff; }

.bid-confirm-btns {
  display: flex;
  gap: 10px;
}

.bid-confirm-yes {
  background: rgba(0,120,0,0.3);
  border-color: rgba(0,180,0,0.5);
  color: #90e090;
}

.bid-confirm-yes:hover {
  background: rgba(0,150,0,0.4);
  border-color: #90e090;
}

.bid-confirm-no {
  background: rgba(120,0,0,0.3);
  border-color: rgba(180,0,0,0.5);
  color: #e09090;
}

.bid-confirm-no:hover {
  background: rgba(150,0,0,0.4);
  border-color: #e09090;
}

/* ── Play card confirmation ── */
#play-confirm {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 16px;
  background: rgba(10,6,2,0.85);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  color: var(--gold-light);
  position: relative;
  z-index: 5;
}

#play-confirm.active { display: flex; }

.play-confirm-text strong { color: #fff; margin: 0 4px; }

.play-confirm-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 3px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.12s;
}

.play-confirm-btn.yes {
  background: rgba(0,120,0,0.3);
  border-color: rgba(0,180,0,0.5);
  color: #90e090;
}

.play-confirm-btn.yes:hover {
  background: rgba(0,150,0,0.4);
}

.play-confirm-btn.no {
  background: rgba(80,60,20,0.3);
  border-color: var(--gold-dim);
  color: var(--text-dim);
}

.play-confirm-btn.no:hover {
  background: rgba(200,168,75,0.1);
  color: var(--gold-light);
}


.join-link-hint {
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  background: rgba(0,0,0,0.06);
  border-left: 3px solid #8b6914;
  font-size: 0.85rem;
  font-style: italic;
  color: #5c3d1a;
  text-align: left;
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Felt colour themes ── */
body[data-felt="green"] {
  --felt:      #1a3d2b;
  --felt-dark: #122d1f;
  --felt-light:#235238;
  --felt-edge: #0d2318;
}
body[data-felt="blue"] {
  --felt:      #1a2b4a;
  --felt-dark: #101d35;
  --felt-light:#243d64;
  --felt-edge: #0a1525;
}
body[data-felt="gold"] {
  --felt:      #4a3500;
  --felt-dark: #332500;
  --felt-light:#5e4500;
  --felt-edge: #221800;
}
body[data-felt="red"] {
  --felt:      #4a1020;
  --felt-dark: #350a16;
  --felt-light:#5e162a;
  --felt-edge: #22060e;
}
body[data-felt="burgundy"] {
  --felt:      #3a0a2a;
  --felt-dark: #28061e;
  --felt-light:#4a1038;
  --felt-edge: #180312;
}

/* ── Felt swatch picker ── */
.felt-swatch-row {
  display: flex;
  gap: 10px;
  padding: 4px 0;
}

.felt-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  outline: none;
}

.felt-swatch:hover { transform: scale(1.15); }

.felt-swatch.active {
  border-color: #c8a84b;
  box-shadow: 0 0 0 2px rgba(200,168,75,0.4);
  transform: scale(1.1);
}

/* ── Room code button on game screen ── */
.btn-room-code {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  padding: 3px 8px;
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 2px;
  background: rgba(0,0,0,0.3);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.btn-room-code:hover {
  background: rgba(200,168,75,0.1);
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-room-code.copied {
  color: #80d090;
  border-color: rgba(128,208,144,0.5);
}



/* ── Game table mobile ── */
@media (max-width: 600px) {
  #player-bar  { flex-direction: column; gap: 6px; align-items: flex-start; }
  #play-area   { flex-direction: column; gap: 12px; }
  #bid-panel   { bottom: 200px; }
  .playing-card { width: 52px; height: 75px; }
  #hand-cards .playing-card { width: 58px; height: 84px; }
}

/* =============================================================================
   CARD CHIPS — v0.3.0
   Compact, high-contrast text chips replacing the small playing card layout.
   ============================================================================= */

/* Hand chips */
#hand-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.card-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #faf7f0;
  border: 2px solid #d4c9a8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  min-width: 56px;
  justify-content: center;
}

.card-chip .chip-rank {
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-chip .chip-suit {
  font-size: 1.55rem;
  line-height: 1;
}

.card-chip.red   { color: #c0392b; }
.card-chip.black { color: #1a0a00; }
.card-chip.blooper {
  background: linear-gradient(135deg, #1a0a2e, #2d1060);
  color: #d4b8ff;
  border-color: #6a40c0;
}

.card-chip.playable {
  border-color: var(--gold);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 0 1px rgba(200,168,75,0.5);
}

.card-chip.playable:hover {
  transform: translateY(-6px) scale(1.06);
  box-shadow: 0 8px 20px rgba(0,0,0,0.6), 0 0 12px var(--active-glow);
  border-color: #f0c060;
  z-index: 10;
}

.card-chip.not-playable {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Trick chips — slightly smaller, static */
.trick-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 5px;
  background: #faf7f0;
  border: 2px solid #d4c9a8;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  min-width: 48px;
  justify-content: center;
}

.trick-chip .chip-rank { font-size: 1.1rem; line-height: 1; }
.trick-chip .chip-suit { font-size: 1.2rem; line-height: 1; }
.trick-chip.red    { color: #c0392b; }
.trick-chip.black  { color: #1a0a00; }
.trick-chip.blooper {
  background: linear-gradient(135deg, #1a0a2e, #2d1060);
  color: #d4b8ff;
  border-color: #6a40c0;
}

/* =============================================================================
   TURN PROMPT
   Persistent glowing prompt above the hand when it is this player's turn.
   ============================================================================= */

#turn-prompt {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  padding: 6px 0 2px;
  min-height: 1.6rem;
  position: relative;
  z-index: 2;
}

#turn-prompt.my-turn {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(200,168,75,0.7);
  animation: prompt-pulse 1.8s ease-in-out infinite;
}

#turn-prompt.waiting {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

@keyframes prompt-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Player bar glow when it's my turn */
#player-bar.my-turn {
  box-shadow: 0 0 0 1px rgba(200,168,75,0.6), 0 0 20px rgba(200,168,75,0.2);
  border-top-color: rgba(200,168,75,0.6);
}
