*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

:root {
  --midnight: #01040d;
  --midnight-2: #040b18;
  --midnight-3: #071226;
  --midnight-4: #0d1d3c;
  --panel: rgba(7, 16, 32, 0.58);
  --panel-strong: rgba(8, 19, 40, 0.82);
  --glass: rgba(13, 24, 45, 0.46);
  --glass-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(82, 116, 170, 0.22);
  --line-blue: rgba(105, 138, 190, 0.18);
  --amber: #243d68;
  --amber-2: #172b50;
  --amber-3: #8fa8d7;
  --blue: #38598f;
  --cyan: #9ab8dc;
  --text: #ecf4ff;
  --text-soft: #aabbd3;
  --text-dim: #66758f;
  --good: #4dffb2;
  --bad: #ff4d68;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.62);
  --glow: 0 0 32px rgba(56, 89, 143, 0.24);
  --font-display: "Orbitron", "JetBrains Mono", monospace;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 8px;
  --nav-h: 72px;
}

html {
  scroll-behavior: smooth;
  background: var(--midnight);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 54% 22%, rgba(44, 54, 112, 0.22), transparent 25%),
    linear-gradient(135deg, rgba(36, 61, 104, 0.12), transparent 32%),
    linear-gradient(225deg, rgba(52, 72, 136, 0.08), transparent 38%),
    var(--midnight);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

input,
textarea,
[contenteditable="true"] {
  user-select: text;
}

.client-locked body::before {
  content: "DementiaDLC";
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: rgba(1, 4, 13, 0.92);
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(28px, 8vw, 72px);
  backdrop-filter: blur(28px);
}

body.modal-open {
  overflow: hidden;
}

button, input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 1px solid rgba(105, 138, 190, 0.42);
  outline-offset: 2px;
}

img, canvas {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #030a17;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--cyan), var(--blue));
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(62, 62, 135, 0.24), transparent 25%),
    linear-gradient(120deg, rgba(36, 61, 104, 0.16), transparent 40%),
    radial-gradient(circle at center, #061126 0%, #01040d 70%);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.gate.dissolve {
  opacity: 0;
  visibility: hidden;
}

.gate-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
}

.gate-panel {
  position: relative;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 34px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.07), transparent 34%),
    linear-gradient(150deg, rgba(9, 20, 45, 0.66), rgba(3, 8, 18, 0.76));
  border: 1px solid rgba(105, 138, 190, 0.28);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(26px) saturate(1.15);
  overflow: hidden;
}

.gate-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 32%, rgba(185, 211, 255, 0.16) 48%, transparent 64%),
    radial-gradient(circle at 22% 14%, rgba(255, 255, 255, 0.12), transparent 28%);
  opacity: 0.42;
  pointer-events: none;
}

.gate-mark {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 24px rgba(84, 118, 181, 0.36));
  animation: markFloat 4.8s ease-in-out infinite;
}

.gate-mark::before,
.gate-mark::after,
.gate-mark-core {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(143, 168, 215, 0.42);
  background:
    linear-gradient(135deg, rgba(210, 226, 255, 0.18), rgba(82, 116, 170, 0.22) 48%, rgba(28, 48, 86, 0.36)),
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.42), transparent 18%);
  box-shadow: inset 0 0 28px rgba(185, 211, 255, 0.15), 0 0 34px rgba(56, 89, 143, 0.28);
  clip-path: polygon(18% 0, 68% 0, 94% 22%, 98% 68%, 72% 100%, 14% 100%, 40% 76%, 58% 76%, 72% 58%, 69% 34%, 56% 23%, 32% 23%, 32% 66%, 14% 84%, 14% 14%);
}

.gate-mark::before {
  transform: translate(7px, -4px);
  opacity: 0.62;
}

.gate-mark::after {
  inset: 20px;
  opacity: 0.42;
  filter: blur(0.2px);
}

.gate-mark-core {
  inset: 0;
}

@keyframes markFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

.gate h1,
.section-head h2,
.hero-copy h2,
.modal-box h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.gate h1 {
  font-size: 30px;
  line-height: 1.1;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--amber-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.gate-status,
.micro {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.micro {
  color: var(--text-dim);
}

.gate-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.gate-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #5f7fb8, #243d68);
  box-shadow: 0 0 16px rgba(84, 118, 181, 0.34);
  transition: width 0.2s ease;
}

.app {
  min-height: 100vh;
  position: relative;
  padding-top: var(--nav-h);
}

.bg-canvas,
.scene-glass {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-canvas {
  z-index: 0;
  opacity: 0.62;
}

.scene-glass {
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, transparent, black 14%, black 86%, transparent);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  background: rgba(1, 5, 13, 0.78);
  border-bottom: 1px solid rgba(105, 138, 190, 0.16);
  backdrop-filter: blur(24px) saturate(1.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-prism {
  width: 34px;
  height: 34px;
  background:
    linear-gradient(135deg, rgba(210, 226, 255, 0.26), rgba(82, 116, 170, 0.34) 46%, rgba(23, 43, 80, 0.62)),
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.7), transparent 16%);
  clip-path: polygon(18% 0, 68% 0, 94% 22%, 98% 68%, 72% 100%, 14% 100%, 40% 76%, 58% 76%, 72% 58%, 69% 34%, 56% 23%, 32% 23%, 32% 66%, 14% 84%, 14% 14%);
  border: 1px solid rgba(143, 168, 215, 0.46);
  box-shadow: 0 0 22px rgba(56, 89, 143, 0.42), inset 0 0 18px rgba(185, 211, 255, 0.16);
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
}

.brand-version,
.mono {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 12px;
}

.nav-menu {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(36, 61, 104, 0.3);
  box-shadow: inset 0 0 0 1px rgba(105, 138, 190, 0.22);
}

.nav-actions,
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(36, 61, 104, 0.26);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 5px auto;
  background: var(--amber);
}

.btn-primary,
.btn-ghost,
.btn-danger,
.btn-amber,
.icon-btn,
.tab-btn,
.link-btn,
.user-chip {
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 40px;
  padding: 10px 15px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background:
    radial-gradient(circle at 22% 0%, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(135deg, rgba(72, 105, 160, 0.92), rgba(23, 43, 80, 0.96));
  color: #eef5ff;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 36px rgba(0, 0, 0, 0.3), 0 0 18px rgba(56, 89, 143, 0.2);
  backdrop-filter: blur(24px) saturate(1.2);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 12px 36px rgba(0, 0, 0, 0.32), 0 0 22px rgba(84, 118, 181, 0.28);
}

.btn-ghost,
.tab-btn,
.icon-btn,
.user-chip {
  background: rgba(8, 17, 33, 0.5);
  border-color: rgba(133, 167, 199, 0.12);
  color: var(--text);
  backdrop-filter: blur(18px);
}

.btn-ghost:hover,
.tab-btn:hover,
.icon-btn:hover,
.user-chip:hover {
  border-color: rgba(105, 138, 190, 0.3);
  background: rgba(36, 61, 104, 0.24);
}

.btn-danger {
  background: rgba(255, 77, 104, 0.12);
  border-color: rgba(255, 77, 104, 0.42);
  color: #ff9aad;
  font-weight: 800;
}

.btn-danger:hover {
  background: rgba(255, 77, 104, 0.2);
}

.btn-amber {
  background: rgba(36, 61, 104, 0.28);
  border-color: rgba(105, 138, 190, 0.26);
  color: var(--amber-3);
  font-weight: 900;
}

.btn-wide {
  width: 100%;
}

.btn-xl {
  min-height: 48px;
  padding-inline: 20px;
}

.link-btn {
  background: transparent;
  border: 0;
  color: var(--amber-3);
  min-height: 28px;
  padding: 0;
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  font-weight: 900;
}

.user-chip {
  padding: 6px 10px 6px 7px;
  font-weight: 800;
}

.user-chip img,
.nav-user img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(105, 138, 190, 0.38);
}

main {
  position: relative;
  z-index: 1;
}

.section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-h));
  padding: 54px 0 64px;
}

.hero-layout {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  align-items: center;
  gap: 42px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-copy h2 {
  font-size: 68px;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 30px rgba(86, 106, 168, 0.18), 0 0 42px rgba(105, 138, 190, 0.12);
}

.hero-sub {
  max-width: 660px;
  color: var(--text-soft);
  font-size: 18px;
}

.hero-actions,
.split-actions,
.tabs-row,
.search-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 640px;
  padding: 8px 0;
  border-top: 1px solid rgba(105, 138, 190, 0.14);
  border-bottom: 1px solid rgba(105, 138, 190, 0.1);
  background: linear-gradient(90deg, rgba(13, 24, 45, 0.18), rgba(13, 24, 45, 0.04), rgba(13, 24, 45, 0.18));
  backdrop-filter: blur(18px);
  mask-image: linear-gradient(90deg, transparent, black 7%, black 93%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 7%, black 93%, transparent);
}

.hero-stats div,
.download-stats div,
.dash-stats div,
.profile-stats div,
.info-panel,
.download-card,
.stack-panel,
.control-card,
.leaderboard-card,
.arena-card,
.profile-card,
.dash-content,
.community-card,
.chat-sidebar,
.chat-main {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.12), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), transparent 32%),
    linear-gradient(150deg, rgba(8, 18, 38, 0.46), rgba(3, 8, 19, 0.58));
  border: 1px solid var(--line-blue);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(28px) saturate(1.18);
  position: relative;
  overflow: hidden;
}

.download-card::before,
.stack-panel::before,
.control-card::before,
.leaderboard-card::before,
.arena-card::before,
.profile-card::before,
.dash-content::before,
.community-card::before,
.chat-sidebar::before,
.chat-main::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.13), transparent 28%),
    radial-gradient(circle at 15% 0%, rgba(185, 211, 255, 0.11), transparent 30%);
  opacity: 0.72;
  pointer-events: none;
}

.download-card > *,
.stack-panel > *,
.control-card > *,
.leaderboard-card > *,
.arena-card > *,
.profile-card > *,
.dash-content > *,
.community-card > *,
.chat-sidebar > *,
.chat-main > * {
  position: relative;
  z-index: 1;
}

.hero-stats div {
  flex: 1;
  padding: 8px 22px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-stats div + div {
  border-left: 1px solid rgba(105, 138, 190, 0.14);
}

.hero-stats strong,
.download-stats strong,
.dash-stats strong,
.profile-stats strong {
  display: block;
  font-family: var(--font-display);
  color: #a9bee4;
  font-size: 24px;
}

.hero-stats span,
.download-stats span,
.dash-stats span,
.profile-stats span {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.dlc-stage {
  min-height: 480px;
  display: grid;
  place-items: center;
  perspective: 900px;
  overflow: hidden;
}

.dlc-orbit {
  position: relative;
  width: 390px;
  height: 390px;
  transform-style: preserve-3d;
  animation: floatStage 5.5s ease-in-out infinite;
}

.dlc-orbit::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(111, 141, 255, 0.22);
  border-radius: 50%;
  transform: rotateX(70deg);
  box-shadow: 0 0 48px rgba(111, 141, 255, 0.2);
}

.dlc-emblem {
  position: absolute;
  inset: 56px;
  filter: drop-shadow(0 0 24px rgba(56, 89, 143, 0.28));
  animation: emblemDrift 6s ease-in-out infinite;
}

.dlc-emblem span {
  position: absolute;
  inset: 0;
  clip-path: polygon(17% 0, 68% 0, 94% 22%, 98% 68%, 72% 100%, 12% 100%, 39% 75%, 58% 75%, 72% 58%, 69% 34%, 56% 22%, 32% 22%, 32% 66%, 13% 84%, 13% 14%);
  background:
    linear-gradient(135deg, rgba(210, 226, 255, 0.16), rgba(92, 112, 172, 0.2) 44%, rgba(23, 43, 80, 0.34)),
    radial-gradient(circle at 20% 14%, rgba(255, 255, 255, 0.34), transparent 15%);
  border: 1px solid rgba(143, 168, 215, 0.3);
  box-shadow: inset 0 0 46px rgba(133, 167, 199, 0.12), 0 0 36px rgba(56, 89, 143, 0.18);
}

.dlc-emblem span:nth-child(1) {
  transform: translate(0, 0);
}

.dlc-emblem span:nth-child(2) {
  transform: translate(14px, -10px) scale(0.98);
  opacity: 0.48;
}

.dlc-emblem span:nth-child(3) {
  transform: translate(-12px, 12px) scale(0.94);
  opacity: 0.32;
}

.dlc-emblem span:nth-child(4) {
  transform: translate(34px, 26px) scale(0.34);
  opacity: 0.7;
}

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

@keyframes floatStage {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

.dlc-chip {
  position: absolute;
  min-width: 74px;
  padding: 8px 12px;
  background: rgba(4, 10, 22, 0.58);
  border: 1px solid rgba(105, 138, 190, 0.22);
  border-radius: var(--radius);
  color: var(--amber-3);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  box-shadow: 0 0 20px rgba(56, 89, 143, 0.12);
  backdrop-filter: blur(16px);
}

.chip-a { top: 46px; left: 40px; }
.chip-b { right: 18px; top: 140px; }
.chip-c { left: 64px; bottom: 54px; }
.chip-d { right: 82px; bottom: 24px; }

.home-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 900px;
  margin-top: 8px;
  border-top: 1px solid rgba(105, 138, 190, 0.14);
  border-bottom: 1px solid rgba(105, 138, 190, 0.1);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 24%),
    rgba(8, 18, 38, 0.2);
  backdrop-filter: blur(24px) saturate(1.14);
  mask-image: linear-gradient(90deg, transparent, black 7%, black 93%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 7%, black 93%, transparent);
}

.info-panel {
  position: relative;
  padding: 20px 0 20px 26px;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.info-panel + .info-panel {
  border-top: 1px solid rgba(105, 138, 190, 0.1);
}

.info-panel::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(143, 168, 215, 0.62);
  box-shadow: 0 0 18px rgba(84, 118, 181, 0.4);
}

.panel-index {
  display: none;
}

.info-panel h3,
.download-card h3,
.control-card h3,
.leaderboard-card h3,
.modal-box h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.info-panel p,
.download-card p,
.section-head p,
.control-card p,
.game-cover p {
  color: var(--text-soft);
}

.section-head {
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: 42px;
  margin-top: 6px;
}

.inline-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.small-head {
  align-items: center;
}

.download-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.download-card {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-color: rgba(105, 138, 190, 0.18);
}

.download-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: var(--radius);
  background: rgba(105, 138, 190, 0.12);
  border: 1px solid rgba(105, 138, 190, 0.22);
  color: var(--amber-3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.download-card h3 {
  font-family: var(--font-display);
  font-size: 28px;
}

.download-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.download-stats div {
  padding: 16px;
}

.stack-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-row {
  width: 100%;
  min-height: 70px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(141, 232, 255, 0.12);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}

.stack-row:hover {
  border-color: rgba(105, 138, 190, 0.22);
}

.stack-row span {
  font-weight: 800;
}

.stack-row b {
  color: var(--amber-3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.search-line input,
.form-stack input,
.control-card input,
.control-card select,
.chat-form input {
  min-height: 44px;
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid rgba(141, 232, 255, 0.18);
  background: rgba(1, 8, 20, 0.72);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-line input:focus,
.form-stack input:focus,
.control-card input:focus,
.control-card select:focus,
.chat-form input:focus {
  border-color: rgba(105, 138, 190, 0.34);
  box-shadow: 0 0 0 3px rgba(105, 138, 190, 0.06);
}

.search-line {
  min-width: min(440px, 100%);
}

.tabs-row {
  margin-bottom: 18px;
}

.tabs-row.compact {
  margin-bottom: 0;
}

.tab-btn.active {
  background: rgba(105, 138, 190, 0.12);
  border-color: rgba(105, 138, 190, 0.24);
  color: var(--amber-3);
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.community-card {
  padding: 16px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.community-card img,
.profile-view img,
.profile-card img {
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(105, 138, 190, 0.34);
  box-shadow: 0 0 16px rgba(105, 138, 190, 0.12);
}

.community-card img {
  width: 52px;
  height: 52px;
}

.community-info {
  min-width: 0;
}

.community-info h3 {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-info p {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.community-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.community-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.chat-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 150px);
  min-height: 620px;
  min-width: 0;
}

.chat-sidebar,
.chat-main {
  overflow: hidden;
  min-width: 0;
}

.chat-sidebar {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-side-head,
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.conv-item,
.dm-item {
  width: 100%;
  min-height: 62px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(141, 232, 255, 0.12);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  min-width: 0;
}

.conv-item span,
.dm-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item.active,
.dm-item.active {
  border-color: rgba(105, 138, 190, 0.24);
  background: rgba(105, 138, 190, 0.08);
}

.conv-item span,
.dm-item span {
  font-weight: 800;
}

.conv-item small,
.dm-item small {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
}

.dm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  padding: 18px;
  gap: 12px;
}

.chat-head h2 {
  font-size: 24px;
}

.chat-messages {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
  min-width: 0;
}

.chat-empty,
.list-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed rgba(141, 232, 255, 0.18);
  border-radius: var(--radius);
}

.message {
  max-width: min(620px, 92%);
  min-width: min(240px, 100%);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-self: flex-start;
  min-inline-size: 0;
}

.message.mine {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 36px;
}

.message img.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(105, 138, 190, 0.22);
  object-fit: cover;
}

.message.mine img.avatar {
  order: 2;
}

.message-bubble {
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(12, 30, 60, 0.82);
  border: 1px solid rgba(141, 232, 255, 0.13);
}

.message.mine .message-bubble {
  background: rgba(105, 138, 190, 0.1);
  border-color: rgba(105, 138, 190, 0.18);
}

.message-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--amber-3);
  font-size: 12px;
  font-family: var(--font-mono);
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.45;
}

.message-photo {
  width: min(420px, 100%);
  min-width: min(220px, 100%);
  max-height: 360px;
  border-radius: var(--radius);
  margin-top: 8px;
  border: 1px solid rgba(105, 138, 190, 0.13);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.24);
}

.message-actions {
  margin-left: auto;
}

.message-actions button {
  border: 0;
  background: transparent;
  color: var(--bad);
  cursor: pointer;
}

.chat-note {
  padding: 12px;
  background: rgba(105, 138, 190, 0.08);
  border: 1px solid rgba(105, 138, 190, 0.14);
  border-radius: var(--radius);
  color: var(--amber-3);
}

.photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(141, 232, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.photo-preview img {
  width: 72px;
  height: 52px;
  border-radius: var(--radius);
  object-fit: cover;
}

.chat-form {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.arena-card,
.leaderboard-card {
  padding: 16px;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.game-hud span {
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(141, 232, 255, 0.12);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.game-hud b {
  display: block;
  color: var(--amber-3);
  font-size: 18px;
}

.click-arena,
.snake-wrap {
  position: relative;
  min-height: 480px;
  border-radius: var(--radius);
  border: 1px solid rgba(105, 138, 190, 0.13);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(141, 232, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(141, 232, 255, 0.035) 1px, transparent 1px),
    rgba(1, 8, 20, 0.72);
  background-size: 36px 36px;
}

.game-cover {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 22px;
  background: rgba(2, 8, 23, 0.74);
  text-align: center;
}

.game-cover h3 {
  font-family: var(--font-display);
  font-size: 28px;
}

.game-cover strong {
  color: var(--amber-3);
  font-family: var(--font-display);
  font-size: 42px;
}

.target-dot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #9fb5db, #38598f 46%, rgba(36, 61, 104, 0.12) 72%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 22px rgba(56, 89, 143, 0.26);
  transform: scale(0.3);
  opacity: 0;
  cursor: crosshair;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.target-dot.active {
  transform: scale(1);
  opacity: 1;
}

.target-dot.dying {
  transform: scale(1.45);
  opacity: 0;
}

.hit-particle {
  position: absolute;
  z-index: 3;
  color: var(--amber-3);
  font-family: var(--font-display);
  pointer-events: none;
  animation: hitLift 0.65s ease forwards;
}

@keyframes hitLift {
  to {
    transform: translateY(-36px);
    opacity: 0;
  }
}

.miss-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 77, 104, 0.18);
  pointer-events: none;
  animation: flashOut 0.32s ease forwards;
}

@keyframes flashOut {
  to {
    opacity: 0;
  }
}

.snake-canvas {
  width: 100%;
  height: auto;
  max-width: 480px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.snake-wrap {
  display: grid;
  place-items: center;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.dpad #dpadUp {
  grid-column: 2;
}

.dpad #dpadLeft {
  grid-column: 1;
}

.dpad #dpadDown {
  grid-column: 2;
}

.dpad #dpadRight {
  grid-column: 3;
  grid-row: 2;
}

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(141, 232, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.lb-row b {
  color: var(--amber-3);
}

.lb-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(14px);
}

.modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: min(820px, calc(100vh - 38px));
  overflow: auto;
  padding: 28px;
  background: linear-gradient(150deg, rgba(10, 27, 55, 0.96), rgba(4, 11, 26, 0.98));
  border: 1px solid rgba(105, 138, 190, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 34px rgba(36, 61, 104, 0.1);
}

.modal-box.wide {
  width: min(1000px, 100%);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tab {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid rgba(141, 232, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  cursor: pointer;
}

.auth-tab.active {
  background: rgba(105, 138, 190, 0.1);
  border-color: rgba(105, 138, 190, 0.24);
  color: var(--amber-3);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-soft);
  font-weight: 700;
}

.form-error {
  color: #ff9aad;
}

.form-note {
  color: var(--text-soft);
  min-height: 20px;
}

.dash-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
}

.profile-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.profile-card img {
  width: 130px;
  height: 130px;
}

.dash-content {
  padding: 18px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.dash-stats div,
.profile-stats div {
  padding: 14px;
  min-width: 0;
}

.dash-stats strong,
.profile-stats strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.dash-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dash-forms > * {
  padding: 14px;
  border: 1px solid rgba(141, 232, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.danger-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-badge,
.rank-admin,
.rank-senior,
.rank-moder {
  display: inline-flex;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: rgba(141, 232, 255, 0.08);
  border: 1px solid rgba(141, 232, 255, 0.18);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 12px;
}

.rank-admin {
  color: var(--amber-3);
  border-color: rgba(105, 138, 190, 0.24);
  background: rgba(105, 138, 190, 0.1);
}

.rank-moder {
  color: var(--good);
  border-color: rgba(77, 255, 178, 0.34);
  background: rgba(77, 255, 178, 0.1);
}

.rank-senior {
  color: var(--cyan);
  border-color: rgba(141, 232, 255, 0.36);
  background: rgba(141, 232, 255, 0.1);
}

.profile-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.profile-view img {
  width: 120px;
  height: 120px;
}

.profile-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.control-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  border-top: 1px solid rgba(141, 232, 255, 0.12);
}

.footer span {
  font-family: var(--font-display);
  color: var(--amber-3);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3000;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: var(--radius);
  background: rgba(10, 27, 55, 0.96);
  border: 1px solid rgba(105, 138, 190, 0.2);
  color: var(--text);
  box-shadow: var(--shadow);
}

.toast.success {
  border-color: rgba(77, 255, 178, 0.4);
}

.toast.error {
  border-color: rgba(255, 77, 104, 0.45);
}

.call-layer {
  position: fixed;
  inset: 0;
  z-index: 2500;
  pointer-events: none;
}

.vc-window,
.gvc-window,
.incoming-call {
  pointer-events: auto;
  position: fixed;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.085), transparent 34%),
    linear-gradient(150deg, rgba(9, 19, 39, 0.72), rgba(2, 6, 14, 0.82));
  border: 1px solid rgba(105, 138, 190, 0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 28px rgba(36, 61, 104, 0.12);
  backdrop-filter: blur(24px) saturate(1.12);
  overflow: hidden;
}

.vc-window {
  right: 18px;
  bottom: 18px;
  width: min(560px, calc(100vw - 36px));
}

.vc-head,
.gvc-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(133, 167, 199, 0.11);
}

.vc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}

.vc-video {
  min-height: 190px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 20%, rgba(133, 167, 199, 0.12), transparent 36%),
    rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(133, 167, 199, 0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.vc-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vc-controls,
.gvc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(133, 167, 199, 0.11);
}

.incoming-call {
  right: 18px;
  top: 88px;
  width: min(360px, calc(100vw - 36px));
  padding: 14px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.incoming-call img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.incoming-call-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.gvc-window {
  inset: 74px 18px 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.gvc-grid {
  padding: 12px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.gvc-tile {
  min-height: 160px;
  border-radius: var(--radius);
  border: 1px solid rgba(141, 232, 255, 0.13);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
}

.gvc-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gvc-name {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.55);
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto auto 1fr;
  }

  .nav-toggle {
    display: inline-block;
    justify-self: end;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-h);
    left: 12px;
    right: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    background: rgba(2, 8, 23, 0.96);
    border: 1px solid rgba(105, 138, 190, 0.15);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-actions,
  .nav-user {
    justify-self: end;
  }

  .hero-layout,
  .download-shell,
  .chat-shell,
  .game-grid,
  .dash-layout {
    grid-template-columns: 1fr;
  }

  .hero-layout {
    min-height: 0;
  }

  .hero-copy h2 {
    font-size: 48px;
  }

  .dlc-stage {
    min-height: 360px;
  }

  .home-panels,
  .community-grid,
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chat-shell {
    height: auto;
  }

  .chat-main {
    min-height: 620px;
  }
}

@media (max-width: 680px) {
  :root {
    --nav-h: 64px;
  }

  body {
    font-size: 14px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-version,
  .brand-text {
    display: none;
  }

  .section {
    width: min(100% - 22px, 1180px);
    padding: 32px 0 48px;
  }

  .hero-copy h2 {
    font-size: 38px;
  }

  .hero-sub {
    font-size: 15px;
  }

  .hero-stats,
  .download-stats,
  .home-panels,
  .community-grid,
  .admin-grid,
  .dash-stats,
  .dash-forms,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .dlc-orbit {
    width: 300px;
    height: 300px;
  }

  .dlc-emblem {
    inset: 58px;
  }

  .dlc-chip {
    display: none;
  }

  .inline-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head h2 {
    font-size: 32px;
  }

  .download-card h3 {
    font-size: 22px;
  }

  .chat-form {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .chat-form .btn-primary {
    grid-column: 1 / -1;
  }

  .game-hud {
    grid-template-columns: 1fr 1fr;
  }

  .click-arena,
  .snake-wrap {
    min-height: 360px;
  }

  .modal {
    padding: 10px;
  }

  .modal-box {
    padding: 24px 16px;
  }

  .nav-user {
    gap: 6px;
  }

  .nav-user .btn-danger,
  #adminBtn {
    min-height: 34px;
    padding: 7px 9px;
  }

  .user-chip span {
    display: none;
  }

  .footer {
    flex-direction: column;
    gap: 8px;
  }

  .hero-stats {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stats div + div {
    border-left: 0;
    border-top: 1px solid rgba(105, 138, 190, 0.14);
  }

  .message {
    max-width: 100%;
    min-width: 0;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .message.mine {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .message img.avatar {
    width: 30px;
    height: 30px;
  }

  .message-photo {
    min-width: 0;
    width: 100%;
  }
}
