:root {
  --bg: #0b0f16;
  --surface: #121822;
  --surface-2: #18212e;
  --surface-3: #1e2938;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #edf2f7;
  --muted: #8b9bb0;
  --ct: #4d9eff;
  --t: #e2a43b;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: var(--tg-vh, var(--tg-viewport-stable-height, 100dvh));
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at 80% -10%, rgba(77, 158, 255, 0.16), transparent 42%),
    radial-gradient(circle at 15% 10%, rgba(226, 164, 59, 0.10), transparent 36%),
    var(--bg);
  padding-bottom: 32px;
}

body.tg-webapp .topbar {
  padding-top: env(safe-area-inset-top);
}

h1, h2, h3, .hero-player-name, .premier-val, .brand-text strong {
  font-family: "Rajdhani", "Inter", sans-serif;
  letter-spacing: 0.02em;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ct);
  text-decoration: none;
}

a:hover {
  color: #7ab8ff;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 15, 22, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(1240px, 96vw);
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--t), #f59e0b);
  color: #0b0f16;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 6px;
  transform: skewX(-10deg);
}

.brand-text {
  display: grid;
  line-height: 1.05;
  min-width: 0;
}

.brand-text strong {
  font-size: 18px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.brand-text small {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.top-nav a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.top-nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.top-nav a.active {
  color: var(--ink);
  background: rgba(77, 158, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(77, 158, 255, 0.35);
}

.nav-admin-link {
  border: 1px solid var(--line);
}

.nav-player-pill {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0 !important;
}

.admin-login-box {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.admin-login-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.logout-form {
  margin: 0;
}

.nav-logout {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  font-size: 13px;
}

/* Container & Cards */
.container {
  width: min(1240px, 95vw);
  max-width: 100%;
  margin: 18px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.container > *,
.split-grid > *,
.split-grid-3 > *,
.podium-grid > *,
.podium-mvp-card > *,
.grid-form > *,
.constraints-grid > *,
.card,
.subcard,
.form-stack,
.podium-runners,
.runner-body,
.podium-mvp-info,
.hero-base-dock,
.cs2-hero-card,
.cs2-tab-panel,
.trend-chart-wrap {
  min-width: 0;
  max-width: 100%;
}

.card {
  background: linear-gradient(180deg, rgba(24, 33, 46, 0.72) 0%, rgba(18, 24, 34, 0.94) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.card-compact {
  padding: 12px 16px;
}

.card h2, .card h3 {
  margin: 0 0 10px 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-head > * {
  min-width: 0;
  max-width: 100%;
}

.subcard {
  background: rgba(11, 15, 22, 0.45);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Premier Rating Pill */
.premier-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 9px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(16, 22, 32, 0.96), rgba(28, 38, 54, 0.92));
  border: 1px solid var(--tier-color, var(--ct));
  box-shadow: 0 0 18px var(--tier-glow, rgba(77, 158, 255, 0.25));
  transform: skewX(-12deg);
}

.premier-pill > * {
  transform: skewX(12deg);
}

.premier-bars {
  color: var(--tier-color, var(--ct));
  font-weight: 800;
  letter-spacing: -1px;
}

.premier-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.premier-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tier-color, var(--ct));
}

.premier-sm {
  padding: 3px 9px 3px 7px;
  gap: 5px;
}

.premier-sm .premier-val {
  font-size: 15px;
}

.premier-xs {
  padding: 2px 7px 2px 5px;
  gap: 4px;
}

.premier-xs .premier-val {
  font-size: 13px;
}

/* Hero Operative Stage (Player Profile) */
.cs2-hero-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #101722 0%, #0b0f16 100%);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.cs2-hero-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 22, 0.65);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 3;
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.hero-player-name {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.back-pill,
.rank-pill,
.map-tag,
.knife-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--ink);
}

.rank-pill {
  font-family: "JetBrains Mono", monospace;
  color: var(--t);
  border-color: rgba(226, 164, 59, 0.35);
}

.map-tag {
  color: var(--tag-color, var(--ct));
  border-color: color-mix(in srgb, var(--tag-color, var(--ct)) 40%, transparent);
  letter-spacing: 0.06em;
}

.cs2-stage {
  --stage-accent: #e2a43b;
  --stage-glow: rgba(226, 164, 59, 0.34);
  --tilt-x: 0px;
  --tilt-y: 0px;
  --bg-shift-x: 0px;
  --bg-shift-y: 0px;
  position: relative;
  height: clamp(330px, 48vh, 450px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background-color: #0b1017;
  cursor: grab;
  touch-action: pan-y;
}

.cs2-stage-lobby {
  height: clamp(380px, 56vh, 540px);
  touch-action: none;
}

.cs2-stage.is-inspecting {
  cursor: grabbing;
}

.cs2-map-bg {
  position: absolute;
  inset: -6%;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: saturate(1.06) brightness(0.76);
  transform: translate3d(var(--bg-shift-x), var(--bg-shift-y), 0) scale(1.08);
  transition: background-image 0.35s ease, transform 0.22s ease-out;
  animation: cs2-map-drift 28s ease-in-out infinite alternate;
  z-index: 0;
}

.cs2-map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 25%, rgba(7, 10, 16, 0.72) 100%),
    linear-gradient(180deg, rgba(11, 15, 22, 0.55) 0%, transparent 22%, transparent 74%, rgba(11, 15, 22, 0.94) 100%);
}

.cs2-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.cs2-stage-spotlight {
  position: absolute;
  top: -15%;
  left: 50%;
  width: 360px;
  height: 115%;
  transform: translateX(calc(-50% + var(--tilt-x) * -0.5));
  background: conic-gradient(from 160deg at 50% 0%, transparent 0deg, var(--stage-glow) 22deg, transparent 44deg);
  filter: blur(26px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 1;
}

.stage-hint {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 4;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(237, 242, 247, 0.75);
  background: rgba(11, 15, 22, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.cs2-agent-wrap {
  position: relative;
  z-index: 2;
  height: 95%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform: translate3d(var(--tilt-x), var(--tilt-y), 0);
  transition: transform 0.18s ease-out;
}

.cs2-agent-canvas {
  display: none;
  height: 100%;
  width: auto;
  pointer-events: none;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.78));
}

.cs2-stage.has-webgl .cs2-agent-canvas {
  display: block;
}

.cs2-stage.has-webgl .cs2-agent-img {
  display: none;
}

.cs2-agent-img {
  height: 100%;
  max-height: 500px;
  width: auto;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.85));
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 92%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 92%, transparent 100%);
  animation: cs2-breathe 4.4s ease-in-out infinite;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.cs2-agent-img.is-switching {
  opacity: 0.15;
  transform: scale(0.97);
}

.map-switcher {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  background: rgba(11, 15, 22, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
}

.map-btn {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.map-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  border-color: var(--stage-accent);
}

.agent-switcher {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(11, 15, 22, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
}

.agent-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.agent-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border-color: var(--line-strong);
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Base Stat Dock under the operative */
.hero-base-dock {
  background: rgba(14, 20, 30, 0.94);
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  display: grid;
  gap: 12px;
}

.base-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.base-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}

.stat-k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-v {
  font-size: 24px;
  line-height: 1.1;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

.hero-dock-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-details {
  background: linear-gradient(135deg, var(--ct), #2563eb);
  color: #fff;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
}

/* Tabs & Detailed Analytics */
.cs2-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.cs2-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 8px 14px;
  font-weight: 600;
}

.cs2-tab-btn.active {
  background: rgba(77, 158, 255, 0.16);
  color: var(--ink);
  border-color: rgba(77, 158, 255, 0.45);
}

.cs2-tab-panel {
  display: none;
}

.cs2-tab-panel.active {
  display: block;
}

.skill-bars {
  display: grid;
  gap: 12px;
}

.skill-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.skill-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bar-color, var(--ct)), #ffffff88);
}

.form-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 135px), 1fr));
  gap: 8px;
}

.form-chip {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 3px;
  font-size: 12px;
}

.form-chip.form-good {
  border-left: 3px solid var(--ok);
}

.form-chip.form-mid {
  border-left: 3px solid var(--t);
}

.form-chip.form-low {
  border-left: 3px solid var(--danger);
}

.form-map {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 12px;
}

.map-card {
  background: radial-gradient(circle at top right, var(--map-glow), rgba(11, 15, 22, 0.7) 65%);
  border: 1px solid var(--line);
  border-top: 3px solid var(--map-accent);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.map-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-rank {
  color: var(--map-accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  margin-right: 6px;
}

.map-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
}

.map-card-metrics > div {
  display: grid;
  gap: 2px;
}

/* Leaderboard Podium */
.podium-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
}

.podium-mvp-card {
  display: grid;
  grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(245, 197, 66, 0.35);
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.08), rgba(18, 24, 34, 0.96));
  color: var(--ink);
  overflow: hidden;
}

.podium-mvp-stage {
  height: 210px;
  border-radius: 10px;
}

.podium-agent-img {
  position: relative;
  z-index: 2;
  height: 96%;
  width: auto;
  object-fit: contain;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 90%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 90%, transparent 100%);
  animation: cs2-breathe 4.4s ease-in-out infinite;
}

.mvp-crown {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #f5c542;
  margin-bottom: 4px;
}

.podium-mvp-info h2 {
  margin: 0 0 10px 0;
  font-size: 30px;
}

.podium-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.podium-runners {
  display: grid;
  gap: 10px;
}

.podium-runner-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.podium-runner-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.runner-avatar {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1017;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.runner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.runner-body {
  display: grid;
  gap: 5px;
}

.runner-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runner-metrics {
  font-size: 12px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  max-width: 260px;
}

/* Killfeed */
.killfeed-list {
  display: grid;
  gap: 8px;
}

.killfeed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(11, 15, 22, 0.5);
  border: 1px solid var(--line);
}

.killfeed-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(239, 68, 68, 0.55);
  font-weight: 600;
  font-size: 13px;
}

.kf-killer {
  color: var(--t);
}

.kf-victim {
  color: var(--ct);
}

.kf-weapon {
  font-size: 14px;
}

.killfeed-meta {
  font-size: 12px;
}

/* Tables & Forms */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}

.mini-stats {
  margin-bottom: 12px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}

.stat-pill strong {
  color: var(--ink);
  font-size: 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.split-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.side-ct-head {
  color: var(--ct);
  border-bottom: 2px solid rgba(77, 158, 255, 0.5);
}

.side-t-head {
  color: var(--t);
  border-bottom: 2px solid rgba(226, 164, 59, 0.5);
}

.quality-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 12px;
}

.quality-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--t), var(--ok));
}

.form-stack {
  display: grid;
  gap: 8px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}

.form-align-end {
  align-content: end;
}

.inline-form {
  display: flex;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

input,
select,
button {
  max-width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(11, 15, 22, 0.85);
  color: var(--ink);
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--ct);
}

button {
  background: linear-gradient(135deg, var(--ct), #2563eb);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.btn-danger-sm {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 4px 9px;
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 8px;
}

.player-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.player-check:has(input:checked) {
  border-color: rgba(77, 158, 255, 0.55);
  background: rgba(77, 158, 255, 0.1);
}

.player-check-info {
  display: grid;
  gap: 4px;
  width: 100%;
  font-size: 12px;
}

.player-check-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.constraints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.constraint-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-mid {
  background: rgba(226, 164, 59, 0.15);
  color: #fde68a;
  border: 1px solid rgba(226, 164, 59, 0.35);
}

.badge-warn {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.alert.error {
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.alert.success {
  border: 1px solid rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.cs2-hero-card[data-can-edit="false"] .owner-only-controls,
.cs2-hero-card[data-can-edit="false"] .owner-edit-badge {
  display: none !important;
}

.owner-edit-badge {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 4;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fde68a;
  background: rgba(11, 15, 22, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 164, 59, 0.45);
  pointer-events: none;
}

.tg-link-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid rgba(77, 158, 255, 0.45);
  background: linear-gradient(135deg, rgba(77, 158, 255, 0.14), rgba(226, 164, 59, 0.08));
}

.tg-link-text {
  display: grid;
  gap: 4px;
  max-width: 620px;
}

.tg-link-form {
  align-items: center;
}

/* Personal Cabinet, Records, Medals, Trend SVG, Server Compare */
.cabinet-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.10), rgba(18, 24, 34, 0.94));
}

.cabinet-strip-left,
.cabinet-strip-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mix-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(77, 158, 255, 0.14);
  border: 1px solid rgba(77, 158, 255, 0.35);
}

.players-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.directory-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}

.directory-card:hover {
  border-color: var(--ct);
  background: rgba(77, 158, 255, 0.08);
}

.directory-head,
.directory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tg-bound-dot {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(77, 158, 255, 0.2);
  color: var(--ct);
}

.medals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.medal-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 13px;
}

.medal-ico {
  font-size: 22px;
  line-height: 1;
}

.medal-gold {
  border-color: rgba(245, 197, 66, 0.45);
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.12), rgba(11, 15, 22, 0.7));
}

.medal-crimson {
  border-color: rgba(235, 75, 75, 0.45);
  background: linear-gradient(135deg, rgba(235, 75, 75, 0.12), rgba(11, 15, 22, 0.7));
}

.medal-magenta {
  border-color: rgba(211, 44, 230, 0.45);
  background: linear-gradient(135deg, rgba(211, 44, 230, 0.12), rgba(11, 15, 22, 0.7));
}

.medal-blue {
  border-color: rgba(75, 139, 255, 0.45);
  background: linear-gradient(135deg, rgba(75, 139, 255, 0.12), rgba(11, 15, 22, 0.7));
}

.trend-chart-wrap {
  display: grid;
  gap: 6px;
}

.trend-svg {
  width: 100%;
  height: 148px;
  display: block;
}

.trend-axis-labels {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
}

.server-compare-grid {
  display: grid;
  gap: 8px;
}

.cmp-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 13px;
}

.cmp-pos {
  color: #4ade80;
  font-weight: 700;
}

.cmp-neg {
  color: #f87171;
  font-weight: 700;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 10px;
}

.record-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(226, 164, 59, 0.35);
  background: radial-gradient(circle at top right, rgba(226, 164, 59, 0.12), rgba(11, 15, 22, 0.7) 70%);
  font-size: 12px;
}

.record-val {
  font-size: 22px;
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(440px, 94vw);
  display: grid;
  gap: 14px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-brand p {
  margin: 2px 0 0 0;
  font-size: 13px;
}

.login-back {
  text-align: center;
  font-size: 13px;
}

/* Bottom Mobile / Telegram Mini App Nav */
.bottom-nav {
  display: none;
}

.cs2-toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%) translateY(14px);
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--ct);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}

.cs2-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes cs2-breathe {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.012);
  }
}

@keyframes cs2-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes cs2-map-drift {
  0% {
    background-position: 46% 48%;
  }
  100% {
    background-position: 54% 52%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cs2-agent-img,
  .podium-agent-img,
  .cs2-pedestal-ring,
  .cs2-map-bg {
    animation: none;
  }
}

/* Season Switcher Bar & Admin Controls */
.season-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 24, 34, 0.88);
  backdrop-filter: blur(8px);
  max-width: 100%;
}

.season-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.season-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  max-width: 100%;
}

.season-pill:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.season-pill.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(77, 158, 255, 0.28), rgba(226, 164, 59, 0.18));
  border-color: rgba(77, 158, 255, 0.65);
  box-shadow: 0 0 14px rgba(77, 158, 255, 0.2);
}

.season-pill-cnt {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.season-select {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 15, 22, 0.9);
  color: var(--ink);
  max-width: min(280px, 100%);
}

.season-select.active {
  border-color: rgba(226, 164, 59, 0.65);
  background: rgba(226, 164, 59, 0.14);
}

.season-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.season-period {
  font-size: 12px;
  color: var(--muted);
}

.season-admin-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fde68a;
  background: rgba(226, 164, 59, 0.14);
  border: 1px solid rgba(226, 164, 59, 0.45);
}

.season-admin-btn:hover {
  background: rgba(226, 164, 59, 0.25);
}

.fallback-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  vertical-align: middle;
}

.mobile-admin-strip {
  display: none;
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  input,
  select {
    font-size: 16px;
  }

  .top-nav {
    display: none;
  }

  .mobile-admin-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 2vw 8px;
  }

  .mobile-admin-strip::-webkit-scrollbar {
    display: none;
  }

  .mobile-admin-strip a {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
  }

  .mobile-admin-strip a.active {
    color: var(--ink);
    border-color: var(--ct);
    background: rgba(77, 158, 255, 0.16);
  }

  .podium-grid,
  .podium-mvp-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .podium-mvp-stage {
    height: 190px;
  }

  .base-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cs2-stage-lobby {
    height: 390px;
  }

  .map-switcher {
    left: 10px;
    right: 10px;
    bottom: 52px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .agent-switcher {
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .map-switcher::-webkit-scrollbar,
  .agent-switcher::-webkit-scrollbar,
  .cs2-tabs::-webkit-scrollbar {
    display: none;
  }

  .map-btn,
  .agent-btn,
  .cs2-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .cs2-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .season-pills {
    width: 100%;
    min-width: 0;
  }

  .season-select {
    max-width: 100%;
    width: 100%;
  }

  .inline-form {
    flex-direction: column;
  }

  table {
    font-size: 12px;
  }

  .leaderboard-table th:nth-child(2),
  .leaderboard-table td:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #131a25;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.35);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .leaderboard-table th:nth-child(2) {
    background: #18212e;
    z-index: 3;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(11, 15, 22, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .bottom-nav.has-5 {
    grid-template-columns: repeat(5, 1fr);
  }

  .bottom-nav a {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 5px 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
  }

  .bottom-nav a.active {
    color: var(--ink);
    background: rgba(77, 158, 255, 0.16);
  }

  .bn-ico {
    font-size: 16px;
    line-height: 1;
  }
}

@media (max-width: 520px) {
  .container {
    width: 100%;
    padding: 0 10px;
    margin: 12px auto;
    gap: 12px;
  }

  .card {
    padding: 12px;
  }

  .card-head {
    gap: 8px;
  }

  .cs2-hero-hud {
    padding: 10px 12px;
  }

  .hero-player-name {
    font-size: 22px;
  }

  .podium-mvp-info h2 {
    font-size: 24px;
  }

  .premier-val {
    font-size: 17px;
  }

  .premier-label {
    font-size: 10px;
  }

  .stat-v {
    font-size: 20px;
  }

  .cs2-stage-lobby {
    height: 360px;
  }

  .owner-edit-badge {
    font-size: 10px;
    padding: 3px 8px;
    max-width: calc(100% - 96px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .season-bar {
    padding: 8px 10px;
    gap: 8px;
    margin-bottom: 4px;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    max-width: 100%;
  }

  .cmp-row {
    grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) auto;
    font-size: 12px;
    padding: 6px 8px;
  }
}
