/* ============================================================
   MINIGAMES HUB – Luna Gaming System Design
   Skeuomorphic, XP-inspired UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --clr-bg: #f2fbff;
  --clr-bg-2: #cfdce2;
  --clr-surface: #f2fbff;
  --clr-surface-2: #e9f6fc;
  --clr-surface-3: #e3f0f6;
  --clr-surface-high: #ddeaf0;
  --clr-surface-highest: #d8e5eb;
  --clr-surface-lowest: #ffffff;
  --clr-border: #c3c5d7;
  --clr-border-2: #737686;

  --clr-primary: #003ead;
  --clr-primary-l: #0053e1;
  --clr-primary-container: #0053e1;
  --clr-on-primary: #ffffff;
  --clr-accent: #f97316;
  --clr-secondary: #0056c3;
  --clr-secondary-container: #006ef4;
  --clr-tertiary: #075418;
  --clr-tertiary-container: #286d2e;
  --clr-cyan: #06b6d4;
  --clr-green: #10b981;
  --clr-yellow: #f59e0b;
  --clr-red: #ba1a1a;
  --clr-error: #ba1a1a;

  --grad-header: linear-gradient(to bottom, #0058e4 0%, #3b93ff 9%, #2f81f7 20%, #216df1 43%, #1b5edb 100%);
  --grad-taskbar: linear-gradient(to bottom, #245edb 0%, #3f8cf3 9%, #245edb 18%, #245edb 92%, #1941a5 100%);
  --grad-start: linear-gradient(to bottom, #388e3c 0%, #4caf50 5%, #388e3c 10%, #2e7d32 90%, #1b5e20 100%);
  --grad-ready: linear-gradient(to bottom, #89c15e 0%, #5d9237 50%, #4a752b 51%, #6eb041 100%);
  --grad-btn: linear-gradient(to bottom, #ffffff 0%, #ebebeb 50%, #dbdbdb 51%, #c5c5c5 100%);
  --grad-btn-close: linear-gradient(to bottom, #e04343 0%, #f17272 10%, #d83b3b 45%, #b92a2a 100%);

  --txt-primary: #111d22;
  --txt-secondary: #434655;
  --txt-muted: #737686;

  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem;
  --sp-4: 1rem;    --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-10: 2.5rem; --sp-12: 3rem;
  --sp-16: 4rem;   --sp-20: 5rem;

  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;

  --shadow-sm: 1px 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 2px 2px 5px rgba(0,0,0,0.25);
  --shadow-lg: 3px 3px 10px rgba(0,0,0,0.3);
  --shadow-bevel: inset 1px 1px 0 #fff, inset -1px -1px 0 #888;
  --shadow-inset: inset 2px 2px 4px rgba(0,0,0,0.15), inset -1px -1px 0 rgba(255,255,255,0.8);

  --t-fast: 0.15s ease;
  --t-mid: 0.25s ease;

  --font-body: 'Work Sans', sans-serif;
  --font-heading: 'Work Sans', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: #3a6ea5;
  color: var(--txt-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* ── Desktop Background ─────────────────────────────────── */
.stars-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, #4a90d9 0%, #6ab0e8 30%, #7ec850 55%, #5da83a 70%, #4a8a2e 100%);
}
.stars-bg::before, .stars-bg::after { display: none; }

/* ── App Shell (Main Window) ────────────────────────────── */
#app {
  position: relative; z-index: 1;
  margin: 12px 12px 52px 12px;
  border: 3px solid #0058e4;
  border-radius: 8px 8px 0 0;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.4);
  background: var(--clr-surface-lowest);
  display: flex; flex-direction: column;
  min-height: calc(100vh - 64px);
  overflow: hidden;
}

/* ── Page system ────────────────────────────────────────── */
.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }
.page-enter { animation: page-in 0.25s ease both; }
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Title Bar (was Navbar) ─────────────────────────────── */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; height: 32px;
  background: var(--grad-header);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
  flex-shrink: 0;
}
.nav-logo {
  display: flex; align-items: center; gap: 6px;
  color: white; font-weight: 700; font-size: 13px;
}
.nav-logo .logo-icon { font-size: 18px; filter: none; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.7);
  padding: 4px 10px; border-radius: 3px;
  transition: all var(--t-fast);
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.15); }
.nav-link.active { color: white; background: rgba(255,255,255,0.2); }
.nav-link::after { display: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions .text-sm { color: rgba(255,255,255,0.8); font-size: 12px; }
.nav-actions .online-dot { width: 8px; height: 8px; }
#nav-avatar-emoji { font-size: 1.2rem; }
#logout-btn {
  background: var(--grad-btn-close); border: 1px solid #7a1515;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.3);
  color: white; font-size: 11px; padding: 2px 8px; border-radius: 3px;
  height: 22px;
}
#logout-btn:hover { filter: brightness(1.1); }

/* Window control buttons (decorative) */
.window-controls { display: flex; gap: 3px; }
.win-btn {
  width: 21px; height: 21px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 2px;
  color: white; font-size: 14px; background: var(--clr-primary);
}
.win-btn:hover { filter: brightness(1.15); }
.win-btn.close { background: var(--grad-btn-close); border-color: #7a1515; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 5px 14px;
  border-radius: 3px; font-weight: 600; font-size: 12px;
  background: var(--grad-btn);
  border: 1px solid #707070;
  box-shadow: var(--shadow-bevel);
  color: var(--txt-primary);
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { background: #cdcdcd; box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2); transform: translateY(1px); }
.btn::before { display: none; }

.btn-primary {
  background: linear-gradient(to bottom, #0058e4 0%, #3b8cf8 10%, #0058e4 40%, #0042ad 100%);
  color: white; border-color: #003ead;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.3), 1px 1px 2px rgba(0,0,0,0.2);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-accent {
  background: linear-gradient(to bottom, #f59e0b 0%, #d97706 100%);
  color: white; border-color: #b45309;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.3), 1px 1px 2px rgba(0,0,0,0.2);
}

.btn-cyan {
  background: var(--grad-ready);
  color: white; border-color: #3c5d23;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 2px 2px 3px rgba(0,0,0,0.2);
}
.btn-cyan:hover { filter: brightness(1.1); }

.btn-ghost {
  background: var(--grad-btn);
  color: var(--txt-primary); border: 1px solid #707070;
}

.btn-danger {
  background: var(--grad-btn-close); color: white; border-color: #7a1515;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.3);
}

.btn-sm { padding: 3px 10px; font-size: 11px; }
.btn-lg { padding: 8px 20px; font-size: 14px; }
.btn-icon {
  width: 28px; height: 28px; padding: 0; border-radius: 3px;
  background: var(--grad-btn); border: 1px solid #707070;
  font-size: 14px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--clr-surface-lowest);
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}

/* ── Form elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--txt-secondary);
  letter-spacing: 0.03em;
}
.form-input {
  background: white;
  border-top: 2px solid #737686;
  border-left: 2px solid #737686;
  border-bottom: 1px solid #e3f0f6;
  border-right: 1px solid #e3f0f6;
  border-radius: 2px;
  padding: 6px 8px;
  color: var(--txt-primary); font-size: 13px;
  transition: border-color var(--t-fast);
}
.form-input:focus {
  border-color: var(--clr-secondary-container);
  box-shadow: 0 0 0 1px var(--clr-secondary-container);
}
.form-input::placeholder { color: var(--txt-muted); }
.form-input.error { border-color: var(--clr-red); box-shadow: 0 0 0 1px rgba(186,26,26,0.3); }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
}
.badge-primary { background: rgba(0,62,173,0.12); color: var(--clr-primary); border: 1px solid rgba(0,62,173,0.25); }
.badge-green   { background: rgba(16,185,129,0.12); color: #047857; border: 1px solid rgba(16,185,129,0.25); }
.badge-accent  { background: rgba(249,115,22,0.12); color: #c2410c; border: 1px solid rgba(249,115,22,0.25); }
.badge-cyan    { background: rgba(6,182,212,0.12);  color: #0e7490; border: 1px solid rgba(6,182,212,0.25); }
.badge-red     { background: rgba(186,26,26,0.12);  color: #991b1b; border: 1px solid rgba(186,26,26,0.25); }

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 56px; right: 16px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--clr-surface-lowest); border: 2px solid var(--clr-primary);
  border-radius: 4px; box-shadow: var(--shadow-md);
  min-width: 240px; animation: toast-in 0.3s ease both;
  pointer-events: all;
}
.toast.out { animation: toast-out 0.25s ease both; }
@keyframes toast-in  { from { opacity:0; transform: translateX(30px); } to { opacity:1; transform: translateX(0); } }
@keyframes toast-out { from { opacity:1; transform: translateX(0); }    to { opacity:0; transform: translateX(30px); } }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg  { font-size: 12px; font-weight: 500; }
.toast.success { border-color: var(--clr-tertiary); }
.toast.error   { border-color: var(--clr-red); }
.toast.info    { border-color: var(--clr-primary); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fade-in 0.2s ease both;
}
.modal-overlay.hidden { display: none; }
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--clr-surface-lowest);
  border: 3px solid #0058e4; border-radius: 8px 8px 0 0;
  max-width: 460px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s ease both;
  overflow: hidden;
}
@keyframes modal-in { from { opacity:0; transform: scale(0.92); } to { opacity:1; transform: scale(1); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; height: 30px;
  background: var(--grad-header);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
}
.modal-title { font-size: 13px; font-weight: 700; color: white; }
.modal-close {
  width: 21px; height: 21px; border-radius: 2px;
  background: var(--grad-btn-close); border: 1px solid #7a1515;
  color: white; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.3);
}
.modal-close:hover { filter: brightness(1.1); }
.modal form { padding: 20px; }

/* ── Loading Screen ─────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(58,110,165,0.95);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  transition: opacity 0.3s ease;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
.loader-logo {
  font-family: var(--font-heading); font-size: 2rem; font-weight: 900;
  color: white; text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}
.loader-ring {
  width: 60px; height: 60px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.loader-ring::before, .loader-ring::after {
  content: ''; position: absolute; border-radius: 50%;
  animation: ring-pulse 1.4s ease-in-out infinite;
}
.loader-ring::before {
  width: 100%; height: 100%;
  border: 3px solid rgba(255,255,255,0.3); border-top-color: white;
  animation: spin 0.8s linear infinite;
}
.loader-ring::after { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.4; }
}
.loader-text { font-size: 13px; color: rgba(255,255,255,0.8); letter-spacing: 0.05em; }
.loader-dots::after { content: ''; animation: dots 1.5s steps(3,end) infinite; }
@keyframes dots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } 100% { content: ''; } }

/* ── Login / Register Page ──────────────────────────────── */
.auth-page {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #4a90d9 0%, #6ab0e8 30%, #7ec850 55%, #5da83a 70%, #4a8a2e 100%);
  min-height: 100%;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--clr-surface-lowest);
  border: 3px solid #0058e4; border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-header {
  background: var(--grad-header);
  padding: 0 12px; height: 30px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
}
.auth-logo { font-size: 18px; }
.auth-title {
  font-size: 13px; font-weight: 700; color: white;
  background: none; -webkit-text-fill-color: white;
  margin-bottom: 0;
}
.auth-subtitle { display: none; }
.auth-form { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--txt-muted); font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--clr-border);
}
.auth-switch { text-align: center; font-size: 12px; color: var(--txt-secondary); margin-top: 8px; }
.auth-switch a { color: var(--clr-primary); font-weight: 600; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Home Page ──────────────────────────────────────────── */
.home-page { flex: 1; display: flex; flex-direction: column; }
.home-hero {
  padding: 20px 20px 16px;
  background: linear-gradient(180deg, var(--clr-surface-2) 0%, var(--clr-surface-lowest) 100%);
  border-bottom: 1px solid var(--clr-border);
}
.home-hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: rgba(0,62,173,0.08); border: 1px solid rgba(0,62,173,0.2);
  border-radius: 3px; font-size: 11px; font-weight: 600;
  color: var(--clr-primary); margin-bottom: 10px;
}
.home-hero h1 {
  font-size: 28px; font-weight: 900; line-height: 1.1; margin-bottom: 8px;
  color: var(--txt-primary);
}
.home-hero h1 span {
  background: none; -webkit-text-fill-color: var(--clr-primary);
  color: var(--clr-primary); filter: none;
}
.home-hero p {
  max-width: 520px; color: var(--txt-secondary); font-size: 13px; line-height: 1.5;
  margin-bottom: 14px;
}
.home-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stats bar */
.stats-bar {
  display: flex; justify-content: center; gap: 32px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-surface-2);
}
.stat-item { text-align: center; }
.stat-value {
  font-size: 18px; font-weight: 800;
  color: var(--clr-primary); background: none; -webkit-text-fill-color: var(--clr-primary);
}
.stat-label { font-size: 10px; color: var(--txt-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Section */
.section { padding: 16px 20px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(0,62,173,0.15);
}
.section-title {
  font-size: 18px; font-weight: 700; color: var(--clr-primary);
  display: flex; align-items: center; gap: 8px;
}
.section-title .icon { font-size: 18px; }

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.game-card {
  background: var(--clr-surface-lowest);
  border: 1px solid var(--clr-border);
  border-radius: 4px; overflow: hidden;
  transition: all var(--t-fast); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.game-card:hover {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.game-card-banner {
  height: 120px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--clr-border);
}
.game-card-icon { font-size: 3rem; z-index: 1; }
.game-card-banner-bg { position: absolute; inset: 0; }
.game-card-body { padding: 10px; }
.game-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.game-card-name { font-size: 14px; font-weight: 700; color: var(--txt-primary); }
.game-card-desc { font-size: 11px; color: var(--txt-secondary); line-height: 1.4; margin-bottom: 8px; }
.game-card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--txt-muted); margin-bottom: 8px;
}
.game-card-actions { display: flex; gap: 6px; }

/* ── Lobby Browser Page ─────────────────────────────────── */
.lobby-browser-page { flex: 1; display: flex; flex-direction: column; }
.lobby-browser-main {
  flex: 1; display: grid; grid-template-columns: 220px 1fr; gap: 0;
}
.lobby-sidebar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px;
  background: linear-gradient(180deg, #f0f0f8 0%, #ced9f1 100%);
  border-right: 1px solid var(--clr-border);
}
.lobby-sidebar-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--txt-muted);
  padding: 4px 8px; margin-bottom: 4px;
}
.lobby-filter-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 3px;
  background: transparent; border: 1px solid transparent;
  color: var(--txt-secondary); font-size: 12px; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
}
.lobby-filter-btn:hover { background: var(--clr-surface-high); }
.lobby-filter-btn.active {
  background: var(--clr-secondary-container); color: white;
  border-color: rgba(0,0,0,0.1);
}
.lobby-main-content { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.lobby-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.lobby-search {
  flex: 1; min-width: 180px;
  display: flex; align-items: center; gap: 6px;
  background: white; border: 1px solid var(--clr-border);
  border-radius: 3px; padding: 4px 10px;
  box-shadow: var(--shadow-inset);
}
.lobby-search input {
  flex: 1; background: none; border: none;
  color: var(--txt-primary); font-size: 12px;
}
.lobby-search input::placeholder { color: var(--txt-muted); }
.lobby-list { display: flex; flex-direction: column; gap: 6px; }
.lobby-item {
  background: var(--clr-surface-lowest);
  border: 1px solid var(--clr-border);
  border-radius: 3px; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  transition: all var(--t-fast); cursor: pointer;
}
.lobby-item:hover { border-color: var(--clr-primary); background: var(--clr-surface-2); }
.lobby-item-icon {
  width: 40px; height: 40px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
  border: 1px solid var(--clr-border);
}
.lobby-item-info { flex: 1; min-width: 0; }
.lobby-item-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.lobby-item-meta { font-size: 10px; color: var(--txt-muted); display: flex; gap: 8px; }
.lobby-item-players {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--txt-secondary); flex-shrink: 0;
}
.lobby-item-players .player-pips { display: flex; gap: 3px; }
.player-pip { width: 8px; height: 8px; border-radius: 50%; background: var(--clr-border); }
.player-pip.filled { background: var(--clr-primary); }
.lobby-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Lobby Room Page ─────────────────────────────────────── */
.lobby-room-page { flex: 1; display: flex; flex-direction: column; }
.lobby-room-main {
  flex: 1; display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
}
.lobby-room-left {
  display: flex; flex-direction: column; gap: 0;
  border-right: 1px solid var(--clr-border);
}
.lobby-room-header-card {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  border-radius: 0; border: none; border-bottom: 1px solid var(--clr-border);
  background: var(--clr-surface-2);
}
.lobby-room-game-icon { font-size: 2.5rem; }
.lobby-room-game-info { flex: 1; }
.lobby-room-game-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.lobby-room-meta { display: flex; align-items: center; gap: 8px; }
.lobby-code-box {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: white; border: 1px solid var(--clr-border);
  border-radius: 3px; box-shadow: var(--shadow-inset);
}
.lobby-code {
  font-family: monospace; font-size: 16px; font-weight: 700;
  letter-spacing: 0.12em; color: var(--clr-primary);
}
.lobby-code-label { font-size: 10px; color: var(--txt-muted); text-transform: uppercase; }

/* Players Grid */
.players-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; padding: 12px;
}
.player-slot {
  aspect-ratio: 1; border-radius: 4px;
  border: 2px dashed var(--clr-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; transition: all var(--t-fast);
  position: relative; overflow: hidden;
}
.player-slot.filled { border-style: solid; border-color: var(--clr-border); background: var(--clr-surface-2); }
.player-slot.filled:hover { border-color: var(--clr-primary); }
.player-slot.host { border-color: var(--clr-accent); }
.player-slot.empty { color: var(--txt-muted); font-size: 1.2rem; }
.player-slot .avatar { font-size: 2rem; }
.player-slot .p-name {
  font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90%;
}
.player-slot .host-crown {
  position: absolute; top: 4px; right: 4px; font-size: 12px;
}
.player-slot .p-ready {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--clr-red); position: absolute; top: 4px; left: 4px;
}
.player-slot .p-ready.ready { background: var(--clr-tertiary-container); }

/* Chat */
.lobby-chat {
  grid-column: 2; grid-row: 1;
  background: var(--clr-surface-lowest);
  border: none; border-left: 1px solid var(--clr-border);
  border-radius: 0; padding: 0;
  display: flex; flex-direction: column;
  height: 100%; min-height: 350px;
}
.chat-title {
  font-weight: 700; font-size: 12px;
  padding: 6px 12px;
  background: var(--clr-surface-3);
  border-bottom: 1px solid var(--clr-border);
  display: flex; align-items: center; gap: 6px;
}
.chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 10px;
}
.chat-msg { display: flex; flex-direction: column; gap: 1px; }
.chat-msg-header { display: flex; align-items: center; gap: 6px; }
.chat-msg-avatar { font-size: 12px; }
.chat-msg-name { font-size: 11px; font-weight: 700; color: var(--clr-primary); }
.chat-msg-time { font-size: 10px; color: var(--txt-muted); margin-left: auto; }
.chat-msg-text { font-size: 12px; color: var(--txt-secondary); padding-left: 20px; }
.chat-msg.system .chat-msg-text {
  color: var(--txt-muted); font-style: italic; font-size: 11px; padding-left: 0; text-align: center;
}
.sep-line { height: 1px; background: var(--clr-border); }
.chat-input-row { display: flex; gap: 6px; padding: 8px; }
.chat-input {
  flex: 1;
  background: white; border-top: 2px solid #737686; border-left: 2px solid #737686;
  border-bottom: 1px solid #e3f0f6; border-right: 1px solid #e3f0f6;
  border-radius: 2px; padding: 5px 8px;
  color: var(--txt-primary); font-size: 12px;
}
.chat-input:focus { border-color: var(--clr-secondary-container); }

.lobby-room-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--clr-border);
  background: var(--clr-surface-2);
}

/* ── Avatar Picker ──────────────────────────────────────── */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-option {
  aspect-ratio: 1; border-radius: 4px;
  border: 2px solid var(--clr-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; cursor: pointer;
  background: var(--clr-surface-2); transition: all var(--t-fast);
}
.avatar-option:hover { border-color: var(--clr-primary); }
.avatar-option.selected {
  border-color: var(--clr-primary);
  background: rgba(0,62,173,0.1);
  box-shadow: 0 0 0 2px rgba(0,62,173,0.2);
}

/* ── Profile Page ───────────────────────────────────────── */
.profile-page { flex: 1; padding: 20px; }
.profile-header-card {
  display: flex; align-items: center; gap: 20px;
  padding: 16px 24px; margin-bottom: 20px;
  max-width: 700px; margin: 0 auto 20px;
}
.profile-avatar-wrap { position: relative; cursor: pointer; }
.profile-avatar-emoji { font-size: 4rem; display: block; }
.profile-avatar-edit {
  position: absolute; bottom: 0; right: -4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--clr-primary); border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.profile-info { flex: 1; }
.profile-username { font-size: 22px; font-weight: 800; margin-bottom: 2px; }
.profile-email { color: var(--txt-muted); font-size: 12px; margin-bottom: 8px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; max-width: 700px; margin: 0 auto;
}
.stat-card {
  padding: 14px; text-align: center;
  background: var(--clr-surface-lowest); border: 1px solid var(--clr-border);
  border-radius: 4px; box-shadow: var(--shadow-sm);
}
.stat-card-value {
  font-size: 24px; font-weight: 800;
  color: var(--clr-primary); background: none; -webkit-text-fill-color: var(--clr-primary);
}
.stat-card-label { font-size: 10px; color: var(--txt-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 16px; font-size: 12px; color: var(--txt-muted);
  background: var(--clr-surface-2);
  border-bottom: 1px solid var(--clr-border);
}
.breadcrumb a { color: var(--clr-primary); cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--txt-primary); font-weight: 500; }

/* ── Online indicator ────────────────────────────────────── */
.online-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--clr-tertiary-container);
  flex-shrink: 0; animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Taskbar ────────────────────────────────────────────── */
.taskbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 40px; z-index: 100;
  background: var(--grad-taskbar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px;
}
.taskbar-left { display: flex; align-items: center; gap: 6px; height: 100%; }
.taskbar-start {
  background: var(--grad-start);
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), 1px 1px 2px rgba(0,0,0,0.3);
  height: 34px; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  border-radius: 0 12px 12px 0;
  color: white; font-weight: 900; font-style: italic; font-size: 16px;
  border: none;
}
.taskbar-start:hover { filter: brightness(1.08); }
.taskbar-start:active { transform: scale(0.97); }
.taskbar-tasks { display: flex; align-items: center; gap: 4px; height: 100%; padding: 3px 0; }
.taskbar-task {
  height: 100%; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; border-radius: 2px; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(0,0,0,0.15); cursor: pointer;
}
.taskbar-task.active {
  background: var(--clr-secondary); color: white;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.taskbar-task:not(.active) {
  background: var(--clr-surface-3); color: var(--txt-primary);
}
.taskbar-task:not(.active):hover { background: var(--clr-surface-highest); }
.taskbar-right {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 100%;
  background: rgba(9,150,241,0.3);
  border-left: 1px solid rgba(255,255,255,0.2);
}
.taskbar-right .material-symbols-outlined { color: white; font-size: 16px; }
.taskbar-clock { color: white; font-size: 12px; font-weight: 700; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 16px; }
::-webkit-scrollbar-track { background: #e9f6fc; border-left: 1px solid #c3c5d7; }
::-webkit-scrollbar-thumb {
  background: #cfdce2; border: 2px solid #e9f6fc;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #888;
}

/* ── Utility ────────────────────────────────────────────── */
.flex { display: flex; } .flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-4 { margin-top: 8px; } .mb-4 { margin-bottom: 8px; }
.text-muted { color: var(--txt-muted); } .text-sm { font-size: 12px; }
.w-full { width: 100%; } .font-bold { font-weight: 700; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
.mt-1 { margin-top: 4px; }
.justify-between { justify-content: space-between; }

.progress-bar {
  height: 8px; border-radius: var(--r-full);
  background: var(--clr-surface-3); overflow: hidden;
  box-shadow: var(--shadow-inset);
}
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: var(--clr-primary); transition: width 0.5s ease;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .lobby-browser-main { grid-template-columns: 1fr; }
  .lobby-sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--clr-border); }
  .lobby-room-main { grid-template-columns: 1fr; }
  .lobby-chat { grid-column: 1; grid-row: auto; min-height: 250px; border-left: none; border-top: 1px solid var(--clr-border); }
  #app { margin: 4px 4px 48px 4px; }
  .section { padding: 12px; }
  .taskbar-task span:not(.material-symbols-outlined) { display: none; }
}
@media (max-width: 600px) {
  .home-hero { padding: 16px 12px; }
  .stats-bar { gap: 12px; flex-wrap: wrap; }
  .games-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Skeleton ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--clr-surface-2) 25%, var(--clr-surface-3) 50%, var(--clr-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Particles (disabled for light theme) ──────────────── */
.particle { display: none; }
