/* ============================================
   SAMBUNG KATA - REFINED DARK + ELECTRIC LIME
   One accent, locked. No AI-purple. No neon glow.
   Motion rationed + motivated.
   ============================================ */

/* ===== TOKENS =====
   All class/id selectors the JS toggles are preserved:
   active, hidden, selected, mode-card, bot-count-btn, player-*, status-*,
   mode-badge-*, badge-*, score-*, rank-*, table-empty, word-list-empty,
   admin-rooms-empty, heart-full/empty, timer-critical, timer-text-critical,
   turn-my, player-active/eliminated/me/bot, score-winner, visible, loading-fadeout.
*/
:root {
  /* Surfaces — near-black, warm-neutral */
  --bg: #0a0a0b;
  --bg-surface: #141416;
  --bg-surface-2: #1a1a1d;
  --bg-input: #16161a;
  --bg-hover: #1f1f24;

  /* Borders */
  --border: #232327;
  --border-strong: #2e2e34;
  --border-accent: rgba(163, 230, 53, 0.35);

  /* Text */
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-dim: #6b6b73;

  /* ONE accent — electric lime, locked across the whole page */
  --accent: #a3e635;
  --accent-hover: #b9f24a;
  --accent-dim: rgba(163, 230, 53, 0.12);
  --accent-soft: rgba(163, 230, 53, 0.08);

  /* Semantic (desaturated, no neon) */
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.1);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.1);

  /* Shape consistency lock: one radius scale.
     Buttons + inputs + small chips = 12px. Cards = 20px. Pills = full.
     Followed everywhere. */
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Type */
  --font-heading: 'Geist', 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Motion — single ease curve, no linear */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: all 0.28s var(--ease);
  --transition-fast: all 0.16s var(--ease-out);

  --nav-height: 64px;
  --bottom-nav-height: 68px;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle fixed grain — pointer-events-none, fixed, cheap */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(163, 230, 53, 0.04), transparent 70%);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== VIDEO BACKGROUND =====
   Full-cover, behind everything. A scrim (bg-scrim) sits above
   the video so foreground text/buttons stay readable (WCAG over
   interactive UI). Foreground layers get position:relative + z-index.
*/
.bg-video {
  position: fixed;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}
.bg-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.loading-wrapper .bg-scrim,
.auth-wrapper .bg-scrim { background: rgba(10, 10, 11, 0.62); }
.app-wrapper .bg-scrim { background: rgba(10, 10, 11, 0.74); }
/* Bring every visible foreground above the scrim */
.loading-content,
.loading-particles,
.loading-orbs,
.noise-overlay,
.auth-container,
.top-nav,
.bottom-nav,
.connection-status,
.app-main,
.game-view .game-container,
.game-over-overlay,
.toast-container,
.spectator-badge {
  position: relative;
  z-index: 2;
}
.loading-orbs, .loading-particles, .noise-overlay { z-index: 1; }

/* ===== BUTTONS =====
   No outer glow. Tactile press. One accent. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }

/* Primary = solid lime on dark. High contrast, readable. */
.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.98); }

/* Secondary = surface, subtle border, lifts on hover */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

/* Danger = desaturated red, solid on dark */
.btn-danger {
  background: var(--danger);
  color: #0a0a0b;
  font-weight: 700;
}
.btn-danger:hover { background: #fb8585; transform: translateY(-1px); }

.btn-lg {
  padding: 0.95rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}
.btn-block { width: 100%; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.4rem 0;
  margin-bottom: 0.75rem;
  transition: var(--transition-fast);
}
.btn-back:hover { color: var(--accent); }

/* ===== FORMS =====
   Labels above inputs. WCAG AA contrast everywhere. */
.input-group { margin-bottom: 1rem; }
.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.input-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  outline: none;
}
.input-group input:focus {
  border-color: var(--accent);
  background: var(--bg-surface-2);
  box-shadow: 0 0 0 3px var(--accent-soft); /* soft ring, NOT a glow */
}
.input-group input::placeholder { color: var(--text-dim); }

.input-code {
  font-family: var(--font-mono);
  font-size: 1.25rem !important;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.form-error {
  padding: 0.6rem 1rem;
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 1rem;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-bar svg, .search-bar i {
  flex-shrink: 0;
  color: var(--text-dim);
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.8rem 0;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-dim); }


/* ============================================
   LOADING SCREEN
   Motion motivated: communicates "preparing".
   Reduced orbs (2, was 4), one accent.
   ============================================ */
.loading-wrapper {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.loading-fadeout {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

/* Particles — fewer, accent-tinted */
.loading-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  20% { opacity: 0.5; }
  80% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-20vh) scale(1); }
}

/* Floating orbs — only 2 used in markup now, subtle */
.loading-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(163, 230, 53, 0.10), transparent 70%);
  top: -15%; left: -10%;
}
.orb-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(163, 230, 53, 0.06), transparent 70%);
  bottom: -10%; right: -5%;
  animation-delay: -4s;
}
/* orbs 3 & 4 unused in markup; kept harmless */
.orb-3, .orb-4 { display: none; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(25px, -25px) scale(1.08); }
}

/* Noise overlay */
.noise-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}

/* Loading content */
.loading-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 500px;
}
.loading-icon-wrapper {
  position: relative;
  width: 120px; height: 120px;
  margin-bottom: 1.75rem;
  display: flex; align-items: center; justify-content: center;
}
.loading-icon {
  width: 80px; height: 80px;
  animation: iconPulse 3s ease-in-out infinite;
}
.logo-svg { width: 100%; height: 100%; }

/* Single subtle ring instead of 3 spinning */
.icon-ring {
  position: absolute;
  border: 1.5px solid transparent;
  border-radius: 50%;
}
.ring-1 { inset: 0; border-top-color: var(--accent); border-right-color: var(--accent); animation: spinRing 4s linear infinite; }
.ring-2 { inset: -12px; border-color: var(--border-strong); opacity: 0.4; }
.ring-3 { inset: -24px; border-color: var(--border); opacity: 0.3; }
@keyframes spinRing { to { transform: rotate(360deg); } }
@keyframes iconPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.loading-title {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.6rem;
  display: flex; gap: 0.4rem; align-items: center; justify-content: center;
}
.title-word {
  display: inline-block;
  opacity: 0;
  animation: titleSlideUp 0.7s var(--ease) forwards;
}
.title-accent { color: var(--accent); }
@keyframes titleSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.loading-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: fadeIn 0.7s var(--ease) 0.9s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

.progress-container {
  width: 100%; max-width: 300px;
  display: flex; align-items: center; gap: 1rem;
  opacity: 0;
  animation: fadeIn 0.7s var(--ease) 1.2s forwards;
}
.progress-track { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
}
.progress-text {
  font-family: var(--font-mono);
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px; text-align: right;
}

.loading-tagline {
  margin-top: 1.75rem; opacity: 0; transform: translateY(8px); transition: all 0.5s var(--ease);
}
.loading-tagline.visible { opacity: 1; transform: translateY(0); }
.loading-tagline p { color: var(--text-secondary); font-size: 0.95rem; }

.loading-enter-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.95rem 2.25rem; margin-top: 1.5rem;
  background: var(--accent);
  color: #0a0a0b; border: none; border-radius: var(--radius-full);
  font-family: var(--font-heading); font-size: 1rem; font-weight: 700;
  letter-spacing: 0.02em; cursor: pointer;
  opacity: 0; transform: translateY(16px); transition: all 0.5s var(--ease);
}
.loading-enter-btn.visible { opacity: 1; transform: translateY(0); }
.loading-enter-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.loading-enter-btn:active { transform: scale(0.98); }


/* ============================================
   AUTH VIEW
   ============================================ */
.auth-wrapper {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow: hidden;
}
.auth-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.auth-logo { margin-bottom: 1rem; }
.auth-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
  text-align: center;
}
.auth-form {
  width: 100%;
  animation: viewFadeIn 0.3s var(--ease);
}
.auth-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.auth-toggle button {
  background: none; border: none; color: var(--accent);
  font-family: var(--font-body); font-weight: 600; font-size: 0.85rem;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.auth-toggle button:hover { color: var(--accent-hover); }

.btn-guest {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.65rem 1.4rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-guest:hover {
  background: var(--bg-surface);
  border-color: var(--text-dim);
  color: var(--text);
}


/* ============================================
   VIEW TRANSITIONS
   ============================================ */
.view {
  display: none;
  animation: viewFadeIn 0.3s var(--ease);
}
.view.active { display: block; }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}


/* ============================================
   CONNECTION STATUS — real semantic state, dot allowed
   ============================================ */
.connection-status {
  position: fixed;
  top: 1rem; right: 1rem;
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 600;
  z-index: 200;
  transition: var(--transition);
  backdrop-filter: blur(12px);
}
.connection-status.connected {
  background: var(--success-dim); border: 1px solid rgba(74, 222, 128, 0.25); color: var(--success);
}
.connection-status.disconnected {
  background: var(--danger-dim); border: 1px solid rgba(248, 113, 113, 0.25); color: var(--danger);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }


/* ============================================
   TOASTS
   ============================================ */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}
.toast {
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  animation: toastIn 0.3s var(--ease);
  text-align: center;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  border: 1px solid transparent;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.toast-out { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
.toast-info { background: var(--bg-surface-2); color: var(--text); border-color: var(--border-strong); }
.toast-error { background: var(--danger); color: #0a0a0b; }
.toast-success { background: var(--success); color: #0a0a0b; }
.toast-warning { background: var(--warning); color: #0a0a0b; }


/* ============================================
   TOP NAV (Desktop) — one line, <=80px
   ============================================ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
}
.nav-left { display: flex; align-items: center; }
.nav-logo { display: flex; align-items: center; gap: 0.6rem; }
.nav-brand {
  font-family: var(--font-heading);
  font-size: 1rem; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.nav-center { display: flex; align-items: center; gap: 0.25rem; }
.nav-tab {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: none; border: none;
  color: var(--text-dim);
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition-fast);
}
.nav-tab:hover { color: var(--text); background: var(--bg-surface); }
.nav-tab.active { color: var(--accent); background: var(--accent-dim); }
.nav-tab span { display: none; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { display: flex; align-items: center; gap: 0.5rem; }
.nav-user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 0.8rem; font-weight: 700; color: var(--accent);
}
.nav-user-name {
  font-size: 0.82rem; font-weight: 500;
  color: var(--text-secondary);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-logout {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer;
  transition: var(--transition-fast);
}
.nav-logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }


/* ============================================
   BOTTOM NAV (Mobile)
   ============================================ */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: rgba(10, 10, 11, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bottom-tab::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transform: scaleX(0);
  transition: var(--transition);
}
.bottom-tab.active { color: var(--accent); }
.bottom-tab.active::before { transform: scaleX(1); }
.bottom-tab span {
  font-size: 0.62rem; font-weight: 600;
  font-family: var(--font-body);
}


/* ============================================
   APP MAIN
   ============================================ */
.app-main {
  flex: 1;
  margin-top: var(--nav-height);
  padding: 0 1rem 1rem;
  margin-bottom: var(--bottom-nav-height);
  overflow-y: auto;
}
.view-inner {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 1.75rem;
  padding-bottom: 2rem;
}


/* ============================================
   HOME VIEW
   ============================================ */
.home-welcome { margin-bottom: 1.75rem; }
.home-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 5vw, 2.1rem); font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.home-title-accent { color: var(--accent); }
.home-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.4rem;
}

/* User Stats Card */
.stats-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stats-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}
.stats-header {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.stats-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.stats-name {
  font-family: var(--font-heading);
  font-size: 1rem; font-weight: 700;
  letter-spacing: -0.01em;
}
.stats-label {
  font-size: 0.72rem; color: var(--text-dim); font-weight: 500;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.stat-item {
  text-align: center;
  padding: 0.6rem 0.4rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.15rem; font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.68rem; color: var(--text-dim); font-weight: 500; margin-top: 0.15rem;
}

/* Guest Hint */
.guest-hint {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--warning-dim);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius);
  color: var(--warning);
  font-size: 0.82rem;
  margin-bottom: 1.5rem;
}
.guest-hint svg, .guest-hint i { flex-shrink: 0; }

/* Menu Grid — 2 columns, admin card spans full width at bottom */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.menu-card-admin {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .menu-grid { grid-template-columns: 1fr; }
}
.menu-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.menu-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.menu-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  background: var(--bg-surface-2);
}
.menu-card:hover::after { opacity: 1; }
.menu-card:active { transform: translateY(0) scale(0.995); }

.menu-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}
/* Each icon container tinted, but accent stays lime where it counts */
.icon-online { background: var(--accent-dim); color: var(--accent); }
.icon-bot { background: var(--success-dim); color: var(--success); }
.icon-leaderboard { background: var(--warning-dim); color: var(--warning); }
.icon-wordindex { background: var(--bg-surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.icon-admin { background: var(--danger-dim); color: var(--danger); }

.menu-card-content { flex: 1; min-width: 0; }
.menu-card-content h3 {
  font-family: var(--font-heading);
  font-size: 0.98rem; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.menu-card-content p {
  font-size: 0.78rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-card-arrow {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: var(--transition);
}
.menu-card:hover .menu-card-arrow { color: var(--accent); transform: translateX(3px); }


/* ============================================
   VIEW HEADER
   ============================================ */
.view-header { margin-bottom: 1.5rem; }
.view-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem; font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.view-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

/* ============================================
   MADE BY FOOTER
   ============================================ */
.made-by-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.made-by-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.made-by-list {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.made-by-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.made-by-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.made-by-pfp {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-surface-2);
}
.made-by-name {
  font-size: 0.78rem;
  font-weight: 600;
}
/* Loading screen variant: fade in after tagline */
.made-by-loading {
  margin-top: 1rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.5s var(--ease);
}
.made-by-loading.visible {
  opacity: 1;
  transform: translateY(0);
}
.made-by-loading .made-by-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}


/* ============================================
   SECTION CARD
   ============================================ */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.section-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1rem; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1rem;
}
.section-title svg, .section-title i { color: var(--accent); }

.section-divider {
  display: flex; align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}
.section-divider::before,
.section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}


/* ============================================
   MODE SELECTOR
   ============================================ */
.mode-selector-label {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.mode-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}
.mode-card:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
.mode-card.selected.mode-easy { border-color: var(--success); background: var(--success-dim); }
.mode-card.selected.mode-normal { border-color: var(--accent); background: var(--accent-dim); }
.mode-card.selected.mode-hard { border-color: var(--danger); background: var(--danger-dim); }

.mode-icon { font-size: 1.4rem; margin-bottom: 0.3rem; line-height: 1; }
.mode-name {
  font-family: var(--font-heading);
  font-size: 0.88rem; font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.mode-card.selected.mode-easy .mode-name { color: var(--success); }
.mode-card.selected.mode-normal .mode-name { color: var(--accent); }
.mode-card.selected.mode-hard .mode-name { color: var(--danger); }
.mode-desc {
  font-size: 0.7rem; color: var(--text-dim); line-height: 1.4;
}


/* ============================================
   BOT COUNT SELECTOR
   ============================================ */
.bot-count-label {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.bot-count-selector {
  display: flex; gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.bot-count-btn {
  flex: 1;
  padding: 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.bot-count-btn:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
.bot-count-btn.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}


/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard-table-wrap {
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.leaderboard-table th {
  padding: 0.7rem 0.5rem;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-surface);
  z-index: 1;
}
.leaderboard-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.leaderboard-table tr:hover td { background: var(--bg-surface-2); }
.table-empty {
  text-align: center !important;
  color: var(--text-dim) !important;
  padding: 2rem !important;
}
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700;
}
.rank-1 { background: var(--accent-dim); color: var(--accent); }
.rank-2 { background: var(--bg-surface-2); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.rank-3 { background: var(--warning-dim); color: var(--warning); }


/* ============================================
   WORD INDEX
   ============================================ */
.word-list {
  max-height: 400px;
  overflow-y: auto;
}
.word-list-empty {
  text-align: center; color: var(--text-dim);
  padding: 2rem; font-size: 0.88rem;
}
.word-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition-fast);
}
.word-item:hover { background: var(--bg-surface-2); }
.word-item-text {
  font-family: var(--font-heading);
  font-weight: 600; font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.word-item-count {
  font-size: 0.72rem; font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--accent-dim);
  color: var(--accent);
}
.word-item-last {
  font-size: 0.72rem; color: var(--text-dim);
  margin-left: 0.5rem;
  white-space: nowrap;
}
.word-item-right {
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
}

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 0.4rem; margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-btn {
  min-width: 34px; height: 34px;
  padding: 0 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #0a0a0b; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-info {
  font-size: 0.78rem; color: var(--text-dim);
  margin: 0 0.3rem;
  font-family: var(--font-mono);
}


/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 500px;
}
.admin-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex; flex-direction: column;
}
.admin-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.admin-sidebar-header h3 {
  font-family: var(--font-heading);
  font-size: 0.9rem; font-weight: 700;
}
.admin-rooms-list { flex: 1; overflow-y: auto; }
.admin-rooms-empty {
  text-align: center; color: var(--text-dim);
  padding: 2rem 0.5rem; font-size: 0.82rem;
}
.admin-room-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.admin-room-item:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
.admin-room-item.active { border-color: var(--accent); background: var(--accent-dim); }
.admin-room-code {
  font-family: var(--font-mono);
  font-weight: 700; font-size: 0.85rem;
  color: var(--accent);
}
.admin-room-info { font-size: 0.68rem; color: var(--text-dim); }

.admin-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.admin-no-room {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; color: var(--text-dim);
  gap: 1rem;
}
.admin-no-room svg, .admin-no-room i { opacity: 0.3; }
.admin-no-room p { font-size: 0.88rem; }

.admin-controls {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}
.admin-controls-title {
  font-family: var(--font-heading);
  font-size: 0.8rem; font-weight: 700;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}
.admin-controls-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-force-word-row { display: flex; gap: 0.5rem; }
.admin-force-word-row input { flex: 1; }
.admin-force-word-row .btn { flex-shrink: 0; }


/* ============================================
   GAME ROOM VIEW
   ============================================ */
.game-view .game-container {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.7rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.game-back-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.game-back-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

.room-code {
  font-size: 0.82rem; color: var(--text-secondary);
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-code strong {
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
.game-header-badges { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* Mode Badge */
.mode-badge {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.mode-badge-easy { background: var(--success-dim); border: 1px solid rgba(74, 222, 128, 0.25); color: var(--success); }
.mode-badge-normal { background: var(--accent-dim); border: 1px solid var(--border-accent); color: var(--accent); }
.mode-badge-hard { background: var(--danger-dim); border: 1px solid rgba(248, 113, 113, 0.25); color: var(--danger); }

.game-status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem; font-weight: 600;
}
.status-playing { background: var(--accent-dim); border: 1px solid var(--border-accent); color: var(--accent); }
.status-waiting { background: var(--warning-dim); border: 1px solid rgba(251, 191, 36, 0.2); color: var(--warning); }
.status-finished { background: var(--success-dim); border: 1px solid rgba(74, 222, 128, 0.2); color: var(--success); }

/* Spectator Badge — real semantic state */
.spectator-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--radius-full);
  color: var(--danger);
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

/* Current word section */
.current-word-section {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}
.current-word-section::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 50%; height: 2px;
  background: var(--accent);
}
.current-word-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 0.75rem;
}
.current-word-display {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 0.25rem; margin-bottom: 1rem; min-height: 50px; align-items: center;
}
.word-char {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 6vw, 2.2rem); font-weight: 800;
  color: var(--text);
  opacity: 0;
  animation: charPop 0.4s var(--ease) forwards;
  text-transform: uppercase;
}
.word-char:last-child { color: var(--accent); }
@keyframes charPop { from { opacity: 0; transform: translateY(8px) scale(0.85); } to { opacity: 1; transform: translateY(0) scale(1); } }

.next-letter-hint { font-size: 0.85rem; color: var(--text-secondary); }
.next-letter {
  display: inline-block;
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 800;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.1rem 0.5rem; border-radius: var(--radius-sm);
  margin-left: 0.3rem;
  text-transform: uppercase;
}

/* Timer */
.timer-section {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 1.5rem;
}
.timer-ring-wrapper { position: relative; width: 100px; height: 100px; margin-bottom: 0.5rem; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.timer-ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
}
.timer-critical { stroke: var(--danger); }
.timer-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--text);
}
.timer-text-critical { color: var(--danger); animation: timerPulse 0.5s ease-in-out infinite; }
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.turn-indicator { font-size: 0.82rem; color: var(--text-secondary); }
.turn-my {
  color: var(--accent); font-weight: 700;
}

/* Players grid */
.players-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.player-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.player-card.player-active {
  border-color: var(--accent);
  background: var(--bg-surface-2);
}
.player-card.player-active::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
}
.player-card.player-eliminated { opacity: 0.4; filter: grayscale(0.6); }
.player-card.player-me { border-color: rgba(163, 230, 53, 0.35); }
.player-card.player-bot { border-style: dashed; border-color: var(--border-strong); }
.player-card.player-bot .player-avatar {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.player-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: var(--accent);
  margin: 0 auto 0.5rem;
  position: relative;
  font-size: 1.1rem;
}
/* Motivated motion: avatar pulse only on the active player's turn */
.avatar-pulse {
  position: absolute; inset: -3px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  animation: avatarPing 1.6s ease-in-out infinite;
}
@keyframes avatarPing { 0%, 100% { opacity: 0.8; transform: scale(1); } 50% { opacity: 0; transform: scale(1.25); } }

.player-name {
  font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem;
  display: flex; align-items: center; justify-content: center; gap: 0.3rem; flex-wrap: wrap;
}
.badge-you, .badge-host, .badge-bot, .badge-account {
  font-size: 0.58rem; font-weight: 700;
  padding: 0.1rem 0.35rem; border-radius: var(--radius-full);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-you { background: var(--accent-dim); color: var(--accent); }
.badge-host { background: var(--bg-surface-2); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.badge-bot { background: var(--bg-surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.badge-account { background: var(--success-dim); color: var(--success); font-size: 0.54rem; }

.player-lives {
  display: flex; justify-content: center; gap: 0.2rem; margin: 0.3rem 0;
}
.life-heart { font-size: 0.85rem; transition: var(--transition-fast); }
.heart-full { color: var(--danger); }
.heart-empty { color: var(--border-strong); }
.player-score {
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--text-secondary);
}

/* Word input — accent border, no breathing glow */
.word-input-section { margin-bottom: 1.5rem; }
.word-input-wrapper {
  display: flex; align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 0.3rem;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-prefix {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 800; color: #0a0a0b;
  flex-shrink: 0;
  text-transform: uppercase;
}
.word-input-wrapper input {
  flex: 1; padding: 0.7rem 1rem;
  background: transparent; border: none;
  color: var(--text); font-family: var(--font-body); font-size: 1.05rem; outline: none;
}
.word-input-wrapper input::placeholder { color: var(--text-dim); }
.btn-send {
  width: 44px; height: 44px;
  border: none;
  background: var(--accent);
  border-radius: var(--radius);
  color: #0a0a0b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition-fast); flex-shrink: 0;
}
.btn-send:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.04); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

/* Waiting turn */
.waiting-turn { text-align: center; margin-bottom: 1.5rem; color: var(--text-dim); }
.waiting-dots { display: flex; justify-content: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.waiting-dots span {
  width: 7px; height: 7px; background: var(--text-dim); border-radius: 50%;
  animation: waitDot 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes waitDot { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.2); } }

/* Waiting room */
.waiting-room-section {
  text-align: center; margin-top: 1rem;
  padding: 1.5rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.waiting-room-info h3 { font-family: var(--font-heading); font-size: 1.05rem; margin-bottom: 0.3rem; letter-spacing: -0.01em; }
.waiting-room-info p { color: var(--text-secondary); font-size: 0.88rem; }
.waiting-room-info strong { color: var(--accent); font-family: var(--font-mono); }
.btn-ready {
  margin-top: 1rem; padding: 0.75rem 2rem;
  background: var(--bg-input); border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text); font-family: var(--font-body);
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-ready:hover { border-color: var(--success); color: var(--success); }
.btn-ready-active { background: var(--success-dim); border-color: var(--success); color: var(--success); }
.btn-start-game {
  margin-top: 0.75rem; padding: 0.8rem 2rem;
  background: var(--accent);
  border: none; border-radius: var(--radius-full);
  color: #0a0a0b; font-family: var(--font-heading);
  font-size: 0.98rem; font-weight: 700; cursor: pointer; transition: var(--transition);
}
.btn-start-game:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-start-game:active { transform: scale(0.98); }

/* Round history */
.round-history {
  margin-top: 1rem; padding: 1rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.round-history h4 {
  font-family: var(--font-heading); font-size: 0.78rem; font-weight: 700;
  color: var(--text-dim); margin-bottom: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.history-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 150px; overflow-y: auto; }
.history-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; padding: 0.25rem 0; }
.history-player { color: var(--text-secondary); font-weight: 500; min-width: 60px; }
.history-arrow { color: var(--text-dim); }
.history-word { font-family: var(--font-heading); font-weight: 700; color: var(--accent); text-transform: uppercase; }

/* Game Over Overlay */
.game-over-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 5, 6, 0.85);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  animation: fadeIn 0.4s var(--ease);
}
.game-over-card {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2rem; max-width: 400px; width: 100%;
  text-align: center;
  animation: cardSlideUp 0.4s var(--ease);
}
@keyframes cardSlideUp { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.game-over-card h2 {
  font-family: var(--font-heading); font-size: 1.4rem; font-weight: 800; margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.winner-crown { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--warning); }
.winner-name { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 800; color: var(--accent); letter-spacing: -0.01em; }
.winner-score { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 1.5rem; font-family: var(--font-mono); }
.final-scores { text-align: left; margin-bottom: 1.5rem; }
.score-row {
  display: flex; align-items: center;
  padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
  margin-bottom: 0.3rem; transition: var(--transition-fast);
  border: 1px solid transparent;
}
.score-row:hover { background: var(--bg-surface-2); }
.score-winner { background: var(--accent-dim); border-color: var(--border-accent); }
.score-rank { font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem; color: var(--text-dim); min-width: 30px; }
.score-name { flex: 1; font-weight: 500; font-size: 0.88rem; }
.score-pts { font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; color: var(--accent); }


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .nav-center { display: none; }
  .nav-tab span { display: none; }
  .top-nav { display: flex; }
  .bottom-nav { display: flex; }

  .admin-panel { grid-template-columns: 1fr; }
  .admin-sidebar { max-height: 200px; }
}

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .app-main { margin-bottom: 0; }
  .nav-tab span { display: inline; }
}

@media (max-width: 480px) {
  .loading-icon-wrapper { width: 100px; height: 100px; }
  .loading-icon { width: 60px; height: 60px; }

  .home-title { font-size: 1.5rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .mode-selector { grid-template-columns: 1fr; gap: 0.5rem; }
  .mode-card { display: flex; align-items: center; gap: 0.75rem; text-align: left; padding: 0.75rem 1rem; }
  .mode-icon { margin-bottom: 0; font-size: 1.2rem; }
  .mode-desc { display: none; }

  .word-char { font-size: 1.6rem; }
  .timer-ring-wrapper { width: 80px; height: 80px; }
  .timer-text { font-size: 1.2rem; }
  .players-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .player-card { padding: 0.75rem; }
  .player-avatar { width: 40px; height: 40px; font-size: 0.95rem; }
  .current-word-section { padding: 1rem; }

  .leaderboard-table { font-size: 0.78rem; }
  .leaderboard-table th, .leaderboard-table td { padding: 0.5rem 0.3rem; }

  .nav-brand { display: none; }
  .nav-user-name { display: none; }
}

@media (max-width: 360px) {
  .menu-card-icon { width: 44px; height: 44px; }
  .menu-card-content p { display: none; }
  .section-card { padding: 1rem; }
}

/* ============================================
   LOADING GHOST — themed to dark + lime
   Body lime, eyes dark hollow, pupils lime, dark shadow.
   Grid-art pixel animation preserved.
   ============================================ */
#ghost {
  position: relative;
  scale: 0.8;
}

#red {
  animation: upNDown infinite 1s;
  position: relative;
  width: 140px;
  height: 140px;
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  grid-template-rows: repeat(14, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  grid-template-areas:
    "a1  a2  a3  a4  a5  top0  top0  top0  top0  a10 a11 a12 a13 a14"
    "b1  b2  b3  top1 top1 top1 top1 top1 top1 top1 top1 b12 b13 b14"
    "c1 c2 top2 top2 top2 top2 top2 top2 top2 top2 top2 top2 c13 c14"
    "d1 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 d14"
    "e1 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 e14"
    "f1 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 top3 f14"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4 top4"
    "st0 st0 an4 st1 an7 st2 an10 an10 st3 an13 st4 an16 st5 st5"
    "an1 an2 an3 an5 an6 an8 an9 an9 an11 an12 an14 an15 an17 an18";
}

@keyframes upNDown {
  0%, 49% { transform: translateY(0px); }
  50%, 100% { transform: translateY(-10px); }
}

/* Ghost body + zigzag bottom = lime accent */
#top0, #top1, #top2, #top3, #top4,
#st0, #st1, #st2, #st3, #st4, #st5 {
  background-color: var(--accent);
}

#top0 { grid-area: top0; }
#top1 { grid-area: top1; }
#top2 { grid-area: top2; }
#top3 { grid-area: top3; }
#top4 { grid-area: top4; }
#st0 { grid-area: st0; }
#st1 { grid-area: st1; }
#st2 { grid-area: st2; }
#st3 { grid-area: st3; }
#st4 { grid-area: st4; }
#st5 { grid-area: st5; }

/* Flicker cells: alternate lime <-> transparent (pixel shimmer on body) */
#an1 { grid-area: an1; animation: flicker0 infinite 0.8s; }
#an18 { grid-area: an18; animation: flicker0 infinite 0.8s; }
#an2 { grid-area: an2; animation: flicker1 infinite 0.8s; }
#an17 { grid-area: an17; animation: flicker1 infinite 0.8s; }
#an3 { grid-area: an3; animation: flicker1 infinite 0.8s; }
#an16 { grid-area: an16; animation: flicker1 infinite 0.8s; }
#an4 { grid-area: an4; animation: flicker1 infinite 0.8s; }
#an15 { grid-area: an15; animation: flicker1 infinite 0.8s; }
#an6 { grid-area: an6; animation: flicker0 infinite 0.8s; }
#an12 { grid-area: an12; animation: flicker0 infinite 0.8s; }
#an7 { grid-area: an7; animation: flicker0 infinite 0.8s; }
#an13 { grid-area: an13; animation: flicker0 infinite 0.8s; }
#an9 { grid-area: an9; animation: flicker1 infinite 0.8s; }
#an10 { grid-area: an10; animation: flicker1 infinite 0.8s; }
#an8 { grid-area: an8; animation: flicker0 infinite 0.8s; }
#an11 { grid-area: an11; animation: flicker0 infinite 0.8s; }

@keyframes flicker0 {
  0%, 49% { background-color: var(--accent); }
  50%, 100% { background-color: transparent; }
}
@keyframes flicker1 {
  0%, 49% { background-color: transparent; }
  50%, 100% { background-color: var(--accent); }
}

/* Eyes = dark hollow sockets cut into the lime body */
#eye {
  width: 40px; height: 50px;
  position: absolute; top: 30px; left: 10px;
}
#eye::before {
  content: "";
  background-color: var(--bg);
  width: 20px; height: 50px;
  transform: translateX(10px);
  display: block; position: absolute;
}
#eye::after {
  content: "";
  background-color: var(--bg);
  width: 40px; height: 30px;
  transform: translateY(10px);
  display: block; position: absolute;
}
#eye1 {
  width: 40px; height: 50px;
  position: absolute; top: 30px; right: 30px;
}
#eye1::before {
  content: "";
  background-color: var(--bg);
  width: 20px; height: 50px;
  transform: translateX(10px);
  display: block; position: absolute;
}
#eye1::after {
  content: "";
  background-color: var(--bg);
  width: 40px; height: 30px;
  transform: translateY(10px);
  display: block; position: absolute;
}

/* Pupils = solid lime dots that track across the hollow sockets */
#pupil {
  width: 20px; height: 20px;
  background-color: var(--accent);
  position: absolute; top: 50px; left: 10px;
  z-index: 1;
  animation: eyesMovement infinite 5s;
  box-shadow: 0 0 8px var(--accent);
}
#pupil1 {
  width: 20px; height: 20px;
  background-color: var(--accent);
  position: absolute; top: 50px; right: 50px;
  z-index: 1;
  animation: eyesMovement infinite 5s;
  box-shadow: 0 0 8px var(--accent);
}
@keyframes eyesMovement {
  0%, 49% { transform: translateX(0px); }
  50%, 99% { transform: translateX(10px); }
  100% { transform: translateX(0px); }
}

/* Ground shadow = soft dark ellipse that pulses with the bob */
#shadow {
  background-color: #000;
  width: 140px; height: 140px;
  position: absolute;
  border-radius: 50%;
  transform: rotateX(80deg);
  filter: blur(20px);
  top: 80%;
  animation: shadowMovement infinite 1s;
}
@keyframes shadowMovement {
  0%, 49% { opacity: 0.5; }
  50%, 100% { opacity: 0.2; }
}

/* Center the ghost inside the loading icon wrapper */
.loading-icon { display: flex; align-items: center; justify-content: center; }

/* ===== REDUCED MOTION — mandatory for MOTION > 3 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .particle, .orb, .icon-ring, #red, #pupil, #pupil1, #shadow,
  #an1, #an2, #an3, #an4, #an6, #an7, #an8, #an9, #an10, #an11, #an12, #an13, #an15, #an16, #an17, #an18 { animation: none !important; }
}
