@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --primary: #1B4332;
  --secondary: #2D6A4F;
  --accent: #40916C;
  --highlight: #52B788;
  --light: #F0F4F0;
  --bg: #1a1a2e;
  --bg-dark: #16213e;
  --bg-card: #1e2a45;
  --bg-card-hover: #243352;
  --text: #ECF0F1;
  --text-muted: #7f8c9b;
  --success: #2ECC71;
  --danger: #E74C3C;
  --white: #FFFFFF;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

::selection {
  background: var(--secondary);
  color: var(--white);
}

h1, h2, h3, h4 {
  font-family: 'Fredoka', sans-serif;
}

/* Loading Screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-card);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============ LOBBY ============ */
.lobby {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(142, 68, 173, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(243, 156, 18, 0.1) 0%, transparent 50%),
    var(--bg);
}

.lobby-content {
  max-width: 440px;
  width: 100%;
  animation: fadeInUp 0.6s ease both;
}

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

.lobby-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.lobby-logo h1 {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
}

.lobby-logo .accent {
  color: var(--highlight);
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 0.25rem;
}

.lobby-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(155, 89, 182, 0.15);
}

.welcome-badge {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.welcome-badge strong {
  color: var(--highlight);
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(236, 240, 241, 0.1);
}

.join-form {
  display: flex;
  gap: 0.75rem;
}

.input-code {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(236, 240, 241, 0.1);
  background: var(--bg-dark);
  color: var(--text);
  font-size: 1.1rem;
  font-family: 'Fredoka', sans-serif;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.input-code:focus {
  border-color: var(--secondary);
}

.input-code::placeholder {
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  text-align: center;
}

.lobby-instructions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.instruction-item {
  flex: 1;
  text-align: center;
  animation: fadeInUp 0.6s ease both;
}

.instruction-item:nth-child(1) { animation-delay: 0.2s; }
.instruction-item:nth-child(2) { animation-delay: 0.35s; }
.instruction-item:nth-child(3) { animation-delay: 0.5s; }

.instruction-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--white);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.instruction-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============ BUTTONS ============ */
.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.6);
  transform: translateY(-1px);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  width: 100%;
}

.btn-secondary {
  background: var(--highlight);
  color: var(--primary);
  font-weight: 600;
}

.btn-secondary:hover {
  background: #e8900e;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(236, 240, 241, 0.05);
}

.btn-tool {
  background: var(--bg-dark);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 1.1rem;
  border: 2px solid transparent;
}

.btn-tool.active {
  border-color: var(--highlight);
  background: rgba(243, 156, 18, 0.15);
}

.btn-tool:hover {
  background: var(--bg-card-hover);
}

.btn-word {
  background: var(--bg-dark);
  color: var(--text);
  padding: 1rem 2rem;
  font-size: 1.3rem;
  font-family: 'Fredoka', sans-serif;
  border: 2px solid rgba(155, 89, 182, 0.3);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.btn-word:hover {
  border-color: var(--highlight);
  background: rgba(243, 156, 18, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.2);
}

.btn-send {
  background: var(--secondary);
  color: var(--white);
  padding: 0.65rem 1rem;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
}

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

/* ============ GAME ROOM ============ */
.game-room {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(155, 89, 182, 0.15);
  min-height: 56px;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.room-badge {
  background: rgba(155, 89, 182, 0.15);
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: 'Fredoka', sans-serif;
}

.room-badge strong {
  color: var(--highlight);
  letter-spacing: 1px;
}

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

.word-display {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
}

.word-reveal strong {
  color: var(--highlight);
}

.word-hint {
  letter-spacing: 4px;
  font-size: 1.4rem;
  color: var(--accent);
}

.status-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: var(--text-muted);
}

.round-end-msg {
  color: var(--highlight);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
}

.mobile-chat-toggle {
  display: none;
  font-size: 1.3rem;
}

/* Timer */
.timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-bar {
  width: 100px;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  border-radius: 4px;
  transition: width 1s linear;
}

.timer-low .timer-fill {
  background: linear-gradient(90deg, var(--danger), #c0392b);
}

.timer-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  min-width: 36px;
}

.timer-low .timer-text {
  color: var(--danger);
  animation: pulse 0.5s ease-in-out infinite;
}

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

/* Word Picker */
.word-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.word-picker {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(155, 89, 182, 0.2);
}

.word-picker h3 {
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  color: var(--text);
}

.word-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Game Body */
.game-body {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 0;
  overflow: hidden;
}

.sidebar-left {
  border-right: 1px solid rgba(155, 89, 182, 0.1);
  overflow-y: auto;
}

.sidebar-right {
  border-left: 1px solid rgba(155, 89, 182, 0.1);
  overflow: hidden;
}

.canvas-area {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-dark);
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(6px);
  z-index: 10;
  gap: 1rem;
  padding: 2rem;
}

.overlay-msg {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  color: var(--highlight);
  text-align: center;
}

.canvas-overlay .btn-large {
  max-width: 300px;
}

/* ============ DRAWING CANVAS ============ */
.drawing-canvas-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.drawing-canvas {
  display: block;
  cursor: default;
  touch-action: none;
}

.drawing-canvas.can-draw {
  cursor: crosshair;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid rgba(155, 89, 182, 0.1);
  flex-wrap: wrap;
  justify-content: center;
}

.color-palette {
  display: flex;
  gap: 4px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.color-swatch.active {
  border-color: var(--white);
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.brush-sizes {
  display: flex;
  gap: 4px;
  align-items: center;
}

.size-btn {
  width: 36px;
  height: 36px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.size-btn.active {
  border-color: var(--highlight);
  background: rgba(243, 156, 18, 0.15);
}

.size-dot {
  display: block;
  border-radius: 50%;
  background: var(--text);
}

/* ============ PLAYER LIST ============ */
.player-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-dark);
}

.player-list-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(155, 89, 182, 0.1);
}

.player-list-header h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-count {
  background: var(--secondary);
  color: var(--white);
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
}

.player-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.no-players {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  animation: slideIn 0.3s ease both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.player-item:nth-child(1) { animation-delay: 0s; }
.player-item:nth-child(2) { animation-delay: 0.05s; }
.player-item:nth-child(3) { animation-delay: 0.1s; }
.player-item:nth-child(4) { animation-delay: 0.15s; }
.player-item:nth-child(5) { animation-delay: 0.2s; }

.player-item.is-drawer {
  background: rgba(142, 68, 173, 0.15);
  border-left: 3px solid var(--secondary);
}

.player-item.is-me {
  background: rgba(243, 156, 18, 0.08);
}

.player-rank {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 18px;
  text-align: center;
}

.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.you-badge {
  font-size: 0.65rem;
  color: var(--highlight);
  background: rgba(243, 156, 18, 0.15);
  padding: 0.05rem 0.4rem;
  border-radius: 8px;
}

.drawer-badge {
  font-size: 0.7rem;
  color: var(--accent);
}

.player-score {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--highlight);
  min-width: 30px;
  text-align: right;
}

/* ============ CHAT PANEL ============ */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-dark);
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(155, 89, 182, 0.1);
}

.chat-header h3 {
  font-size: 1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  gap: 0.5rem;
}

.chat-empty-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.chat-message {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  animation: msgIn 0.2s ease;
}

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

.chat-message.system {
  text-align: center;
  padding: 0.5rem;
}

.system-msg {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Fredoka', sans-serif;
}

.chat-author {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.4rem;
}

.chat-text {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-word;
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(155, 89, 182, 0.1);
}

.chat-input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(236, 240, 241, 0.1);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--secondary);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(155, 89, 182, 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(155, 89, 182, 0.4);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .game-body {
    grid-template-columns: 1fr;
  }

  .sidebar-left {
    display: none;
  }

  .sidebar-right {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45vh;
    z-index: 50;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 2px solid var(--secondary);
    border-left: none;
  }

  .game-body.show-chat .sidebar-right {
    transform: translateY(0);
  }

  .mobile-chat-toggle {
    display: flex !important;
  }

  .canvas-area {
    height: calc(100vh - 56px);
  }

  .word-hint {
    font-size: 1rem;
    letter-spacing: 2px;
  }

  .timer-bar {
    width: 60px;
  }

  .room-badge {
    display: none;
  }

  .word-options {
    flex-direction: column;
  }

  .btn-word {
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .lobby-instructions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .instruction-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
  }

  .instruction-num {
    flex-shrink: 0;
  }

  .lobby-card {
    padding: 1.5rem;
  }

  .lobby-logo h1 {
    font-size: 2.2rem;
  }

  .toolbar {
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
  }

  .color-swatch {
    width: 24px;
    height: 24px;
  }

  .header-center {
    gap: 0.5rem;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to PictoGuess! You'll see the lobby where you can create or join a room.", "view": "lobby", "highlight_selector": ".lobby-card", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Click 'Create New Room' to start a new game. Share the room code with friends.", "view": "lobby", "highlight_selector": ".btn-primary", "wait_for": "user_interaction"},
  {"step": 3, "narration": "You're in the game room! The player list shows who's online. Click 'Start Drawing' to begin.", "view": "game", "highlight_selector": ".canvas-overlay", "wait_for": "user_interaction"},
  {"step": 4, "narration": "Pick one of three words to draw. The timer starts at 60 seconds.", "view": "game", "highlight_selector": ".word-picker", "wait_for": "user_interaction"},
  {"step": 5, "narration": "Use the drawing tools — colors, brush sizes, eraser — to sketch your word on the canvas.", "view": "game", "highlight_selector": ".toolbar", "wait_for": "tap_to_continue"},
  {"step": 6, "narration": "Other players type their guesses in the chat panel on the right. Correct guesses earn points!", "view": "game", "highlight_selector": ".chat-panel", "wait_for": "tap_to_continue"},
  {"step": 7, "narration": "Scores are tracked in the player list. The drawer gets 5 points per correct guess, the guesser gets 10!", "view": "game", "highlight_selector": ".player-list", "wait_for": "tap_to_continue"}
]
-->

.word-bank-hint, .word-bank-manager { margin-top: 1rem; }
.word-bank-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.word-bank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.word-bank-list li { display: flex; justify-content: space-between; align-items: center; }
.chat-target-hint, .chat-target-hidden { opacity: 0.8; font-size: 0.9rem; }
.current-drawer { font-weight: 700; }
.drawing-canvas-wrap { display: flex; flex-direction: column; gap: 0.75rem; }
.drawing-canvas { width: 100%; max-width: 100%; background: #fff; border-radius: 12px; }
.game-room-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; }
.room-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.room-list-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.error-text { color: #d33; }

.guess-badge { display: inline-block; margin-top: 0.15rem; font-size: 0.68rem; color: var(--success); background: rgba(46, 204, 113, 0.12); padding: 0.05rem 0.4rem; border-radius: 8px; }
.score-flash { display: inline-block; margin-left: 0.35rem; font-size: 0.72rem; color: var(--highlight); animation: scorePop 0.8s ease; }
@keyframes scorePop { 0% { opacity: 0; transform: translateY(4px) scale(0.9); } 20% { opacity: 1; transform: translateY(0) scale(1.05); } 100% { opacity: 0; transform: translateY(-4px) scale(1); } }

.timer-ai-status { font-size: 0.8rem; color: var(--highlight); font-family: 'Fredoka', sans-serif; }

.leaderboard-section {
  position: relative;
  z-index: 2;
  padding: 1rem;
  background: var(--bg-dark);
  border-top: 1px solid rgba(155, 89, 182, 0.12);
}

.leaderboard-panel {
  background: var(--bg-card);
  border: 1px solid rgba(155, 89, 182, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(155, 89, 182, 0.1);
}

.leaderboard-header h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.leaderboard-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.leaderboard-export-btn {
  white-space: nowrap;
}

.leaderboard-table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.8rem 1rem;
  background: rgba(236, 240, 241, 0.03);
}

.leaderboard-table tbody td {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(155, 89, 182, 0.08);
  font-size: 0.92rem;
}

.leaderboard-table tbody tr.is-me {
  background: rgba(243, 156, 18, 0.08);
}

.leaderboard-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.4rem;
}

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.leaderboard-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-card-hover);
}

.leaderboard-you,
.leaderboard-drawer {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.68rem;
  border-radius: 8px;
  padding: 0.05rem 0.38rem;
}

.leaderboard-you {
  color: var(--highlight);
  background: rgba(243, 156, 18, 0.14);
}

.leaderboard-drawer {
  color: var(--accent);
  background: rgba(142, 68, 173, 0.14);
}

.leaderboard-pdf-only {
  position: absolute;
  inset: auto;
  opacity: 0;
  pointer-events: none;
  left: 0;
  top: 0;
  width: 900px;
  background: #fff;
  color: #111;
  padding: 24px;
}

.leaderboard-pdf-only h1 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #111;
  font-family: 'Fredoka', sans-serif;
}

.leaderboard-pdf-only p {
  margin-bottom: 16px;
  color: #444;
}

.leaderboard-pdf-only table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-pdf-only th,
.leaderboard-pdf-only td {
  border: 1px solid #ddd;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
}

.leaderboard-pdf-only th {
  background: #f5f5f5;
}

@media (max-width: 900px) {
  .leaderboard-section {
    padding: 0.75rem;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .leaderboard-export-btn {
    width: 100%;
  }
}
