/* ═══════════════════════════════════════════════════════════
   Wordgrove — Forest Grimoire Design System
   "The Alchemist's Journal" — Enchanted Editorial
   ═══════════════════════════════════════════════════════════ */

/* ─── Custom Properties (Woodland Witchy — Default) ──────── */
:root {
  /* Forest Backgrounds — tonal layering, no harsh borders */
  --bg:             #041706;
  --surface:        #041706;
  --surface-low:    #0c200d;
  --surface-mid:    #102411;
  --surface-high:   #1b2f1b;
  --surface-highest: #253a25;
  --surface-bright: #2a3e29;
  --surface-variant: #253a25;

  /* Primary: Honey Gold */
  --primary:        #eec068;
  --primary-dim:    #b38a38;
  --primary-container: #382600;
  --on-primary:     #412d00;

  /* Secondary: Lavender Mist */
  --secondary:      #dcb9fa;
  --secondary-container: #573a72;
  --on-secondary:   #3f235a;

  /* Tertiary: Sage Green */
  --tertiary:       #aad0ad;
  --tertiary-container: #0f3018;
  --on-tertiary:    #16371f;

  /* Text — warm cream, NEVER pure white */
  --text:           #d0e9cb;
  --text-muted:     #8d928a;
  --text-dim:       #5d6259;

  /* Outline — ghost borders */
  --outline:        #8d928a;
  --outline-variant: #434841;

  /* Accent aliases (mapped to primary/secondary for compatibility) */
  --accent:         #eec068;
  --accent-light:   #ffdea6;
  --accent-dim:     #7b5804;
  --accent-glow:    rgba(238, 192, 104, 0.35);

  /* Gold */
  --gold:           #eec068;
  --gold-light:     #ffdea6;
  --gold-glow:      rgba(238, 192, 104, 0.40);

  /* Tiles */
  --tile-bg:        #1b2f1b;
  --tile-hover:     #253a25;

  /* Bonus colours — nature-coded */
  --dl-bg:   #1d4ed8;  --dl-text:  #bfdbfe;
  --tl-bg:   #0f3018;  --tl-text:  #aad0ad;
  --2w-bg:   #7b5804;  --2w-text:  #ffdea6;
  --3w-bg:   #93000a;  --3w-text:  #ffdad6;

  /* Error */
  --error:          #ffb4ab;
  --error-container: #93000a;

  /* Radius — soft woodland, no sharp corners */
  --r-sm:   0.25rem;
  --r-md:   0.75rem;
  --r-lg:   1rem;
  --r-xl:   1.5rem;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 0.12s ease;
  --t-med:  0.25s ease;

  /* Fonts */
  --font-headline: 'Newsreader', 'Georgia', serif;
  --font-body:     'Noto Serif', 'Georgia', serif;
  --font-label:    'Manrope', 'Inter', system-ui, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
ul, ol  { list-style: none; }
button  { font-family: inherit; cursor: pointer; border: none; }
input   { font-family: inherit; }

/* ─── Body / App ─────────────────────────────────────────── */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(238, 192, 104, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 110%, rgba(220, 185, 250, 0.04) 0%, transparent 50%);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: 48px;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Deep-forest vignette overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(4, 23, 6, 0.65) 100%);
  pointer-events: none;
  z-index: 0;
}
#app, #top-toolbar { position: relative; z-index: 1; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-mid); }
::-webkit-scrollbar-thumb { background: rgba(238, 192, 104, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(238, 192, 104, 0.55); }

/* ─── Focus ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════════════════════
   SCREENS
   ══════════════════════════════════════════════════════════ */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
  animation: screen-fade-in var(--t-med) both;
}
@keyframes screen-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Card — tonal layering, NO harsh borders ────────────── */
.card {
  background: var(--surface-mid);
  border: 1px solid rgba(67, 72, 65, 0.2);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ─── Game Title — honey-gold italic serif ───────────────── */
.game-title {
  font-family: var(--font-headline);
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--primary);
  text-shadow: 0 0 15px rgba(238, 192, 104, 0.6);
}

.game-subtitle {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* ─── Buttons — "Sigils" ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  border-radius: var(--r-full);
  cursor: pointer;
  transition:
    box-shadow var(--t-fast),
    transform var(--t-fast),
    background var(--t-med);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dim) 100%);
  color: var(--on-primary);
  box-shadow: 0 4px 16px rgba(238, 192, 104, 0.30);
}
.btn--primary:hover {
  box-shadow: 0 6px 28px rgba(238, 192, 104, 0.50), 0 0 0 1px rgba(255, 222, 166, 0.25);
  transform: translateY(-1px);
}
.btn--primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--outline-variant);
}
.btn--ghost:hover {
  background: rgba(170, 208, 173, 0.06);
  color: var(--text);
  border-color: var(--outline);
}

.btn--full { width: 100%; }
.btn--lg   { padding: 0.875rem 2rem; font-size: 1rem; }

/* ─── Inputs — "Scribe's Mark" underline style ───────────── */
.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-bottom: 2px solid var(--outline);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.75rem 0.75rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 2px 0 0 var(--primary), 0 0 8px rgba(238, 192, 104, 0.15);
}

/* ─── Toggle Switch ──────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-thumb {
  position: absolute;
  inset: 0;
  background: var(--outline-variant);
  border-radius: 13px;
  transition: background var(--t-med);
}
.toggle-thumb::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform var(--t-med), background var(--t-med);
}
.toggle-switch input:checked + .toggle-thumb {
  background: rgba(238, 192, 104, 0.3);
}
.toggle-switch input:checked + .toggle-thumb::before {
  transform: translateX(22px);
  background: var(--primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════
   LOADING SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-loading {
  align-items: center;
  justify-content: center;
}

.loading-wizard {
  font-size: 5rem;
  animation: wizard-float 3s ease-in-out infinite;
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(220, 185, 250, 0.5));
}

@keyframes wizard-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

.loading-title {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: clamp(2.5rem, 10vw, 5rem);
  letter-spacing: 0.04em;
  color: var(--primary);
  text-shadow: 0 0 15px rgba(238, 192, 104, 0.6);
  display: flex;
  gap: 0.05em;
  justify-content: center;
}

.loading-title span {
  opacity: 0;
  animation: letter-appear 0.4s ease forwards;
}
.loading-title span:nth-child(1) { animation-delay: 0.1s; }
.loading-title span:nth-child(2) { animation-delay: 0.2s; }
.loading-title span:nth-child(3) { animation-delay: 0.3s; }
.loading-title span:nth-child(4) { animation-delay: 0.4s; }
.loading-title span:nth-child(5) { animation-delay: 0.5s; }
.loading-title span:nth-child(6) { animation-delay: 0.6s; }
.loading-title span:nth-child(7) { animation-delay: 0.7s; }
.loading-title span:nth-child(8) { animation-delay: 0.8s; }
.loading-title span:nth-child(9) { animation-delay: 0.9s; }

@keyframes letter-appear {
  from { opacity: 0; transform: translateY(-20px) scale(0.5); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-subtitle {
  font-family: var(--font-label);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  animation: fade-in-up 0.6s 1s ease both;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#screen-loading .game-title  { font-size: clamp(3rem, 10vw, 5.5rem); }
#screen-loading .game-subtitle { margin-top: -0.25rem; }

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(238, 192, 104, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
  margin-top: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Firefly sparkles */
.loading-sparkles { position: relative; height: 60px; margin-top: 1rem; }
.sparkle {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  animation: firefly-drift 3.5s ease-in-out infinite;
}
.sparkle:nth-child(1) { left: 10%; animation-delay: 0s; }
.sparkle:nth-child(2) { left: 30%; animation-delay: 0.7s; }
.sparkle:nth-child(3) { left: 50%; animation-delay: 1.4s; }
.sparkle:nth-child(4) { left: 70%; animation-delay: 0.35s; }
.sparkle:nth-child(5) { left: 90%; animation-delay: 1.05s; }

@keyframes firefly-drift {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  30%  { opacity: 0.8; transform: translateY(-12px) scale(1); }
  60%  { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-35px) scale(0.3); }
}

/* ══════════════════════════════════════════════════════════
   LOBBY SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-lobby {
  align-items: center;
  justify-content: flex-start;
  padding: 2.5rem 1rem 2rem;
}

.lobby-container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.lobby-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.lobby-icon {
  font-size: 2.5rem;
  animation: wizard-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(220, 185, 250, 0.5));
}
.lobby-header .game-title { font-size: clamp(2rem, 8vw, 3.5rem); }

.lobby-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 600px) {
  .lobby-body { grid-template-columns: 1fr; }
}

/* Form */
.form-heading {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.25rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}
.form-group--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.form-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.form-label-hint {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0.1rem;
}
.form-label-group { display: flex; flex-direction: column; }

/* Players card */
.lobby-players { display: flex; flex-direction: column; gap: 0.875rem; }

.section-heading {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.player-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  background: var(--secondary-container);
  color: var(--secondary);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-label);
}

/* ─── Player List ────────────────────────────────────────── */
.player-list { display: flex; flex-direction: column; gap: 0.5rem; }
.player-list-empty {
  color: var(--text-dim);
  font-size: 0.875rem;
  text-align: center;
  padding: 1.5rem 0;
  font-style: italic;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--surface-high);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.player-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary-container), var(--tertiary-container));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-headline);
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(220, 185, 250, 0.2);
}
.player-name { flex: 1; font-size: 0.9375rem; font-weight: 500; color: var(--text); }
.player-score {
  font-family: var(--font-headline);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9375rem;
}
.player-ready-badge {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--tertiary);
  background: rgba(170, 208, 173, 0.1);
  border-radius: var(--r-full);
  padding: 0.15em 0.55em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Active player pulsing avatar */
.player-item.active-turn .player-avatar {
  animation: pulse-avatar 1.8s ease-out infinite;
}
@keyframes pulse-avatar {
  0%   { box-shadow: 0 0 0 0   rgba(220, 185, 250, 0.65); }
  70%  { box-shadow: 0 0 0 10px rgba(220, 185, 250, 0); }
  100% { box-shadow: 0 0 0 0   rgba(220, 185, 250, 0); }
}

/* ══════════════════════════════════════════════════════════
   GAME SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-game {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 0;
}

/* ─── Timer Bar ──────────────────────────────────────────── */
.timer-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  flex-shrink: 0;
  transition: height var(--t-med), opacity var(--t-med);
}
.timer-bar-wrap.collapsed { height: 0; opacity: 0; pointer-events: none; }

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(
    90deg,
    var(--tertiary-container) 0%,
    var(--tertiary)           40%,
    var(--primary)            80%,
    var(--gold-light)         100%
  );
  transform-origin: left center;
}
@keyframes timer-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.timer-bar.danger {
  background: linear-gradient(90deg, #7f1d1d 0%, #dc2626 50%, #f87171 100%);
  animation: timer-danger-pulse 0.45s ease-in-out infinite alternate !important;
}
@keyframes timer-danger-pulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.5) drop-shadow(0 0 5px rgba(239, 68, 68, 0.9)); }
}

/* ─── Game Layout (3-column) ─────────────────────────────── */
.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr 190px;
  gap: 1rem;
  padding: 1rem;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

/* ─── Score Panel (left) ─────────────────────────────────── */
.score-panel {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  position: sticky;
  top: 1rem;
}
.round-indicator {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
  padding: 0.4rem 0.75rem;
  background: var(--surface-high);
  border-radius: var(--r-full);
}
.turn-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.75rem;
  background: var(--surface-high);
  border-radius: var(--r-md);
}
.turn-label {
  font-family: var(--font-label);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 500;
}
.turn-player-name {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--secondary);
  text-shadow: 0 0 12px rgba(220, 185, 250, 0.4);
}
.player-scores { display: flex; flex-direction: column; gap: 0.625rem; }

/* ─── Player Score Entry (game screen) ───────────────────── */
.player-score-entry {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: var(--surface-high);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.player-score-entry.active-player {
  background: rgba(238, 192, 104, 0.07);
  box-shadow: 0 0 0 1px rgba(238, 192, 104, 0.18);
}
.player-score-entry .player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(220, 185, 250, 0.15);
}
.player-score-entry.active-player .player-avatar {
  animation: avatar-glow 1.5s ease-in-out infinite;
}
.player-score-entry .player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.player-score-entry .player-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-score-entry .player-score-value {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold-glow);
  white-space: nowrap;
  flex-shrink: 0;
}
.turn-badge {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Board Area (center) ────────────────────────────────── */
.board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
}

/* ─── Game Grid — moss-bed board ─────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 12px;
  background: var(--surface-low);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 450px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(170, 208, 173, 0.03);
}

/* ─── Tile — "Letter Stones" ─────────────────────────────── */
.tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-highest);
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition:
    background   var(--t-fast),
    transform    var(--t-fast),
    box-shadow   var(--t-fast);
}

/* Subtle moss sheen */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(148deg, rgba(170, 208, 173, 0.04) 0%, transparent 55%);
  border-radius: inherit;
  pointer-events: none;
}

.tile:hover {
  background: var(--surface-bright);
  transform: scale(1.05) translateY(-1px);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.35),
    0 0 6px rgba(170, 208, 173, 0.1);
}

.tile.in-path {
  background: var(--secondary-container);
  box-shadow: 0 0 10px rgba(220, 185, 250, 0.3), 0 2px 8px rgba(0,0,0,0.3);
}

.tile.selected {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dim) 100%);
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 0 0 2px rgba(238, 192, 104, 0.4),
    0 0 18px rgba(238, 192, 104, 0.4),
    0 0 36px rgba(238, 192, 104, 0.15),
    0 5px 14px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.tile.highlighted-bonus {
  box-shadow: 0 0 12px rgba(238, 192, 104, 0.35);
}

/* ─── Tile Inner Elements ────────────────────────────────── */
.tile-letter {
  font-family: var(--font-headline);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  /* sits in the flex center without any positioning */
  z-index: 1;
  pointer-events: none;
}
.tile.selected .tile-letter {
  color: var(--on-primary);
  text-shadow: 0 0 6px rgba(65, 45, 0, 0.3);
}
@media (max-width: 540px) { .tile-letter { font-size: 1.05rem; } }

.tile-points {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-family: var(--font-label);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}
.tile.selected .tile-points { color: rgba(65, 45, 0, 0.55); }

/* ─── Bonus Badge (top-left corner of tile) ──────────────── */
.tile-bonus {
  position: absolute;
  top: 3px;
  left: 3px;
  font-family: var(--font-label);
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 1px 3px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

/* Bonus tile tints + badge colours */
.tile.bonus-dl { box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.35); }
.tile.bonus-dl .tile-bonus { background: var(--dl-bg); color: var(--dl-text); }

.tile.bonus-tl { box-shadow: inset 0 0 0 1px rgba(170, 208, 173, 0.35); }
.tile.bonus-tl .tile-bonus { background: var(--tl-bg); color: var(--tl-text); }

.tile.bonus-2w { box-shadow: inset 0 0 0 1px rgba(238, 192, 104, 0.35); }
.tile.bonus-2w .tile-bonus { background: var(--2w-bg); color: var(--2w-text); }

.tile.bonus-3w { box-shadow: inset 0 0 0 1px rgba(147, 0, 10, 0.45); }
.tile.bonus-3w .tile-bonus { background: var(--3w-bg); color: var(--3w-text); }

/* ─── Word Preview Bar ───────────────────────────────────── */
.word-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 450px;
  padding: 0.75rem 1.25rem;
  background: var(--surface-mid);
  border-radius: var(--r-lg);
  min-height: 56px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
  transition: box-shadow var(--t-fast);
}
.word-preview:has(.word-preview-text:not(:empty)) {
  box-shadow:
    0 0 18px rgba(220, 185, 250, 0.12),
    0 4px 18px rgba(0, 0, 0, 0.25);
}

.word-preview-text {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
  text-shadow: 0 0 8px rgba(220, 185, 250, 0.2);
  min-height: 1.5em;
}
.word-preview-text:empty::before {
  content: 'Trace a word\2026';
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}
.word-preview-score {
  font-family: var(--font-headline);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
  white-space: nowrap;
  padding-left: 1rem;
}

/* ─── Word Action Buttons ────────────────────────────────── */
.word-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin-top: 0.75rem;
}

/* ─── Bonus Legend (right) ───────────────────────────────── */
.bonus-legend {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}
.legend-title {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.legend-list { display: flex; flex-direction: column; gap: 0.625rem; }
.legend-item { display: flex; align-items: center; gap: 0.625rem; }

.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 20px;
  border-radius: 4px;
  font-family: var(--font-label);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.badge--dl { background: var(--dl-bg); color: var(--dl-text); }
.badge--tl { background: var(--tl-bg); color: var(--tl-text); }
.badge--2w { background: var(--2w-bg); color: var(--2w-text); }
.badge--3w { background: var(--3w-bg); color: var(--3w-text); }

.legend-info { display: flex; flex-direction: column; }
.legend-name { font-size: 0.8rem; font-weight: 500; color: var(--text); }
.legend-desc { font-size: 0.68rem; color: var(--text-dim); }

.legend-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 0.625rem 0.75rem;
  background: rgba(238, 192, 104, 0.06);
  border-radius: var(--r-md);
}
.legend-tip strong { color: var(--gold); }
.legend-tip-icon   { font-size: 0.85rem; flex-shrink: 0; margin-top: 0.05rem; }

/* ══════════════════════════════════════════════════════════
   SUMMARY SCREENS (shared)
   ══════════════════════════════════════════════════════════ */
#screen-round-summary,
#screen-game-summary {
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.summary-wrapper {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.summary-card { width: 100%; min-height: 200px; }

.summary-actions {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  justify-content: center;
}

.summary-title {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(238, 192, 104, 0.3);
}

.summary-round-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.5rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.summary-table th {
  font-family: var(--font-label);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(67, 72, 65, 0.3);
}
.summary-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid rgba(67, 72, 65, 0.15);
  color: var(--text);
}
.summary-table td:last-child {
  text-align: right;
  font-family: var(--font-headline);
  font-weight: 700;
  color: var(--gold);
}
.summary-table tr.winner td {
  background: rgba(238, 192, 104, 0.06);
}

/* Best word badge — "Aura Chip" */
.best-word {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.4rem 0.9rem;
  background: var(--surface-variant);
  border-radius: var(--r-full);
  font-family: var(--font-headline);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary);
  box-shadow: 0 0 12px rgba(220, 185, 250, 0.1);
}
.best-word-label {
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Winner banner */
.winner-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(238, 192, 104, 0.08) 0%,
    rgba(220, 185, 250, 0.06) 100%
  );
  border-radius: var(--r-lg);
  margin-bottom: 1.5rem;
  text-align: center;
}
.winner-crown { font-size: 2.5rem; }
.winner-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.winner-name {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 18px var(--gold-glow);
}

/* ══════════════════════════════════════════════════════════
   TOP TOOLBAR
   ══════════════════════════════════════════════════════════ */
#top-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(4, 23, 6, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.game-logo-small {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(238, 192, 104, 0.4);
}

.toolbar-actions { display: flex; gap: 0.5rem; }

.icon-btn {
  background: var(--surface-high);
  border-radius: var(--r-md);
  padding: 0.35rem 0.65rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-bright); transform: scale(1.05); }
.icon-btn:active { transform: scale(0.95); }

/* ══════════════════════════════════════════════════════════
   TILE ANIMATIONS
   ══════════════════════════════════════════════════════════ */
.tile.removing {
  animation: tile-remove 0.4s ease forwards;
}
@keyframes tile-remove {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(0); opacity: 0; }
}

.tile.dropping {
  animation: tile-drop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes tile-drop {
  from { transform: translateY(-40px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Bonus shimmer — subtle moss glow */
.tile.bonus-dl,
.tile.bonus-tl,
.tile.bonus-2w,
.tile.bonus-3w {
  animation: bonus-shimmer 4s ease-in-out infinite;
}
@keyframes bonus-shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

/* Selected tile pulse ring */
.tile.selected::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(238, 192, 104, 0.5);
  animation: ring-pulse 0.8s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.3; }
}

/* ─── Score Popup ────────────────────────────────────────── */
.score-popup {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--font-headline);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 14px var(--gold-glow);
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  animation: score-float-up 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes score-float-up {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-64px) scale(0.8); }
}

/* ─── Word Preview Chips ─────────────────────────────────── */
#word-preview .letter-chip {
  display: inline-block;
  background: var(--secondary-container);
  color: var(--secondary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--r-sm);
  margin: 0 1px;
  font-family: var(--font-headline);
  font-size: 1.1rem;
  animation: chip-pop 0.15s ease both;
}
@keyframes chip-pop {
  from { transform: scale(0.7) translateY(6px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

#word-preview.valid-word {
  box-shadow: 0 0 12px rgba(170, 208, 173, 0.3);
}
#word-preview.invalid-word {
  box-shadow: 0 0 8px rgba(255, 180, 171, 0.2);
}

/* ─── Winner Celebration ─────────────────────────────────── */
.winner-banner .trophy {
  font-size: 4rem;
  display: block;
  animation: trophy-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes trophy-bounce {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
.winner-banner h2 {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-light), var(--gold));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-text 2s linear infinite;
}
@keyframes shimmer-text {
  from { background-position: 0% center; }
  to { background-position: 200% center; }
}
.winner-score {
  font-size: 1.5rem;
  color: var(--gold);
  font-weight: 700;
  margin-top: 0.5rem;
}

/* ─── Turn indicator ─────────────────────────────────────── */
.turn-indicator.your-turn {
  color: var(--primary);
  font-weight: 700;
  animation: your-turn-pulse 1.5s ease-in-out infinite;
}
@keyframes your-turn-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(238, 192, 104, 0.4); }
  50% { text-shadow: 0 0 18px rgba(238, 192, 104, 0.6), 0 0 30px rgba(238, 192, 104, 0.3); }
}

/* ─── Active Player Glow ─────────────────────────────────── */
.player-score-entry.active-player .player-avatar {
  animation: avatar-glow 1.5s ease-in-out infinite;
}
@keyframes avatar-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(220, 185, 250, 0.3); }
  50% { box-shadow: 0 0 18px rgba(220, 185, 250, 0.5), 0 0 30px rgba(220, 185, 250, 0.2); }
}

/* ══════════════════════════════════════════════════════════
   SWITCHABLE SKINS
   ══════════════════════════════════════════════════════════ */

/* ── Skin: Dark Fantasy (original) ────────────────────── */
body.skin-dark-fantasy {
  --bg:             #0d0d1a;
  --surface:        #0d0d1a;
  --surface-low:    #12122a;
  --surface-mid:    #1a1a2e;
  --surface-high:   #16213e;
  --surface-highest: #2a2a4a;
  --surface-bright: #3a3a6a;
  --surface-variant: #1e1e3a;

  --primary:        #7c3aed;
  --primary-dim:    #5b21b6;
  --primary-container: #4c1d95;
  --on-primary:     #ffffff;

  --secondary:      #a855f7;
  --secondary-container: #6d28d9;
  --on-secondary:   #ffffff;

  --tertiary:       #c084fc;
  --tertiary-container: #4c1d95;
  --on-tertiary:    #ffffff;

  --text:           #e2e8f0;
  --text-muted:     #64748b;
  --text-dim:       #475569;

  --outline:        #64748b;
  --outline-variant: rgba(100, 116, 139, 0.28);

  --accent:         #7c3aed;
  --accent-light:   #a855f7;
  --accent-dim:     #4c1d95;
  --accent-glow:    rgba(168, 85, 247, 0.32);

  --gold:           #f59e0b;
  --gold-light:     #fbbf24;
  --gold-glow:      rgba(245, 158, 11, 0.40);

  --tile-bg:        #2a2a4a;
  --tile-hover:     #3a3a6a;

  --dl-bg: #1d4ed8; --dl-text: #bfdbfe;
  --tl-bg: #15803d; --tl-text: #bbf7d0;
  --2w-bg: #b45309; --2w-text: #fde68a;
  --3w-bg: #b91c1c; --3w-text: #fecaca;
}

body.skin-dark-fantasy::before {
  background: radial-gradient(
    ellipse 80% 50% at 50% -10%,
    rgba(124, 58, 237, 0.14) 0%, transparent 60%
  );
}

body.skin-dark-fantasy {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 58, 237, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 110%, rgba(245, 158, 11, 0.06) 0%, transparent 50%);
}

body.skin-dark-fantasy #top-toolbar {
  background: rgba(13, 13, 26, 0.7);
}

/* ── Skin: Daylight Cottage ───────────────────────────── */
body.skin-daylight {
  --bg:             #f4efe4;
  --surface:        #f4efe4;
  --surface-low:    #ede7d9;
  --surface-mid:    #e6dece;
  --surface-high:   #ddd4c1;
  --surface-highest: #d2c8b2;
  --surface-bright: #ccc0a8;
  --surface-variant: #ede7d9;

  --primary:        #7b5804;
  --primary-dim:    #5d4200;
  --primary-container: #ffdea6;
  --on-primary:     #ffffff;

  --secondary:      #573a72;
  --secondary-container: #f0dbff;
  --on-secondary:   #ffffff;

  --tertiary:       #2d4e33;
  --tertiary-container: #c6ecc8;
  --on-tertiary:    #ffffff;

  --text:           #1a2e1a;
  --text-muted:     #6b7060;
  --text-dim:       #8d928a;

  --outline:        #8d928a;
  --outline-variant: rgba(141, 146, 138, 0.25);

  --accent:         #7b5804;
  --accent-light:   #b38a38;
  --accent-dim:     #5d4200;
  --accent-glow:    rgba(123, 88, 4, 0.2);

  --gold:           #7b5804;
  --gold-light:     #b38a38;
  --gold-glow:      rgba(123, 88, 4, 0.25);

  --tile-bg:        #ddd4c1;
  --tile-hover:     #d2c8b2;

  --dl-bg: #1d4ed8; --dl-text: #ffffff;
  --tl-bg: #2d4e33; --tl-text: #ffffff;
  --2w-bg: #7b5804; --2w-text: #ffffff;
  --3w-bg: #93000a; --3w-text: #ffffff;
}

body.skin-daylight {
  background-image: none;
}

body.skin-daylight::before {
  background: radial-gradient(circle at 50% 50%, transparent 50%, rgba(244, 239, 228, 0.3) 100%);
}

body.skin-daylight #top-toolbar {
  background: rgba(244, 239, 228, 0.85);
  backdrop-filter: blur(12px);
}

/* ══════════════════════════════════════════════════════════
   VINE DECORATIONS (loading/lobby)
   ══════════════════════════════════════════════════════════ */
.vine-decoration {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}
.vine-decoration svg { width: 100%; height: 100%; }
.vine-path {
  fill: none;
  stroke: var(--on-tertiary, #16371f);
  stroke-width: 2;
  stroke-linecap: round;
}
.vine-dot {
  fill: var(--tertiary-container, #2d4e33);
}

/* ══════════════════════════════════════════════════════════
   MISC ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes glow-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* Tablet / small desktop */
@media (max-width: 880px) {
  .game-layout {
    grid-template-columns: 1fr;
    padding: 0.75rem;
    gap: 0.875rem;
  }

  .board-area   { order: 1; }
  .bonus-legend { order: 2; position: static; }
  .score-panel  { order: 3; position: static; }

  .bonus-legend {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: start;
    gap: 0.5rem 1rem;
    padding: 0.875rem 1rem;
  }
  .legend-title { grid-column: 1 / -1; }
  .legend-list  { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
  .legend-tip   { grid-column: 1 / -1; }

  .score-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 0.875rem;
    align-items: center;
  }
  .round-indicator { grid-column: 1 / -1; justify-self: start; }
  .turn-indicator  { align-items: flex-start; padding: 0.5rem 0.75rem; }
  .player-scores   { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
}

/* Mobile */
@media (max-width: 500px) {
  .game-grid   { max-width: 100%; }
  .word-preview { max-width: 100%; }
  .bonus-legend { grid-template-columns: 1fr; }
  .legend-list  { flex-direction: column; }
  .score-panel  { grid-template-columns: 1fr; }
  .player-scores { flex-direction: column; }
  .summary-actions { flex-direction: column; align-items: stretch; }
  .game-layout { flex-direction: column; gap: 0.5rem; }
  #score-panel, .bonus-legend { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
  .tile { min-width: 44px; min-height: 44px; font-size: 1rem; }
  #top-toolbar { padding: 0.3rem 0.75rem; }
}


/* ── Play announcements and the word log ──────────────────────────
   The bot used to clear its tiles within 400ms, so nobody could see what it
   played. Every play is now said out loud above the board and kept in a short
   log beside the scores. */
.play-announce {
  margin: 0 auto 10px;
  max-width: 420px;
  padding: 9px 16px;
  border-radius: 999px;
  text-align: center;
  font-family: var(--font-label, inherit);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--text, #eaf3e6);
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--accent-dim, rgba(255, 255, 255, 0.16));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-6px);
}

.play-announce[hidden] { display: none; }

.play-announce.is-in {
  animation: announceIn 220ms cubic-bezier(.2, .9, .3, 1.1) forwards;
}

@keyframes announceIn {
  to { opacity: 1; transform: translateY(0); }
}

.play-announce b {
  font-size: 16px;
  letter-spacing: 0.10em;
  color: var(--gold, #eec068);
}

.play-announce[data-tone="bot"] {
  border-color: var(--gold, #eec068);
  background: rgba(238, 192, 104, 0.14);
}

.play-announce[data-tone="you"] {
  border-color: var(--accent, #7bc47f);
  background: rgba(123, 196, 127, 0.14);
}

.play-announce[data-tone="muted"] {
  color: var(--text-dim, rgba(234, 243, 230, 0.65));
  font-style: italic;
}

.announce-score { color: var(--gold, #eec068); font-weight: 700; }

.play-log { margin-top: 14px; }

.play-log-title {
  margin: 0 0 6px;
  font-family: var(--font-label, inherit);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(234, 243, 230, 0.6));
}

.play-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.play-log-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}

.play-log-row:last-child { border-bottom: 0; }

.play-log-who {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(234, 243, 230, 0.55));
}

.play-log-row.is-bot .play-log-who { color: var(--gold, #eec068); }
.play-log-row.is-bot .play-log-word { color: var(--gold-light, #f2d79b); }

.play-log-word {
  font-weight: 700;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-log-score {
  font-variant-numeric: tabular-nums;
  color: var(--accent, #7bc47f);
}

.play-log-empty {
  font-size: 12px;
  color: var(--text-dim, rgba(234, 243, 230, 0.5));
}

@media (max-width: 720px) {
  .play-announce { font-size: 12.5px; padding: 8px 12px; max-width: none; }
  .play-announce b { font-size: 14px; }
}


/* An unplayable trace gets a visible reason and a shake, not just a grey button. */
.word-preview.invalid-word .word-preview-score {
  color: var(--error, #e06c75);
  font-style: italic;
  letter-spacing: 0.02em;
}

.word-preview.invalid-word .word-preview-text {
  color: var(--error, #e06c75);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(224, 108, 117, 0.6);
}

.game-grid.is-invalid {
  animation: gridNope 240ms ease;
}

@keyframes gridNope {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .game-grid.is-invalid { animation: none; }
}


/* Lobby: two entry points, and somewhere to say what the room is doing. */
.lobby-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 12.5px;
  color: var(--text-dim, rgba(234, 243, 230, 0.7));
  text-align: center;
}

.lobby-status[data-tone="error"] { color: var(--error, #e06c75); }
.lobby-status[data-tone="good"] { color: var(--accent, #7bc47f); }

#btn-solo-game { margin-top: 8px; }

.turn-indicator.is-you .turn-player-name { color: var(--accent, #7bc47f); }
.turn-indicator.is-waiting .turn-player-name { color: var(--gold, #eec068); }

/* The board is not interactive when it is the other player's turn. */
.game-grid.is-locked { opacity: 0.72; }
.game-grid.is-locked .tile { cursor: not-allowed; }
