@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Press+Start+2P&display=swap');

:root {
  --bg: #05070d;
  --bg-2: #080c16;
  --panel: rgba(12, 18, 32, 0.86);
  --panel-solid: #0c1220;
  --panel-2: #111a2c;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e9effc;
  --muted: #8c9bb5;
  --dim: #5f6d85;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #fb7185;
  --violet: #a78bfa;
  --font-display: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(34, 211, 238, 0.18), transparent 62%),
    radial-gradient(760px 500px at 94% 6%, rgba(244, 114, 182, 0.16), transparent 64%),
    radial-gradient(700px 520px at 50% 112%, rgba(251, 191, 36, 0.09), transparent 65%),
    linear-gradient(180deg, #070a12 0%, #05070d 48%, #04060b 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 18%, black, transparent 78%);
  opacity: 0.75;
}
::selection { background: rgba(34, 211, 238, 0.35); color: #fff; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.modal-open { overflow: hidden; }
.mono { font-family: var(--font-display); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.24); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Layout */
.wrap { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(5, 7, 13, 0.74);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.2), rgba(244, 114, 182, 0.12));
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.18), inset 0 0 18px rgba(34, 211, 238, 0.06);
}
.brand-mark svg { width: 24px; height: 24px; color: var(--cyan); filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.6)); }
.brand-copy { line-height: 1.05; }
.brand-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #f8fbff;
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
}
.brand-sub {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--dim);
  font-weight: 700;
}
.header-nav { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.nav-link {
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.18s ease;
}
.nav-link:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.nav-link.active { color: var(--cyan); background: rgba(34, 211, 238, 0.08); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.online-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(12, 18, 32, 0.7);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 32, 0.7);
  border-radius: 99px;
  padding: 5px 12px 5px 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  transition: 0.18s ease;
}
.user-chip:hover { border-color: rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.06); }
.user-chip .avatar { width: 28px; height: 28px; font-size: 11px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(17, 26, 44, 0.8);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(148, 163, 184, 0.4); background: rgba(23, 35, 58, 0.9); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #041018;
  border-color: transparent;
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 45%, #0ea5e9 100%);
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #a5f3fc 0%, #22d3ee 45%, #0ea5e9 100%); box-shadow: 0 14px 36px rgba(34, 211, 238, 0.32); }
.btn-pink {
  color: #1b0713;
  border-color: transparent;
  background: linear-gradient(135deg, #f9a8d4, #f472b6 55%, #ec4899);
  box-shadow: 0 10px 30px rgba(244, 114, 182, 0.22);
}
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 9px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.btn-block { width: 100%; }

/* Panels */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%);
}
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 7px;
}
.panel-head h2, .section-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.panel-head h2 span, .section-title span { color: var(--muted); font-weight: 600; }
.panel-body { padding: 18px 20px; }

/* Hero */
.hero { padding: 54px 0 26px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 40px;
  align-items: center;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  background: rgba(34, 211, 238, 0.06);
  border-radius: 99px;
  color: #a5f3fc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero-kicker .pulse-dot { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.hero h1 {
  margin: 0;
  font-size: clamp(38px, 5.1vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(100deg, #67e8f9 0%, #22d3ee 35%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(34, 211, 238, 0.18);
}
.hero p.lead {
  max-width: 560px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.stat { min-width: 90px; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.stat-label { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }

/* Hero visual */
.hero-visual { position: relative; display: flex; justify-content: center; }
.squad-card {
  position: relative;
  width: min(100%, 370px);
  border-radius: 22px;
  padding: 20px;
  background:
    linear-gradient(160deg, rgba(34, 211, 238, 0.12), rgba(12, 18, 32, 0.92) 36%, rgba(244, 114, 182, 0.08)),
    var(--panel-solid);
  border: 1px solid rgba(34, 211, 238, 0.24);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 60px rgba(34, 211, 238, 0.08);
  transform: rotate(1.5deg);
  overflow: hidden;
}
.squad-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 4px);
  pointer-events: none;
  opacity: 0.35;
}
.squad-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.squad-code {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.08em;
}
.squad-live { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; color: var(--green); letter-spacing: 0.12em; }
.squad-title { margin: 16px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.squad-sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.squad-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
.squad-slot {
  aspect-ratio: 1 / 1.15;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.squad-slot.filled {
  border-style: solid;
  border-color: rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.06);
  color: var(--text);
}
.squad-slot .avatar { width: 34px; height: 34px; font-size: 12px; }
.squad-slot .slot-label { color: var(--dim); font-size: 9px; }
.squad-slot.filled .slot-label { color: var(--cyan); }
.squad-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.squad-foot span { font-size: 11px; color: var(--muted); font-weight: 700; }
.squad-join {
  font-size: 11px; font-weight: 800; color: #041018;
  background: var(--cyan); border-radius: 8px; padding: 8px 12px;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
}
.hero-orbit {
  position: absolute;
  inset: -40px;
  border: 1px solid rgba(34, 211, 238, 0.08);
  border-radius: 50%;
  transform: rotate(-18deg);
  pointer-events: none;
}
.hero-orbit::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 16px var(--pink);
  top: 12%; right: 12%;
}

/* Lobby */
.lobby { padding: 18px 0 70px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr); gap: 20px; align-items: start; }
.side-col { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 94px; }

.filters { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 7, 13, 0.5); }
.filter-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 10px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  transition: 0.16s ease;
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active { color: #041018; background: var(--cyan); box-shadow: 0 0 16px rgba(34, 211, 238, 0.25); }

.parties-list { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.party-card {
  --sys: var(--cyan);
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.025), transparent 35%), rgba(8, 12, 22, 0.6);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.party-card:hover { border-color: rgba(34, 211, 238, 0.28); transform: translateY(-2px); background: rgba(13, 20, 35, 0.9); }
.party-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--sys); box-shadow: 0 0 18px var(--sys);
}
.party-system {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  color: var(--sys);
}
.party-system .sys-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--sys) 40%, transparent);
  background: color-mix(in srgb, var(--sys) 10%, transparent);
  font-size: 9px; font-weight: 900; letter-spacing: 0.04em;
}
.party-system .sys-label { font-size: 8px; font-weight: 800; letter-spacing: 0.12em; color: var(--dim); writing-mode: vertical-rl; transform: rotate(180deg); }
.party-body { padding: 14px 16px 14px; min-width: 0; }
.party-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.party-title { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-desc { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--dim); font-size: 11px; font-weight: 700; }
.party-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--dim); }
.party-meta .host { color: var(--muted); }
.party-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.party-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid #0a0f1b; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more { margin-left: 6px; font-size: 10px; font-weight: 800; color: var(--dim); }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 99px;
  font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.status-chip.waiting { color: var(--amber); border-color: rgba(251, 191, 36, 0.25); background: rgba(251, 191, 36, 0.07); }
.status-chip.playing { color: var(--green); border-color: rgba(52, 211, 153, 0.25); background: rgba(52, 211, 153, 0.07); }
.status-chip.full { color: var(--red); border-color: rgba(251, 113, 133, 0.25); background: rgba(251, 113, 133, 0.07); }
.lock-icon { color: var(--amber); font-size: 11px; }

.empty-state { padding: 46px 24px 52px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; margin-bottom: 12px; opacity: 0.8; }
.empty-state h3 { margin: 0 0 8px; color: var(--text); font-size: 17px; }
.empty-state p { margin: 0 auto 18px; max-width: 380px; font-size: 13px; line-height: 1.6; }

/* Chat */
.chat-panel { display: flex; flex-direction: column; min-height: 420px; max-height: 540px; }
.chat-panel .panel-head { padding-bottom: 12px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 11px; min-height: 0; }
.chat-msg { display: flex; gap: 9px; align-items: flex-start; animation: fadeIn 0.2s ease; }
.chat-msg .avatar { width: 26px; height: 26px; font-size: 10px; flex-shrink: 0; margin-top: 1px; }
.chat-msg-body { min-width: 0; flex: 1; }
.chat-msg-head { display: flex; align-items: baseline; gap: 7px; }
.chat-name { font-size: 11px; font-weight: 800; color: var(--text); }
.chat-time { font-size: 9px; color: var(--dim); font-weight: 700; }
.chat-text { margin-top: 3px; color: #c9d4e8; font-size: 12.5px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.chat-msg.own .chat-text { color: #d9fbff; }
.chat-msg.own .chat-name { color: var(--cyan); }
.chat-msg.system { justify-content: center; }
.chat-msg.system .chat-msg-body { flex: 0 1 auto; text-align: center; }
.chat-msg.system .chat-text {
  display: inline-block;
  padding: 5px 10px; border-radius: 99px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--line);
  color: var(--dim); font-size: 10.5px; font-weight: 600;
}
.chat-msg.system .chat-name, .chat-msg.system .chat-time, .chat-msg.system .avatar { display: none; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: rgba(5, 7, 13, 0.35); }
.chat-form input {
  flex: 1; min-width: 0;
  background: rgba(5, 7, 13, 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.chat-form input:focus { border-color: rgba(34, 211, 238, 0.4); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08); }
.chat-form input::placeholder { color: var(--dim); }
.chat-send {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #67e8f9, #22d3ee);
  color: #041018; font-size: 16px; font-weight: 900;
  display: grid; place-items: center;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.22);
  transition: transform 0.16s ease;
}
.chat-send:hover { transform: translateY(-1px); }

/* Online */
.online-panel .panel-head { padding-bottom: 10px; }
.online-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; max-height: 230px; overflow-y: auto; }
.online-user { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; transition: background 0.16s ease; }
.online-user:hover { background: rgba(148, 163, 184, 0.06); }
.online-user .avatar { width: 28px; height: 28px; font-size: 10px; }
.online-user-info { min-width: 0; flex: 1; }
.online-user-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-user-status { font-size: 9.5px; color: var(--dim); font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-user-status.playing { color: var(--green); }
.online-user-status.party { color: var(--amber); }
.online-user .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex-shrink: 0; }
.online-empty { padding: 18px 12px; color: var(--dim); font-size: 12px; text-align: center; }

/* Avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--avatar-bg, #22d3ee);
  color: #041018;
  font-size: 12px; font-weight: 900;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 14px color-mix(in srgb, var(--avatar-bg, #22d3ee) 22%, transparent);
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.xl { width: 56px; height: 56px; font-size: 19px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; visibility: visible; }
.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 820px);
  overflow-y: auto;
  background: linear-gradient(180deg, #101827, #0a0f1b);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(34, 211, 238, 0.04);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.2s ease;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-close {
  width: 32px; height: 32px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 17px;
  display: grid; place-items: center;
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); }
.modal-body { padding: 20px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; margin-top: 18px; border-top: 1px solid var(--line); }

/* Forms */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field textarea, .field select {
  width: 100%;
  background: rgba(5, 7, 13, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(34, 211, 238, 0.45); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08); }
.field .hint { margin-top: 6px; color: var(--dim); font-size: 11px; line-height: 1.45; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.segmented { display: flex; gap: 6px; }
.segmented button {
  flex: 1; padding: 9px 8px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(5, 7, 13, 0.5); color: var(--muted);
  font-size: 12px; font-weight: 800;
}
.segmented button.active { color: #041018; background: var(--cyan); border-color: transparent; box-shadow: 0 0 16px rgba(34, 211, 238, 0.2); }

/* ROM picker */
.rom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.rom-card {
  display: flex; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 11px;
  background: rgba(5, 7, 13, 0.45);
  text-align: left; color: var(--text);
  transition: 0.16s ease;
}
.rom-card:hover { border-color: rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.04); }
.rom-card.selected { border-color: var(--cyan); background: rgba(34, 211, 238, 0.08); box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.12); }
.rom-cover {
  width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(145deg, color-mix(in srgb, var(--sys, #22d3ee) 28%, transparent), rgba(5, 7, 13, 0.8));
  border: 1px solid color-mix(in srgb, var(--sys, #22d3ee) 40%, transparent);
  color: var(--sys, #22d3ee);
  font-size: 10px; font-weight: 900;
}
.rom-info { min-width: 0; }
.rom-title { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rom-meta { margin-top: 3px; color: var(--dim); font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rom-tag { display: inline-block; margin-left: 5px; padding: 2px 5px; border-radius: 4px; background: rgba(251, 191, 36, 0.12); color: var(--amber); font-size: 8px; font-weight: 900; letter-spacing: 0.06em; }
.rom-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rom-count { color: var(--dim); font-size: 11px; font-weight: 700; }

/* Upload */
.dropzone {
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  background: rgba(5, 7, 13, 0.4);
  transition: 0.18s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--cyan); background: rgba(34, 211, 238, 0.05); }
.dropzone-icon { font-size: 28px; margin-bottom: 10px; }
.dropzone h3 { margin: 0 0 6px; font-size: 15px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.upload-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.upload-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 7, 13, 0.4); font-size: 11px; }
.upload-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.upload-item .state { color: var(--muted); font-weight: 700; }
.upload-item .state.ok { color: var(--green); }
.upload-item .state.err { color: var(--red); }
.legal-note { margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.18); color: #d6c18a; font-size: 10.5px; line-height: 1.55; }

/* How to */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--cyan); font-family: var(--font-display); font-size: 9px;
}
.step h4 { margin: 2px 0 4px; font-size: 13px; }
.step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* Toast */
.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(15, 23, 40, 0.96);
  color: var(--text);
  font-size: 12.5px; font-weight: 600;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.22s ease;
}
.toast .toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.toast.error .toast-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.toast.warn .toast-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0 30px; color: var(--dim); font-size: 11px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--cyan); }

/* ============================ PLAY PAGE ============================ */
.play-body { min-height: 100vh; }
.play-header {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.82);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 60;
}
.play-header .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.play-header .brand-title { font-size: 12px; }
.play-header .brand-sub { display: none; }
.play-title { min-width: 0; }
.play-title .eyebrow { margin-bottom: 4px; }
.play-title h1 { margin: 0; font-size: 19px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-title .play-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--dim); font-size: 10.5px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.play-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.code-chip {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  padding: 8px 10px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.06);
  white-space: nowrap;
}
.play-main {
  width: min(1440px, calc(100% - 32px));
  margin: 16px auto 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 16px;
  align-items: start;
}
.emulator-panel { min-width: 0; }
.emulator-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 50px rgba(34, 211, 238, 0.05);
}
.emulator-frame #game { position: absolute; inset: 0; }
.emulator-frame .ejs_parent { width: 100% !important; height: 100% !important; }
.emulator-frame .ejs_start_button { display: none !important; }
.emulator-frame #game canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.emulator-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(15, 23, 42, 0.88), rgba(3, 6, 12, 0.96));
  transition: opacity 0.2s ease;
}
.emulator-overlay.hide { opacity: 0; pointer-events: none; }
.overlay-card { text-align: center; padding: 24px; max-width: 420px; }
.overlay-card h2 { margin: 14px 0 8px; font-size: 20px; letter-spacing: -0.02em; }
.overlay-card p { margin: 0 auto 18px; color: var(--muted); font-size: 12.5px; line-height: 1.6; max-width: 340px; }
.overlay-spinner {
  width: 34px; height: 34px; margin: 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.18);
  border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}
.overlay-spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.netplay-badge {
  position: absolute; left: 12px; top: 12px; z-index: 45;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(3, 6, 12, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}
.netplay-badge.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.3); }
.netplay-badge.err { color: var(--red); border-color: rgba(251, 113, 133, 0.3); }
.netplay-badge .pulse-dot { width: 6px; height: 6px; }
.netplay-badge.hidden { display: none; }
.emulator-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 4px 0;
  color: var(--dim); font-size: 10.5px; font-weight: 600;
}
.control-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 9px; font-weight: 800;
}
.host-note { color: var(--dim); }

.play-sidebar {
  display: flex; flex-direction: column;
  min-height: 480px;
  max-height: calc(100vh - 120px);
  position: sticky; top: 84px;
}
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; }
.sidebar-tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 9px; border-radius: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
}
.sidebar-tab.active { color: var(--cyan); background: rgba(34, 211, 238, 0.08); }
.sidebar-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.players-list { padding: 12px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }
.player-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.4);
}
.player-row.me { border-color: rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.05); }
.player-row.offline { opacity: 0.55; }
.player-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.player-info { flex: 1; min-width: 0; }
.player-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { margin-top: 2px; color: var(--dim); font-size: 9.5px; font-weight: 700; }
.slot-badge {
  font-family: var(--font-display); font-size: 8px;
  padding: 5px 6px; border-radius: 6px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
}
.slot-badge.p1 { color: var(--amber); background: rgba(251, 191, 36, 0.1); }
.slot-badge.p2 { color: var(--cyan); background: rgba(34, 211, 238, 0.1); }
.slot-badge.p3 { color: var(--pink); background: rgba(244, 114, 182, 0.1); }
.slot-badge.p4 { color: var(--green); background: rgba(52, 211, 153, 0.1); }
.player-empty { border-style: dashed; color: var(--dim); background: transparent; }
.player-empty .player-name { color: var(--dim); font-weight: 700; }
.party-code-box {
  margin: 12px;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: rgba(34, 211, 238, 0.05);
}
.party-code-label { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }
.party-code-value { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.party-code-value strong { font-family: var(--font-display); font-size: 13px; color: var(--cyan); letter-spacing: 0.1em; }
.party-hint { margin-top: 8px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.delay-control {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 7, 13, 0.4);
}
.delay-label { color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.delay-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 7px; }
.delay-buttons button {
  padding: 6px 4px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer;
}
.delay-buttons button.active { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.delay-control.pending { opacity: 0.7; }
.delay-hint { margin-top: 6px; color: var(--dim); font-size: 9.5px; line-height: 1.4; }
.sidebar-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sidebar-chat .chat-log { padding: 12px; }
.sidebar-chat .chat-form { padding: 10px; }
.sidebar-foot { padding: 10px 12px; border-top: 1px solid var(--line); color: var(--dim); font-size: 10px; line-height: 1.5; }
.sidebar-foot strong { color: var(--muted); }
.hidden { display: none !important; }

/* Telegram */
.tg-webapp .site-header { padding-top: env(safe-area-inset-top); }
.tg-webapp .play-header { padding-top: calc(12px + env(safe-area-inset-top)); }
.tg-webapp .play-body { min-height: var(--tg-vh, 100dvh); }
.tg-webapp .toast-container { bottom: calc(18px + env(safe-area-inset-bottom)); }
.tg-webapp .site-footer { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }

/* Responsive */
@media (max-width: 1200px) {
  .header-nav { gap: 0; }
  .nav-link { padding: 8px 8px; font-size: 12px; }
}
@media (max-width: 1050px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .side-col { position: static; }
  .chat-panel { max-height: 460px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-visual { justify-content: flex-start; }
  .squad-card { transform: none; width: min(100%, 430px); }
  .play-main { grid-template-columns: 1fr; }
  .play-sidebar { position: static; max-height: none; min-height: 380px; }
  .emulator-frame { aspect-ratio: 16 / 10; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .header-inner { min-height: 64px; gap: 10px; }
  .header-nav { display: none; }
  .brand-sub { display: none; }
  .online-pill { padding: 7px 9px; font-size: 10px; }
  .user-chip { padding: 4px 8px 4px 4px; }
  .user-chip .user-name { display: none; }
  .hero { padding: 34px 0 18px; }
  .hero h1 { font-size: clamp(32px, 10vw, 46px); }
  .hero p.lead { font-size: 14px; }
  .hero-stats { gap: 18px; }
  .stat-value { font-size: 20px; }
  .panel-head { padding: 16px 14px 12px; }
  .filters { overflow-x: auto; }
  .filter-btn { padding: 6px 8px; font-size: 10px; }
  .parties-list { padding: 10px; }
  .party-card { grid-template-columns: 42px minmax(0, 1fr); }
  .party-system .sys-label { display: none; }
  .party-desc { display: none; }
  .party-footer { margin-top: 9px; }
  .play-header { padding: 8px 10px; gap: 9px; flex-wrap: wrap; }
  .play-title h1 { font-size: 15px; }
  .play-title .play-meta { display: none; }
  .play-actions { gap: 6px; }
  .play-actions .btn { padding: 8px 10px; font-size: 10px; }
  .code-chip { display: none; }
  .play-main { width: calc(100% - 16px); margin-top: 8px; gap: 10px; }
  .emulator-frame { aspect-ratio: 4 / 3; border-radius: 10px; }
  .emulator-footer { display: none; }
  .play-sidebar { min-height: 340px; border-radius: 12px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 92vh; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .rom-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .toast-container { right: 10px; bottom: 10px; left: 10px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  .hero-actions .btn { flex: 1; }
  .squad-card { padding: 14px; }
  .squad-title { font-size: 20px; }
  .squad-slots { gap: 5px; }
}

/* ============================ SEASONS / RECORDS / PROFILE ============================ */
.season-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.8fr) auto;
  gap: 18px;
  align-items: center;
  margin: 0 auto 20px;
  padding: 18px 20px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(100deg, rgba(251, 191, 36, 0.09), rgba(12, 18, 32, 0.9) 42%, rgba(34, 211, 238, 0.06)),
    var(--panel);
  box-shadow: var(--shadow);
}
.season-banner h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.season-banner p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.season-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.season-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 8px; border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.45);
  color: var(--muted); font-size: 10px; font-weight: 700;
}
.season-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--chip, #22d3ee); box-shadow: 0 0 7px var(--chip, #22d3ee); }
.season-top-mini { display: flex; flex-direction: column; gap: 5px; }
.season-top-mini .mini-row { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: var(--muted); }
.season-top-mini .mini-row strong { color: var(--text); }
.season-top-mini .mini-rank { width: 18px; color: var(--amber); font-family: var(--font-display); font-size: 8px; }
.season-top-mini .avatar { width: 22px; height: 22px; font-size: 8px; }

.page-hero { padding: 34px 0 18px; }
.page-hero-inner {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 260px at 10% 0%, rgba(34, 211, 238, 0.12), transparent 70%),
    linear-gradient(120deg, rgba(244, 114, 182, 0.06), transparent 50%),
    var(--panel);
  box-shadow: var(--shadow);
}
.page-hero h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.04em; }
.page-hero p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-hero .hero-actions { margin-top: 16px; }
.page-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--amber); font-size: 10px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 9px; }
.countdown-box { text-align: right; flex-shrink: 0; }
.countdown-value { font-family: var(--font-display); font-size: 18px; color: var(--cyan); letter-spacing: 0.06em; }
.countdown-label { margin-top: 6px; color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr); gap: 20px; padding-bottom: 60px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.season-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.season-game-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 7, 13, 0.45);
  padding: 12px;
  min-width: 0;
}
.season-game-card .game-head { display: flex; align-items: center; gap: 8px; }
.season-game-card .game-head .rom-cover { width: 34px; height: 34px; border-radius: 7px; font-size: 9px; }
.season-game-card h3 { margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.season-game-card .game-meta { margin-top: 2px; color: var(--dim); font-size: 9px; font-weight: 700; }
.season-game-scores { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.season-game-score { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.season-game-score .rank { width: 14px; color: var(--amber); font-family: var(--font-display); font-size: 7px; }
.season-game-score .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.season-game-score .score { color: var(--text); font-weight: 800; }
.season-game-empty { margin-top: 10px; color: var(--dim); font-size: 10px; }

.leaderboard { padding: 8px 10px 12px; }
.lb-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 70px 60px;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 9px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}
.lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: rgba(34, 211, 238, 0.05); border-bottom-color: transparent; }
.lb-row.all-games { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 70px 60px; }
.lb-row.all-games .lb-name { font-size: 11px; }
.lb-rank { font-family: var(--font-display); font-size: 10px; color: var(--dim); }
.lb-row:nth-child(1) .lb-rank { color: var(--amber); }
.lb-row:nth-child(2) .lb-rank { color: #cbd5e1; }
.lb-row:nth-child(3) .lb-rank { color: #f59e0b; }
.lb-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-player .avatar { width: 28px; height: 28px; font-size: 10px; }
.lb-name { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub { margin-top: 2px; color: var(--dim); font-size: 9px; font-weight: 700; }
.lb-points { text-align: right; font-size: 13px; font-weight: 800; color: var(--cyan); }
.lb-score { text-align: right; font-family: var(--font-display); font-size: 10px; color: var(--text); }
.lb-date { text-align: right; color: var(--dim); font-size: 10px; }
.lb-head { padding: 8px 8px 6px; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.lb-empty { padding: 28px 18px; text-align: center; color: var(--dim); font-size: 12px; }
.player-link { cursor: pointer; }
.player-link:hover .lb-name, .player-link:hover .online-user-name { color: var(--cyan); }

.champion-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  margin: 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: linear-gradient(100deg, rgba(251, 191, 36, 0.1), rgba(5, 7, 13, 0.4));
}
.champion-card .avatar { width: 44px; height: 44px; font-size: 15px; }
.champion-card h3 { margin: 0; font-size: 15px; }
.champion-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.champion-crown { margin-left: auto; font-size: 26px; filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.5)); }

.season-history { display: flex; flex-direction: column; gap: 7px; padding: 14px; }
.season-history-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 7, 13, 0.35); }
.season-history-row .sh-title { flex: 1; min-width: 0; }
.season-history-row .sh-title strong { display: block; font-size: 11px; }
.season-history-row .sh-title span { display: block; margin-top: 2px; color: var(--dim); font-size: 9px; }
.season-history-row .sh-champ { color: var(--amber); font-size: 10px; font-weight: 800; text-align: right; }

.profile-hero { display: flex; align-items: center; gap: 20px; padding: 24px; }
.profile-avatar { width: 84px; height: 84px; font-size: 28px; box-shadow: 0 0 40px color-mix(in srgb, var(--avatar-bg) 30%, transparent); }
.profile-main { min-width: 0; flex: 1; }
.profile-main h1 { margin: 0; font-size: 30px; letter-spacing: -0.03em; }
.profile-main p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.stat-card { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 7, 13, 0.4); }
.stat-card .v { font-size: 20px; font-weight: 800; }
.stat-card .l { margin-top: 3px; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.achievement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; }
.achievement-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5, 7, 13, 0.4);
}
.achievement-card.earned { border-color: rgba(251, 191, 36, 0.25); background: linear-gradient(120deg, rgba(251, 191, 36, 0.07), rgba(5, 7, 13, 0.4)); }
.achievement-card.locked { opacity: 0.5; filter: grayscale(0.7); }
.ach-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 20px; }
.achievement-card.earned .ach-icon { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.25); }
.ach-copy h4 { margin: 0; font-size: 12px; }
.ach-copy p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.ach-date { margin-top: 5px; color: var(--dim); font-size: 9px; font-weight: 700; }

.best-scores { display: flex; flex-direction: column; gap: 7px; padding: 14px; }
.best-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 7, 13, 0.35); }
.best-row .rom-cover { width: 32px; height: 32px; border-radius: 7px; font-size: 8px; }
.best-row .best-info { flex: 1; min-width: 0; }
.best-row .best-title { font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best-row .best-meta { margin-top: 2px; color: var(--dim); font-size: 9px; }
.best-row .best-score { font-family: var(--font-display); font-size: 11px; color: var(--cyan); }

.records-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.records-controls label { color: var(--dim); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.select {
  background: rgba(5, 7, 13, 0.7);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 12px;
  outline: none;
  min-width: 180px;
}
.select:focus { border-color: rgba(34, 211, 238, 0.4); }
.pill-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 7, 13, 0.5); }
.pill-tab { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 6px; font-size: 10px; font-weight: 800; }
.pill-tab.active { color: #041018; background: var(--cyan); }

.score-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: 9px; border: 1px solid rgba(34, 211, 238, 0.2); background: rgba(34, 211, 238, 0.05); font-size: 11px; }
.score-preview strong { color: var(--cyan); }
.score-preview .game { color: var(--muted); font-weight: 700; }
.score-rules { margin-top: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(5, 7, 13, 0.35); color: var(--dim); font-size: 10px; line-height: 1.55; }

.toast.achievement-toast { border-color: rgba(251, 191, 36, 0.35); background: linear-gradient(120deg, rgba(251, 191, 36, 0.12), rgba(15, 23, 40, 0.98)); }
.toast.achievement-toast .ach-toast-icon { font-size: 20px; flex-shrink: 0; }
.toast.achievement-toast .ach-toast-copy { display: flex; flex-direction: column; gap: 2px; }
.toast.achievement-toast strong { font-size: 11px; color: var(--amber); }
.toast.achievement-toast small { font-size: 10px; color: var(--muted); }

@media (max-width: 1050px) {
  .season-banner { grid-template-columns: 1fr; }
  .season-top-mini { flex-direction: row; flex-wrap: wrap; }
  .content-grid { grid-template-columns: 1fr; }
  .season-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .page-hero { padding: 18px 0 10px; }
  .page-hero-inner { padding: 18px; flex-direction: column; align-items: flex-start; }
  .countdown-box { text-align: left; }
  .achievement-grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; align-items: flex-start; }
  .profile-avatar { width: 64px; height: 64px; font-size: 22px; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .lb-row { grid-template-columns: 30px minmax(0, 1fr) 56px; }
  .lb-date { display: none; }
  .records-controls { padding: 12px 14px; }
  .select { min-width: 0; flex: 1; }
}

/* ============================ MOBILE / TELEGRAM ============================ */
.mobile-nav { display: none; }

@media (max-width: 720px) {
  .play-body { min-height: 100dvh; }
  .play-sidebar { max-height: none; }
  .emulator-frame { max-height: 58dvh; }
  .emulator-frame .ejs_parent { touch-action: none; }
  .emulator-frame .ejs_virtualGamepad_parent { z-index: 50; }
  body:not(.play-body) { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    background: rgba(5, 7, 13, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .mobile-nav-link {
    flex: 1;
    padding: 9px 4px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-align: center;
    text-decoration: none;
    line-height: 1.15;
  }
  .mobile-nav-link.active {
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.09);
  }
  .mobile-nav-link:active { background: rgba(34, 211, 238, 0.14); }
}

@supports (height: 100dvh) {
  .play-body { min-height: 100dvh; }
}

