/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&display=swap');

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

:root {
  --bg:       #ecdcbc;
  --surface:  #e0cfaa;
  --panel:    #d4c09a;
  --border:   #9a7a50;
  --lead:     #c8b080;
  --text:     #1e0e04;
  --muted:    #6a5030;
  --accent:   #c8921a;
  --accent2:  #8a2010;
  --danger:   #8a1818;
  --success:  #285028;

  /* Mosaic tile colours – drawing tool palette */
  --c-red:    #cc2200;
  --c-orange: #e86000;
  --c-amber:  #cc8800;
  --c-yellow: #ccaa00;
  --c-lime:   #559900;
  --c-green:  #007744;
  --c-teal:   #007788;
  --c-cyan:   #0088aa;
  --c-blue:   #1144cc;
  --c-indigo: #3322aa;
  --c-violet: #6622bb;
  --c-purple: #881199;
  --c-pink:   #bb0055;
  --c-rose:   #cc1133;
  --c-frost:  #b8ccd8;
  --c-smoke:  #667788;
}

html, body {
  height: 100%;
  font-family: 'Cinzel', 'Palatino Linotype', Georgia, serif;
  background-color: #d8c8a4;
  color: var(--text);
  overflow: hidden;
}

/* Rough two-tone: warm Pompeian red covers the lower portion of the viewport.
   Screens without an explicit background (host review, r2, r3) are transparent
   and show this directly. Screens with cream backgrounds (lobby, leaderboard)
   only let a sliver through. */
body::before {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52%;
  background: linear-gradient(to top, #6a1808 0%, #8a2412 50%, #9c2e1a 100%);
  pointer-events: none;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: 'Cinzel', 'Palatino Linotype', Georgia, serif;
  letter-spacing: 0.04em;
}
h1 { font-size: clamp(2rem, 6vw, 4rem); font-weight: 900; }
h2 { font-size: clamp(1.4rem, 4vw, 2.4rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
p  { line-height: 1.6; color: var(--muted); }

.title-glow {
  background: linear-gradient(150deg, #a85c10 0%, #7a2c08 45%, #a85c10 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 6px rgba(80,30,8,0.25));
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 5px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.15s;
  text-transform: uppercase;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(160deg, #6a1810, #a82818);
  color: #fde8d8;
  box-shadow: 0 3px 16px rgba(140,30,20,0.45),
              inset 0 1px 0 rgba(255,180,160,0.15);
  border: 1px solid rgba(160,40,30,0.5);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 5px 24px rgba(160,40,20,0.65),
              inset 0 1px 0 rgba(255,180,160,0.2);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(200,160,80,0.08);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent {
  background: linear-gradient(160deg, #7a4a08, #c8922a);
  color: #2c1004;
  box-shadow: 0 3px 16px rgba(180,120,20,0.45),
              inset 0 1px 0 rgba(255,230,140,0.2);
  border: 1px solid rgba(160,100,20,0.5);
}
.btn-accent:hover:not(:disabled) {
  box-shadow: 0 5px 24px rgba(180,120,20,0.6),
              inset 0 1px 0 rgba(255,230,140,0.3);
}

.btn-danger {
  background: linear-gradient(160deg, #7a1010, #c42424);
  color: #ffd8d8;
  border: 1px solid rgba(180,40,40,0.5);
}

.btn-lg { padding: 1rem 2.5rem; font-size: 1.1rem; border-radius: 6px; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--lead);
  border: 2px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.12);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.12), 0 0 0 2px rgba(160,100,20,0.25);
}
.input::placeholder { color: var(--muted); }

.input-code {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text);
}

/* ── Screen system ────────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Shared screen background ─────────────────────────────────────────────── */
#screen-landing,
#screen-host-lobby,
#screen-player-join,
#screen-player-lobby,
#screen-player-waiting,
#screen-player-leaderboard,
#screen-host-leaderboard,
#screen-between-votes,
#screen-player-being-rated,
#screen-player-tutorial,
#screen-player-r3-being-rated,
#screen-player-r3-vote {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 70%),
    radial-gradient(ellipse 60% 40% at 20% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 60%),
    rgba(236,220,188,0.93);
}

/* ── Landing ──────────────────────────────────────────────────────────────── */
#screen-landing { gap: 3rem; }

.landing-logo { text-align: center; }
.landing-logo .subtitle {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 0.75rem;
}

.landing-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
}

/* ── Host lobby ───────────────────────────────────────────────────────────── */
#screen-host-lobby { gap: 2rem; }

.game-code-display {
  background: linear-gradient(160deg, #e0d0b0, #d4c4a0);
  border: 2px solid #6a5428;
  border-radius: 8px;
  padding: 1.75rem 2.75rem;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(200,160,60,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 6px 24px rgba(0,0,0,0.7);
}
.game-code-display .label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.game-code-display .code {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-shadow: 0 2px 6px rgba(80,40,8,0.4), 0 1px 2px rgba(0,0,0,0.3);
}
.game-code-display .url {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
  letter-spacing: 0.05em;
}
.join-url {
  margin-top: 0.6rem;
  padding: 0.35rem 0.75rem;
  background: var(--lead);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  word-break: break-all;
}
.join-url:hover { border-color: var(--accent2); color: var(--accent2); }
.join-url.copied { border-color: var(--success); color: #1a3c1a; }

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  max-width: 700px;
}
.player-chip {
  padding: 0.45rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  animation: chip-in 0.3s ease;
  box-shadow: inset 0 1px 0 rgba(200,160,80,0.06);
}
@keyframes chip-in {
  from { transform: scale(0.75); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.player-count {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

/* ── Host review screen ───────────────────────────────────────────────────── */
#screen-host-review {
  position: relative;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 65%),
    radial-gradient(ellipse 50% 40% at 15% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 55%),
    rgba(236,220,188,0.93);
  justify-content: flex-start;
  padding: 1rem;
}

.review-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  align-items: center;
}

.review-canvas-wrap {
  position: relative;
  align-self: center;
  justify-self: center;
}

/* ── Light shafts ─────────────────────────────────────────────────────────── */
.light-shafts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 8px;
}
.shaft {
  position: absolute;
  top: -120px;
  bottom: -120px;
  width: 55px;
  background: linear-gradient(to right,
    transparent 0%,
    rgba(200,160,80,0.12) 40%,
    rgba(220,180,100,0.18) 50%,
    rgba(200,160,80,0.12) 60%,
    transparent 100%);
  transform: rotate(8deg);
  animation: shaft-drift 20s ease-in-out infinite;
}
.shaft-a { left:  8%; width: 45px; animation-duration: 17s; }
.shaft-b { left: 30%; width: 65px; animation-duration: 23s; animation-delay: -7s;  opacity: 0.6; }
.shaft-c { left: 58%; width: 38px; animation-duration: 19s; animation-delay: -13s; opacity: 0.75; }
.shaft-d { left: 78%; width: 52px; animation-duration: 26s; animation-delay: -4s;  opacity: 0.5; }
@keyframes shaft-drift {
  0%   { transform: rotate(7deg)  translateX(-18px); opacity: 0.6; }
  50%  { transform: rotate(9deg)  translateX(12px);  opacity: 1.0; }
  100% { transform: rotate(7deg)  translateX(-18px); opacity: 0.6; }
}

/* ── Review info panel ────────────────────────────────────────────────────── */
.review-info {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(232,218,184,0.88);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 4px 28px rgba(0,0,0,0.35), inset 0 1px 0 rgba(200,160,60,0.1);
}

.review-artist {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
}

.review-prompt {
  background: linear-gradient(160deg, #e0d0b0, #d4c4a0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.08);
}
.review-prompt .prompt-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.review-prompt .prompt-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}

.vote-progress {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.06);
}
.vote-progress .count { color: var(--text); font-weight: 700; }

.review-counter {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  font-family: 'Cinzel', Georgia, serif;
}

/* ── Timer ────────────────────────────────────────────────────────────────── */
.timer-display {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.timer-display.urgent { color: var(--danger); animation: pulse 0.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
#screen-host-leaderboard  { gap: 2rem; }
#screen-player-leaderboard { gap: 2rem; }

.leaderboard-list {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  background: linear-gradient(160deg, #ddd0b0, #d0c4a0);
  border: 1px solid var(--border);
  border-radius: 5px;
  animation: entry-in 0.45s ease both;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.07), 0 3px 10px rgba(0,0,0,0.5);
}
.leaderboard-entry:nth-child(1) {
  border-color: #c8922a;
  background: linear-gradient(160deg, #eeddb0, #e8d4a4);
  box-shadow: inset 0 1px 0 rgba(255,210,80,0.12), 0 4px 16px rgba(0,0,0,0.6),
              0 0 0 1px rgba(200,146,42,0.15);
}
.leaderboard-entry:nth-child(2) { border-color: #7a7a8a; }
.leaderboard-entry:nth-child(3) { border-color: #7a5020; }

@keyframes entry-in {
  from { transform: translateX(-28px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.lb-rank {
  font-size: 1.4rem;
  font-weight: 900;
  width: 2rem;
  text-align: center;
  color: var(--muted);
}
.leaderboard-entry:nth-child(1) .lb-rank { color: var(--accent); }

.lb-name {
  flex: 1;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.lb-score {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ── Player join ──────────────────────────────────────────────────────────── */
#screen-player-join { gap: 2rem; }

.join-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 360px;
}

.error-msg {
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.4em;
}

/* ── Player lobby wait ────────────────────────────────────────────────────── */
#screen-player-lobby {
  gap: 2rem;
  text-align: center;
}

/* ── Waiting animation (candle flicker) ───────────────────────────────────── */
.waiting-animation {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}
.waiting-animation span {
  width: 8px;
  height: 20px;
  background: linear-gradient(to top, #c8922a, #f0d060);
  border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%;
  animation: flicker 1.6s infinite ease-in-out;
  transform-origin: bottom center;
}
.waiting-animation span:nth-child(2) {
  height: 24px;
  animation-delay: 0.3s;
  opacity: 0.8;
}
.waiting-animation span:nth-child(3) {
  height: 18px;
  animation-delay: 0.6s;
  opacity: 0.65;
}
@keyframes flicker {
  0%,100% { transform: scaleX(1.0) scaleY(1.0) rotate(-1deg); opacity: 0.7; }
  25%     { transform: scaleX(0.8) scaleY(1.1) rotate(1deg);  opacity: 1.0; }
  75%     { transform: scaleX(1.1) scaleY(0.9) rotate(-2deg); opacity: 0.85; }
}

.start-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

/* ── Player design screen ─────────────────────────────────────────────────── */
#screen-player-design {
  padding: 0;
  justify-content: flex-start;
  background: rgba(236,220,188,0.93);
  overflow: hidden;
}

.design-header {
  width: 100%;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.prompt-display {
  flex: 1;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.prompt-display strong { color: var(--accent); }

@media (max-width: 480px) {
  .design-header {
    flex-wrap: wrap;
    padding: 0.4rem 0.75rem;
    gap: 0.4rem;
  }
  .prompt-display {
    white-space: normal;
    width: 100%;
    flex: none;
    line-height: 1.4;
  }
}

.design-toolbar {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.color-palette {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.1s;
  flex-shrink: 0;
}
.color-swatch:hover { border-color: rgba(232,208,128,0.45); }
.color-swatch.active {
  border-color: #e8d080;
  box-shadow: 0 0 0 2px rgba(232,208,128,0.35);
}

.shape-palette {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.palette-row {
  position: relative;
  width: 100%;
}
.palette-row::after {
  content: '';
  display: none;
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 48px;
  background: linear-gradient(to right, transparent, var(--surface) 85%);
  pointer-events: none;
  transition: opacity 0.3s;
}

.shape-thumb {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: grab;
  touch-action: none;
  transition: border-color 0.15s, transform 0.1s;
}
.shape-thumb:hover { border-color: rgba(200,146,42,0.5); }
.shape-thumb:active { cursor: grabbing; }

.design-canvas-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #3a2010;
  position: relative;
  min-height: 0;
}

#design-canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* ── Player vote screen ───────────────────────────────────────────────────── */
#screen-player-vote {
  gap: 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(228,210,174,0.91) 0%, rgba(236,220,188,0.93) 65%),
    rgba(236,220,188,0.93);
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: 2rem;
}

.vote-header { text-align: center; width: 100%; }

.design-preview-wrap {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.sliders-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.slider-label .val {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--accent);
  font-weight: 800;
}

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: #c8b080;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d060, #c8922a);
  cursor: pointer;
  border: 2px solid rgba(200,160,60,0.5);
  box-shadow: 0 0 8px rgba(200,146,42,0.5), 0 2px 4px rgba(0,0,0,0.5);
}

/* ── Player waiting screens ───────────────────────────────────────────────── */
#screen-player-waiting {
  gap: 1.5rem;
  text-align: center;
}

#screen-between-votes { gap: 1.5rem; text-align: center; }

#screen-player-being-rated { gap: 1.5rem; text-align: center; }

/* ── Mosaic tile shapes ───────────────────────────────────────────────────── */
.placed-shape {
  touch-action: none;
}

/* ── Glass texture overlay ────────────────────────────────────────────────── */
.glass-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.5) 2px, rgba(255,255,255,0.5) 3px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,255,255,0.5) 2px, rgba(255,255,255,0.5) 3px);
  background-size: 40px 40px;
}

/* ── Avatars ──────────────────────────────────────────────────────────────── */

/* Small avatar inside chips (lobby, submission grid) */
.chip-avatar {
  width: 26px;
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.3rem;
  flex-shrink: 0;
}

/* Player's own badge — fixed bottom-right on all screens */
.player-avatar-badge {
  position: fixed;
  bottom: 28px;
  right: 10px;
  z-index: 150;
  width: 52px;
  height: 52px;
  pointer-events: none;
}
.player-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Artist avatar during review — sits beside the name */
.review-artist-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.review-artist-avatar {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Leaderboard row avatar */
.lb-avatar {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.lb-avatar.winner {
  filter:
    drop-shadow(0 0 6px rgba(200,146,42,0.9))
    drop-shadow(0 0 18px rgba(200,146,42,0.5));
  animation: winner-pulse 2.5s ease-in-out infinite;
}
@keyframes winner-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(200,146,42,0.9))  drop-shadow(0 0 18px rgba(200,146,42,0.5)); }
  50%       { filter: drop-shadow(0 0 10px rgba(255,210,80,1.0)) drop-shadow(0 0 28px rgba(200,146,42,0.7)); }
}

/* ── Build tag ────────────────────────────────────────────────────────────── */
#build-tag {
  position: fixed;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  color: rgba(100,60,10,0.35);
  font-family: monospace;
  z-index: 9999;
  pointer-events: none;
  letter-spacing: 0.05em;
}

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

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 3px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tag-purple {
  background: rgba(100,40,20,0.12);
  color: var(--accent2);
  border: 1px solid rgba(138,32,16,0.35);
}
.tag-amber {
  background: rgba(160,100,20,0.2);
  color: var(--accent);
  border: 1px solid rgba(200,146,42,0.3);
}

.divider {
  width: 100%;
  max-width: 400px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

/* ── Shape thumb paint-mode active state ──────────────────────────────────── */
.shape-thumb.active {
  border-color: #e8d080;
  background: rgba(200,146,42,0.18);
  box-shadow: 0 0 0 2px rgba(232,208,128,0.35);
}

/* ── Editor controls bar ──────────────────────────────────────────────────── */
.editor-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.4);
}

.editor-btn-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ctrl-size-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.size-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

#ctrl-size-slider {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}

.fill-panel {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fill-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  margin-right: 0.1rem;
}

.fill-btn {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.06);
  transition: background 0.1s, border-color 0.1s;
}
.fill-btn:active { background: var(--border); }
.fill-btn-clear { flex: 0 0 36px; border-color: rgba(180,40,40,0.35); color: var(--danger); font-size: 0.85rem; }

.ctrl-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
  touch-action: manipulation;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.06);
}
.ctrl-btn:active { background: var(--border); }
.ctrl-btn.ctrl-text { font-size: 0.75rem; font-family: 'Cinzel', Georgia, serif; letter-spacing: 0.05em; }

/* ── Submitted overlay ────────────────────────────────────────────────────── */
.submitted-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-shadow: 0 0 24px rgba(200,146,42,0.6);
}

/* ── Narration screen ─────────────────────────────────────────────────────── */
#screen-host-narration {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 70%),
    radial-gradient(ellipse 60% 40% at 20% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 60%),
    rgba(236,220,188,0.93);
  gap: 2rem;
}

.narration-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2.75rem 4rem;
  background: linear-gradient(160deg, #ddd0b0, #d4c4a0);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.1), 0 8px 32px rgba(0,0,0,0.7);
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.narration-ornament {
  font-size: 0.9rem;
  letter-spacing: 0.6em;
  color: var(--accent);
  opacity: 0.45;
}

.narration-stage-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.narration-stage {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.narration-waves {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  height: 36px;
  margin-top: 0.25rem;
}
.narration-waves span {
  width: 5px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  animation: nwave 0.9s ease-in-out infinite;
}
.narration-waves span:nth-child(1) { height: 14px; animation-delay: 0.00s; }
.narration-waves span:nth-child(2) { height: 22px; animation-delay: 0.12s; }
.narration-waves span:nth-child(3) { height: 30px; animation-delay: 0.24s; }
.narration-waves span:nth-child(4) { height: 22px; animation-delay: 0.36s; }
.narration-waves span:nth-child(5) { height: 14px; animation-delay: 0.48s; }
@keyframes nwave {
  0%, 100% { transform: scaleY(0.3); opacity: 0.35; }
  50%       { transform: scaleY(1.1); opacity: 1.0;  }
}

.narration-skip,
.review-skip {
  font-size: 0.8rem;
  opacity: 0.45;
  padding: 0.4rem 1.2rem;
}
.narration-skip:hover,
.review-skip:hover { opacity: 0.75; }

/* ── Options button & panel ───────────────────────────────────────────────── */
.options-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}
.options-btn:hover { border-color: var(--accent); color: var(--accent); }

.options-panel {
  position: fixed;
  top: 48px;
  right: 14px;
  z-index: 200;
  background: linear-gradient(160deg, #ddd0b0, #d4c4a0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  min-width: 210px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.75), inset 0 1px 0 rgba(200,160,60,0.1);
}

.options-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 2px; left: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-track {
  background: rgba(200,146,42,0.18);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(20px);
  background: var(--accent);
}

/* ── Fanfare leaderboard ──────────────────────────────────────────────────── */
.fanfare-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.fanfare-ornament {
  font-size: 0.85rem;
  letter-spacing: 0.55em;
  color: var(--accent);
  opacity: 0.5;
}
.fanfare-subtitle {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

.leaderboard-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.game-credits {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(74,60,30,0.4);
  max-width: 420px;
  width: 100%;
}
.credits-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}
.credits-sub {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(122,106,68,0.7);
  margin-bottom: 0.25rem;
}
.credits-line {
  font-size: 0.72rem;
  color: rgba(122,106,68,0.5);
  font-style: italic;
  line-height: 1.5;
}

.latin-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  opacity: 0.75;
  margin: 0.2rem 0;
}

/* ── Now playing card ────────────────────────────────────────────────────── */
.now-playing-card {
  position: fixed;
  bottom: 20px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(10, 6, 2, 0.96);
  border: 1px solid rgba(200,168,60,0.45);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  z-index: 200;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
  max-width: 210px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}
.now-playing-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.now-playing-art {
  width: 38px;
  height: 38px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(200,168,60,0.2);
}
.now-playing-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.now-playing-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.58rem;
  color: rgba(200,168,80,0.7);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#now-playing-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  color: rgba(220,188,80,0.9);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Player rank reveal ───────────────────────────────────────────────────── */
#screen-player-leaderboard {
  gap: 1.5rem;
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: 2rem;
}

.player-rank-reveal {
  width: 100%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(160deg, #ddd0b0, #d2c4a0);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(200,160,60,0.1), 0 6px 24px rgba(0,0,0,0.6);
  animation: reveal-in 0.6s cubic-bezier(0.2,0,0.2,1) both;
}

/* Gold shimmer for 1st */
.player-rank-reveal[data-rank="0"] {
  border-color: #c8922a;
  box-shadow: inset 0 1px 0 rgba(255,210,80,0.15),
              0 6px 28px rgba(0,0,0,0.7),
              0 0 0 1px rgba(200,146,42,0.2);
}
/* Silver for 2nd */
.player-rank-reveal[data-rank="1"] { border-color: #8a8a9a; }
/* Bronze for 3rd */
.player-rank-reveal[data-rank="2"] { border-color: #8a5824; }

@keyframes reveal-in {
  from { transform: scale(0.88) translateY(12px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.rank-medal {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.1rem;
}

.rank-pos {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.rank-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}
.player-rank-reveal[data-rank="0"] .rank-title { color: var(--accent); }

.rank-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 0.4rem 0;
}

.rank-message {
  font-style: italic;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  letter-spacing: 0.02em;
  max-width: 280px;
}
.player-rank-reveal[data-rank="0"] .rank-message { color: #a87840; }

/* ── Round 2 ─────────────────────────────────────────────────────────────── */

#screen-player-r2-being-rated,
#screen-host-r2-playing {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 70%),
    radial-gradient(ellipse 60% 40% at 20% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 60%),
    rgba(236,220,188,0.93);
}

#screen-player-r2-being-rated { gap: 1.5rem; text-align: center; }

#screen-host-r2-playing { gap: 2rem; }

#screen-host-r2-review {
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 65%),
    radial-gradient(ellipse 50% 40% at 15% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 55%),
    rgba(236,220,188,0.93);
}

#screen-player-r2-vote {
  gap: 1rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(228,210,174,0.91) 0%, rgba(236,220,188,0.93) 65%),
    rgba(236,220,188,0.93);
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: 1.5rem;
}

/* Host R2 pair grid */
.r2-pair-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  max-width: 900px;
}

.r2-pair-chip-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.r2-pair-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Host R2 review layout */
.r2-review-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.r2-design-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1200px;
}

.r2-design-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.r2-review-svg {
  height: min(55vh, 360px);
  width: auto;
  background: white;
  border-radius: 6px;
  border: 2px solid #4a3c1e;
  display: block;
  box-shadow: 0 4px 24px rgba(0,0,0,0.65);
}

.r2-tally {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* Player R2 vote — thumbnails */
.r2-thumbs-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 480px;
}

.r2-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.r2-thumb-svg {
  width: min(38vw, 140px);
  height: auto;
  background: white;
  border-radius: 4px;
  border: 2px solid #4a3c1e;
  display: block;
  box-shadow: 0 3px 12px rgba(0,0,0,0.5);
}

.r2-thumb-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  text-align: center;
}

/* Player R2 choice buttons */
.r2-choice-btns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}

.r2-choice-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200,146,42,0.3);
}

/* Player R2 weighted slider */
.r2-weighted-wrap {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.r2-split-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.r2-split-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.r2-split-val {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  min-width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.r2-split-hint {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* Tap-to-zoom */
.zoomable-design { cursor: zoom-in; }

.zoom-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.design-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.design-zoom-overlay svg {
  width: min(90vw, calc(85vh * 2 / 3));
  height: auto;
  max-height: 85vh;
  border-radius: 6px;
  border: 2px solid #4a3c1e;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  background: white;
}

/* ── Leaderboard countdown ───────────────────────────────────────────────── */

.lb-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.lb-countdown-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lb-countdown-num {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

/* ── Round 3 host ─────────────────────────────────────────────────────────── */

#screen-host-r3-playing {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(228,210,174,0.91) 0%, rgba(236,220,188,0.93) 65%),
    rgba(236,220,188,0.93);
  gap: 2rem;
}

#screen-host-r3-review {
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(200,158,95,0.50) 0%, rgba(236,220,188,0.93) 65%),
    radial-gradient(ellipse 50% 40% at 15% 100%, rgba(180,138,75,0.42) 0%, rgba(236,220,188,0.93) 55%),
    rgba(236,220,188,0.93);
  justify-content: flex-start;
  padding: 1rem;
  gap: 0.75rem;
}

.r3-design-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
}

.r3-design-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  transition: opacity 0.6s;
}

.r3-review-svg {
  width: min(200px, calc(44vw));
  height: auto;
  background: white;
  border-radius: 6px;
  border: 2px solid #4a3c1e;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  display: block;
  transition: border-color 0.5s, box-shadow 0.5s, transform 0.5s;
}

/* Jupiter divine reveal — lightning flash overlay */
.r3-lightning-overlay {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  animation: r3-lightning-flash var(--flash-dur, 180ms) ease-out forwards;
}

@keyframes r3-lightning-flash {
  0%   { opacity: var(--flash-peak, 0.92); }
  100% { opacity: 0; }
}

/* Winner card: rises and glows */
.r3-design-card.r3-spotlit-winner {
  z-index: 2;
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), opacity 0.3s;
}

.r3-design-card.r3-spotlit-winner .r3-review-svg {
  border-color: rgba(255,220,80,1);
  box-shadow:
    0 0 60px rgba(255,200,50,0.95),
    0 0 120px rgba(255,180,30,0.5);
  transform: scale(1.28);
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), border-color 0.3s, box-shadow 0.3s;
}

/* Loser card: flies off screen */
.r3-design-card.r3-loser-exit {
  animation: r3-loser-exit 0.7s cubic-bezier(0.55,0,1,0.45) forwards;
}

@keyframes r3-loser-exit {
  0%   { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--exit-x, 120vw), 40vh) rotate(var(--exit-rot, 25deg)); opacity: 0; }
}

/* Tie: both cards glow gold */
.r3-design-card.r3-spotlit-tie .r3-review-svg {
  border-color: rgba(255,220,80,1);
  box-shadow: 0 0 40px rgba(255,200,50,0.85);
  transform: scale(1.08);
  transition: transform 0.5s ease, border-color 0.3s, box-shadow 0.3s;
}

/* Keep header text readable over any glow */
#screen-host-r3-review .r2-review-header {
  position: relative;
  z-index: 5;
  background: rgba(220,204,168,0.88);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  width: 100%;
}

#screen-host-r3-review .r3-design-card .review-artist-row {
  background: rgba(220,204,168,0.85);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  position: relative;
  z-index: 2;
}

/* Divine panel — winner reveal */
.r3-divine-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.r3-divine-winner {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.06em;
  text-shadow: 0 0 20px rgba(255,180,40,0.6);
  opacity: 0;
  transition: opacity 1s ease;
}

.r3-divine-winner.revealed {
  opacity: 1;
}

/* ── Round 3 player vote ──────────────────────────────────────────────────── */

#screen-player-r3-vote {
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-y: auto;
}

.r3-thumbs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.r3-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  cursor: pointer;
}

.r3-thumb-wrap.r3-own {
  cursor: default;
  opacity: 0.5;
}

.r3-thumb-svg {
  width: min(100px, 28vw);
  height: auto;
  background: white;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: block;
  transition: border-color 0.2s;
}

.r3-thumb-wrap.r3-picked .r3-thumb-svg {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200,146,42,0.4);
}

.r3-thumb-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.r3-thumb-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--surface);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.r3-picks-display {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.r3-pick-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 0.6rem;
  background: var(--panel);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.r3-pick-medal {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.r3-pick-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

@keyframes pick-shift {
  0%   { background: rgba(200,146,42,0.35); }
  100% { background: transparent; }
}
.r3-pick-row.shifted {
  animation: pick-shift 0.7s ease-out forwards;
  border-radius: 4px;
}

/* Sticky R3 medal indicator bar */
#medal-indicator {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  background: linear-gradient(160deg, #3a2010, #6a3808);
  border-top: 1px solid rgba(200,160,60,0.4);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(240,210,120,0.95);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  transition: opacity 0.4s, transform 0.4s;
}
#medal-indicator.hidden-bar {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}
#medal-indicator .medal-emoji {
  font-size: 1.4rem;
  line-height: 1;
}

.r3-pick-hint {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ── Responsive tweaks ────────────────────────────────────────────────────── */

/* Host lobby: stack QR + code vertically on narrow screens */
@media (max-width: 640px) {
  #screen-host-lobby {
    gap: 1rem;
    justify-content: flex-start;
    padding-top: 1.25rem;
    overflow-y: auto;
  }
  .lobby-join-row {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: center;
    width: 100%;
  }
  .lobby-qr {
    width: 120px !important;
    height: 120px !important;
  }
  .game-code-display {
    padding: 1rem 1.5rem;
    text-align: center;
    width: 100%;
    max-width: 360px;
  }
  .game-code-display .url { display: none; }
  .join-url { font-size: 0.72rem; }
}

@media (max-width: 400px) {
  .design-header { padding: 0.4rem 0.6rem; }
  .color-swatch { width: 24px; height: 24px; }
  .shape-thumb { width: 38px; height: 38px; }
}
