/* ==========================================================================
   IRANGAMER — Design tokens
   ========================================================================== */
:root {
  --bg: #08080c;
  --bg-alt: #0e0f16;
  --surface: #14151f;
  --surface-2: #1b1c29;
  --line: #262838;
  --text: #eceef5;
  --muted: #8b8da3;
  --red: #ff2a4d;
  --red-glow: #ff2a4dcc;
  --blue: #00d4ff;
  --blue-glow: #00d4ffcc;
  --turquoise: #1de9b6;
  --turquoise-glow: #1de9b6cc;
  --gold: #ffd166;

  --font-display: 'Orbitron', 'Vazirmatn', sans-serif;
  --font-body: 'Vazirmatn', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-tag: 'Rajdhani', 'Vazirmatn', sans-serif;

  --radius: 10px;
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* Ambient texture layers */
.scanline {
  position: fixed; inset: 0; pointer-events: none; z-index: 500;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
}
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 499; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.accent { color: var(--red); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed; top: 0; inset-inline: 0; z-index: 100;
  background: rgba(8,8,12,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--container); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.brand-logo {
  height: 38px; width: auto; object-fit: contain;
}
.brand-name { font-weight: 700; letter-spacing: 1px; font-size: 15px; }

.main-nav { display: flex; gap: 30px; }
.main-nav a {
  font-size: 14.5px; color: var(--muted); position: relative; padding: 4px 0;
  transition: color .2s ease;
}
.main-nav a::after {
  content: ""; position: absolute; bottom: 0; inset-inline: 0; height: 1px;
  background: var(--red); transform: scaleX(0); transition: transform .25s ease;
  box-shadow: 0 0 6px var(--red-glow);
}
.main-nav a:hover { color: var(--text); }
.main-nav a:hover::after { transform: scaleX(1); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 120px 24px 60px;
  background: var(--bg);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 140% 100% at 50% 20%, rgba(255,42,77,0.13), transparent 85%),
    radial-gradient(ellipse 120% 90% at 80% 85%, rgba(0,212,255,0.08), transparent 85%);
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(180deg, black 0%, black 75%, transparent 100%);
  mask-image:
    linear-gradient(90deg, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(180deg, black 0%, black 75%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,42,77,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,42,77,0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(180deg, black 0%, black 75%, transparent 100%);
  mask-image:
    linear-gradient(90deg, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(180deg, black 0%, black 75%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  animation: gridDrift 18s linear infinite;
}
@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 44px 44px, 44px 44px; }
}
.hero-particles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hero-content { position: relative; z-index: 2; max-width: 760px; }
.hero-eyebrow {
  font-family: var(--font-tag); font-weight: 700; letter-spacing: 5px; color: var(--blue);
  font-size: 17px; margin: 0 0 18px; text-transform: uppercase;
}
.hero-title {
  font-family: 'Black Ops One', var(--font-display); font-weight: 400; font-size: clamp(3rem, 10vw, 6.5rem);
  margin: 0; letter-spacing: 2px; color: #fff; position: relative; direction: ltr;
  text-shadow: 0 0 16px var(--red-glow), 0 0 32px var(--turquoise-glow), 0 0 50px var(--blue-glow);
  will-change: transform, opacity;
  transition: transform .05s linear;
}
.hero-title .ht-letters {
  display: inline-block;
}
.hero-title.ht-armed .ht-letters span {
  display: inline-block;
  animation: letterPop .6s cubic-bezier(.2,.8,.2,1) both;
}
.hero-title::before, .hero-title::after {
  content: attr(data-text); position: absolute; inset: 0; opacity: 0.7;
}
.hero-title::before { color: var(--blue); transform: translate(3px, 0); mix-blend-mode: screen; animation: glitchA 5s infinite; }
.hero-title::after { color: var(--red); transform: translate(-3px, 0); mix-blend-mode: screen; animation: glitchB 6s infinite; }
@keyframes glitchA {
  0%, 92%, 100% { transform: translate(3px,0); opacity: 0.7; }
  93% { transform: translate(-4px,2px); opacity: 0.9; }
  95% { transform: translate(2px,-2px); opacity: 0.4; }
}
@keyframes glitchB {
  0%, 90%, 100% { transform: translate(-3px,0); opacity: 0.7; }
  91% { transform: translate(4px,-2px); opacity: 0.9; }
  94% { transform: translate(-2px,2px); opacity: 0.4; }
}
@keyframes letterPop {
  0% { transform: translateY(40px) scale(.6) rotateX(60deg); opacity: 0; filter: blur(6px); }
  60% { filter: blur(0); }
  100% { transform: translateY(0) scale(1) rotateX(0); opacity: 1; }
}

.hero-sub { color: var(--muted); font-size: 18px; margin: 22px 0 40px; }

.hero-stats {
  display: flex; align-items: center; justify-content: center; gap: 28px;
  margin-bottom: 44px; flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--blue); text-shadow: 0 0 10px var(--blue-glow); direction: ltr; unicode-bidi: isolate; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-divider { width: 1px; height: 34px; background: var(--line); }

.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 30px; font-family: var(--font-body); font-weight: 700; font-size: 15px;
  border-radius: 6px; cursor: pointer; border: 1px solid transparent; transition: all .2s ease;
}
.btn-primary {
  background: var(--red); color: #fff;
  box-shadow: 0 0 0 1px rgba(255,42,77,0.4), 0 8px 24px -6px var(--red-glow);
}
.btn-primary:hover { background: #ff425f; transform: translateY(-2px); box-shadow: 0 0 0 1px var(--red), 0 12px 30px -6px var(--red-glow); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 16px -4px var(--blue-glow); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.hero-scroll {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%, 0);} 50% { transform: translate(-50%, 6px);} }

/* ==========================================================================
   Sections generic
   ========================================================================== */
section { padding: 110px 24px; max-width: var(--container); margin: 0 auto; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 56px; }
.section-tag {
  font-family: var(--font-tag); color: var(--red); font-size: 17px; font-weight: 700; letter-spacing: 3px;
  display: inline-block; margin-bottom: 14px;
}
.section-head h2 { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0; color: #fff; }
.section-desc { color: var(--muted); margin-top: 14px; }

/* ==========================================================================
   About
   ========================================================================== */
.about-grid { display: grid; grid-template-columns: 1.3fr 0.9fr; gap: 60px; align-items: center; }
.about-text p { color: #c7c9db; }
.placeholder-note { font-size: 13px; color: var(--gold); border: 1px dashed rgba(255,209,102,0.4); padding: 10px 14px; border-radius: 6px; background: rgba(255,209,102,0.05); }

.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 34px; }
.value-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 18px; transition: border-color .2s ease, transform .2s ease;
}
.value-card:hover { border-color: var(--red); transform: translateY(-4px); }
.value-icon { color: var(--red); font-size: 14px; }
.value-card h3 { font-size: 15.5px; margin: 10px 0 6px; color: #fff; }
.value-card p { font-size: 13.5px; color: var(--muted); margin: 0; }

.about-visual { display: flex; justify-content: center; }
.logo-frame {
  width: 220px; height: 220px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  background: radial-gradient(circle, rgba(255,42,77,0.12), transparent 70%);
}
.logo-particles-canvas {
  position: absolute; top: 50%; left: 50%; width: min(500px, 85vw); height: min(500px, 85vw);
  transform: translate(-50%, -50%); pointer-events: none; z-index: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-img {
  width: 124%; height: 124%; object-fit: contain; position: relative; z-index: 1;
  animation: spin 14s linear infinite;
}

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline { position: relative; max-width: 760px; margin: 0 auto; padding-inline-start: 30px; border-inline-start: 1px solid var(--line); }
.timeline-item { position: relative; padding-bottom: 48px; padding-inline-start: 34px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; inset-inline-start: -37px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 4px rgba(255,42,77,0.15), 0 0 14px var(--red-glow);
}
.timeline-date { font-family: var(--font-mono); color: var(--blue); font-size: 13px; letter-spacing: 1px; }
.timeline-content h3 { margin: 6px 0 8px; color: #fff; font-size: 18px; }
.timeline-content p { color: var(--muted); margin: 0; font-size: 14.5px; }

/* ==========================================================================
   Gallery
   ========================================================================== */
.gallery-grid {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 1fr);
  grid-auto-columns: 220px; gap: 14px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  direction: ltr; /* برای رفتار یکسان scrollLeft در همه مرورگرها؛ متن داخل آیتم‌ها جداگانه RTL نگه داشته می‌شود */
}
.gallery-grid::-webkit-scrollbar { height: 8px; }
.gallery-grid::-webkit-scrollbar-track { background: transparent; }
.gallery-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
.gallery-grid::-webkit-scrollbar-thumb:hover { background: var(--blue); }
.gallery-item {
  aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; position: relative;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; direction: rtl;
}
.gallery-item::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .25s ease;
  box-shadow: inset 0 0 0 1px var(--red), 0 0 24px -4px var(--red-glow);
}
.gallery-item:hover::after { opacity: 1; }
.gallery-item span { font-family: var(--font-mono); color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item { cursor: pointer; }
.gallery-item .gallery-caption-tip {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 2;
  background: linear-gradient(0deg, rgba(8,8,12,0.92) 10%, transparent 100%);
  color: var(--red); font-family: var(--font-tag); font-weight: 700;
  font-size: 17px; letter-spacing: 3px; padding: 30px 12px 12px;
  -webkit-text-stroke: 0.6px #08080c;
  text-shadow: 0 0 6px #000, 0 0 12px rgba(0,0,0,0.8), 0 1px 2px #000;
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.gallery-item:hover .gallery-caption-tip { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Gallery lightbox
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 600; display: none;
  align-items: center; justify-content: center; padding: 60px 20px;
  background: rgba(8,8,12,0.92); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .25s ease;
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox-inner {
  position: relative; max-width: 920px; width: 100%; max-height: 85vh;
  text-align: center; transform: scale(0.96); transition: transform .25s ease;
}
.lightbox.open .lightbox-inner { transform: scale(1); }
.lightbox-inner img {
  max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: 0 0 50px -6px var(--red-glow);
}
.lightbox-caption { color: var(--muted); margin: 16px 0 0; font-size: 14px; }
.lightbox-close {
  position: absolute; top: -46px; inset-inline-end: 0; width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(20,21,31,0.8);
  color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color .2s ease, color .2s ease;
}
.lightbox-close:hover { border-color: var(--red); color: var(--red); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 601;
  width: 52px; height: 52px;
  background: linear-gradient(160deg, var(--surface), var(--bg-alt));
  border: 1px solid var(--line);
  clip-path: polygon(18% 0, 100% 0, 100% 82%, 82% 100%, 0 100%, 0 18%);
  color: var(--blue); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(0,212,255,0.15), 0 0 18px -8px var(--blue-glow);
  transition: border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.lightbox-nav svg { width: 22px; height: 22px; }
.lightbox-nav:hover {
  border-color: var(--red); color: var(--red);
  box-shadow: 0 0 0 1px rgba(255,42,77,0.2), 0 0 24px -4px var(--red-glow);
  transform: translateY(-50%) scale(1.06);
}
.lightbox-nav:active { transform: translateY(-50%) scale(0.94); }
.lightbox-prev { inset-inline-start: -74px; }
.lightbox-next { inset-inline-end: -74px; }

@media (max-width: 1200px) {
  .lightbox-prev { inset-inline-start: -50px; }
  .lightbox-next { inset-inline-end: -50px; }
}

@media (max-width: 860px) {
  .lightbox-nav { width: 44px; height: 44px; }
  .lightbox-nav svg { width: 19px; height: 19px; }
  .lightbox-prev { inset-inline-start: -12px; }
  .lightbox-next { inset-inline-end: -12px; }
}

@media (max-width: 720px) {
  .lightbox-nav { width: 40px; height: 40px; background: rgba(20,21,31,0.9); }
  .lightbox-prev { inset-inline-start: 4px; }
  .lightbox-next { inset-inline-end: 4px; }
}

/* ==========================================================================
   Roster
   ========================================================================== */
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; perspective: 1200px; }
.roster-loading, .roster-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px; font-family: var(--font-mono); font-size: 13px; }
.content-loading { text-align: center; color: var(--muted); padding: 20px; font-family: var(--font-mono); font-size: 13px; }
.player-card {
  background: linear-gradient(160deg, var(--surface), var(--bg-alt));
  background-size: cover; background-position: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px;
  min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; overflow: hidden; transform-style: preserve-3d; will-change: transform;
  transition: transform .15s ease, border-color .2s ease, background-size .5s ease;
}
.player-card::before {
  content: ""; position: absolute; top: 0; inset-inline: 0; height: 2px; z-index: 2;
  background: linear-gradient(90deg, var(--red), var(--blue));
}
.player-card.has-avatar::after {
  content: ""; position: absolute; inset: 0; z-index: 0; transition: opacity .4s ease;
  background: linear-gradient(180deg, rgba(8,8,12,0.15) 0%, rgba(8,8,12,0.55) 55%, rgba(8,8,12,0.92) 100%);
}
.player-card:hover { border-color: var(--blue); }
.player-card.has-avatar:hover { background-size: 112%; }
.player-card.has-avatar:hover::after { opacity: 0.8; }
.player-card > * { position: relative; z-index: 1; }
.player-card.has-avatar { cursor: pointer; }
.player-card.has-avatar > * {
  opacity: 0; transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease;
}
.player-card.has-avatar:hover > * { opacity: 1; transform: translateY(0); }
.player-name { color: #fff; font-weight: 700; margin: 0 0 4px; }
.player-fullname { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.player-role {
  display: inline-block; font-family: var(--font-mono); font-size: 11.5px; color: var(--blue);
  border: 1px solid rgba(0,212,255,0.3); padding: 2px 8px; border-radius: 4px; margin-bottom: 10px;
  background: rgba(8,8,12,0.4);
}
.player-gameid { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.player-bio { font-size: 13px; color: #a9abc0; margin: 0; }

/* ==========================================================================
   Join form
   ========================================================================== */
.join { background: var(--bg-alt); border-radius: 20px; }
.join-inner { max-width: 620px; margin: 0 auto; }
.join-form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row label { font-size: 13.5px; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 14.5px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,212,255,0.12); outline: none;
}
.form-status { text-align: center; font-size: 13.5px; min-height: 20px; margin: 0; }
.form-status.ok { color: #5ee6a0; }
.form-status.err { color: var(--red); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); padding: 40px 24px; }
.footer-inner {
  max-width: var(--container); margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 14px; }
.footer-social { display: flex; gap: 20px; }
.footer-social a { color: var(--muted); font-size: 13.5px; }
.footer-social a:hover { color: var(--blue); }
.footer-copy { color: var(--muted); font-size: 12.5px; width: 100%; text-align: center; margin-top: 10px; }

.fab-join {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 90;
  background: var(--red); color: #fff; padding: 13px 22px; border-radius: 30px;
  font-weight: 700; font-size: 13.5px; box-shadow: 0 8px 22px -4px var(--red-glow);
  display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-visual { order: -1; }
  .value-grid { grid-template-columns: 1fr 1fr; }
  .gallery-grid { grid-auto-columns: 170px; }
}

@media (max-width: 720px) {
  .main-nav {
    position: fixed; top: 62px; inset-inline: 0; background: var(--bg-alt);
    flex-direction: column; padding: 20px 24px; gap: 18px; border-bottom: 1px solid var(--line);
    transform: translateY(-140%); transition: transform .25s ease; z-index: 99;
  }
  .main-nav.open { transform: translateY(0); }
  .nav-toggle { display: flex; }
  .value-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-auto-columns: 130px; gap: 10px; }
  .fab-join { display: block; }
  section { padding: 80px 20px; }
}

/* ==========================================================================
   Game page (game.html) — IRG Arena
   ========================================================================== */
body.game-page {
  margin: 0; background: var(--bg); color: var(--text); min-height: 100vh;
  display: flex; flex-direction: column; font-family: var(--font-body);
  overflow: hidden;
}
.game-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0;
}
.game-back { color: var(--muted); font-size: 13.5px; text-decoration: none; }
.game-back:hover { color: var(--blue); }
.game-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
.game-title .accent { color: var(--red); font-weight: 400; }

.game-wrap {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 18px; min-height: 0;
}

#gameCanvas {
  background: radial-gradient(circle at center, #10111a 0%, #08080c 100%);
  border: 1px solid var(--line); border-radius: 12px; max-width: 100%; max-height: 100%;
  box-shadow: 0 0 40px rgba(0,0,0,0.5); cursor: crosshair; touch-action: none;
}

.game-hint {
  position: absolute; bottom: 26px; inset-inline: 0; text-align: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted); pointer-events: none;
}

.game-overlay {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(8,8,12,0.82); backdrop-filter: blur(4px);
}
.game-join-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px 30px; width: 100%; max-width: 360px; text-align: center;
}
.game-join-card h2 { font-family: var(--font-display); margin: 0 0 10px; font-size: 19px; }
.game-join-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.game-join-card input {
  width: 100%; padding: 12px 14px; background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); font-size: 14.5px; margin-bottom: 14px; font-family: inherit;
}
.game-join-card input:focus { outline: none; border-color: var(--blue); }
.game-join-card button {
  width: 100%; background: var(--red); color: #fff; border: none; padding: 12px;
  border-radius: 6px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 14.5px;
}
.game-join-card .msg { min-height: 18px; margin: 10px 0 0; font-size: 13px; }
.game-join-card .msg.err { color: var(--red); }

.game-hud {
  position: absolute; top: 18px; inset-inline: 18px; z-index: 15;
  display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none;
}
.game-hud-left { display: flex; align-items: center; gap: 10px; }
.game-health-bar {
  width: 160px; height: 14px; border-radius: 7px; background: rgba(255,255,255,0.08);
  border: 1px solid var(--line); overflow: hidden;
}
.game-health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .15s ease; }
.game-health-label { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.game-hud-right {
  background: rgba(20,21,31,0.85); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 150px;
}
.game-hud-title { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
#gameLeaderboard { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
#gameLeaderboard li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
#gameLeaderboard li .lb-name { color: var(--text); }
#gameLeaderboard li .lb-kills { color: var(--gold); font-family: var(--font-mono); }

@media (max-width: 720px) {
  .game-hud { inset-inline: 10px; top: 10px; }
  .game-health-bar { width: 110px; }
  .game-hud-right { min-width: 110px; padding: 8px 10px; }
  .game-hint { display: none; }
}
