:root { color-scheme: dark; --bg: #1c1917; --panel: #292524; --panel-alt: #3c3836; --line: #44403c; --text: #fafaf9; --muted: #a8a29e; --accent: #f59e0b; --accent-strong: #d97706; --shadow: 0 18px 40px rgba(0, 0, 0, 0.35); --danger: #f87171; --danger-bg: rgba(127, 29, 29, 0.35); --notice: rgba(41, 37, 36, 0.9); --wall: #57534e; --block: #b45309; --floor: rgba(214, 211, 209, 0.06); --spawn-a: #38bdf8; --spawn-b: #fb923c; --spawn-c: #4ade80; --spawn-d: #facc15; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, sans-serif; background: radial-gradient(circle at top, #1e293b, var(--bg) 45%); color: var(--text); }
body { padding: 24px; }
button, input { font: inherit; }
.app-shell { max-width: 1080px; margin: 0 auto; display: grid; gap: 20px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; padding: 18px 20px; background: rgba(17, 24, 39, 0.82); border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 20px; box-shadow: var(--shadow); }
.topbar-title { font-size: 1.2rem; font-weight: 700; }
.topbar-meta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.badge { padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(15, 23, 42, 0.9); color: var(--muted); font-size: 0.86rem; }
.notification-banner { padding: 14px 18px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.18); background: var(--notice); color: var(--text); box-shadow: var(--shadow); }
.panel { display: grid; gap: 16px; padding: 28px; border-radius: 24px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(17, 24, 39, 0.9); box-shadow: var(--shadow); }
.panel-wide { grid-template-columns: 1fr; }
.eyebrow { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); }
.page-title { margin: 0; font-size: clamp(2rem, 4vw, 3rem); }
.lead { margin: 0; line-height: 1.6; color: var(--muted); }
.section-title { margin: 0; font-size: 1.1rem; }
.label { font-weight: 600; }
.input { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: rgba(15, 23, 42, 0.92); color: var(--text); padding: 14px 16px; }
.feedback { margin: 0; color: var(--muted); line-height: 1.5; }
.feedback-error { color: #fecaca; background: var(--danger-bg); padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(248, 113, 113, 0.35); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }
.button { border: 1px solid var(--line); background: var(--panel-alt); color: var(--text); border-radius: 14px; padding: 12px 16px; cursor: pointer; }
.button[disabled] { opacity: 0.65; cursor: progress; }
.button-primary { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: #052e16; border: none; font-weight: 700; }
.button-danger { background: rgba(127, 29, 29, 0.24); border-color: rgba(248, 113, 113, 0.38); color: #fecaca; font-weight: 700; }
.button-small { padding: 5px 10px; border-radius: 8px; font-size: 0.82rem; }
.metrics-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.metric-card { display: grid; gap: 8px; border-radius: 18px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.72); padding: 16px; }
.metric-card-local { border-color: rgba(34, 197, 94, 0.45); box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.25); }
.info-list { display: grid; gap: 8px; color: var(--muted); }
.info-list p { margin: 0; }
.participants-shell,
.chat-shell,
.players-shell { display: grid; gap: 14px; padding: 18px; border-radius: 20px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.72); }
.chat-shell-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.participants-list,
.chat-log { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.participant-item,
.chat-message { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; background: rgba(30, 41, 59, 0.78); }
.chat-message-system { border-left: 3px solid var(--accent); }
.chat-message strong { font-size: 0.95rem; }
.chat-message p { margin: 0; color: var(--muted); }
.arena-empty { padding: 20px; border-radius: 18px; border: 1px dashed rgba(148, 163, 184, 0.3); background: rgba(15, 23, 42, 0.55); color: var(--muted); }
.arena-board { display: grid; gap: 4px; padding: 16px; border-radius: 20px; background: rgba(15, 23, 42, 0.75); border: 1px solid rgba(148, 163, 184, 0.18); }
.arena-cell { aspect-ratio: 1 / 1; min-height: 20px; border-radius: 8px; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; position: relative; overflow: hidden; }
.arena-overlay-slot { will-change: transform; }
@keyframes player-cell-move {
  from { transform: translate(var(--player-move-from-x, 0%), var(--player-move-from-y, 0%)); }
  to { transform: translate(0%, 0%); }
}
.arena-wall { background: var(--wall); color: #e2e8f0; }
.arena-block { background: var(--block); color: #fef3c7; }
.arena-floor { background: var(--floor); color: transparent; border: 1px solid rgba(148, 163, 184, 0.08); }
.arena-spawn { color: #020617; }
.arena-spawn-a { background: var(--spawn-a); }
.arena-spawn-b { background: var(--spawn-b); }
.arena-spawn-c { background: var(--spawn-c); }
.arena-spawn-d { background: var(--spawn-d); }
.arena-cell-explosion { box-shadow: inset 0 0 0 2px rgba(250, 204, 21, 0.6); }
.player-chip,
.cell-label,
.bomb-chip,
.explosion-chip,
.powerup-chip { display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; padding: 2px 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; position: relative; z-index: 2; }
.player-chip { background: rgba(15, 23, 42, 0.92); color: #e5e7eb; border: 1px solid rgba(148, 163, 184, 0.25); }
.player-chip-local { background: rgba(34, 197, 94, 0.9); color: #052e16; border-color: transparent; }
.cell-label { background: transparent; color: inherit; }
.bomb-chip { position: absolute; bottom: 4px; right: 4px; min-width: 18px; min-height: 18px; padding: 0; background: rgba(2, 6, 23, 0.9); color: #f8fafc; border: 1px solid rgba(148, 163, 184, 0.25); }
.explosion-chip { position: absolute; top: 4px; left: 4px; min-width: 18px; min-height: 18px; padding: 0; background: rgba(250, 204, 21, 0.92); color: #7c2d12; box-shadow: 0 0 16px rgba(250, 204, 21, 0.5); }
.powerup-chip { position: absolute; top: 4px; right: 4px; min-width: 18px; min-height: 18px; padding: 0 4px; border: 1px solid rgba(2, 6, 23, 0.2); }
.powerup-chip-bomb { background: rgba(96, 165, 250, 0.95); color: #082f49; }
.powerup-chip-flame { background: rgba(251, 191, 36, 0.95); color: #78350f; }
.powerup-chip-speed { background: rgba(74, 222, 128, 0.95); color: #14532d; }
.powerup-chip-bombpass { background: rgba(129, 140, 248, 0.95); color: #312e81; }
.powerup-chip-blockpass { background: rgba(244, 114, 182, 0.95); color: #831843; }
.powerup-chip-oneup { background: rgba(248, 113, 113, 0.95); color: #7f1d1d; }
.arena-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.legend-chip { padding: 8px 12px; border-radius: 999px; font-size: 0.86rem; border: 1px solid rgba(148, 163, 184, 0.2); }
.legend-wall { background: rgba(71, 85, 105, 0.5); }
.legend-block { background: rgba(161, 98, 7, 0.4); }
.legend-floor { background: rgba(148, 163, 184, 0.1); }
.legend-spawn { background: rgba(34, 197, 94, 0.25); }
.legend-player { background: rgba(15, 23, 42, 0.92); }
.legend-bomb { background: rgba(2, 6, 23, 0.92); }
.legend-explosion { background: rgba(250, 204, 21, 0.92); color: #7c2d12; }
.legend-powerup-bomb { background: rgba(96, 165, 250, 0.95); color: #082f49; }
.legend-powerup-flame { background: rgba(251, 191, 36, 0.95); color: #78350f; }
.legend-powerup-speed { background: rgba(74, 222, 128, 0.95); color: #14532d; }
.legend-powerup-bombpass { background: rgba(129, 140, 248, 0.95); color: #312e81; }
.legend-powerup-blockpass { background: rgba(244, 114, 182, 0.95); color: #831843; }
.legend-powerup-oneup { background: rgba(248, 113, 113, 0.95); color: #7f1d1d; }


.topbar-title-group { display: grid; gap: 4px; }
.topbar-subtitle { color: var(--muted); font-size: 0.9rem; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.topbar-button { min-width: 140px; font-weight: 700; }
.config-page-shell { display: grid; gap: 18px; }
.config-tab-row { display: flex; flex-wrap: wrap; gap: 12px; }
.config-tab-button { min-width: 120px; }
.config-section-card { display: grid; gap: 14px; padding: 18px; border-radius: 20px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.72); }
.config-field-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.config-field { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(2, 6, 23, 0.35); border: 1px solid rgba(148, 163, 184, 0.12); }
.config-field-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.config-default-chip { padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; color: var(--muted); border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.8); }
.checkbox-row { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.checkbox-label { font-weight: 600; }
.config-warning-list { display: grid; gap: 10px; }
.level-template-grid { display: grid; gap: 4px; overflow: auto; padding: 12px; border-radius: 16px; background: rgba(2, 6, 23, 0.42); border: 1px solid rgba(148, 163, 184, 0.16); }
.level-template-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(18px, 18px)); gap: 4px; }
.level-template-cell { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-size: 0.6rem; line-height: 1; }
.level-template-cell-wall { background: var(--wall); color: #e2e8f0; }
.level-template-cell-floor { background: rgba(148, 163, 184, 0.1); color: rgba(148, 163, 184, 0.32); }
@media (max-width: 900px) {
  .topbar { align-items: stretch; }
  .topbar-meta { order: 3; }
}


.level-list-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.level-card { display: grid; gap: 8px; text-align: left; padding: 14px; border-radius: 16px; border: 1px solid rgba(148,163,184,0.18); background: rgba(2,6,23,0.35); }
.level-card-selected { border-color: rgba(56,189,248,0.65); box-shadow: 0 0 0 1px rgba(56,189,248,0.35) inset; }
.level-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.level-card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-primary { background: rgba(56,189,248,0.18); border-color: rgba(56,189,248,0.45); }
.textarea { width: 100%; min-height: 100px; resize: vertical; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(2, 6, 23, 0.7); color: inherit; }


.map-designer-card { display: grid; gap: 14px; padding: 18px; border-radius: 18px; background: rgba(2, 6, 23, 0.4); border: 1px solid rgba(148,163,184,0.16); }
.map-designer-header { display: grid; gap: 12px; }
.map-designer-title-group { display: grid; gap: 6px; }
.map-designer-toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.brush-button { min-width: 110px; }
.level-designer-grid { display: grid; gap: 4px; overflow: auto; padding: 12px; border-radius: 16px; background: rgba(2,6,23,0.42); border: 1px solid rgba(148,163,184,0.16); }
.level-designer-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(24px, 24px)); gap: 4px; }
.level-designer-cell { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(148,163,184,0.18); font-size: 0.72rem; line-height: 1; display: inline-grid; place-items: center; }
.level-designer-cell-wall { background: var(--wall); color: #e2e8f0; }
.level-designer-cell-floor { background: rgba(148,163,184,0.1); color: rgba(226,232,240,0.75); }
.level-designer-cell-protected { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.45); color: #7dd3fc; cursor: not-allowed; }


.validation-card { display: grid; gap: 14px; padding: 18px; border-radius: 18px; background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(148,163,184,0.16); }
.validation-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.validation-metrics-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.validation-list { display: grid; gap: 8px; }
.badge-success { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.35); }
.badge-danger { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.35); }


.map-resize-card { display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(15, 23, 42, 0.42); border: 1px solid rgba(148,163,184,0.16); }
.map-resize-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.map-resize-controls { display: grid; gap: 10px; grid-template-columns: auto minmax(90px, 110px) auto minmax(90px, 110px) auto; align-items: center; }
.input-small { max-width: 110px; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-button { min-width: 84px; }
@media (max-width: 900px) {
  .map-resize-controls { grid-template-columns: 1fr 1fr; }
}


.level-designer-cell-block { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.45); color: #fbbf24; }
.level-template-cell-block { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.brush-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.brush-legend-item { padding: 6px 10px; border-radius: 999px; font-size: 0.82rem; color: var(--muted); border: 1px solid rgba(148,163,184,0.18); background: rgba(15,23,42,0.8); }


.spawn-editor-card { display: grid; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid rgba(148,163,184,0.16); background: rgba(2, 6, 23, 0.35); }
.spawn-editor-header { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spawn-chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.spawn-chip { min-width: 130px; }
.level-designer-cell-current-spawn { box-shadow: 0 0 0 2px rgba(56,189,248,0.55) inset; }
.level-designer-cell-protected.level-designer-cell-current-spawn { background: rgba(56,189,248,0.18); }


.paint-hint-chip { padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(148,163,184,0.18); background: rgba(15,23,42,0.8); color: var(--muted); font-size: 0.82rem; }


.map-pattern-card { display: grid; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid rgba(148,163,184,0.16); background: rgba(2, 6, 23, 0.35); }
.pattern-tools-row { display: flex; flex-wrap: wrap; gap: 10px; }


.corridor-summary-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.corridor-summary-card { display: grid; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid rgba(148,163,184,0.14); background: rgba(15,23,42,0.55); }


.gift-summary-card { display: grid; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid rgba(148,163,184,0.16); background: rgba(2, 6, 23, 0.35); }
.gift-pill-row { display: flex; flex-wrap: wrap; gap: 10px; }


.gift-editor-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.input-medium { max-width: 220px; }
.gift-pill-button { padding: 8px 12px; border-radius: 999px; }
.gift-placement-list { display: flex; flex-wrap: wrap; gap: 10px; }
.gift-placement-item { padding: 6px 10px; border-radius: 999px; font-size: 0.82rem; color: var(--muted); border: 1px solid rgba(148,163,184,0.18); background: rgba(15,23,42,0.8); }


.gift-tool-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gift-tool-button { min-width: 110px; }
.level-designer-cell-gifted { box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.45) inset; color: #fde68a; }

body.app-reduced-motion *,
body.app-reduced-motion *::before,
body.app-reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
.powerup-picker-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.powerup-picker-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.12); background: rgba(2, 6, 23, 0.28); }

.notification-drawer { display: grid; gap: 14px; padding: 18px; border-radius: 20px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(17, 24, 39, 0.92); box-shadow: var(--shadow); }
.notification-drawer-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.notification-list { display: grid; gap: 10px; }
.notification-item { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: rgba(15, 23, 42, 0.75); border: 1px solid rgba(148, 163, 184, 0.14); }
.notification-item p { margin: 0; color: var(--muted); }
.notification-button { min-width: 160px; }
.main-menu-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.chat-feed { display: grid; gap: 10px; }
.chat-composer { display: grid; gap: 12px; grid-template-columns: 1fr auto; align-items: center; }
@media (max-width: 720px) { .chat-composer { grid-template-columns: 1fr; } }

.invite-user-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.invite-user-card { display: grid; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.14); background: rgba(2, 6, 23, 0.35); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.7); display: grid; place-items: center; padding: 24px; z-index: 40; }
.modal-card { width: min(100%, 460px); display: grid; gap: 16px; padding: 24px; border-radius: 24px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(17, 24, 39, 0.97); box-shadow: var(--shadow); }
.modal-card-wide { width: min(100%, 760px); max-height: min(80vh, 720px); overflow: auto; }
.config-auth-shell { min-height: 56vh; }
.config-auth-backdrop { z-index: 30; }
.config-auth-card { width: min(100%, 420px); }
.config-auth-actions { justify-content: flex-end; }

body { padding: 20px; }
.app-shell { max-width: 1320px; }
.topbar { grid-template-columns: minmax(220px, 1.2fr) minmax(320px, 1.5fr) minmax(360px, 1.8fr); display: grid; align-items: center; gap: 18px; padding: 20px 22px; background: linear-gradient(180deg, rgba(17, 24, 39, 0.94), rgba(15, 23, 42, 0.9)); border-radius: 24px; }
.topbar-brand { min-width: 0; }
.topbar-title { font-size: 1.45rem; letter-spacing: 0.04em; }
.topbar-status-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.topbar-status-pill { display: grid; gap: 3px; min-width: 96px; padding: 10px 12px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.16); background: rgba(15, 23, 42, 0.82); }
.topbar-status-label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.topbar-status-value { font-size: 0.95rem; color: var(--text); }
.topbar-actions { justify-content: flex-end; flex-wrap: wrap; }
.topbar-button { min-width: 128px; }
.topbar-logout-button { min-width: 110px; }
.button-quiet { background: rgba(127, 29, 29, 0.18); border-color: rgba(248, 113, 113, 0.28); }
.lobby-home-panel { gap: 22px; }
.lobby-hero { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); align-items: stretch; }
.lobby-hero-copy { display: grid; gap: 12px; padding: 22px; border-radius: 22px; border: 1px solid rgba(34, 197, 94, 0.16); background: linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.78)); }
.lobby-identity-card { align-content: start; }
.metric-label { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.metric-detail { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.lobby-metric-card { min-height: 150px; align-content: start; }
.lobby-metric-value { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.lobby-home-grid { display: grid; gap: 18px; grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.3fr); align-items: start; }
.lobby-presence-card { min-height: 100%; }
.lobby-section-title-group { display: grid; gap: 6px; }
.lobby-identity-list { display: grid; gap: 10px; }
.lobby-identity-item { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.12); background: rgba(2, 6, 23, 0.3); }
.lobby-identity-item span { color: var(--muted); font-size: 0.92rem; }
.lobby-chat-shell { min-height: 100%; grid-template-rows: auto minmax(280px, 1fr) auto; }
.lobby-chat-feed { align-content: start; max-height: 360px; overflow: auto; padding-right: 4px; }
.lobby-chat-composer { grid-template-columns: 1fr auto; }
.system-footer-strip { display: grid; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(148, 163, 184, 0.14); color: var(--muted); background: rgba(2, 6, 23, 0.22); border-radius: 16px; }
.system-footer-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.system-footer-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; }
.system-footer-connection { font-size: 0.78rem; }
.system-footer-list { display: grid; gap: 6px; }
.system-footer-item, .system-footer-empty { margin: 0; font-size: 0.84rem; line-height: 1.4; }
.lobby-modal-card { width: min(100%, 520px); }
.modal-summary-card { background: rgba(15, 23, 42, 0.82); }
.join-code-input { letter-spacing: 0.18em; text-transform: uppercase; }
@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr; justify-items: stretch; }
  .topbar-status-strip { justify-content: flex-start; }
  .topbar-actions { justify-content: flex-start; }
  .lobby-hero, .lobby-home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .lobby-chat-composer { grid-template-columns: 1fr; }
  .topbar-button, .notification-button { min-width: 0; width: 100%; }
  .topbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
}


.topbar-status-pill-button {
  background: transparent;
  cursor: pointer;
}

.topbar-status-pill-button:hover,
.topbar-status-pill-button:focus-visible {
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-1px);
}

.lobby-home-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.system-footer-strip-compact {
  padding: 8px 14px;
}

.system-footer-line {
  margin: 0;
  font-size: 12px;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-users-modal-card {
  max-width: 720px;
}

.online-users-modal-list {
  max-height: 360px;
  overflow: auto;
}

.topbar-brand-with-avatar { display: flex; align-items: center; gap: 14px; }
.topbar-brand-copy { display: grid; gap: 4px; min-width: 0; }
.topbar-avatar { width: 52px; height: 52px; border-radius: 16px; object-fit: cover; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(15, 23, 42, 0.82); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.topbar-avatar-placeholder { display: grid; place-items: center; }
.nickname-panel { gap: 20px; }
.nickname-layout { display: grid; gap: 20px; grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.35fr); align-items: start; }
.nickname-form-column { display: grid; gap: 16px; }
.nickname-avatar-preview-card { display: grid; gap: 14px; padding: 18px; border-radius: 20px; border: 1px solid rgba(148, 163, 184, 0.16); background: rgba(15, 23, 42, 0.72); }
.nickname-avatar-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nickname-avatar-preview-image { width: 88px; height: 88px; border-radius: 22px; object-fit: cover; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(15, 23, 42, 0.82); }
.nickname-avatar-preview-copy { display: grid; gap: 8px; min-width: 0; }
.nickname-avatar-picker-shell { display: grid; gap: 16px; padding: 18px; border-radius: 22px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.72); }
.nickname-avatar-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); max-height: 560px; overflow: auto; padding-right: 6px; }
.nickname-avatar-option { display: grid; gap: 8px; justify-items: center; padding: 10px 8px; border-radius: 18px; border: 1px solid rgba(148, 163, 184, 0.14); background: rgba(2, 6, 23, 0.34); transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease; }
.nickname-avatar-option:hover, .nickname-avatar-option:focus-visible { transform: translateY(-1px); border-color: rgba(34, 197, 94, 0.36); background: rgba(15, 23, 42, 0.9); }
.nickname-avatar-option-active { border-color: rgba(34, 197, 94, 0.55); background: rgba(21, 128, 61, 0.16); box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.22), 0 10px 24px rgba(15, 23, 42, 0.25); }
.nickname-avatar-option-image { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: rgba(15, 23, 42, 0.82); }
.nickname-avatar-option-label { font-size: 0.78rem; color: var(--muted); }
@media (max-width: 980px) { .nickname-layout { grid-template-columns: 1fr; } .nickname-avatar-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } }
@media (max-width: 720px) { .topbar-brand-with-avatar { align-items: flex-start; } .nickname-avatar-preview-image { width: 72px; height: 72px; } }

.nickname-layout-single-column { grid-template-columns: minmax(320px, 760px); justify-content: center; }
.nickname-avatar-trigger { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.nickname-avatar-trigger:hover .nickname-avatar-preview-card,
.nickname-avatar-trigger:focus-visible .nickname-avatar-preview-card { border-color: rgba(34, 197, 94, 0.36); }
.nickname-avatar-preview-card { transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease; }
.nickname-avatar-trigger:hover .nickname-avatar-preview,
.nickname-avatar-trigger:focus-visible .nickname-avatar-preview { transform: translateY(-1px); }
.nickname-avatar-modal-card { width: min(100%, 880px); }
.nickname-avatar-grid { max-height: min(68vh, 620px); }

.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.topbar-brand { display: grid; gap: 4px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.topbar-status-button { white-space: nowrap; }
.topbar-profile-area { position: relative; display: flex; align-items: center; justify-content: flex-end; }
.topbar-avatar-button { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
.topbar-avatar-button:hover .topbar-avatar,
.topbar-avatar-button:focus-visible .topbar-avatar { border-color: rgba(34, 197, 94, 0.44); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14); }
.topbar-avatar { width: 48px; height: 48px; border-radius: 16px; object-fit: cover; border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(15, 23, 42, 0.82); transition: border-color 120ms ease, box-shadow 120ms ease; }
.topbar-avatar-indicator { position: absolute; right: 1px; top: 1px; width: 12px; height: 12px; border-radius: 999px; background: #ef4444; border: 2px solid rgba(15, 23, 42, 0.96); box-shadow: 0 0 10px rgba(239, 68, 68, 0.42); }
.topbar-avatar-indicator-online { background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, 0.52); }
.topbar-profile-popup { position: absolute; top: calc(100% + 10px); right: 0; width: min(260px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 14px; border-radius: 18px; border: 1px solid rgba(148, 163, 184, 0.18); background: rgba(15, 23, 42, 0.97); box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42); z-index: 30; }
.topbar-profile-popup::before { content: ''; position: absolute; top: -6px; right: 18px; width: 12px; height: 12px; transform: rotate(45deg); background: rgba(15, 23, 42, 0.97); border-left: 1px solid rgba(148, 163, 184, 0.18); border-top: 1px solid rgba(148, 163, 184, 0.18); }
.topbar-profile-popup-header { display: flex; align-items: center; gap: 12px; }
.topbar-profile-popup-avatar { width: 42px; height: 42px; border-radius: 14px; object-fit: cover; border: 1px solid rgba(148, 163, 184, 0.24); }
.topbar-profile-popup-copy { display: grid; gap: 4px; min-width: 0; }
.topbar-profile-popup-actions { display: grid; gap: 8px; }
@media (max-width: 960px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}


.notifications-drawer {
  position: fixed;
  top: 88px;
  right: 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(72vh, 760px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42);
  z-index: 35;
}

.notifications-list {
  display: grid;
  gap: 12px;
}

.notification-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.34);
}

.notification-card-unread {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(21, 128, 61, 0.10);
}

.notification-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.notification-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.invite-popup-card {
  width: min(100%, 520px);
}

.invite-popup-details {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.28);
}

@media (max-width: 960px) {
  .notifications-drawer {
    top: auto;
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 16px;
    max-height: 56vh;
  }
}

/* Batch 62 room lists and viewer HUD */
.room-lists-shell {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.room-lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.room-list-panel {
  min-height: 100%;
}

.room-card-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.room-card,
.room-list-empty {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1rem;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 0.75rem;
}

.room-card-main {
  display: grid;
  gap: 0.35rem;
}

.room-card-code {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

/* Batch 67 player leave rules and countdown overlay */
.game-shell {
  position: relative;
}

.game-shell-paused .arena-board,
.game-shell-paused .arena-empty {
  filter: saturate(0.72) brightness(0.82);
}

.arena-frame {
  position: relative;
  min-height: 220px;
}

.arena-empty-paused {
  display: grid;
  gap: 0.45rem;
  place-items: center;
  min-height: 260px;
  text-align: center;
}

.game-countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  border-radius: 1.5rem;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(4px);
}

.game-countdown-card {
  width: min(100%, 420px);
  display: grid;
  gap: 0.85rem;
  padding: 1.35rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.5rem;
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42);
  text-align: center;
}

.game-countdown-card .page-title {
  font-size: clamp(3rem, 10vw, 6rem);
  line-height: 1;
}
.confirmation-backdrop { z-index: 55; }
.confirmation-card { width: min(100%, 480px); }
.confirmation-message { line-height: 1.55; }
.confirmation-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

/* Game-over overlay */
.game-shell-over .arena-board { filter: saturate(0.5) brightness(0.6); }

.game-over-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: 1.5rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
}

.game-over-card {
  width: min(100%, 480px);
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 24px 56px rgba(2, 6, 23, 0.54);
  text-align: center;
}

.game-over-banner {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.game-over-banner-win {
  background: rgba(16, 44, 26, 0.75);
  border-color: rgba(74, 222, 128, 0.35);
}

.game-over-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
  margin: 0;
}

.game-over-winner-name {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0;
}

.game-over-winner-sub {
  font-size: 0.82rem;
  opacity: 0.65;
  margin: 0;
}

.game-over-players {
  display: grid;
  gap: 0.5rem;
  text-align: left;
}

.game-over-player-row {
  display: grid;
  grid-template-columns: 1.8rem 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(30, 41, 59, 0.45);
}

.game-over-player-row-winner {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(40, 35, 10, 0.55);
}

.game-over-player-row-local {
  border-color: rgba(148, 163, 184, 0.28);
}

.game-over-player-slot {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #020617;
}

.game-over-player-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.game-over-player-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-over-player-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.game-over-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
}

.game-over-tag-winner { background: rgba(250, 204, 21, 0.2); color: #fde047; }
.game-over-tag-you { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

.game-over-player-status {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.game-over-player-alive { color: #4ade80; }
.game-over-player-dead { color: #f87171; opacity: 0.7; }

.game-over-player-powerups {
  display: grid;
  gap: 0.1rem;
  font-size: 0.68rem;
  opacity: 0.55;
  text-align: right;
  white-space: nowrap;
}

.game-over-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

/* Batch 87 entity animation configuration */
.entity-animation-panel {
  gap: 18px;
}

.entity-animation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.entity-animation-editor {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.entity-animation-field-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ea-num-input {
  min-width: 0;
  text-align: center;
}

.ea-stepper {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: stretch;
  min-width: 0;
}

.ea-stepper .ea-num-input {
  border-radius: 0;
  padding-left: 4px;
  padding-right: 4px;
}

.ea-stepper-button {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.ea-stepper-button:first-child {
  border-radius: 14px 0 0 14px;
  border-right: 0;
}

.ea-stepper-button:last-child {
  border-radius: 0 14px 14px 0;
  border-left: 0;
}

.entity-animation-top-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.entity-animation-config-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.entity-animation-pair-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.entity-animation-pattern-field {
  min-width: 0;
}

.entity-animation-pattern-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.entity-animation-pattern-header .label {
  margin-bottom: 0;
}

.entity-animation-pattern-input {
  min-height: 94px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.entity-animation-preview-card {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.38);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.entity-animation-preview-stage {
  display: grid;
  place-items: center;
  width: min(100%, 240px);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  overflow: hidden;
  margin-bottom: -2px;
}

.entity-animation-preview-frame {
  width: min(220px, 92%, 100%);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  background-repeat: no-repeat;
  background-color: transparent;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.32));
}

.entity-animation-preview-actions {
  justify-content: center;
}

.entity-animation-toolbar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ea-loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.ea-loop-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.entity-animation-info-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.72);
  color: var(--muted);
  font-size: 0.84rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.entity-animation-info-box p {
  margin: 0;
}

@media (max-width: 980px) {
  .entity-animation-layout {
    grid-template-columns: 1fr;
  }

  .entity-animation-preview-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .entity-animation-top-config {
    grid-template-columns: 1fr;
  }
}
