/* ═══════════════════════════════════════════════════════════════════════════
   FLAPPY BIRD MULTIPLAYER — MAIN STYLESHEET
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --sky-top:    #4ec0ca;
  --sky-bot:    #87ceeb;
  --ground:     #ded895;
  --ground-dark:#b8a048;
  --pipe-green: #73bf2e;
  --pipe-dark:  #538a1f;
  --bird-yellow:#f5c518;

  /* UI */
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface2:   #21262d;
  --border:     #30363d;
  --primary:    #58a6ff;
  --primary-dk: #1f6feb;
  --success:    #3fb950;
  --danger:     #f85149;
  --warning:    #e3b341;
  --text:       #e6edf3;
  --text-dim:   #8b949e;
  --text-muted: #484f58;

  /* Spacing / radius */
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  18px;

  /* Transitions */
  --t-fast:     .12s ease;
  --t-med:      .22s ease;
  --t-slow:     .4s ease;
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input  { font-family: inherit; outline: none; }
code   { font-family: 'Cascadia Code', 'Fira Code', monospace; }

/* ── Screen System ────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(.98);
  transition: opacity var(--t-slow), transform var(--t-slow);
  z-index: 1;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
  z-index: 10;
}
.screen.slide-out {
  opacity: 0;
  transform: translateX(-3%) scale(.97);
  pointer-events: none;
}

/* ── Sky Background (shared) ─────────────────────────────────────────────── */
.sky-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 100%);
  overflow: hidden;
  z-index: 0;
}

.ground-strip {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(180deg, var(--ground) 0%, var(--ground-dark) 100%);
  border-top: 4px solid var(--ground-dark);
}

/* Clouds */
.cloud {
  position: absolute;
  background: rgba(255,255,255,.88);
  border-radius: 50px;
  filter: blur(1px);
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud-1 {
  width: 120px; height: 40px;
  top: 12%; left: -140px;
  animation: cloud-drift 22s linear infinite;
}
.cloud-1::before { width:60px; height:60px; top:-28px; left:18px; }
.cloud-1::after  { width:45px; height:45px; top:-18px; left:52px; }

.cloud-2 {
  width: 90px; height: 32px;
  top: 28%; left: -110px;
  animation: cloud-drift 30s linear infinite 8s;
}
.cloud-2::before { width:46px; height:46px; top:-22px; left:12px; }
.cloud-2::after  { width:36px; height:36px; top:-14px; left:40px; }

.cloud-3 {
  width: 150px; height: 48px;
  top: 18%; left: -180px;
  animation: cloud-drift 38s linear infinite 15s;
}
.cloud-3::before { width:72px; height:72px; top:-34px; left:22px; }
.cloud-3::after  { width:56px; height:56px; top:-22px; left:68px; }

@keyframes cloud-drift {
  to { left: calc(100vw + 200px); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOADING SCREEN
───────────────────────────────────────────────────────────────────────────── */
#screen-loading {
  background: linear-gradient(160deg, #0d1117 0%, #161b22 100%);
  z-index: 100;
}
.loading-inner {
  text-align: center;
  animation: fade-in .6s ease;
}
.loading-bird {
  font-size: 5rem;
  animation: bob 1s ease-in-out infinite alternate;
  display: block;
  margin-bottom: 12px;
}
.loading-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.loading-sub {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.loading-bar-wrap {
  width: 220px;
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  margin: 24px auto 10px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 99px;
  transition: width .3s ease;
}
.loading-text {
  font-size: .85rem;
  color: var(--text-dim);
}

@keyframes bob {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-12px) rotate(5deg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   AUTH SCREEN
───────────────────────────────────────────────────────────────────────────── */
#screen-auth {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 60%, var(--ground) 100%);
  position: relative;
  overflow: hidden;
}
.auth-bg { position: absolute; inset: 0; pointer-events: none; }

/* Decorative pipes on auth bg */
.pipe {
  position: absolute;
  width: 62px;
  background: linear-gradient(180deg, var(--pipe-green) 0%, var(--pipe-dark) 100%);
  border-radius: 6px;
  border: 3px solid var(--pipe-dark);
}
.pipe-left  { height: 40%; top: 0; left: 10%; border-top-left-radius:0; border-top-right-radius:0; }
.pipe-left::after {
  content: '';
  position: absolute;
  bottom: -18px; left: -8px; right: -8px;
  height: 18px;
  background: var(--pipe-green);
  border-radius: 6px;
  border: 3px solid var(--pipe-dark);
}
.pipe-right { height: 35%; bottom: 80px; right: 10%; border-bottom-left-radius:0; border-bottom-right-radius:0; }
.pipe-right::before {
  content: '';
  position: absolute;
  top: -18px; left: -8px; right: -8px;
  height: 18px;
  background: var(--pipe-green);
  border-radius: 6px;
  border: 3px solid var(--pipe-dark);
}

.auth-card {
  position: relative;
  z-index: 2;
  background: rgba(22, 27, 34, .92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: min(380px, 90vw);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: slide-up .5s ease;
}
.auth-logo { font-size: 3.5rem; margin-bottom: 8px; }
.auth-title { font-size: 1.8rem; font-weight: 800; }
.auth-sub   { color: var(--primary); font-size: .9rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-top: 4px; margin-bottom: 20px; }

.auth-error {
  background: rgba(248,81,73,.12);
  border: 1px solid rgba(248,81,73,.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 14px;
}

.auth-form { text-align: left; }
.auth-hint { font-size: .75rem; color: var(--text-muted); margin-top: 14px; }
.auth-hint code { color: var(--text-dim); }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: .82rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: .95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.form-group input::placeholder { color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  transition: opacity var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.btn:hover  { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }

.btn-primary  { background: var(--primary);   color: #000; }
.btn-success  { background: var(--success);   color: #000; }
.btn-danger   { background: var(--danger);    color: #fff; }
.btn-warning  { background: var(--warning);   color: #000; }
.btn-ghost    { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface2); }
.btn-lg   { padding: 13px 26px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm   { padding: 6px 14px; font-size: .82rem; }
.btn-full { width: 100%; }

.btn-back {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: .9rem;
  font-weight: 600;
  transition: background var(--t-fast);
}
.btn-back:hover { background: rgba(255,255,255,.25); }

.btn-copy {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: .7;
  transition: opacity var(--t-fast);
}
.btn-copy:hover { opacity: 1; }

/* ─────────────────────────────────────────────────────────────────────────────
   PILLS / BADGES
───────────────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.pill-green  { background: rgba(63,185,80,.15);  color: var(--success); border: 1px solid rgba(63,185,80,.3); }
.pill-red    { background: rgba(248,81,73,.15);  color: var(--danger);  border: 1px solid rgba(248,81,73,.3); }
.pill-blue   { background: rgba(88,166,255,.15); color: var(--primary); border: 1px solid rgba(88,166,255,.3); }
.pill-yellow { background: rgba(227,179,65,.15); color: var(--warning); border: 1px solid rgba(227,179,65,.3); }
.pill-gray   { background: rgba(139,148,158,.12);color: var(--text-dim);border: 1px solid var(--border); }

/* ─────────────────────────────────────────────────────────────────────────────
   MAIN MENU
───────────────────────────────────────────────────────────────────────────── */
#screen-menu .sky-bg { z-index: 0; }

.menu-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(420px, 96vw);
  gap: 0;
  padding-bottom: 20px;
}

.menu-header {
  text-align: center;
  margin-bottom: 16px;
}
.menu-bird-wrap { position: relative; height: 70px; }
.menu-bird {
  font-size: 4rem;
  display: inline-block;
  animation: menu-bird-fly 2.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
@keyframes menu-bird-fly {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-14px) rotate(5deg); }
}
.menu-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0,0,0,.4);
  letter-spacing: -.02em;
}
.menu-sub {
  font-size: .95rem;
  color: rgba(255,255,255,.8);
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* Player bar */
.player-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 10px 16px;
  width: 100%;
  margin-bottom: 16px;
}
.player-avatar { font-size: 1.6rem; }
.player-info   { flex: 1; }
.player-name   { font-size: .95rem; font-weight: 700; color: #fff; display: block; }
.player-stats-mini { font-size: .78rem; color: rgba(255,255,255,.6); }
.online-badge  { font-size: .78rem; color: rgba(255,255,255,.7); display: flex; align-items: center; gap: 4px; }

/* Menu buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  text-align: left;
  font-size: 1rem;
  transition: transform var(--t-med), opacity var(--t-fast), box-shadow var(--t-med);
  position: relative;
  overflow: hidden;
}
.menu-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.menu-btn:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.menu-btn:hover::before { background: rgba(255,255,255,.06); }
.menu-btn:active { transform: scale(.98); }

.menu-btn-solo       { background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%); }
.menu-btn-online     { background: linear-gradient(135deg, #2980b9 0%, #6dd5fa 100%); }
.menu-btn-leaderboard{ background: linear-gradient(135deg, #8e44ad 0%, #c0392b 100%); }

.menu-btn-icon { font-size: 1.8rem; flex-shrink: 0; }
.menu-btn-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.menu-btn-title { font-size: 1rem; font-weight: 700; }
.menu-btn-desc  { font-size: .78rem; opacity: .75; }
.menu-btn-arrow { font-size: 1.4rem; opacity: .6; }

.menu-footer {
  margin-top: 14px;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}

/* ─────────────────────────────────────────────────────────────────────────────
   ONLINE LOBBY
───────────────────────────────────────────────────────────────────────────── */
.lobby-wrap {
  position: relative;
  z-index: 2;
  width: min(440px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 20px;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.lobby-wrap::-webkit-scrollbar { display: none; }

.lobby-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.lobby-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Ranked toggle */
.ranked-toggle-wrap {
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.ranked-toggle-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ranked-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ranked-icon { font-size: 1.4rem; }
.ranked-title { font-size: .95rem; font-weight: 700; color: #fff; }
.ranked-desc  { font-size: .78rem; color: rgba(255,255,255,.6); margin-top: 2px; }

.ranked-status-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--t-med);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-med);
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }

/* Online mode cards */
.online-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.online-mode-card {
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 18px 10px;
  color: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform var(--t-med), background var(--t-fast);
}
.online-mode-card:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
}
.omc-icon  { font-size: 2rem; }
.omc-title { font-size: .88rem; font-weight: 700; }
.omc-desc  { font-size: .72rem; color: rgba(255,255,255,.6); }

/* Join room form */
.join-room-form {
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  padding: 16px;
}

/* Queue status */
.queue-status {
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(88,166,255,.3);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: fade-in .3s ease;
}
.queue-spinner { position: relative; }
.spinner-bird {
  font-size: 2.5rem;
  animation: spin-bob 1.2s ease-in-out infinite;
}
@keyframes spin-bob {
  0%,100% { transform: translateY(0) rotate(-8deg); }
  50%      { transform: translateY(-10px) rotate(8deg); }
}
.queue-text  { font-size: 1rem; font-weight: 600; color: #fff; }
.queue-timer { font-size: 1.6rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }

.queue-info {
  text-align: center;
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}

/* ─────────────────────────────────────────────────────────────────────────────
   WAITING ROOM
───────────────────────────────────────────────────────────────────────────── */
.room-wrap {
  position: relative;
  z-index: 2;
  width: min(440px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.room-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.room-header h2 { display: none; }
.room-code-display {
  flex: 1;
  text-align: center;
  font-size: 1rem;
  color: rgba(255,255,255,.8);
  background: rgba(0,0,0,.25);
  border-radius: 99px;
  padding: 6px 16px;
}
.room-code-display strong { color: #fff; letter-spacing: .1em; }

.room-players {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: fade-in .3s ease;
}
.player-slot.empty {
  border-style: dashed;
  opacity: .5;
}
.player-slot-avatar { font-size: 2rem; }
.player-slot-info   { flex: 1; }
.player-slot-name   { font-size: .95rem; font-weight: 700; color: #fff; }
.player-slot-sub    { font-size: .78rem; color: rgba(255,255,255,.5); margin-top: 2px; }
.player-slot-badge  { }

.player-slot.is-ready { border-color: rgba(63,185,80,.5); }
.player-slot.is-ready .player-slot-badge::after { content: '✓ Ready'; color: var(--success); font-size: .78rem; font-weight: 700; }

/* Countdown overlay */
.room-countdown {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.countdown-number {
  font-size: 8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(88,166,255,.6);
  animation: countdown-pop .8s ease infinite;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.countdown-label {
  font-size: 1.2rem;
  color: rgba(255,255,255,.7);
  margin-top: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
@keyframes countdown-pop {
  0%   { transform: scale(1.1); opacity: 1; }
  80%  { transform: scale(.95); opacity: .7; }
  100% { transform: scale(1.1); opacity: 1; }
}

.room-controls { text-align: center; }
.room-hint { color: rgba(255,255,255,.65); font-size: .9rem; margin-bottom: 12px; }

/* ─────────────────────────────────────────────────────────────────────────────
   GAME CANVAS SCREEN
───────────────────────────────────────────────────────────────────────────── */
#screen-game {
  background: #000;
  padding: 0;
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* HUD */
.game-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(180deg, rgba(0,0,0,.6) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}
.hud-score, .hud-pipes {
  text-align: center;
}
.hud-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.6);
}
.hud-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hud-center {
  flex: 1;
  text-align: center;
}

/* Opponents mini panel */
.opponents-panel {
  position: absolute;
  top: 62px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.opponent-card {
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-width: 110px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fade-in .3s ease;
}
.opponent-card.dead { opacity: .45; }
.opponent-avatar { font-size: 1.1rem; }
.opponent-info   { flex: 1; }
.opponent-name   { font-size: .72rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72px; }
.opponent-score  { font-size: .8rem; color: var(--warning); font-weight: 800; font-variant-numeric: tabular-nums; }
.opponent-dead-label { font-size: .65rem; color: var(--danger); font-weight: 600; }

/* Game Over Overlay */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fade-in .4s ease;
}
.game-over-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  text-align: center;
  width: min(320px, 90vw);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: slide-up .4s ease;
}
.game-over-icon  { font-size: 3rem; margin-bottom: 8px; }
.game-over-title { font-size: 1.6rem; font-weight: 900; margin-bottom: 16px; }

.game-over-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
}
.go-stat { text-align: center; }
.go-stat-label { font-size: .7rem; color: var(--text-dim); display: block; text-transform: uppercase; letter-spacing: .06em; }
.go-stat-value { font-size: 1.5rem; font-weight: 800; color: var(--warning); display: block; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* Standings (multiplayer result) */
.go-standings {
  margin-bottom: 16px;
}
.go-standing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 5px;
  background: var(--bg);
  font-size: .88rem;
}
.go-standing-row.rank-1 { background: rgba(227,179,65,.1); border: 1px solid rgba(227,179,65,.25); }
.go-rank  { font-size: .85rem; font-weight: 800; width: 22px; text-align: center; }
.go-name  { flex: 1; font-weight: 600; text-align: left; }
.go-pts   { font-weight: 800; color: var(--warning); }
.go-bot   { font-size: .7rem; color: var(--text-dim); }

.game-over-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Pause Overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.pause-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: center;
  animation: fade-in .25s ease;
}
.pause-icon { font-size: 3rem; margin-bottom: 8px; }
.pause-card h2 { margin-bottom: 20px; }
.pause-actions { display: flex; gap: 10px; justify-content: center; }

/* ─────────────────────────────────────────────────────────────────────────────
   LEADERBOARD
───────────────────────────────────────────────────────────────────────────── */
.lb-wrap {
  position: relative;
  z-index: 2;
  width: min(500px, 98vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 94vh;
  padding-bottom: 10px;
}

.lb-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.lb-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Tabs */
.lb-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,.3);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.1);
}
.lb-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  color: rgba(255,255,255,.65);
  background: transparent;
  transition: background var(--t-fast), color var(--t-fast);
}
.lb-tab.active {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.lb-tab:hover:not(.active) { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }

/* My rank card */
.my-rank-card {
  background: rgba(88,166,255,.12);
  border: 1px solid rgba(88,166,255,.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.my-rank-left  { display: flex; align-items: center; gap: 10px; flex: 1; }
.my-rank-num   { font-size: 1.5rem; font-weight: 900; color: var(--primary); min-width: 40px; }
.my-rank-name  { font-size: .95rem; font-weight: 700; color: #fff; }
.my-rank-sub   { font-size: .78rem; color: rgba(255,255,255,.55); margin-top: 2px; }
.my-rank-score { font-size: 1.8rem; font-weight: 900; color: var(--warning); font-variant-numeric: tabular-nums; }

/* Global list */
.lb-list-wrap {
  flex: 1;
  overflow-y: auto;
  max-height: 260px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.lb-list-wrap::-webkit-scrollbar { width: 4px; }
.lb-list-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-loading { text-align: center; padding: 20px; color: var(--text-dim); font-size: .88rem; }

.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  animation: fade-in .25s ease;
  transition: background var(--t-fast);
}
.lb-entry:hover { background: rgba(255,255,255,.07); }
.lb-entry.me    { border-color: rgba(88,166,255,.4); background: rgba(88,166,255,.08); }

.lb-entry-rank {
  font-size: .9rem;
  font-weight: 800;
  width: 30px;
  text-align: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.lb-entry.rank-1 .lb-entry-rank { color: gold; font-size: 1.1rem; }
.lb-entry.rank-2 .lb-entry-rank { color: silver; }
.lb-entry.rank-3 .lb-entry-rank { color: #cd7f32; }

.lb-entry-avatar { font-size: 1.4rem; }
.lb-entry-info   { flex: 1; min-width: 0; }
.lb-entry-name   { font-size: .9rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-entry-sub    { font-size: .72rem; color: rgba(255,255,255,.45); }
.lb-entry-score  { font-size: 1.2rem; font-weight: 900; color: var(--warning); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.lb-entry-extra  { font-size: .72rem; color: var(--text-dim); text-align: right; flex-shrink: 0; }

/* History section */
.lb-history-wrap {
  overflow-y: auto;
  max-height: 200px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.lb-history-wrap::-webkit-scrollbar { width: 4px; }
.lb-history-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.lb-history-title {
  font-size: .8rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.lb-history { display: flex; flex-direction: column; gap: 5px; }

.lb-history-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: .82rem;
  animation: fade-in .2s ease;
}
.lh-score { font-weight: 800; color: var(--warning); font-variant-numeric: tabular-nums; min-width: 36px; }
.lh-pipes { color: var(--text-dim); min-width: 50px; }
.lh-date  { flex: 1; color: var(--text-muted); text-align: right; }
.lh-rank  { font-weight: 700; }
.lh-rank.win  { color: var(--success); }
.lh-rank.loss { color: var(--text-dim); }
.lh-ranked-pill { }

.lb-history-pagination {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: center;
}
.lb-pg-btn {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  font-size: .78rem;
  background: rgba(0,0,0,.25);
  transition: background var(--t-fast);
}
.lb-pg-btn:hover  { background: rgba(255,255,255,.1); }
.lb-pg-btn.active { background: var(--primary); color: #000; border-color: var(--primary); }

/* ─────────────────────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toast-in .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: all;
}
.toast.removing { animation: toast-out .25s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-close { background: none; border: none; color: var(--text-dim); font-size: 1rem; cursor: pointer; padding: 0 2px; }
.toast-close:hover { color: var(--text); }

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--primary); }
.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px) scale(.92); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   PULSE / ONLINE DOT
───────────────────────────────────────────────────────────────────────────── */
.dot-pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY
───────────────────────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.visible { display: flex !important; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scrollbar (global) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .menu-title    { font-size: 1.9rem; }
  .online-modes  { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .omc-icon      { font-size: 1.5rem; }
  .omc-desc      { display: none; }
  .game-hud      { height: 48px; }
  .hud-value     { font-size: 1.3rem; }
  .auth-card     { padding: 26px 20px; }
  .game-over-card { padding: 22px 18px; }
  .lb-wrap       { max-height: 96vh; }
}

@media (max-height: 600px) {
  .menu-bird-wrap { height: 50px; }
  .menu-bird      { font-size: 3rem; }
  .menu-title     { font-size: 1.8rem; }
  .menu-buttons   { gap: 7px; }
  .menu-btn       { padding: 12px 14px; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   CANVAS PIXEL FONT (Score display on canvas itself)
───────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'FlappyFont';
  src: local('Arial Black'), local('Impact');
}
