/* ═══════════════════════════════════════════════════════════════════════════
   Cards Against Humanity — Stark. Black. Brutal.
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --black:       #000000;
  --near-black:  #111111;
  --bg:          #1a1a1a;
  --surface:     #222222;
  --white:       #ffffff;
  --off-white:   #f8f8f8;
  --gray-light:  #e0e0e0;
  --gray-mid:    #888888;
  --gray-dark:   #444444;
  --gold:        #f0c040;
  --gold-glow:   rgba(240, 192, 64, 0.35);
  --red:         #cc2222;
  --red-dark:    #991111;
  --shadow-card: 0 4px 16px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-lifted: 0 12px 32px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --radius:      8px;
  --font:        "Helvetica Neue", "Arial", system-ui, sans-serif;
  --header-h:    52px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.4;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ─── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }
.full-width { width: 100%; }

/* ─── Loading Overlay ────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast Notifications ────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 8888;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--white); color: var(--black);
  padding: 12px 20px;
  font-size: 0.875rem; font-weight: 700;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: none;
  max-width: 320px;
}
.toast.error { background: var(--red); color: var(--white); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ─── Header ─────────────────────────────────────────────── */
#app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--black);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 2px solid var(--near-black);
}

.header-left { display: flex; align-items: center; gap: 16px; }

.header-logo {
  font-size: 1.1rem; font-weight: 900; letter-spacing: 0.05em;
  color: var(--white);
}

.header-code {
  font-size: 0.8rem; color: var(--gray-mid);
  letter-spacing: 2px;
}

/* ─── Screens ─────────────────────────────────────────────── */
.screen {
  min-height: calc(100dvh - var(--header-h));
  padding: 40px 20px;
}

#screen-home { min-height: 100dvh; padding: 0; }
#screen-finished {
  display: flex; align-items: center; justify-content: center;
}
#screen-lobby {
  display: flex; align-items: flex-start; justify-content: center;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--white); color: var(--black);
  border: none; border-radius: var(--radius);
  padding: 14px 28px;
  font-size: 1rem; font-weight: 900; font-family: var(--font);
  cursor: pointer; letter-spacing: 0.02em;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.btn-primary:hover  { background: var(--off-white); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent; color: var(--gray-mid);
  border: 2px solid var(--gray-dark); border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 0.9rem; font-weight: 700; font-family: var(--font);
  cursor: pointer; letter-spacing: 0.02em;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--gray-mid); color: var(--white); }

.btn-danger {
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.85rem; font-weight: 900; font-family: var(--font);
  cursor: pointer; letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.1s;
}
.btn-danger:hover { background: var(--red-dark); transform: translateY(-1px); }

.btn-copy {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--gray-mid);
  border: 2px solid var(--gray-dark); border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.8rem; font-weight: 700; font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-copy:hover { border-color: var(--white); color: var(--white); }
.btn-copy.copied { border-color: var(--gold); color: var(--gold); }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 8px;
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray-mid);
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: var(--surface); color: var(--white);
  border: 2px solid var(--gray-dark); border-radius: var(--radius);
  font-size: 1rem; font-weight: 700; font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--white); }
.form-input::placeholder { color: var(--gray-dark); font-weight: 400; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 6px;
  text-align: center;
  font-size: 1.8rem !important;
}

.form-hint {
  margin-top: 8px;
  font-size: 0.8rem; font-weight: 400;
  color: var(--gray-mid); line-height: 1.5;
}
.option-tooltip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px;
  background: var(--gray-dark); color: var(--gray-mid);
  border-radius: 50%; font-size: 0.65rem; font-weight: 700;
  cursor: default; vertical-align: middle; margin-left: 5px;
}
.option-tooltip-text {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: var(--surface); border: 1px solid var(--gray-dark);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.78rem; font-weight: 400; line-height: 1.5;
  color: var(--gray-mid);
  pointer-events: none;
  z-index: 50;
}
.option-tooltip:hover .option-tooltip-text,
.option-tooltip:focus .option-tooltip-text { display: block; }

.form-error {
  margin-top: 12px;
  color: #ff6b6b;
  font-size: 0.875rem; font-weight: 700;
  min-height: 20px;
}

/* Checkbox */
.checkbox-label {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; margin-bottom: 4px;
}
.checkbox-label input[type="checkbox"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.checkbox-label input:focus-visible + .checkbox-custom {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 20px; height: 20px; margin-top: 1px;
  background: var(--surface);
  border: 2px solid var(--gray-dark); border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--white);
  border-color: var(--white);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  position: absolute; top: 2px; left: 6px;
  width: 5px; height: 10px;
  border: 2px solid var(--black);
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.checkbox-text {
  font-size: 0.95rem; font-weight: 700; line-height: 1.4;
}

/* ─── HOME SCREEN ─────────────────────────────────────────── */
.home-hero {
  background: var(--black);
  padding: 60px 40px 50px;
  text-align: left;
}

.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 20px;
}

.game-subtitle {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 400;
  color: var(--gray-mid);
  letter-spacing: 0.02em;
}

.home-panels {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 40px 20px;
  max-width: 860px;
  margin: 0 auto;
}

.panel {
  flex: 1;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius);
}

.panel-heading {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-mid);
  margin-bottom: 24px;
  font-weight: 900;
}

.panel-divider {
  display: flex; align-items: center; justify-content: center;
  width: 60px; flex-shrink: 0;
  font-size: 0.75rem; letter-spacing: 0.1em;
  color: var(--gray-dark);
}

/* ─── LOBBY SCREEN ────────────────────────────────────────── */
.lobby-container {
  width: 100%; max-width: 560px;
  padding: 20px 0;
}

.code-display-block {
  text-align: center;
  background: var(--black);
  border-radius: var(--radius);
  padding: 32px 40px;
  margin-bottom: 24px;
}
.code-label {
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gray-mid); margin-bottom: 12px;
}
.code-value-row {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-bottom: 12px;
}
.code-value {
  font-size: 3.5rem; font-weight: 900;
  letter-spacing: 0.2em; color: var(--white);
  font-variant-numeric: tabular-nums;
}
.code-share-hint {
  font-size: 0.75rem; color: var(--gray-dark); font-weight: 400;
}

.lobby-meta {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.player-count-badge {
  font-size: 0.8rem; letter-spacing: 0.05em;
  color: var(--gray-mid);
}

.rando-notice {
  font-size: 0.8rem; color: var(--gray-mid); font-weight: 400;
}

.lobby-player-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 28px;
}

.player-row {
  display: flex; align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  gap: 10px;
}
.player-row-name { flex: 1; font-size: 0.95rem; font-weight: 700; }
.player-badge {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 4px;
}
.badge-you  { background: var(--white); color: var(--black); }
.badge-host { background: var(--gray-dark); color: var(--gray-light); }
.badge-spectator { background: var(--gray-dark); color: var(--gray-mid); }

.lobby-actions {
  display: flex; flex-direction: column; gap: 12px;
}

.lobby-start-hint {
  font-size: 0.8rem; color: var(--gray-mid); font-weight: 400;
  margin-top: 8px; text-align: center;
}

.waiting-text {
  font-size: 0.85rem; color: var(--gray-mid); font-weight: 400;
  text-align: center; padding: 8px 0;
}

/* ─── GAME SCREEN ─────────────────────────────────────────── */
#screen-game {
  padding: 0;
  display: flex; flex-direction: column;
}

/* Scoreboard */
.scoreboard-bar {
  position: sticky; top: var(--header-h); z-index: 50;
  background: var(--black);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--near-black);
}

.score-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  font-size: 0.78rem; font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.2s;
}
.score-chip.is-czar   { border-color: var(--white); }
.score-chip.is-me     { background: var(--near-black); }
.score-chip.is-winner { border-color: var(--gold); color: var(--gold); }
.score-chip.spectator-count-chip { opacity: 0.5; font-style: italic; }
.upgrade-bar { margin-top: 24px; text-align: center; }
.score-chip-name      { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.score-chip-pts {
  background: var(--gray-dark);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.7rem;
}

/* Game area */
.game-area {
  flex: 1;
  padding: 24px 20px 40px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* Phase label */
.phase-label {
  font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gray-mid); margin-bottom: 20px;
}

/* Role banner */
.role-banner {
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem; font-weight: 700;
  line-height: 1.5;
}
.role-banner.czar-banner {
  background: var(--white); color: var(--black);
}
.role-banner.waiting-banner {
  background: var(--surface); color: var(--gray-mid);
}
.spectator-banner { background: rgba(255,255,255,0.07); border-color: var(--gray-dark); color: var(--gray-mid); }
.game-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
}
.game-modal.hidden { display: none; }
.game-modal-inner {
  background: var(--surface); border: 1px solid var(--gray-dark);
  border-radius: var(--radius); padding: 28px 24px; max-width: 340px; width: 90%;
}
.game-modal-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 16px; text-align: center;
}

/* Black card */
.black-card.red {
  background: #5a1010;
}
.black-card {
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  width: auto;
  max-height: 20em;
  aspect-ratio: 63 / 88;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
}

.black-card-text {
  font-size: 1rem; font-weight: 700; line-height: 1.45;
  flex: 1;
  white-space: pre-wrap;
}

.black-card-text .blank {
  color: black;
  text-decoration: underline;
  text-decoration-color: white;
  text-underline-offset: 3px;
}
.card-small { font-size: 0.7em; }

.black-card-footer {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: 16px;
}
.black-card-brand {
  font-size: 0.55rem; font-weight: 400; letter-spacing: 0.05em;
  opacity: 0.5;
}
.black-card-pick {
  font-size: 0.65rem; font-weight: 900; letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* White card */
.white-card {
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius);
  padding: 16px;
  height: 20em;
  width: auto;
  aspect-ratio: 63 / 88;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  border: 3px solid transparent;
  animation: cardFadeIn 0.3s ease forwards;
  user-select: none;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.white-card:hover:not(.disabled):not(.readonly) {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lifted);
}

.white-card.selected {
  border-color: var(--black);
  transform: translateY(-8px);
  box-shadow: var(--shadow-lifted);
}

/* selection badge is rendered via .selection-num span; only show ::after checkmark
   when no explicit badge is present (pick-1 cards that lack the span) */
.white-card.selected:not(:has(.selection-num))::after {
  content: '✓';
  position: absolute; top: 8px; right: 10px;
  font-size: 0.7rem; font-weight: 900;
  background: var(--black); color: var(--white);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.white-card.winning {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow-lifted) !important;
  animation: winnerPulse 0.6s ease 0.1s;
  cursor: default;
}

@keyframes winnerPulse {
  0%   { box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow-card); }
  50%  { box-shadow: 0 0 0 12px var(--gold-glow), var(--shadow-lifted); }
  100% { box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow-lifted); }
}

.white-card.disabled {
  opacity: 0.45; cursor: not-allowed;
}
.white-card.readonly {
  cursor: default;
}

.white-card-text {
  font-size: 1rem; font-weight: 700; line-height: 1.4;
  flex: 1;
  white-space: pre-wrap;
  color: var(--black);
}
.white-card.silver .white-card-text {
  background: linear-gradient(135deg, #6e6e6e 0%, #b8b8b8 30%, #f0f0f0 50%, #b0b0b0 70%, #5a5a5a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  background-size: 50%;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.white-card.red    .white-card-text { color: #c0392b; }
.white-card-brand {
  font-size: 0.5rem; font-weight: 400; letter-spacing: 0.05em;
  color: #555; margin-top: 12px;
}

/* Single-emoji cards */
.white-card--emoji .white-card-text {
  font-size: 3.5rem; line-height: 1;
}

/* Review mark checkboxes */
.review-mark-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; }

/* Player name tag on white card (in results) */
.card-player-tag {
  font-size: 0.6rem; font-weight: 900; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--black); color: var(--white);
  padding: 3px 8px; border-radius: 4px;
  margin-top: 6px; align-self: flex-start;
}
.card-player-tag.rando { background: #555; }
.card-player-tag.you   { background: var(--black); }

/* ─── Game Layout: Black card + content ─────────────────── */
.round-layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: flex-start;
}

.round-content { width: 100%; min-width: 0; }

/* Submission progress */
.submission-progress {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.85rem; color: var(--gray-mid); font-weight: 700;
}
.progress-bar-track {
  height: 4px; background: var(--gray-dark);
  border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--white);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Hand */
.hand-section { margin-top: 24px; }
.hand-label {
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray-mid); margin-bottom: 14px;
}
.hand-grid {
  display: flex; flex-wrap: nowrap; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 10px; cursor: grab; user-select: none;
}
.hand-grid.is-dragging { cursor: grabbing; }
.hand-grid .white-card { scroll-snap-align: start; }

/* Submissions grid */
.submissions-section { margin-top: 4px; }
.submission-wrapper { display: flex; flex-direction: column; }
.vote-count-badge {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--gold); color: var(--black);
  font-size: 0.7rem; font-weight: 900;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.submission-select-btn { margin-top: 8px; width: 100%; }
.submissions-label {
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray-mid); margin-bottom: 14px;
}
.submissions-grid {
  display: flex; flex-wrap: nowrap; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 10px; cursor: grab; user-select: none;
}
.submissions-grid.is-dragging { cursor: grabbing; }
.submissions-grid .submission-wrapper { flex-shrink: 0; scroll-snap-align: start; }

/* Pick-2: groups stack vertically, cards inside each group are horizontal */
.submissions-grid.pick2 {
  flex-direction: column; overflow-x: visible;
  cursor: default; scroll-snap-type: none;
}
.submissions-grid.pick2 .submission-wrapper { flex-shrink: unset; scroll-snap-align: none; }
.submissions-grid.pick2 .submission-group { flex-direction: row; gap: 10px; align-items: flex-start; }

/* Submission group — one player's cards, side by side */
.submission-group {
  display: flex; gap: 6px; align-items: flex-start;
  border-radius: var(--radius);
  transition: outline 0.12s;
}
.submission-group.selected > .white-card { border-color: var(--black); transform: translateY(-8px); box-shadow: var(--shadow-lifted); }
.submission-group.winning  > .white-card { border-color: var(--gold) !important; box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow-lifted) !important; }
.submission-group.winning  > .white-card { animation: winnerPulse 0.6s ease 0.1s; }

/* Selection order badge */
.selection-num {
  position: absolute; top: 8px; right: 10px;
  width: 22px; height: 22px;
  background: var(--black); color: var(--white);
  border-radius: 50%;
  font-size: 0.7rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* Submit / Choose button area */
.action-bar {
  margin-top: 20px;
  display: flex; align-items: center; gap: 12px;
}

.action-bar-fixed {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 16px 20px;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
  z-index: 200;
  margin-top: 0;
}

/* Extra breathing room so the last card isn't hidden behind the fixed bar */
.game-area { padding-bottom: 80px; }

/* Results */
.winner-banner {
  background: var(--gold);
  color: var(--black);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 1rem; font-weight: 900;
}

/* ─── FINISHED SCREEN ─────────────────────────────────────── */
.finished-container {
  text-align: center;
  padding: 40px 20px;
  max-width: 600px;
  margin: 0 auto;
}
.game-over-label {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900; letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 16px;
  line-height: 1;
}
.winner-announcement {
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 700; color: var(--gray-mid);
  margin-bottom: 40px;
  line-height: 1.5;
}
.winner-announcement strong { color: var(--white); font-weight: 900; }

.final-scoreboard {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 36px; text-align: left;
}
.final-score-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 20px;
  border: 2px solid transparent;
}
.final-score-row.winner-row { border-color: var(--gold); }
.final-score-name { font-size: 1rem; font-weight: 700; }
.final-score-pts  { font-size: 1.1rem; font-weight: 900; color: var(--gold); }
.final-score-row:not(.winner-row) .final-score-pts { color: var(--gray-mid); }

/* ─── Debug Panel ─────────────────────────────────────────────────── */
.debug-panel {
  margin-top: 16px;
  padding: 12px 14px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255,200,0,0.06),
    rgba(255,200,0,0.06) 6px,
    transparent 6px,
    transparent 14px
  );
  border: 1px solid rgba(255,200,0,0.3);
  border-radius: var(--radius);
}
.debug-panel-title {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #f5c400; margin-bottom: 8px;
}
.debug-bot-row, .debug-btn-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* ─── Review Mode ─────────────────────────────────────────────── */
#screen-review {
  min-height: 100vh; padding: 0;
  display: flex; flex-direction: column;
}
.review-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--gray-dark);
  padding: 16px 24px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
}
.review-title {
  font-size: 1rem; font-weight: 900; letter-spacing: 0.08em;
  text-transform: uppercase; margin: 0; white-space: nowrap;
}
.review-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-type-tabs { display: flex; gap: 4px; }
.review-tab {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--gray-dark);
  background: none; color: var(--white); cursor: pointer; font-size: 0.8rem;
  font-weight: 600; transition: background 0.12s, border-color 0.12s;
}
.review-tab:hover { background: var(--gray-dark); }
.review-tab.active { background: var(--white); color: var(--black); border-color: var(--white); }
.review-set-filter { padding: 6px 10px; font-size: 0.8rem; width: auto; }
.review-count {
  padding: 6px 24px; font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray-mid);
}
.review-grid {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 16px 24px 40px;
}
.review-card { cursor: pointer; max-height: 20em; width: 229.08px; }
.review-card:hover { transform: translateY(-6px) !important; box-shadow: var(--shadow-lifted) !important; }

/* Edit modal */
.review-modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.review-modal.hidden { display: none; }
.review-modal-inner {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 16px;
}
.review-modal-title { font-size: 1rem; font-weight: 700; margin: 0; }
.review-textarea {
  width: 100%; box-sizing: border-box;
  padding: 12px; background: var(--bg);
  border: 1px solid var(--gray-dark); border-radius: 6px;
  color: var(--white); font-size: 0.95rem; line-height: 1.5;
  resize: vertical; font-family: inherit;
}
.review-textarea:focus { outline: 2px solid var(--white); outline-offset: 1px; }
.review-modal-meta { display: flex; flex-direction: column; gap: 10px; }
.review-field-row { display: flex; align-items: center; gap: 10px; }
.review-field-label {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em;
  white-space: nowrap; min-width: 2.5rem;
}
.review-pick-select { width: auto; padding: 6px 10px; }
.review-modal-actions { display: flex; gap: 10px; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .home-panels {
    flex-direction: column;
    padding: 24px 16px;
    gap: 16px;
  }
  .panel { padding: 24px; }
  .panel-divider { width: 100%; justify-content: center; padding: 4px 0; }

  .home-hero { padding: 40px 24px 36px; }

  .black-card { width: auto; max-height: 20em; }

  .white-card-text { font-size: 0.9rem; }

  .screen { padding: 20px 16px 32px; }
  .game-area { padding: 16px 16px 32px; }
}
