/* ============================================================
   Header (skribble-specific tweaks)
   ============================================================ */
.header-back__icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
}

/* Connection banner — shown when the socket is dropped / reconnecting. */
.connection-banner {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(210, 153, 34, 0.4);
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.connection-banner.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(248, 81, 73, 0.4); }
.connection-banner::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Connection-quality pill — driven by the periodic ping/RTT loop in
   game.js. Tone: "good" = green, "fair" = amber, "poor" = red. Hidden
   until the first sample lands. The connection-banner above takes the
   top-right margin-left:auto slot, so this sits next to it. */
.conn-quality {
  margin-left: 8px;
  padding: 3px 9px;
  background: rgba(28, 31, 46, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-pill);
  font-size: 11px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
}
.conn-quality__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-soft);
  flex-shrink: 0;
}
.conn-quality--good .conn-quality__dot { background: var(--good); box-shadow: 0 0 4px rgba(63, 185, 80, 0.6); }
.conn-quality--fair .conn-quality__dot { background: var(--warn); }
.conn-quality--poor .conn-quality__dot { background: var(--bad); }
.conn-quality--good { color: var(--good); }
.conn-quality--fair { color: var(--warn); }
.conn-quality--poor { color: var(--bad); }

/* ============================================================
   Sections — cross-fade transitions
   ============================================================ */
section.login-screen,
section.lobby-screen,
section.game-screen {
  animation: fade-in var(--dur-base) var(--ease-out);
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-6);
  padding: var(--s-7) var(--s-4);
}
.login-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.login-hero .tagline {
  font-size: var(--t-lg);
  letter-spacing: 0.02em;
}
.login-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.hero-demo {
  margin-top: var(--s-3);
  min-height: 28px;
  display: flex;
  justify-content: center;
}
.hero-demo__dots {
  display: inline-flex;
  gap: 6px;
}
.hero-demo__cell {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--t-lg);
  width: 22px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--border-strong);
  color: var(--text-soft);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.hero-demo__cell--open {
  animation: hero-letter-pop 460ms var(--ease-out);
}
@keyframes hero-letter-pop {
  0%   { transform: translateY(6px) scale(0.7); color: var(--accent); border-color: var(--accent); }
  55%  { transform: translateY(0) scale(1.18);  color: var(--accent); border-color: var(--accent); }
  100% { transform: scale(1); color: var(--text); border-color: var(--accent); }
}
.hero-demo__cell--open { color: var(--text); border-color: var(--accent); }
.join-row {
  display: flex;
  gap: var(--s-2);
}
.join-row__code {
  flex: 1;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
}
.join-row .btn { flex-shrink: 0; }

/* ============================================================
   LOBBY — grid + .lobby-tutorial vocabulary live in shared/style.css.
   Game-specific tweaks below.
   ============================================================ */
.lobby-screen { padding: var(--s-4); }

.game-players, .game-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.panel-header h3 {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Room code card */
.room-code-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: flex-start;
}
.room-code {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.room-code code {
  font-family: var(--font-mono);
  font-size: var(--t-3xl);
  font-weight: 700;
  letter-spacing: 8px;
  background: var(--grad-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 16px rgba(99, 102, 241, 0.35));
}
/* Wobble outline on the room code itself — feels like a circled note. */
#room-code-display {
  padding: var(--s-1) var(--s-3);
  display: inline-block;
}

/* Settings card — ruled-notebook overlay so it reads as a sketchpad page. */
.card.lobby-settings {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 28px,
    rgba(255, 255, 255, 0.04) 28px 29px
  );
}
.lobby-settings .field { gap: var(--s-1); }

/* Tiny squiggle marks flanking the host crown — pure CSS, inline-SVG bg. */
.player-row__crown::before,
.player-row__crown::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 8px;
  margin: 0 2px;
  vertical-align: middle;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6' fill='none'><path d='M1 3 Q 3 1 6 3 T 11 3' stroke='%23ffb454' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.85;
}

/* Lobby actions block */
.lobby-actions { display: flex; flex-direction: column; gap: var(--s-2); }

/* Waiting banner */
.waiting-banner {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--warn-soft);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--r-md);
  color: var(--warn);
  font-size: var(--t-xs);
}

/* ============================================================
   Player lists — in-game uses old .player-row markup; lobby uses
   the new .player-chip vocabulary defined in shared/style.css.
   ============================================================ */
#players {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
#players li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  border-radius: var(--r-md);
  background: transparent;
  transition: background var(--dur-fast) var(--ease-out);
}
#players li:hover { background: var(--panel-elev); }

.player-row__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.player-row__name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-row__crown {
  color: var(--accent);
  flex-shrink: 0;
}
.player-row__score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--t-base);
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
li.disconnected { opacity: 0.5; }
li.drawer .player-row__pencil {
  color: var(--primary);
  flex-shrink: 0;
}
li.guessed .player-row__check {
  color: var(--good);
  flex-shrink: 0;
  animation: pop var(--dur-slow) var(--ease-out);
}
/* Correct guesser's name turns green for the rest of the round. */
li.guessed .player-row__name {
  color: var(--good);
  font-weight: 600;
}
li.score-pop {
  animation: score-pop var(--dur-slow) var(--ease-out);
}
/* Lobby player chips reuse this animation when scores update. */
#lobby-players li.score-pop {
  animation: score-pop var(--dur-slow) var(--ease-out);
}
@keyframes score-pop {
  0% { transform: scale(1); background: var(--primary-soft); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); background: transparent; }
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

/* ============================================================
   GAME
   ============================================================ */
.game-screen {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: var(--s-4);
  padding: var(--s-4);
  height: calc(100vh - 90px);
}
@media (max-width: 980px) {
  .game-screen { grid-template-columns: 1fr; height: auto; }
}

/* Narrow phones: bump tap targets, simplify spacing, tighten the toolbar. */
@media (max-width: 600px) {
  .game-screen, .lobby-screen { padding: var(--s-2); }
  .swatch { width: 24px; height: 24px; }
  .swatches { grid-template-columns: repeat(13, 24px); }
  .brush-dropdown { width: 70px; height: 38px; }
  .toolbar { padding: var(--s-2) var(--s-1); gap: var(--s-1); }
  .toolbar .btn--icon { width: 40px; height: 40px; }
  .status-word { font-size: var(--t-xl); letter-spacing: 3px; }
  .room-code code { font-size: var(--t-2xl); letter-spacing: 5px; }
  .chatlog { min-height: 140px; }
  .canvas-frame canvas {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
  }
  .login-hero .wordmark--xl { font-size: 3rem; }
}

.game-canvas-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-height: 0;
}

/* Status bar — vertical: timer-bar on top, masked word + letter count below. */
.status-bar {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.status-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.status-word {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Drawer's secret word — amber gradient, the "this is yours" moment. */
.status-word--mine {
  letter-spacing: 2px;
  background: var(--grad-accent);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.status-word .letter { display: inline-block; }
.status-word .letter--reveal {
  animation: letter-reveal var(--dur-slow) var(--ease-out);
}
@keyframes letter-reveal {
  0%   { transform: scale(0.4); color: var(--accent); opacity: 0; text-shadow: 0 0 12px var(--accent); }
  60%  { transform: scale(1.2); color: var(--accent); text-shadow: 0 0 8px var(--accent); }
  100% { transform: scale(1); color: var(--text); opacity: 1; text-shadow: none; }
}

/* Letter-count badge — sits where the ring timer used to. Shown only during
   an active round; empty text content collapses naturally without display:none. */
.letter-count {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  line-height: 1;
}
.letter-count:empty { visibility: hidden; }

/* Round timer — thin progress bar above the canvas. Fills left-to-right via
   transform: scaleX, color stages green → warn → bad with the ring's pulse
   animation reused under 25%. */
.timer-bar {
  height: 5px;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.timer-bar__fill {
  height: 100%;
  background: var(--good);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 0.25s linear, background var(--dur-base) var(--ease-out);
}
.timer-bar.warn .timer-bar__fill { background: var(--warn); }
.timer-bar.bad  .timer-bar__fill { background: var(--bad); }
.timer-bar.bad  { animation: pulse 0.9s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* Toolbar — sits below the canvas. */
.toolbar {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--s-2);
  margin-top: var(--s-2);
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.toolbar.disabled { opacity: 0.4; pointer-events: none; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--primary); transform: scale(1.05); }
.swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.swatches {
  display: grid;
  grid-template-columns: repeat(13, 22px);
  gap: 3px;
}

/* Brush-size combobox: trigger button + popover listbox. */
.brush-sizes {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--s-2);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.brush-dropdown {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 64px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.brush-dropdown:hover { border-color: var(--primary); background: var(--panel-elev); }
.brush-dropdown:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.brush-dropdown[aria-expanded="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.brush-dropdown__current {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brush-dropdown__dot {
  display: inline-block;
  border-radius: var(--r-pill);
  background: var(--text);
}
.brush-dropdown__chevron {
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
}
.brush-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: var(--s-2);
  z-index: 10;
  min-width: 110px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.brush-dropdown__menu[hidden] { display: none; }
.brush-dropdown__menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  outline: none;
}
.brush-dropdown__menu li:hover,
.brush-dropdown__menu li:focus { background: var(--panel-elev); }
.brush-dropdown__menu li[aria-selected="true"] { background: var(--primary-soft); }
.brush-dropdown__label {
  font-size: var(--t-sm);
  color: var(--text);
}

/* Custom brush cursor on the canvas. */
.brush-cursor {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--r-pill);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width var(--dur-fast) var(--ease-out), height var(--dur-fast) var(--ease-out);
  z-index: 5;
}
.brush-cursor--draw {
  background: currentColor;
  opacity: 0.85;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.brush-cursor--erase {
  background: transparent;
  border: 1.5px solid #1a1a1a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

/* Canvas */
.canvas-frame {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
canvas {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  box-shadow: 0 0 0 4px var(--panel-elev), 0 0 0 5px var(--border);
}
.canvas-frame.drawer canvas { cursor: none; }
.replay-banner {
  position: absolute;
  top: var(--s-3);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--t-xs);
}

/* Round results overlay (top-right of canvas frame). */
.round-results {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 240px;
  max-height: calc(100% - var(--s-5));
  overflow-y: auto;
  padding: var(--s-3);
  background: rgba(22, 24, 36, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  animation: rr-in 220ms var(--ease-out);
}
.round-results.leaving { animation: rr-out 220ms var(--ease-out) forwards; }
.round-results h3 {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}
.round-results ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.round-results li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 6px;
  border-radius: var(--r-sm);
}
.round-results .rr-name { flex: 1; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round-results .rr-points {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  color: var(--text-soft);
}
.round-results .rr-points--positive { color: var(--accent); }
.round-results .rr-drew {
  font-size: 10px;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 1px 6px;
  margin-left: 4px;
}
@keyframes rr-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rr-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* ============================================================
   Chat
   ============================================================ */
.chatlog {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  margin-bottom: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 200px;
}
.chatlog .msg { word-break: break-word; }
.chatlog .msg.system { color: var(--good); font-style: italic; }
.chatlog .msg.close  { color: var(--warn); font-style: italic; }
.chatlog .msg .name {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: var(--s-1);
}
.chat-form { display: flex; gap: var(--s-2); }
.chat-form .input { flex: 1; }

/* ============================================================
   Modals
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in var(--dur-base) var(--ease-out);
  padding: var(--s-4);
}
.modal {
  box-shadow: var(--sh-lg);
  min-width: 320px;
  max-width: 500px;
  text-align: center;
  animation: modal-in var(--dur-slow) var(--ease-out);
}
@keyframes modal-in {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal h2 { margin-bottom: var(--s-3); font-size: var(--t-2xl); }

/* Word-choice modal */
.modal--word-choice .word-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.modal--word-choice .word-choice-buttons button {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  padding: var(--s-3) var(--s-4);
  letter-spacing: 0.02em;
}

/* Match-end modal — trophy + podium */
.modal--match-end .trophy {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--s-3);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-accent);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 18px rgba(255, 138, 61, 0.45));
  animation: trophy-rise 600ms var(--ease-out) 80ms backwards;
}
.modal--match-end .trophy svg { stroke: var(--accent); }
@keyframes trophy-rise {
  from { transform: translateY(8px) scale(0.85); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* Classical 2-1-3 podium stage. Pillars rise from below; #1 has a crown. */
.podium-stage {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: var(--s-3);
  margin: var(--s-5) auto var(--s-4);
  max-width: 440px;
  min-height: 220px;
}
.pillar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: var(--s-2) var(--s-2) var(--s-3);
  border-radius: var(--r-md) var(--r-md) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  text-align: center;
  animation: pillar-rise 540ms var(--ease-out) backwards;
}
.pillar__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--s-2);
}
.pillar__avatar { width: 40px; height: 40px; font-size: var(--t-base); }
.pillar__medal {
  display: block;
  margin: 0 auto var(--s-1);
  animation: medal-draw 720ms var(--ease-out) backwards;
}
.pillar--silver .pillar__medal { animation-delay: 80ms; }
.pillar--gold   .pillar__medal { animation-delay: 240ms; }
.pillar--bronze .pillar__medal { animation-delay: 400ms; }
@keyframes medal-draw {
  0%   { opacity: 0; transform: scale(0.4) rotate(-30deg); }
  60%  { opacity: 1; transform: scale(1.15) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.pillar__name {
  font-weight: 600;
  font-size: var(--t-sm);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pillar__score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--t-lg);
  font-variant-numeric: tabular-nums;
}
/* Small rank pill at the top of each pillar — clearer than the translucent
   bottom number which collided with the score. */
.pillar__rank {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  pointer-events: none;
}
.pillar--gold .pillar__rank {
  color: var(--accent);
  background: rgba(255, 180, 84, 0.18);
}

/* Tiered heights and colors */
.pillar--gold {
  height: 220px;
  background: linear-gradient(180deg, rgba(255, 180, 84, 0.28), rgba(255, 138, 61, 0.14)), var(--panel-elev);
  border-color: var(--accent);
  box-shadow: 0 -10px 32px rgba(255, 138, 61, 0.22);
  grid-column: 2;
  grid-row: 1;
}
.pillar--silver {
  height: 150px;
  background: linear-gradient(180deg, rgba(200, 210, 230, 0.22), rgba(160, 175, 200, 0.10)), var(--panel-elev);
  border-color: rgba(200, 210, 230, 0.35);
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}
.pillar--bronze {
  height: 120px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.22), rgba(160, 95, 40, 0.10)), var(--panel-elev);
  border-color: rgba(205, 127, 50, 0.35);
  grid-column: 3;
  grid-row: 1;
  align-self: end;
}
.pillar--gold .pillar__name, .pillar--gold .pillar__score { color: var(--accent); }
.pillar--silver .pillar__name { color: #c9d2e6; }
.pillar--bronze .pillar__name { color: #e0a574; }

.pillar--silver { animation-delay: 80ms; }
.pillar--gold   { animation-delay: 240ms; }
.pillar--bronze { animation-delay: 400ms; }

@keyframes pillar-rise {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* Crown floats above the gold pillar — drops in from above. */
.pillar__crown {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  filter: drop-shadow(0 4px 10px rgba(255, 180, 84, 0.5));
  animation: crown-drop 600ms var(--ease-out) 460ms backwards;
}
@keyframes crown-drop {
  from { transform: translateX(-50%) translateY(-20px) scale(0.6); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

/* Team list (4th onwards) — flat chips below the podium. */
.team-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px dashed var(--border);
}
.team-list::before {
  content: "Team";
  width: 100%;
  text-align: center;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px var(--s-3) 4px 4px;
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
}
.team-chip__rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-xs);
  color: var(--text-soft);
  margin: 0 4px;
}
.team-chip__score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
