/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #1a1a2e;
  --bg-secondary: #16213e;
  --fg: #ffffff;
  --border: #2a2a4a;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --gold: #f5c518;
  --tile-bg: #0f3460;
  --tile-selected: #e94560;
  --preview-bg: #16213e;
  --preview-border: #533483;
  --btn-shuffle: #533483;
  --btn-submit: #27ae60;
  --btn-last: #2980b9;
  --btn-clear: #c0392b;
  --history-bg: #0a0a1a;
  --accent-glow: rgba(233, 69, 96, 0.35);
  --success-glow: rgba(39, 174, 96, 0.4);
}

html, body {
  height: 100%;
  height: 100dvh;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(15, 52, 96, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(233, 69, 96, 0.05) 0%, transparent 50%);
  color: var(--fg);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 700px;
  height: 100%;
  height: 100dvh;
  padding: 0 clamp(4px, 2vw, 12px);
  gap: 0;
}

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(4px, 1.5vh, 12px) 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

/* Timer progress bar */
:root {
  --timer-pct: 100%;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: var(--timer-pct);
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 1s linear;
  border-radius: 0 0 2px 2px;
  opacity: 0.7;
}

header h1 {
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.header-left {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.header-left button {
  background: none;
  border: none;
  color: var(--fg);
  font-size: clamp(16px, 4vw, 20px);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.header-left button:hover { background: var(--border); }

.header-info {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  align-items: center;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
}

.timer {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.timer.warning {
  color: var(--accent);
  animation: pulse 1s infinite;
}

.timer.critical {
  color: #ff0040 !important;
  animation: pulse 0.5s infinite, timer-shake 0.3s infinite;
}

@keyframes timer-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-2px); }
  75%      { transform: translateX(2px); }
}

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

.score {
  color: var(--gold);
}

/* ===== TOASTERS ===== */
#toaster {
  position: fixed;
  top: clamp(50px, 12vh, 70px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  background: var(--fg);
  color: var(--bg);
  padding: clamp(8px, 2vh, 12px) clamp(14px, 4vw, 22px);
  border-radius: 12px;
  font-size: clamp(12px, 3.5vw, 14px);
  font-weight: 700;
  animation: toast-in 0.3s, toast-out 0.3s 1.5s forwards;
  pointer-events: auto;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.toast.score-toast {
  background: linear-gradient(135deg, #f5c518, #e6a800);
  color: #000;
  box-shadow: 0 4px 20px rgba(245, 197, 24, 0.4);
}

.toast.reject-toast {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

@keyframes toast-in {
  0%   { opacity: 0; transform: translateY(-20px) scale(0.8); }
  60%  { transform: translateY(5px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out { from { opacity:1; } to { opacity:0; } }

/* ===== PREVIEW AREA ===== */
#preview-area {
  width: 100%;
  flex-shrink: 0;
  height: clamp(44px, 8vh, 60px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(2px, 1vh, 6px) 0;
}

#preview-slots {
  display: flex;
  gap: clamp(4px, 1.2vw, 8px);
  justify-content: center;
  flex-wrap: wrap;
}

.preview-letter {
  width: clamp(32px, 9vw, 48px);
  height: clamp(36px, 10vw, 54px);
  border: 2px solid var(--preview-border);
  border-radius: 10px;
  background: var(--preview-bg);
  color: var(--fg);
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 800;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.12s ease-out;
  box-shadow: 0 2px 8px rgba(83, 52, 131, 0.3);
  transition: background 0.15s;
}

.preview-letter:hover {
  background: rgba(83, 52, 131, 0.3);
}

/* Ghost preview slots */
.preview-ghost {
  border: 2px dashed rgba(83, 52, 131, 0.3) !important;
  background: transparent !important;
  box-shadow: none !important;
  animation: none !important;
}

@keyframes pop {
  0%   { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== LETTER POOL ===== */
#letter-pool {
  display: flex;
  gap: clamp(1px, 0.4vw, 4px);
  justify-content: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-height: 0;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

.letter-tile {
  flex: 1 1 0;
  min-width: 0;
  max-width: 60px;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: clamp(4px, 1.5vw, 12px);
  background: linear-gradient(145deg, #1a4a7a, #0f3460);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.08);
  color: var(--fg);
  font-size: clamp(16px, 6vw, 46px);
  font-weight: 800;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s, opacity 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

.letter-tile:hover {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 0 24px rgba(233, 69, 96, 0.15);
}

.letter-tile:active,
.letter-tile.pressed {
  transform: scale(0.95);
  box-shadow: 0 0 4px var(--accent-glow);
}

.letter-tile.score-flash {
  animation: score-flash 0.5s ease-out;
}

@keyframes score-flash {
  0% { box-shadow: 0 0 0 0 var(--success-glow); }
  40% { box-shadow: 0 0 20px 4px var(--success-glow); border-color: var(--btn-submit); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.letter-tile .letter-char {
  line-height: 1;
  transform: translateY(-8%);
}

.letter-tile .point-badge {
  position: absolute;
  bottom: 4%;
  right: 5%;
  font-size: clamp(9px, 2vw, 14px);
  font-weight: 600;
  opacity: 0.5;
  line-height: 1;
}

/* Wrap tile text in a span via JS — handled in game.js */

.letter-tile.selected {
  background: var(--tile-selected);
  border-color: var(--accent-hover);
  opacity: 0.35;
  transform: scale(0.9);
}

/* Shuffle animation for letter tiles */
.letter-tile.shuffling {
  animation: tile-shuffle 0.4s ease-in-out;
}

@keyframes tile-shuffle {
  0%   { transform: scale(1) rotate(0); opacity: 1; }
  30%  { transform: scale(0.5) rotate(-15deg); opacity: 0.3; }
  60%  { transform: scale(0.5) rotate(15deg); opacity: 0.3; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ===== ACTION BUTTONS ===== */
#actions {
  display: flex;
  gap: clamp(4px, 1.5vw, 8px);
  width: 100%;
  flex-shrink: 0;
  padding: 0;
  margin-top: clamp(2px, 1vh, 6px);
}

#actions button {
  flex: 1;
  padding: clamp(8px, 2.5vh, 14px) clamp(2px, 1vw, 8px);
  border: none;
  border-radius: clamp(6px, 2vw, 10px);
  font-size: clamp(11px, 3.2vw, 14px);
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}

#actions button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.4s;
}

#actions button:hover::before {
  left: 100%;
}

#actions button:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transform: translateY(-1px);
}

#actions button:active,
#actions button.pressed {
  opacity: 0.8;
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

#btn-shuffle { background: var(--btn-shuffle); }
#btn-submit  { background: var(--btn-submit); }
#btn-last    { background: var(--btn-last); }
#btn-clear   { background: var(--btn-clear); }

/* ===== WORD HISTORY ===== */
#word-history {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--history-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: clamp(6px, 1.5vh, 10px);
  overflow-y: auto;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
  margin-top: clamp(8px, 3vh, 16px);
  margin-bottom: clamp(4px, 1.5vh, 8px);
}

.history-label {
  font-size: clamp(9px, 2.8vw, 11px);
  font-weight: 600;
  opacity: 0.5;
  margin-bottom: clamp(2px, 1vh, 4px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#history-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2px, 0.8vw, 4px);
}

.history-word {
  font-size: clamp(10px, 3vw, 12px);
  font-weight: 600;
  color: var(--gold);
  background: rgba(245, 197, 24, 0.08);
  border: 1px solid rgba(245, 197, 24, 0.12);
  padding: clamp(1px, 0.5vh, 3px) clamp(4px, 1.5vw, 8px);
  border-radius: 4px;
  text-transform: uppercase;
  animation: pop 0.2s ease-out;
  transition: background 0.2s;
}

.history-word:hover {
  background: rgba(245, 197, 24, 0.2);
}

.history-word.history-new {
  animation: history-highlight 2s ease-out forwards;
}

@keyframes history-highlight {
  0%   { background: rgba(245, 197, 24, 0.4); color: #fff; transform: scale(1.2); }
  100% { background: rgba(245, 197, 24, 0.08); color: var(--gold); transform: scale(1); }
}

/* ===== START SCREEN ANIMATION ===== */
#start-modal {
  background: var(--bg);
}

#start-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#start-modal .modal-content {
  position: relative;
  z-index: 1;
}

.start-title {
  font-size: clamp(26px, 8vw, 36px);
  margin-bottom: clamp(6px, 2vh, 12px);
  animation: title-pulse 3s ease-in-out infinite;
}

@keyframes title-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.2); }
}

.title-glow {
  color: var(--accent);
  text-shadow:
    0 0 10px var(--accent-glow),
    0 0 20px var(--accent-glow),
    0 0 40px rgba(233, 69, 96, 0.2);
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px var(--accent-glow),
      0 0 20px var(--accent-glow),
      0 0 40px rgba(233, 69, 96, 0.2);
  }
  50% {
    text-shadow:
      0 0 15px var(--accent-glow),
      0 0 30px var(--accent-glow),
      0 0 60px rgba(233, 69, 96, 0.3),
      0 0 80px rgba(233, 69, 96, 0.1);
  }
}

/* ===== MODALS ===== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}
.modal.open { display: flex; }
.modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.modal.open .modal-content {
  animation: modal-in 0.3s ease-out;
}
@keyframes modal-in {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(20px, 5vw, 32px);
  max-width: 420px;
  width: 92%;
  text-align: center;
  color: var(--fg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(233, 69, 96, 0.08);
}

.modal-content h2 {
  font-size: clamp(22px, 7vw, 28px);
  margin-bottom: clamp(6px, 2vh, 12px);
}

.subtitle {
  font-size: clamp(12px, 3.5vw, 14px);
  opacity: 0.7;
  margin-bottom: clamp(12px, 4vh, 20px);
}

.rules {
  text-align: left;
  font-size: clamp(12px, 3.5vw, 14px);
  line-height: clamp(1.8, 5vh, 2);
  margin-bottom: clamp(14px, 5vh, 24px);
  list-style: none;
}

.rules li {
  padding-left: clamp(8px, 2vw, 14px);
  border-left: 3px solid var(--accent);
  margin-bottom: clamp(4px, 1.5vh, 8px);
}

.modal-content button,
.result-content button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: clamp(10px, 3vh, 14px) clamp(20px, 6vw, 32px);
  border-radius: 10px;
  font-size: clamp(15px, 4.5vw, 18px);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: clamp(6px, 2vh, 10px);
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.modal-content button:active {
  transform: scale(0.97);
}

.modal-content button:hover {
  background: var(--accent-hover);
}

/* ===== GAME OVER ===== */
.result-stats {
  margin: clamp(10px, 3vh, 20px) 0;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: clamp(4px, 1.5vh, 8px) 0;
  border-bottom: 1px solid var(--border);
  font-size: clamp(13px, 4vw, 16px);
}

.result-label { opacity: 0.6; }
.result-value { font-weight: 700; color: var(--gold); }

/* ===== HELP MODAL ===== */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(10px, 3vh, 16px);
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: clamp(22px, 7vw, 28px);
  cursor: pointer;
  line-height: 1;
  width: auto;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(12px, 3.8vw, 14px);
}

.score-table td {
  padding: clamp(4px, 1.5vh, 6px) clamp(4px, 2vw, 8px);
  border-bottom: 1px solid var(--border);
}

.score-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--gold);
}

.bonus-note {
  margin-top: clamp(8px, 3vh, 16px);
  font-size: clamp(11px, 3.5vw, 13px);
  color: var(--gold);
}

/* ===== WORD BREAKDOWN ===== */
.final-breakdown {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: calc(92vh - 340px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(8px, 2vw, 12px);
  margin: clamp(8px, 3vh, 16px) 0;
}

.breakdown-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(4px, 1.5vw, 8px);
  margin-bottom: clamp(8px, 3vh, 16px);
  padding-bottom: clamp(6px, 2vh, 12px);
  border-bottom: 1px solid var(--border);
}

.breakdown-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(10px, 3vw, 12px);
}

.breakdown-number {
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 800;
  color: var(--gold);
}

.breakdown-stat span:last-child {
  opacity: 0.6;
  margin-top: clamp(1px, 0.8vh, 2px);
  font-size: clamp(8px, 2.5vw, 10px);
}

.breakdown-section {
  margin-bottom: clamp(6px, 2vh, 12px);
}

.breakdown-section-header {
  font-size: clamp(11px, 3.5vw, 13px);
  font-weight: 700;
  margin-bottom: clamp(3px, 1vh, 6px);
  opacity: 0.7;
}

.breakdown-seven {
  opacity: 1;
  color: var(--gold);
  font-size: clamp(13px, 4vw, 15px);
}

.breakdown-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2px, 0.8vw, 4px);
}

.breakdown-word {
  font-size: clamp(10px, 3vw, 12px);
  font-weight: 600;
  padding: clamp(2px, 0.8vh, 3px) clamp(4px, 1.5vw, 8px);
  border-radius: 4px;
  text-transform: uppercase;
}

.breakdown-found {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.breakdown-missed {
  background: rgba(233, 69, 96, 0.15);
  color: var(--accent);
  opacity: 0.7;
}

.breakdown-seven-word {
  opacity: 1 !important;
  border: 1px solid rgba(245, 197, 24, 0.3);
  font-size: clamp(11px, 3.5vw, 13px);
}

/* 7-letter found: green box */
.breakdown-seven-word.breakdown-found {
  background: rgba(39, 174, 96, 0.3) !important;
  color: #27ae60 !important;
  border-color: rgba(39, 174, 96, 0.5);
}

/* 7-letter missed: red box */
.breakdown-seven-word.breakdown-missed {
  background: rgba(233, 69, 96, 0.2) !important;
  color: var(--accent) !important;
  border-color: rgba(233, 69, 96, 0.4);
}

.result-content {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ===== GAME OVER OVERLAY ===== */
#gameover-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 1500;
  justify-content: center;
  align-items: center;
}

#gameover-overlay.show { display: flex; }

#gameover-overlay.show .overlay-content {
  animation: overlay-in 0.5s ease-out;
}

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

.overlay-content {
  text-align: center;
  color: var(--fg);
  width: 90%;
  max-width: 320px;
}

.overlay-content h2 {
  font-size: clamp(24px, 8vw, 32px);
  margin-bottom: clamp(10px, 4vh, 20px);
}

.overlay-stats {
  font-size: clamp(16px, 5vw, 22px);
  margin-bottom: clamp(14px, 5vh, 24px);
  line-height: 2;
}

.overlay-stats strong {
  color: var(--gold);
}

.overlay-content button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: clamp(12px, 3.5vh, 16px) clamp(20px, 6vw, 32px);
  border-radius: 10px;
  font-size: clamp(15px, 5vw, 18px);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin: clamp(4px, 1.5vh, 8px) 0;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.overlay-content button:active {
  transform: scale(0.97);
}

.overlay-content button:hover {
  background: var(--accent-hover);
}

.secondary-btn {
  background: var(--btn-last) !important;
}

.secondary-btn:hover {
  background: #3498db !important;
}

/* ===== MULTIPLAYER ===== */
.multi-section {
  margin: clamp(10px, 3vh, 16px) 0;
}

.multi-section h3 {
  font-size: clamp(14px, 4vw, 18px);
  margin-bottom: clamp(6px, 2vh, 10px);
  opacity: 0.8;
}

.multi-section input {
  width: 100%;
  padding: clamp(8px, 2.5vh, 12px) clamp(12px, 3vw, 16px);
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: clamp(14px, 4vw, 16px);
  margin-bottom: clamp(6px, 2vh, 10px);
  outline: none;
  text-align: center;
}

.multi-section input:focus {
  border-color: var(--accent);
}

.multi-section button {
  width: 100%;
  padding: clamp(10px, 3vh, 14px);
  border: none;
  border-radius: 8px;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.1s;
}

.multi-section:first-child button {
  background: var(--accent);
}

.multi-section:last-child button {
  background: var(--btn-last);
}

.multi-divider {
  text-align: center;
  opacity: 0.4;
  margin: clamp(8px, 2.5vh, 14px) 0;
  font-size: clamp(12px, 3.5vw, 14px);
}

/* Lobby */
#lobby-players-list {
  margin: clamp(8px, 2.5vh, 14px) 0;
}

.lobby-player-row {
  display: flex;
  justify-content: space-between;
  padding: clamp(6px, 2vh, 10px) clamp(8px, 2.5vw, 12px);
  border-bottom: 1px solid var(--border);
  font-size: clamp(13px, 4vw, 15px);
}

.lobby-ready {
  font-weight: 600;
}

#lobby-status {
  opacity: 0.5;
  font-size: clamp(11px, 3.2vw, 13px);
  margin: clamp(4px, 1.5vh, 8px) 0;
}

#btn-host-start {
  background: var(--btn-submit) !important;
  margin-top: clamp(8px, 2.5vh, 12px);
}
#btn-host-start:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Player indicator */
#player-indicator {
  text-align: center;
  padding: clamp(2px, 1vh, 4px) 0;
  flex-shrink: 0;
}

.player-name {
  background: var(--btn-last);
  color: #fff;
  padding: clamp(2px, 0.8vh, 4px) clamp(10px, 3vw, 16px);
  border-radius: 20px;
  font-size: clamp(11px, 3.2vw, 13px);
  font-weight: 700;
}

/* Leaderboard */
.multi-leaderboard {
  margin: clamp(10px, 3vh, 16px) 0;
}

.leaderboard-player-detail {
  padding: clamp(8px, 2.5vh, 12px) clamp(4px, 1.5vw, 8px);
  border-bottom: 1px solid var(--border);
}

.lb-header {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.5vw, 8px);
}

.lb-rank {
  font-size: clamp(16px, 5vw, 20px);
  text-align: center;
  flex-shrink: 0;
}

.lb-name {
  font-weight: 700;
  flex: 1;
  font-size: clamp(13px, 4vw, 15px);
}

.lb-score {
  color: var(--gold);
  font-weight: 800;
  font-size: clamp(15px, 4.5vw, 18px);
  flex-shrink: 0;
}

.lb-words {
  opacity: 0.5;
  font-size: clamp(10px, 3vw, 12px);
  flex-shrink: 0;
}

.lb-wordlist {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2px, 0.6vw, 4px);
  margin-top: clamp(4px, 1.5vh, 8px);
  font-size: clamp(10px, 3vw, 12px);
}

.lb-word {
  background: rgba(245, 197, 24, 0.1);
  color: var(--gold);
  padding: clamp(1px, 0.5vh, 3px) clamp(4px, 1.2vw, 6px);
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.lb-word-seven {
  background: rgba(245, 197, 24, 0.25) !important;
  color: var(--gold) !important;
  border: 1px solid rgba(245, 197, 24, 0.3);
}

.lb-no-words {
  opacity: 0.3;
  font-style: italic;
  font-size: clamp(10px, 3vw, 12px);
}

.leader-me {
  background: rgba(245, 197, 24, 0.05);
  border-radius: 8px;
}

/* ===== ANIMATIONS ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
}

.shake { animation: shake 0.4s ease-in-out; }

@keyframes score-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.score-pop { animation: score-pop 0.3s ease-out; }
