/* ════════════════════════════════════════════════════════════════════════════
   MyAnichess — UI v3  |  Material Design 3 Dark Blue + Glassmorphism
   ════════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Design Tokens (Material You Dark Blue palette) ──────────────────────── */
:root {
  /* Background layers */
  --bg: #071421;
  --surface-lowest: #030f1b;
  --surface-low: #0f1d29;
  --surface: #14212d;
  --surface-container: #14212d;
  --surface-high: #1e2b38;
  --surface-highest: #293643;
  --surface-bright: #2d3a48;

  /* Primary — blue */
  --primary: #a5c8ff;
  --primary-dim: #3c92f4;
  --primary-container: #3c92f4;
  --on-primary: #00315e;
  --primary-fixed: #d4e3ff;
  --primary-fixed-dim: #a5c8ff;

  /* Secondary */
  --secondary: #b1c5ff;
  --secondary-container: #0452c4;

  /* Tertiary — coral accent */
  --tertiary: #ffb4a7;
  --tertiary-container: #ff553e;

  /* Text */
  --text: #d6e4f5;
  --text-sub: #c0c7d4;
  --text-muted: #8b919e;

  /* Borders */
  --border: rgba(65, 71, 82, 0.5);
  --border-mid: rgba(65, 71, 82, 0.8);
  --outline: #8b919e;
  --outline-variant: #414752;

  /* Semantic */
  --win: #22C55E;
  --win-dim: rgba(34, 197, 94, 0.12);
  --lose: #EF4444;
  --lose-dim: rgba(239, 68, 68, 0.12);
  --cancel: #6B7280;
  --gold: #a5c8ff;
  /* use primary as "accent" */
  --gold-dim: rgba(165, 200, 255, 0.12);
  --gold-soft: rgba(165, 200, 255, 0.06);
  --cyan: #a5c8ff;
  --cyan-dim: rgba(165, 200, 255, 0.10);
  --violet: #b1c5ff;
  --red: #EF4444;
  --red-dim: rgba(239, 68, 68, 0.12);

  /* Game types */
  --gambit-color: #a5c8ff;
  --gambit-dim: rgba(165, 200, 255, 0.12);
  --ranked-color: #b1c5ff;
  --ranked-dim: rgba(177, 197, 255, 0.12);

  /* Glass */
  --glass-bg: rgba(41, 54, 67, 0.45);
  --glass-border: rgba(165, 200, 255, 0.10);
  --glass-blur: blur(14px);

  /* CTAs */
  --gradient-primary: linear-gradient(135deg, #a5c8ff 0%, #3c92f4 100%);
  --gradient-primary-dim: linear-gradient(135deg, rgba(165, 200, 255, 0.15) 0%, rgba(60, 146, 244, 0.15) 100%);

  /* Shape */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --sidebar-w: 220px;

  --shadow: 0 4px 24px rgba(3, 15, 27, 0.6);
  --shadow-primary: 0 4px 20px rgba(60, 146, 244, 0.20);
  --transition: 0.18s ease;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
}

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

button {
  font-family: inherit;
}

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--surface-lowest);
}

::-webkit-scrollbar-thumb {
  background: rgba(165, 200, 255, 0.12);
  border-radius: 3px;
}

/* ─── Utility ──────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

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

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

.gold-color {
  color: var(--primary);
}

.cyan-color {
  color: var(--primary);
}

/* ─── Glass Card Mixin ─────────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

/* ─── Floating Particles ───────────────────────────────────────────────────── */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  color: var(--primary);
  user-select: none;
  pointer-events: none;
  opacity: 0.25;
  animation: floatP linear infinite;
}

@keyframes floatP {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-50px) rotate(180deg);
  }

  100% {
    transform: translateY(0) rotate(360deg);
  }
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 56px;
  background: rgba(4, 12, 22, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(165, 200, 255, 0.06);
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60, 146, 244, 0.3), rgba(177, 197, 255, 0.2), transparent);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.logo-text {
  font-size: 15px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* Header link button (replaces Compare) */
.header-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  background: rgba(165, 200, 255, 0.06);
  border: 1px solid rgba(165, 200, 255, 0.1);
  transition: var(--transition);
}

.header-link-btn:hover {
  color: var(--primary);
  background: rgba(165, 200, 255, 0.1);
  border-color: rgba(165, 200, 255, 0.2);
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface-low);
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  padding: 3px 4px 3px 14px;
  gap: 8px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(165, 200, 255, 0.12);
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  min-width: 0;
  font-family: inherit;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-btn {
  background: var(--gradient-primary);
  color: var(--on-primary);
  border: none;
  border-radius: 7px;
  padding: 6px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-primary);
}

#search-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

#search-btn:active {
  transform: translateY(0);
}

#search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0b1825;
  border: 1px solid rgba(165, 200, 255, 0.12);
  border-radius: var(--radius);
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-sub);
  transition: var(--transition);
  font-size: 13px;
  border-bottom: 1px solid rgba(165, 200, 255, 0.04);
  background: #0b1825;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: #12233a;
  color: var(--text);
}

/* Header Right */
.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

#live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid var(--outline-variant);
  letter-spacing: 0.5px;
  background: var(--surface-low);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cancel);
}

#live-indicator.live-active .live-dot {
  background: var(--win);
  animation: livePulse 1.5s ease infinite;
}

@keyframes livePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface-high);
  color: var(--text);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ─── 3D Chess Background Canvas ───────────────────────────────────────────── */
#chess3d-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

#chess3d-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ─── Welcome Screen (Hero Revamp) ─────────────────────────────────────────── */
#welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 56px);
  text-align: center;
  padding: 0 24px 0;
  position: relative;
  z-index: 1;
}

/* Hide header search on welcome, show it in app-shell */
body:has(#welcome:not(.hidden)) .header-search-wrap {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  overflow: hidden;
  transition: all 0.35s ease;
}

body:has(#app-shell:not(.hidden)) .header-search-wrap {
  opacity: 1;
  pointer-events: all;
  max-width: 520px;
  transition: all 0.35s ease;
}

/* ── Hero Section ─────────────────────────────────────────────────────────── */
.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: max(8vh, 48px);
  max-width: 720px;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(165, 200, 255, 0.06);
  border: 1px solid rgba(165, 200, 255, 0.15);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 28px;
  animation: fadeDown 0.6s ease;
}

.hero-title {
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 20px;
  animation: fadeDown 0.7s ease 0.1s both;
}

.hero-title-accent {
  background: linear-gradient(135deg, #a5c8ff 0%, #3c92f4 40%, #b1c5ff 70%, #7c9dff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-sub);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 36px;
  animation: fadeDown 0.7s ease 0.2s both;
}

/* ── Hero Search Bar ──────────────────────────────────────────────────────── */
.hero-search-wrap {
  width: 100%;
  max-width: 600px;
  position: relative;
  animation: fadeDown 0.7s ease 0.3s both;
  margin-bottom: 20px;
}

.hero-search-box {
  display: flex;
  align-items: center;
  background: rgba(14, 29, 41, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(165, 200, 255, 0.18);
  border-radius: 16px;
  padding: 6px 6px 6px 18px;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 30px rgba(3, 15, 27, 0.5), 0 0 0 0 rgba(60, 146, 244, 0);
}

.hero-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 30px rgba(3, 15, 27, 0.5), 0 0 0 3px rgba(60, 146, 244, 0.15);
}

.hero-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#hero-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  min-width: 0;
  font-family: inherit;
  padding: 10px 0;
}

#hero-search-input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

#hero-search-btn {
  background: var(--gradient-primary);
  color: var(--on-primary);
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(60, 146, 244, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

#hero-search-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(60, 146, 244, 0.4);
}

#hero-search-btn:active {
  transform: translateY(0);
}

#hero-search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #0b1825;
  border: 1px solid rgba(165, 200, 255, 0.12);
  border-radius: 12px;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* ── Recent Searches ──────────────────────────────────────────────────────── */
#recent-searches-wrap {
  animation: fadeDown 0.7s ease 0.4s both;
}

.recent-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#recent-searches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.recent-item {
  background: rgba(14, 29, 41, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(165, 200, 255, 0.1);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.recent-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(60, 146, 244, 0.08);
}

/* ── Feature Cards Grid ─────────────────────────────────────────────────────── */
.hero-features-section {
  width: 100%;
  max-width: 800px;
  margin: 28px 0 36px;
  animation: fadeDown 0.7s ease 0.45s both;
}

.hero-features-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hf-card {
  width: calc(25% - 6px); /* Center 4 items exactly minus gaps */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 10px 14px;
  background: rgba(14, 29, 41, 0.45);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(165, 200, 255, 0.06);
  border-radius: 14px;
  transition: all 0.25s ease;
  cursor: default;
}

.hf-card:hover {
  border-color: rgba(165, 200, 255, 0.18);
  background: rgba(165, 200, 255, 0.05);
  transform: translateY(-2px);
}

.hf-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 18px;
  transition: transform 0.25s ease;
}

.hf-card:hover .hf-icon-wrap {
  transform: scale(1.12);
}

/* Icon wrap colors */
.hf-stats {
  background: rgba(60, 146, 244, 0.12);
}

.hf-nft {
  background: rgba(124, 157, 255, 0.12);
}

.hf-token {
  background: rgba(245, 197, 66, 0.12);
}

.hf-spell {
  background: rgba(168, 85, 247, 0.12);
}

.hf-rating {
  background: rgba(34, 197, 94, 0.12);
}

.hf-compare {
  background: rgba(165, 200, 255, 0.10);
}

.hf-share {
  background: rgba(59, 130, 246, 0.12);
}

.hf-live {
  background: rgba(239, 68, 68, 0.12);
}

.hf-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
}

.hf-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

@media (max-width: 700px) {
  .hf-card {
    width: calc(50% - 4px); /* Fallback to 2 items per row */
  }
}

/* ── Quick Links Section ──────────────────────────────────────────────────── */
.quick-links-section {
  width: 100%;
  max-width: 800px;
  animation: fadeDown 0.7s ease 0.55s both;
}

.ql-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.ql-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(165, 200, 255, 0.15), transparent);
}

.ql-divider-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  white-space: nowrap;
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.ql-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 29, 41, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(165, 200, 255, 0.08);
  border-radius: 14px;
  padding: 14px 16px;
  transition: all 0.25s ease;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.ql-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(165, 200, 255, 0.04), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ql-card:hover {
  border-color: rgba(165, 200, 255, 0.22);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(3, 15, 27, 0.5);
}

.ql-card:hover::before {
  opacity: 1;
}

.ql-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.ql-icon {
  font-size: 20px;
}

/* Icon wrap colors per type */
.ql-game .ql-icon-wrap {
  background: rgba(60, 146, 244, 0.12);
}

.ql-puzzle .ql-icon-wrap {
  background: rgba(124, 157, 255, 0.12);
}

.ql-dex .ql-icon-wrap {
  background: rgba(34, 197, 94, 0.12);
}

.ql-chain .ql-icon-wrap {
  background: rgba(60, 146, 244, 0.12);
}

.ql-nft .ql-icon-wrap {
  background: rgba(88, 130, 255, 0.12);
}

.ql-discord .ql-icon-wrap {
  background: rgba(88, 101, 242, 0.12);
}

.ql-twitter .ql-icon-wrap {
  background: rgba(165, 200, 255, 0.10);
}

.ql-info {
  flex: 1;
  min-width: 0;
  text-align: left;
  position: relative;
  z-index: 1;
}

.ql-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ql-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ql-arrow {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
  z-index: 1;
}

.ql-card:hover .ql-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* Hover accent colors per type */
.ql-game:hover {
  border-color: rgba(60, 146, 244, 0.3);
}

.ql-puzzle:hover {
  border-color: rgba(124, 157, 255, 0.3);
}

.ql-dex:hover {
  border-color: rgba(34, 197, 94, 0.3);
}

.ql-chain:hover {
  border-color: rgba(60, 146, 244, 0.3);
}

.ql-nft:hover {
  border-color: rgba(88, 130, 255, 0.3);
}

.ql-discord:hover {
  border-color: rgba(88, 101, 242, 0.3);
}

.ql-twitter:hover {
  border-color: rgba(165, 200, 255, 0.25);
}

/* ── Hero Token Widget ────────────────────────────────────────────────────── */
.hero-token-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 29, 41, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(165, 200, 255, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  z-index: 50;
  animation: fadeDown 0.7s ease 0.6s both;
  transition: var(--transition);
}

.hero-token-widget:hover {
  border-color: rgba(165, 200, 255, 0.2);
}

.htw-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.htw-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.htw-change {
  font-size: 11px;
  color: var(--text-muted);
}

/* Hide hero token widget when not on welcome */
body:has(#welcome.hidden) .hero-token-widget {
  display: none;
}

@media (max-width: 900px) {
  .quick-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .quick-links-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 32px;
    letter-spacing: -1px;
  }
}

/* ─── Loading Screen ───────────────────────────────────────────────────────── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  gap: 16px;
  position: relative;
  z-index: 1;
}

.loading-chess {
  font-size: 48px;
  animation: loadSpin 1.5s ease-in-out infinite;
}

@keyframes loadSpin {

  0%,
  100% {
    transform: rotate(-15deg) scale(1);
  }

  50% {
    transform: rotate(15deg) scale(1.1);
  }
}

#loading-txt {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 500;
}

.loading-bar-wrap {
  width: 180px;
  height: 2px;
  background: var(--outline-variant);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  animation: loadBar 1.5s ease-in-out infinite;
}

@keyframes loadBar {
  0% {
    width: 0%;
    margin-left: 0;
  }

  50% {
    width: 65%;
    margin-left: 15%;
  }

  100% {
    width: 0%;
    margin-left: 100%;
  }
}

/* ─── App Shell ─────────────────────────────────────────────────────────────── */
/* Hide 3D chess and particles on dashboard */
body:has(#app-shell:not(.hidden)) #chess3d-container,
body:has(#app-shell:not(.hidden)) #particles {
  display: none !important;
}

#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 56px);
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: rgba(4, 12, 22, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(165, 200, 255, 0.06);
  padding: 16px 0 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  align-self: start;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(165, 200, 255, 0.08) transparent;
}

#sidebar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(60, 146, 244, 0.15), rgba(177, 197, 255, 0.1), transparent);
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 16px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-link:hover {
  color: var(--text);
  background: rgba(165, 200, 255, 0.04);
  border-left-color: rgba(165, 200, 255, 0.15);
}

.sidebar-link.active {
  color: var(--primary);
  background: rgba(60, 146, 244, 0.06);
  border-left-color: var(--primary);
}

.sidebar-link .sl-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-link .sl-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(165, 200, 255, 0.1), transparent);
  margin: 8px 16px;
}

/* Sidebar token widget */
.sidebar-token {
  margin: 8px 12px 0;
  background: rgba(14, 29, 41, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(165, 200, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

.st-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.st-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
}

.st-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.st-change {
  font-size: 11px;
  margin-top: 3px;
}

/* ─── Main Content ─────────────────────────────────────────────────────────── */
#dashboard {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 20px;
}

/* ─── Profile Strip ────────────────────────────────────────────────────────── */
.profile-strip {
  background: rgba(14, 29, 41, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(165, 200, 255, 0.08);
  border-radius: 18px;
  padding: 22px 28px;
  margin-bottom: 16px;
  animation: fadeDown 0.35s ease;
  position: relative;
  overflow: hidden;
}

.profile-strip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60, 146, 244, 0.25), rgba(177, 197, 255, 0.15), transparent);
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-strip-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.profile-avatar-wrap {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(60, 146, 244, 0.3);
  object-fit: cover;
  display: block;
  box-shadow: 0 0 24px rgba(60, 146, 244, 0.2);
}

.profile-meta {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  word-break: break-word;
  background: linear-gradient(135deg, #a5c8ff 0%, #3c92f4 40%, #b1c5ff 70%, #7c9dff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.addr-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(14, 29, 41, 0.5);
  border: 1px solid rgba(165, 200, 255, 0.1);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 12px;
  font-family: monospace;
  transition: all 0.2s ease;
}

.addr-copy-btn:hover {
  color: var(--primary);
  border-color: rgba(60, 146, 244, 0.3);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--glass-bg);
  border: 1px solid;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.rating-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.rating-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.rating-bar-wrap {
  flex: 1;
  height: 3px;
  background: var(--outline-variant);
  border-radius: 2px;
  max-width: 140px;
}

.rating-bar {
  height: 3px;
  border-radius: 2px;
  transition: width 1s ease;
}

/* Dual rating display (Gambit + Ranked side by side) */
.rating-dual {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.rating-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 29, 41, 0.5);
  border: 1px solid rgba(165, 200, 255, 0.08);
  border-radius: 8px;
  padding: 5px 10px;
  transition: all 0.2s ease;
}

.rating-chip:hover {
  border-color: var(--chip-color, rgba(165, 200, 255, 0.15));
  background: rgba(14, 29, 41, 0.7);
}

.rc-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.rc-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.rc-bar-wrap {
  width: 60px;
  height: 3px;
  background: var(--outline-variant);
  border-radius: 2px;
}

.rc-bar {
  height: 3px;
  border-radius: 2px;
  transition: width 1s ease;
}

.rc-next {
  font-size: 10px;
  color: var(--text-muted);
}

.profile-stats-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.game-type-stats {
  background: rgba(14, 29, 41, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(165, 200, 255, 0.06);
  border-radius: 14px;
  padding: 10px 16px;
  min-width: 320px;
}

.gts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.game-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.game-type-badge.gambit {
  background: var(--gambit-dim);
  color: var(--gambit-color);
}

.game-type-badge.ranked {
  background: var(--ranked-dim);
  color: var(--ranked-color);
}

.gts-total {
  font-size: 11px;
  color: var(--text-muted);
}

.gts-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gts-item {
  text-align: center;
}

.gts-val {
  font-size: 16px;
  font-weight: 700;
}

.gts-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 1px;
}

/* ─── Tab Navigation ───────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: rgba(14, 29, 41, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(165, 200, 255, 0.06);
  border-radius: 14px;
  padding: 3px;
}

.tab-btn {
  flex: none;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn svg {
  flex-shrink: 0;
}

.tab-btn:hover {
  background: rgba(165, 200, 255, 0.05);
  color: var(--text);
}

.tab-btn.active {
  background: rgba(60, 146, 244, 0.15);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(60, 146, 244, 0.15);
}

/* ─── Tab Panels ───────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: panelIn 0.2s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ─── Overview Layout ──────────────────────────────────────────────────────── */
.overview-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.stat-card--streak::before {
  background: linear-gradient(90deg, #EF4444, #F97316, transparent);
}

.stat-card--peak::before {
  background: linear-gradient(90deg, #F5C542, #F97316, transparent);
}

.stat-card--moves::before {
  background: linear-gradient(90deg, #3c92f4, #7c9dff, transparent);
}

.stat-card:hover {
  border-color: rgba(165, 200, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(3, 15, 27, 0.4);
}

.stat-card:hover::before {
  opacity: 1;
}

/* Stat card icon wraps */
.sc-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.sc-icon--fire {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
}

.sc-icon--star {
  background: rgba(245, 197, 66, 0.12);
  color: #F5C542;
}

.sc-icon--moves {
  background: rgba(60, 146, 244, 0.12);
  color: #3c92f4;
}

.sc-icon-wrap svg {
  stroke: currentColor;
}

.sc-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.sc-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
}

.sc-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.overview-mid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.overview-full {
  margin-bottom: 14px;
}

.wl-chart-wrap {
  height: 150px;
  position: relative;
}

.wl-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.wl-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.wl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.rating-chart-wrap {
  height: 170px;
}

.spell-chart-wrap {
  height: 200px;
}

/* Top spells */
.top-spell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(165, 200, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: var(--transition);
}

.top-spell:hover {
  background: rgba(165, 200, 255, 0.08);
  border-color: rgba(165, 200, 255, 0.2);
}

.ts-medal {
  font-size: 18px;
}

.ts-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: contain;
}

.ts-icon-fallback {
  display: none;
}

.ts-info {
  flex: 1;
  min-width: 0;
}

.ts-name {
  font-size: 13px;
  font-weight: 600;
}

.ts-stats {
  font-size: 11px;
  color: var(--text-sub);
}

/* Token summary */
.token-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tsm-item {
  background: rgba(14, 29, 41, 0.5);
  border: 1px solid rgba(165, 200, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
}

.tsm-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.tsm-val {
  font-size: 16px;
  font-weight: 700;
}

/* ─── Match History ────────────────────────────────────────────────────────── */
.match-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-right: 2px;
}

.filter-btn {
  background: rgba(14, 29, 41, 0.5);
  border: 1px solid rgba(165, 200, 255, 0.08);
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--gold-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.filter-btn.active.gambit-active {
  background: var(--gambit-dim);
  border-color: var(--gambit-color);
  color: var(--gambit-color);
}

.filter-btn.active.ranked-active {
  background: var(--ranked-dim);
  border-color: var(--ranked-color);
  color: var(--ranked-color);
}

.filter-select {
  background: rgba(14, 29, 41, 0.5);
  border: 1px solid rgba(165, 200, 255, 0.1);
  border-radius: 8px;
  padding: 5px 28px 5px 12px;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='rgba(165, 200, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 120px;
}

.filter-select:hover, .filter-select:focus {
  border-color: var(--primary);
  color: var(--text);
  background-color: rgba(14, 29, 41, 0.7);
}

.filter-select option {
  background: #071421;
  color: var(--text);
  padding: 8px;
}

.match-type-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.match-type-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outline-variant);
  opacity: 0.5;
}

#match-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-card {
  display: flex;
  background: rgba(14, 29, 41, 0.35);
  border: 1px solid rgba(165, 200, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.match-card:hover {
  background: rgba(14, 29, 41, 0.55);
  border-color: rgba(165, 200, 255, 0.12);
  transform: translateX(3px);
}

.match-outcome-bar {
  width: 3px;
  flex-shrink: 0;
}

.match-card.win .match-outcome-bar {
  background: var(--win);
}

.match-card.lose .match-outcome-bar {
  background: var(--lose);
}

.match-card.cancel .match-outcome-bar {
  background: var(--cancel);
}

.match-content {
  flex: 1;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.match-top,
.match-mid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.outcome-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.outcome-badge.win {
  background: var(--win-dim);
  color: var(--win);
}

.outcome-badge.lose {
  background: var(--red-dim);
  color: var(--red);
}

.outcome-badge.cancel {
  background: rgba(75, 85, 99, 0.2);
  color: var(--cancel);
}

.match-type-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.match-type-tag.gambit {
  background: var(--gambit-dim);
  color: var(--gambit-color);
}

.match-type-tag.ranked {
  background: var(--ranked-dim);
  color: var(--ranked-color);
}

.rating-gain {
  font-size: 12px;
  color: var(--win);
  font-weight: 600;
}

.rating-loss {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
}

.match-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.match-vs {
  font-size: 11px;
  color: var(--text-muted);
}

.opp-addr-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: monospace;
  padding: 0;
}

.opp-addr-btn:hover {
  text-decoration: underline;
}

.opp-elo {
  font-size: 11px;
  color: var(--text-muted);
}

.match-moves {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.match-spells {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.spell-chip {
  background: var(--surface-high);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text-sub);
  font-weight: 500;
  white-space: nowrap;
}

.match-meta-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(165, 200, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
}

.opp-rank-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.opp-rank-chip.apprentice {
  background: rgba(156, 163, 175, 0.12);
  color: #9CA3AF;
}

.opp-rank-chip.bronze {
  background: rgba(205, 127, 50, 0.12);
  color: #CD7F32;
}

.opp-rank-chip.silver {
  background: rgba(192, 192, 192, 0.12);
  color: #C0C0C0;
}

.opp-rank-chip.gold {
  background: var(--gambit-dim);
  color: var(--gambit-color);
}

.opp-rank-chip.platinum {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.opp-rank-chip.diamond {
  background: var(--ranked-dim);
  color: var(--ranked-color);
}

#load-more-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

#load-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ─── Collection ───────────────────────────────────────────────────────────── */
.coll-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.coll-tab-btn {
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.coll-tab-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.coll-tab-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--gold-dim);
}

.coll-count-badge {
  background: var(--surface-highest);
  border: 1px solid var(--outline-variant);
  border-radius: 50px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.coll-panel {
  display: none;
}

.coll-panel.active {
  display: block;
}

.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.nft-card {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.nft-card:hover {
  border-color: rgba(165, 200, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(3, 15, 27, 0.65);
}

.nft-img-wrap {
  flex-shrink: 0;
  position: relative;
  aspect-ratio: 4/3;
  width: 100%;
  background: radial-gradient(circle at top, var(--surface-highest), var(--surface-high));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nft-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.nft-card:hover .nft-img {
  transform: scale(1.08);
}

.nft-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 36px;
  color: var(--text-muted);
  opacity: 0.4;
}

.nft-mana {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(6, 16, 28, 0.84);
  color: var(--cyan);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 212, 238, 0.25);
}

.nft-info {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
}

.nft-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nft-desc {
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spell-img {
  object-fit: contain;
  padding: 16px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

/* Ethernal NFT — golden premium variant */
.nft-card--ethernal {
  border-color: rgba(245, 197, 66, 0.25);
  background: linear-gradient(150deg, rgba(14, 29, 41, 0.85) 0%, rgba(20, 18, 10, 0.9) 100%);
}

.nft-card--ethernal:hover {
  border-color: rgba(245, 197, 66, 0.55);
  box-shadow: 0 14px 36px rgba(3, 15, 27, 0.65), 0 0 28px rgba(245, 197, 66, 0.12);
}

.nft-img-wrap {
  position: relative;
}

.nft-ethernal-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.9), rgba(200, 150, 30, 0.9));
  color: #1a1000;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(245, 197, 66, 0.3);
}

/* NFT Attribute chips (Ethernals traits) */
.nft-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.nft-attr-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(245, 197, 66, 0.06);
  border: 1px solid rgba(245, 197, 66, 0.15);
  border-radius: 5px;
  padding: 3px 6px;
  min-width: 0;
}

.nft-attr-type {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(245, 197, 66, 0.7);
}

.nft-attr-val {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Token Panel ──────────────────────────────────────────────────────────── */
.token-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 680px;
}

.token-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.token-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--gradient-primary-dim);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.token-icon-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.token-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.token-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.token-price {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
}

.token-change {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.token-change.up {
  color: var(--win);
}

.token-change.down {
  color: var(--red);
}

.token-price-wrap {
  margin-left: auto;
  text-align: right;
}

.token-balance-card {
  background: var(--surface-high);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tb-main {
  flex: 1;
  min-width: 200px;
}

.tb-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.tb-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 10px;
}

.tb-usd {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 2px;
}

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

.tb-chain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
}

.tb-chain-amt {
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
}

.chain-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chain-badge.base {
  background: rgba(0, 82, 255, 0.15);
  color: #0052FF;
  border: 1px solid rgba(0, 82, 255, 0.3);
}

.chain-badge.abstract {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

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

.ts-item {
  background: var(--surface-high);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.ts-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}

.ts-val {
  font-size: 15px;
  font-weight: 700;
}

.token-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Live Feed ────────────────────────────────────────────────────────────── */
.live-feed-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 14px;
}

.live-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--win);
}

.live-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--win);
  animation: livePulse 1.5s ease infinite;
}

/* ─── Compare Modal ────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
}

.modal.active {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 15, 27, 0.75);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 92%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-highest);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.compare-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.compare-search-row input {
  flex: 1;
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.compare-search-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(165, 200, 255, 0.10);
}

.compare-grid {
  display: flex;
  align-items: center;
  gap: 16px;
}

.compare-vs {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}

.compare-player {
  flex: 1;
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.cmp-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 2px solid var(--primary-dim);
  object-fit: cover;
  display: block;
}

.cmp-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cmp-rank {
  font-size: 12px;
  margin-bottom: 12px;
}

.cmp-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.cmp-stat {
  background: var(--surface-highest);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.csv {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

.csk {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Share modal */
.modal-box-share {
  max-width: 420px;
}

.share-preview-wrap {
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid rgba(165, 200, 255, 0.15);
  box-shadow: 0 0 24px rgba(60, 146, 244, 0.12);
  position: relative;
  aspect-ratio: 4/5;
}

.share-preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.share-actions {
  display: flex;
  gap: 10px;
}

/* ─── Overview Type Split — Enhanced ──────────────────────────────────────── */
.overview-type-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.ots-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.ots-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

#gambit-stats-card::before {
  background: linear-gradient(90deg, var(--gambit-color), transparent);
}

#ranked-stats-card::before {
  background: linear-gradient(90deg, var(--ranked-color), transparent);
}

.ots-card:hover {
  border-color: rgba(165, 200, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(3, 15, 27, 0.3);
}

.ots-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ots-total {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.ots-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ots-item {
  text-align: center;
}

.ots-val {
  font-size: 20px;
  font-weight: 700;
}

.ots-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ─── Empty & Error States ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.error-state {
  color: var(--red);
  text-align: center;
  padding: 20px;
}

.loading-mini {
  text-align: center;
  padding: 20px;
  color: var(--text-sub);
}

/* ─── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  max-width: 280px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass-blur);
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-color: var(--win);
  color: var(--win);
}

.toast-error {
  border-color: var(--red);
  color: var(--red);
}

.toast-warn {
  border-color: var(--primary);
  color: var(--primary);
}

.toast-info {
  border-color: var(--secondary);
  color: var(--secondary);
}

/* ─── Pagination ───────────────────────────────────────────────────────────── */
#match-pagination {
  margin-top: 12px;
}

.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  border-top: 1px solid var(--outline-variant);
}

.pg-info {
  font-size: 12px;
  color: var(--text-sub);
}

.pg-info strong {
  color: var(--text);
  font-weight: 600;
}

.pg-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pg-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-btn:hover:not(:disabled) {
  background: var(--glass-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.pg-btn.pg-active {
  background: var(--gold-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(165, 200, 255, 0.12);
}

.pg-btn.pg-disabled,
.pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pg-ellipsis {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 34px;
  user-select: none;
}

/* ─── Skeleton Shimmer ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0% {
    background-position: -800px 0;
  }

  100% {
    background-position: 800px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--surface-high) 25%,
      rgba(165, 200, 255, 0.05) 50%,
      var(--surface-high) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 6px;
}

/* ─── Chart Time Filter ────────────────────────────────────────────────────── */
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title-row .card-title {
  margin-bottom: 0;
}

.chart-time-filter {
  display: flex;
  gap: 4px;
}

.ctf-btn {
  background: var(--surface-high);
  border: 1px solid var(--outline-variant);
  border-radius: 5px;
  padding: 4px 10px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ctf-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ctf-btn.active {
  background: var(--gold-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ─── Search Input Error ───────────────────────────────────────────────────── */
.input-error {
  animation: inputShake 0.4s ease;
}

#search-input.input-error {
  color: var(--red);
}

.search-box:has(#search-input.input-error) {
  border-color: var(--red);
}

@keyframes inputShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

/* ─── Misc ─────────────────────────────────────────────────────────────────── */
.suggestion-header {
  padding: 8px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(165, 200, 255, 0.08);
  background: #0e1c2d;
}

.compare-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.compare-recent-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  width: 100%;
  margin-bottom: 2px;
}

.winrate-tooltip-wrap {
  position: relative;
}

.winrate-tooltip-wrap:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--surface-highest);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  z-index: 99;
  box-shadow: var(--shadow);
}

/* ─── Ambient background glow ──────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60vw;
  height: 60vh;
  background: radial-gradient(ellipse, rgba(60, 146, 244, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ─── H2H Page ─────────────────────────────────────────────────────────────── */
.h2h-win-val {
  color: var(--win);
}

.h2h-loss-val {
  color: var(--red);
}

.h2h-draw-val {
  color: var(--gold);
}

.h2h-vs-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-highest);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  box-shadow: 0 0 24px rgba(60, 146, 244, 0.35);
  flex-shrink: 0;
}

/* New H2H redesign */
.h2h-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.h2h-score-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
}

@media (max-width: 700px) {
  .h2h-score-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .h2h-vs-col {
    order: -1;
  }
}

.h2h-player-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.h2h-pfp {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  border: 2px solid var(--glass-border);
  background: var(--surface-high);
  object-fit: cover;
  margin-bottom: 4px;
}

.h2h-pname {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-paddr {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

.h2h-pbig {
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  margin-top: 8px;
}

.h2h-psub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.h2h-vs-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.h2h-record-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.h2h-record-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -4px;
}

.h2h-wr-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  margin: 2px 0;
}

.h2h-wr-you {
  height: 100%;
  border-radius: 4px;
  background: var(--win);
  transition: flex 0.4s ease;
}

.h2h-wr-opp {
  height: 100%;
  border-radius: 4px;
  background: var(--red);
  transition: flex 0.4s ease;
}

.h2h-wr-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 12px;
  font-weight: 600;
}

.h2h-matches-section {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 20px;
}

.h2h-matches-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.h2h-matches-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-high);
  border-radius: 20px;
  padding: 3px 10px;
}

.h2h-match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.h2h-lists-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(ellipse, rgba(177, 197, 255, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   H2H BATTLE ARENA — Full redesign
═══════════════════════════════════════════════════════════════════════════ */
.h2h-battle-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

/* ─── Arena Hero Header ─── */
.h2h-arena {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 40px 32px 36px;
  background: linear-gradient(135deg, rgba(6, 14, 26, 0.98) 0%, rgba(10, 20, 36, 0.94) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 260px;
}

/* Aura glows */
.arena-aura {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.arena-aura--left {
  left: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(60, 146, 244, 0.24) 0%, transparent 65%);
}

.arena-aura--right {
  right: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(239, 68, 68, 0.2) 0%, transparent 65%);
}

/* Divider glow line */
.h2h-arena::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60, 146, 244, 0.4), rgba(239, 68, 68, 0.4), transparent);
}

/* Chess king decoration */
.arena-king {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 190px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  line-height: 1;
  user-select: none;
}

.arena-king--left {
  left: -18px;
  color: #3c92f4;
  text-shadow: 0 0 80px rgba(60, 146, 244, 0.5);
}

.arena-king--right {
  right: -18px;
  color: #EF4444;
  text-shadow: 0 0 80px rgba(239, 68, 68, 0.5);
}

/* Players */
.arena-player {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.arena-player--left {
  padding-right: 8px;
}

.arena-player--right {
  padding-left: 8px;
}

/* Avatar */
.arena-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 6px;
}

.arena-pfp {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.arena-avatar--blue .arena-pfp {
  border: 3px solid rgba(60, 146, 244, 0.8);
}

.arena-avatar--red .arena-pfp {
  border: 3px solid rgba(239, 68, 68, 0.7);
}

.arena-glow {
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  filter: blur(14px);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.arena-glow--blue {
  background: #3c92f4;
}

.arena-glow--red {
  background: #EF4444;
}

.arena-interactive-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  transition: background 0.1s ease;
}

.h2h-arena:hover .arena-glow {
  opacity: 0.45;
}

.arena-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arena-addr {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

.arena-win-big {
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  margin-top: 8px;
}

.arena-win-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Center VS column */
.arena-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}

.arena-vs-badge {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface-highest);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 32px rgba(60, 146, 244, 0.5), 0 0 64px rgba(60, 146, 244, 0.15);
}

.arena-vs-text {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 2px;
}

.arena-score {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.arena-score-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -6px;
}

.arena-wr-wrap {
  width: 100%;
}

.arena-wr-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 5px;
}

.arena-wr-you {
  height: 100%;
  background: var(--win);
  border-radius: 4px;
}

.arena-wr-opp {
  height: 100%;
  background: var(--red);
  border-radius: 4px;
}

.arena-wr-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.arena-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  max-width: 180px;
}

.arena-type-pill {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(165, 200, 255, 0.07);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2px 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 700px) {
  .h2h-arena {
    grid-template-columns: 1fr;
    padding: 24px 16px;
    gap: 16px;
  }

  .arena-center {
    order: -1;
  }

  .arena-king {
    display: none;
  }
}

/* ─── Recap Stats Bar ─── */
.h2h-recap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 16px 24px;
}

.recap-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 20px;
}

.recap-val {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.recap-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
}

.recap-sep {
  width: 1px;
  height: 36px;
  background: var(--glass-border);
  flex-shrink: 0;
}

/* ─── Battle Log ─── */
.h2h-battle-log {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 20px;
}

.battle-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.battle-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── H2H Match Row ─── */
.h2h-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  background: var(--surface-high);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.h2h-match-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.h2h-match-row.win {
  border-color: rgba(34, 197, 94, 0.22);
}

.h2h-match-row.win::before {
  background: var(--win);
}

.h2h-match-row.lose {
  border-color: rgba(239, 68, 68, 0.22);
}

.h2h-match-row.lose::before {
  background: var(--red);
}

.h2h-match-row.draw {
  border-color: rgba(245, 197, 66, 0.2);
}

.h2h-match-row.draw::before {
  background: var(--gold);
}

.h2h-match-row.cancel {
  opacity: 0.55;
}

.h2h-match-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Spell side columns */
.h2h-row-spells {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.h2h-row-spells--left {
  align-items: flex-start;
}

.h2h-row-spells--right {
  align-items: flex-end;
  text-align: right;
}

.h2h-spell-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
  margin-bottom: 2px;
}

.h2h-spell-chip {
  display: inline-block;
  font-size: 10px;
  background: rgba(165, 200, 255, 0.09);
  border: 1px solid rgba(165, 200, 255, 0.15);
  color: var(--text-sub);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 500;
}

.h2h-no-spell {
  font-size: 11px;
  color: rgba(165, 200, 255, 0.3);
}

/* Center column */
.h2h-row-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 145px;
  text-align: center;
}

/* Outcome badge */
.h2h-row-outcome {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 6px;
}

.h2h-row-outcome.win {
  color: var(--win);
  background: rgba(34, 197, 94, 0.1);
}

.h2h-row-outcome.lose {
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

.h2h-row-outcome.draw {
  color: var(--gold);
  background: rgba(245, 197, 66, 0.1);
}

.h2h-row-outcome.cancel {
  color: var(--text-muted);
  background: var(--surface-highest);
}

.h2h-outcome-label {
  font-size: 12px;
  font-weight: 800;
}

.h2h-victor-arrow {
  font-size: 10px;
}

/* Meta chips row */
.h2h-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

/* Actions */
.h2h-row-actions {
  display: flex;
  gap: 6px;
}

.h2h-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--primary);
  background: rgba(60, 146, 244, 0.1);
  border: 1px solid rgba(60, 146, 244, 0.25);
  border-radius: 6px;
  padding: 3px 9px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.h2h-share-btn:hover {
  border-color: var(--primary);
  background: rgba(60, 146, 244, 0.18);
  color: #fff;
}

@media (max-width: 600px) {
  .h2h-match-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .h2h-row-spells--right {
    align-items: flex-start;
    text-align: left;
  }
}

/* ─── H2H Battle Log Pagination ─────────────────────────────────────────────── */
.h2h-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.h2h-pg-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  background: var(--surface-high);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.h2h-pg-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(60, 146, 244, 0.08);
}

.h2h-pg-btn.active {
  background: rgba(60, 146, 244, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(60, 146, 244, 0.2);
}

.h2h-pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.h2h-pg-sep {
  font-size: 14px;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 34px;
  user-select: none;
}

/* ─── Floating H2H Button (FAB) ──────────────────────────────────────────────── */
.fab-h2h {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  background: linear-gradient(135deg, #3c5aff 0%, #7c3aed 100%);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(60, 90, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
}

.fab-h2h:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 32px rgba(60, 90, 255, 0.65), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fab-h2h:active {
  transform: translateY(0) scale(0.97);
}

/* ─── H2H Lookup Modal ────────────────────────────────────────────────────────── */
.modal-box-h2h {
  max-width: 520px;
}

.h2h-lookup-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}

.h2h-lookup-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.h2h-lookup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.h2h-lookup-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.h2h-lookup-dot--blue {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

.h2h-lookup-dot--red {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.h2h-lookup-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-highest);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 12px;
  font-family: monospace;
  transition: var(--transition);
  box-sizing: border-box;
}

.h2h-lookup-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 146, 244, 0.15);
}

.h2h-lookup-vs-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 24px;
}

.h2h-lookup-vs-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-highest);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.h2h-lookup-submit {
  width: 100%;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
}

.h2h-lookup-status {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  min-height: 20px;
  color: var(--text-muted);
}

@media (max-width: 500px) {
  .h2h-lookup-inputs {
    grid-template-columns: 1fr;
  }

  .h2h-lookup-vs-col {
    padding-top: 0;
  }

  .fab-h2h {
    bottom: 16px;
    right: 16px;
    padding: 11px 18px;
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   H2H STANDALONE PAGE (h2h.html)
═══════════════════════════════════════════════════════════════════════════ */
.h2h-page-wrapper {
  position: relative;
  z-index: 10;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 20px;
  box-sizing: border-box;
}

/* ─── Page Header ─── */
.h2h-page-header {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.h2h-page-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.h2h-page-back:hover {
  color: var(--text);
}

.h2h-page-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.h2h-page-logo-icon {
  font-size: 22px;
}

.h2h-page-logo-text {
  font-size: 18px;
  color: var(--text-sub);
}

.h2h-page-logo-text strong {
  color: var(--text);
  font-weight: 800;
}

/* ─── Hero Form Section ─── */
.h2h-page-hero {
  width: 100%;
  max-width: 900px;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.h2h-page-hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, #a0c0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.h2h-page-hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
}

/* ─── Form ─── */
.h2h-page-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 16px;
  align-items: end;
  width: 100%;
  margin-top: 8px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
}

.h2h-page-player-input {
  display: flex;
  align-items: center;
  gap: 12px;
}

.h2h-page-player-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  flex-shrink: 0;
}

.h2h-page-player-badge--a {
  background: rgba(60, 146, 244, 0.2);
  color: #3c92f4;
  border: 1px solid rgba(60, 146, 244, 0.3);
}

.h2h-page-player-badge--b {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.h2h-page-input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.h2h-page-input-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.h2h-page-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-highest);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
  transition: var(--transition);
  box-sizing: border-box;
}

.h2h-page-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 146, 244, 0.12);
}

.h2h-page-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 2px;
}

.h2h-page-vs-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: var(--surface-highest);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

.h2h-page-submit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(60, 146, 244, 0.35);
}

.h2h-page-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(60, 146, 244, 0.45);
}

.h2h-page-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.h2h-page-status {
  font-size: 13px;
  min-height: 20px;
}

@media (max-width: 700px) {
  .h2h-page-form {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 16px;
  }

  .h2h-page-vs {
    display: none;
  }
}

/* ─── Results ─── */
.h2h-page-results {
  width: 100%;
  max-width: 1000px;
  margin-top: 32px;
}

.h2h-page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 60px 20px;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
}

.h2h-page-empty-icon {
  font-size: 52px;
  opacity: 0.35;
}

.h2h-page-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.h2h-page-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCAN OVERLAY ANIMATION
═══════════════════════════════════════════════════════════════════════════ */
.h2h-scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 99000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 10, 0.85);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.h2h-scan-overlay.visible {
  opacity: 1;
}

.h2h-scan-box {
  width: min(560px, 90vw);
  background: linear-gradient(135deg, rgba(10, 18, 32, 0.98) 0%, rgba(6, 12, 24, 0.95) 100%);
  border: 1px solid rgba(60, 146, 244, 0.3);
  border-radius: 24px;
  padding: 36px 40px;
  box-shadow: 0 0 80px rgba(60, 146, 244, 0.15), 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.h2h-scan-overlay.visible .h2h-scan-box {
  transform: scale(1);
}

.h2h-scan-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 4px 12px;
  border-radius: 20px;
  width: fit-content;
  background: rgba(60, 146, 244, 0.12);
  color: var(--primary);
  border: 1px solid rgba(60, 146, 244, 0.25);
  animation: scan-pulse 1.5s ease infinite;
}

.h2h-scan-phase-badge--scan {
  background: rgba(60, 146, 244, 0.12);
  color: var(--primary);
  border-color: rgba(60, 146, 244, 0.25);
}

.h2h-scan-phase-badge--analyze {
  background: rgba(245, 197, 66, 0.1);
  color: var(--gold);
  border-color: rgba(245, 197, 66, 0.2);
}

.h2h-scan-phase-badge--done {
  background: rgba(34, 197, 94, 0.1);
  color: var(--win);
  border-color: rgba(34, 197, 94, 0.2);
  animation: none;
}

@keyframes scan-pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.55
  }
}

.h2h-scan-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.h2h-scan-addr {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
  min-height: 16px;
}

/* Progress bar */
.h2h-scan-bar-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: visible;
}

.h2h-scan-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #3c92f4, #a855f7);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.h2h-scan-bar-fill::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 12px #a855f7;
}

.h2h-scan-bar-glow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 6px;
  border-radius: 3px;
  background: rgba(168, 85, 247, 0.6);
  filter: blur(8px);
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.h2h-scan-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-height: 24px;
}

.h2h-scan-msg {
  font-size: 13px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 4px;
}

.scan-dots::after {
  content: '...';
  animation: scan-dots 1.2s steps(4, end) infinite;
}

@keyframes scan-dots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }
}

/* Scan log */
.h2h-scan-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 90px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.scan-log-line {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  animation: log-appear 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-log-line:last-child {
  color: var(--text-sub);
}

@keyframes log-appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ─── H2H Match Row: Side Outcome Badges ────────────────────────────────────── */
.h2h-side-outcome {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
  width: fit-content;
}

.h2h-side-outcome--win {
  background: rgba(34, 197, 94, 0.15);
  color: var(--win);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.h2h-side-outcome--lose {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.h2h-side-outcome--draw {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.h2h-side-outcome--cancel {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.15);
}

/* right side badge aligns to the right */
.h2h-row-spells--right .h2h-side-outcome {
  align-self: flex-end;
  margin-left: auto;
}

.h2h-row-spells--right {
  align-items: flex-end;
}

.h2h-no-spell {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── H2H Center Column Details Label ─────────────────────────────────────── */
.h2h-row-details-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
  margin-bottom: 2px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Full mobile / tablet support
   Breakpoints: 768px (tablet), 600px (mobile), 480px (small), 380px (xs)
═══════════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Header ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #main-header {
    padding: 0 16px;
    gap: 10px;
    height: 52px;
  }

  .header-search-wrap {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }

  .header-link-btn .btn-label {
    display: none;
  }

  #live-indicator span:not(.live-dot) {
    display: none;
  }
}

/* ─── 2. App Shell: Sidebar → Bottom Nav ────────────────────────────────────── */
@media (max-width: 768px) {
  #app-shell {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 52px);
  }

  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: unset;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 6px 8px;
    border-right: none;
    border-top: 1px solid rgba(165, 200, 255, 0.1);
    background: rgba(4, 10, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    overflow-x: auto;
    scrollbar-width: none;
    min-height: 60px;
  }

  #sidebar::-webkit-scrollbar {
    display: none;
  }

  #sidebar::after {
    display: none;
  }

  /* hide gradient border */

  /* Hide everything except the nav tab section */
  .sidebar-section:not(.sidebar-nav-main),
  .sidebar-sep,
  .sidebar-token,
  .sidebar-section-title {
    display: none;
  }

  /* Nav tabs become horizontal items */
  .sidebar-nav-main {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    margin: 0;
  }

  .sidebar-link {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 16px;
    font-size: 10px;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px;
    flex: 1;
    min-width: 60px;
    text-align: center;
  }

  .sidebar-link:hover {
    border-left-color: transparent;
  }

  .sidebar-link.active {
    border-left-color: transparent;
    border-bottom-color: var(--primary);
    background: rgba(60, 146, 244, 0.08);
  }

  .sidebar-link .sl-icon {
    width: auto;
    font-size: 18px;
  }

  .sidebar-link .sl-text {
    font-size: 10px;
    line-height: 1;
  }

  /* Main content: add bottom padding to clear fixed bottom nav */
  #main-content {
    padding-bottom: 76px;
  }
}

/* ─── 3. Stats Grids ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .gts-cols {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-top {
    grid-template-columns: 1fr 1fr;
  }

  .cmp-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .token-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-type-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .overview-top {
    grid-template-columns: 1fr;
  }

  .overview-mid {
    grid-template-columns: 1fr;
  }

  .token-summary-grid {
    grid-template-columns: 1fr;
  }

  .ots-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .wl-legend {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 380px) {
  .gts-cols {
    gap: 6px;
  }

  .token-stats-row {
    grid-template-columns: 1fr;
  }
}

/* ─── 4. H2H Match Row ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .h2h-match-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .h2h-row-spells--left,
  .h2h-row-spells--right {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .h2h-row-spells--right {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .h2h-row-spells--right .h2h-side-outcome {
    margin-left: 0;
    align-self: flex-start;
  }

  .h2h-row-meta {
    flex-wrap: wrap;
    gap: 6px;
  }

  .h2h-row-center {
    gap: 8px;
  }

  .h2h-row-details-label {
    text-align: left;
  }
}

/* ─── 5. H2H Arena (Score Card + Battle Header) ─────────────────────────────── */
@media (max-width: 768px) {
  .h2h-arena {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 16px;
  }

  .h2h-score-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .h2h-player-block {
    flex-direction: column !important;
    text-align: center;
    align-items: center;
  }

  .h2h-player-block.right {
    flex-direction: column !important;
  }

  .h2h-vs-divider {
    flex-direction: row;
    padding: 0;
  }
}

/* ─── 6. H2H Page Form ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .h2h-page-hero-title {
    font-size: 36px;
  }

  .h2h-page-hero-sub {
    font-size: 13px;
  }

  .h2h-page-form {
    padding: 16px 12px;
  }

  .h2h-page-submit {
    padding: 12px 16px;
    font-size: 13px;
  }

  .h2h-page-wrapper {
    padding: 80px 12px 60px;
  }
}

/* ─── 7. Match History Cards ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .match-card {
    padding: 12px 10px;
    gap: 10px;
  }

  .match-spells {
    flex-wrap: wrap;
    gap: 4px;
  }

  .spell-btn {
    font-size: 9px;
    padding: 2px 6px;
  }

  .tab-btn {
    font-size: 11px;
    padding: 6px 10px;
    gap: 5px;
  }

  .tab-btn span:not(.sl-icon) {
    display: none;
  }

  /* icon only on small */
}

/* ─── 8. Modal Boxes — Full Screen Mobile ───────────────────────────────────── */
@media (max-width: 480px) {
  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    min-width: unset;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px 32px;
    margin: 0;
  }

  .modal-box-h2h {
    max-width: 100%;
  }

  .h2h-lookup-inputs {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .h2h-lookup-vs-col {
    display: none;
  }
}

/* ─── 9. FAB Button — above bottom nav ──────────────────────────────────────── */
@media (max-width: 768px) {
  .fab-h2h {
    bottom: 76px;
    right: 16px;
  }
}

/* ─── 10. NFT Grid ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .nft-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .nft-card-img {
    height: 120px;
  }
}

/* ─── 11. Charts ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .win-loss-chart-wrap {
    height: 180px !important;
  }

  canvas {
    max-width: 100% !important;
  }

  .overview-top .stat-card canvas {
    max-height: 160px;
  }
}

/* ─── 12. Welcome / Hero Section ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hero-section {
    padding: 24px 16px 16px;
    gap: 12px;
  }

  .hero-title {
    font-size: clamp(26px, 8vw, 36px);
  }

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

  .hero-search-box {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }

  .hero-search-icon {
    display: none;
  }

  #hero-search-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
  }

  #hero-search-btn {
    width: 100%;
    border-radius: 10px;
    padding: 13px;
    justify-content: center;
  }

  .hero-badge {
    font-size: 9px;
    padding: 4px 12px;
  }

  .quick-links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .ql-card {
    padding: 10px 12px;
    gap: 8px;
  }
}

/* ─── Global utilities ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Prevent any horizontal overflow */
  body {
    overflow-x: clip;
  }

  /* Cards spacing on mobile */
  .card {
    padding: 14px 12px;
  }

  /* Profile header compact */
  .profile-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  /* Section tab bar scroll horizontal */
  .section-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .section-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Main content full width */
  #main-content {
    min-width: 0;
  }
}

/* Scan overlay mobile */
@media (max-width: 480px) {
  .h2h-scan-box {
    padding: 24px 20px;
  }

  .h2h-scan-title {
    font-size: 18px;
  }

  .h2h-scan-count {
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MOBILE HOTFIX — Fixes overflow, broken IDs, and layout issues on mobile
═══════════════════════════════════════════════════════════════════════════════ */

/* Fix: #main-content doesn't exist, actual ID is #dashboard */
@media (max-width: 768px) {
  #dashboard {
    padding: 12px 12px 80px;
    /* 80px bottom clears fixed bottom nav */
    min-width: 0;
  }
}

/* Fix: game-type-stats min-width causes overflow on mobile */
@media (max-width: 768px) {
  .game-type-stats {
    min-width: 0 !important;
    width: 100%;
  }

  .profile-stats-area {
    flex-shrink: 1;
    width: 100%;
  }

  .profile-strip {
    padding: 14px 16px;
  }

  .profile-strip-inner {
    gap: 12px;
  }

  .profile-name {
    font-size: 16px;
  }

  .profile-avatar-wrap {
    width: 48px;
    height: 48px;
  }

  .profile-avatar {
    width: 48px;
    height: 48px;
  }

  /* Rating dual compact */
  .rating-dual {
    gap: 6px;
  }

  .rc-bar-wrap {
    width: 40px;
  }

  .rating-bar-wrap {
    max-width: 100%;
  }
}

/* Fix: tab-nav needs horizontal scroll on mobile */
@media (max-width: 768px) {
  .tab-nav {
    overflow-x: auto;
    scrollbar-width: none;
    padding: 3px;
    gap: 2px;
    flex-wrap: nowrap;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 7px 13px;
    font-size: 12px;
  }

  .coll-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .coll-tabs::-webkit-scrollbar {
    display: none;
  }
}

/* Fix: Match card inner flex elements overflow */
@media (max-width: 480px) {
  .match-content {
    padding: 8px 10px;
    gap: 4px;
  }

  .match-top,
  .match-mid {
    gap: 5px;
  }

  .match-time {
    margin-left: 0;
  }

  .match-moves {
    margin-left: 0;
  }

  .opp-addr-btn {
    font-size: 11px;
  }
}

/* Fix: Overview stat cards on mobile */
@media (max-width: 768px) {
  .stat-card {
    padding: 14px 12px;
  }

  .overview-top {
    gap: 8px;
    margin-bottom: 10px;
  }

  .overview-mid {
    gap: 8px;
  }
}

/* Fix: Cards general padding on mobile */
@media (max-width: 768px) {
  .card {
    padding: 14px 12px;
  }

  .card-title {
    font-size: 11px;
    margin-bottom: 12px;
  }
}

/* Fix: profile header does not need full column stack, just wrap nicely */
@media (max-width: 600px) {
  .profile-strip-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Fix: gts-cols 4-col → 2-col, no overflow */
@media (max-width: 480px) {
  .gts-cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .gts-val {
    font-size: 14px;
  }

  .game-type-stats {
    padding: 8px 12px;
  }
}

/* Fix: H2H section headers overflow */
@media (max-width: 600px) {
  .h2h-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .h2h-battle-counter {
    font-size: 11px;
  }
}

/* Fix: NFT card text overflow */
@media (max-width: 480px) {
  .nft-card-meta {
    font-size: 10px;
  }

  .nft-card-name {
    font-size: 12px;
  }
}

/* Fix: token section grid overflow */
@media (max-width: 480px) {
  .token-balance-row {
    flex-direction: column;
    gap: 4px;
  }

  .token-chain-badge {
    font-size: 9px;
  }
}

/* Fix: hero features on tiny screens */
@media (max-width: 380px) {
  .hf-card {
    width: 100%;
  }

  .quick-links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .ql-card {
    padding: 8px 10px;
    gap: 6px;
  }

  .ql-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
}

/* Fix: touch target sizes for mobile */
@media (max-width: 768px) {
  .sidebar-link {
    min-height: 54px;
  }

  .tab-btn {
    min-height: 36px;
  }

  .h2h-share-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* Fix: Global box-sizing enforcement */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Fix: no horizontal scroll on body */
html,
body {
  max-width: 100vw;
  overflow-x: clip;
}

/* Fix: search suggestion dropdown on mobile */
@media (max-width: 768px) {
  #search-suggestions {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PROFILE STRIP — Premium Mobile Redesign
   Target: < 768px
═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Container: padding tighter */
  .profile-strip {
    padding: 14px 14px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  /* ── Row 1: Avatar + Meta stacked vertically ── */
  .profile-strip-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  /* Avatar + name row: horizontal compact */
  .profile-strip-inner>.profile-avatar-wrap {
    display: none;
    /* hidden — avatar shown inline below */
  }

  /* Inject avatar inline in meta on mobile via CSS trick — 
     instead we make the first row flex-row */
  .profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(165, 200, 255, 0.07);
    margin-bottom: 10px;
  }

  /* Name row compact */
  .profile-name {
    font-size: 18px;
    font-weight: 900;
  }

  /* Address + badges row */
  .profile-addr-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
  }

  .addr-copy-btn {
    font-size: 11px;
    padding: 2px 8px;
  }

  .rank-badge {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* Rating chips row: horizontal, wrappable */
  .rating-dual {
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  .rating-chip {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    gap: 5px;
  }

  .rc-value {
    font-size: 16px;
  }

  .rc-bar-wrap {
    width: 48px;
  }

  .rc-next {
    display: none;
  }

  /* hide "→ next tier" on mobile to save space */

  /* Mini stats row (total games, wins, WR) */
  .profile-meta>div:last-child {
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 0;
  }

  /* ── Row 2: Game type stats — side by side 2-col ── */
  .profile-stats-area {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
  }

  .game-type-stats {
    min-width: 0 !important;
    width: 100% !important;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .gts-header {
    margin-bottom: 6px;
    gap: 5px;
    flex-wrap: wrap;
  }

  .gts-total {
    font-size: 10px;
  }

  .gts-cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .gts-val {
    font-size: 14px;
  }

  .gts-lbl {
    font-size: 9px;
  }

  /* ── Row 3: Action buttons — horizontal ── */
  .profile-strip-inner>div:last-child {
    flex-direction: row !important;
    gap: 6px;
    width: 100%;
    align-self: stretch !important;
  }

  .profile-strip-inner>div:last-child>* {
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 11px !important;
    padding: 7px 4px !important;
    white-space: nowrap;
  }
}

/* ── Extra compact at 480px ── */
@media (max-width: 480px) {
  .profile-strip {
    padding: 12px 12px 14px;
  }

  .profile-name {
    font-size: 16px;
  }

  .rating-chip {
    min-width: 100px;
  }

  .rc-value {
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   H2H ARENA PROFILE — Premium Mobile Layout  
═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* H2H score card: break 3-col → vertical */
  .h2h-score-card {
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  /* VS badge center */
  .h2h-score-vs {
    padding: 0;
    margin: 8px 0;
    display: flex;
    justify-content: center;
  }

  /* Both player blocks: horizontal compact row */
  .h2h-player-block,
  .h2h-player-block.right {
    flex-direction: row !important;
    text-align: left !important;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(165, 200, 255, 0.07);
  }

  .h2h-player-block:last-of-type,
  .h2h-player-block.right:last-of-type {
    border-bottom: none;
  }

  /* Avatar smaller */
  .h2h-player-avatar {
    width: 44px;
    height: 44px;
  }

  /* Name + address compact */
  .h2h-player-name {
    font-size: 14px;
  }

  .h2h-player-addr {
    font-size: 11px;
  }

  /* Score area */
  .h2h-score-area {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0 6px;
    border-top: 1px solid rgba(165, 200, 255, 0.07);
    margin-top: 4px;
  }

  .h2h-score-num {
    font-size: 36px;
  }

  /* Win rate bar compact */
  .h2h-winrate-row {
    flex-direction: column;
    gap: 4px;
  }

  .h2h-winrate-label {
    font-size: 10px;
  }
}

/* Filter bar on mobile — scrollable */
@media (max-width: 480px) {
  .match-filters {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    gap: 4px;
  }

  .match-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    white-space: nowrap;
    font-size: 11px;
    padding: 4px 10px;
  }

  .filter-group-label {
    white-space: nowrap;
    font-size: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PROFILE STRIP — REFINED MOBILE (overrides previous block)
   Layout: [Avatar + Meta] → [Stats 2-col] → [Actions row]
═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Restore avatar visibility and shrink it */
  .profile-strip-inner>.profile-avatar-wrap {
    display: flex !important;
    width: 52px !important;
    height: 52px !important;
    flex-shrink: 0;
    align-self: flex-start;
  }

  .profile-avatar {
    width: 52px !important;
    height: 52px !important;
  }

  /* Row 1: avatar + meta = same line (wrap together) */
  .profile-strip-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  /* Meta expands to fill row 1 remainder */
  .profile-meta {
    flex: 1 1 200px;
    min-width: 0;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
    display: block;
  }

  /* Row 2: stats area — force full-width new row, 2-col grid */
  .profile-stats-area {
    flex: 0 0 100% !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
    align-self: stretch;
    padding-top: 2px;
  }

  /* Row 3: action buttons — force full-width new row, horizontal */
  .profile-strip-inner>div:last-child {
    flex: 0 0 100% !important;
    flex-direction: row !important;
    align-self: stretch !important;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(165, 200, 255, 0.07);
  }

  .profile-strip-inner>div:last-child>* {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    padding: 7px 4px !important;
    white-space: nowrap !important;
  }
}

/* Full reset back to original on desktop */
@media (min-width: 769px) {
  .profile-strip-inner {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .profile-meta {
    display: block;
    padding-bottom: 0;
    border-bottom: none;
  }

  .profile-stats-area {
    display: flex !important;
    flex-direction: column !important;
  }

  .profile-strip-inner>div:last-child {
    flex-direction: column !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PROFILE STRIP — DEFINITIVE MOBILE (final override, cleans all conflicts)
   Layout target @ ≤ 768px:
   ┌────────────────────────────────────┐
   │ [52px] Name                        │
   │        0x123...  Gold  #42         │
   │        Ranked ●●●   Gambit ●●      │
   │        📅 Apr  👤 230  🏆 65%      │
   ├──────────────┬─────────────────────┤
   │ GAMBIT       │ RANKED              │
   │ 150W 80L 2D  │ 50W 30L 1D         │
   ├──────────────┴─────────────────────┤
   │ [Share]   [Compare]   [Anichess]   │
   └────────────────────────────────────┘
═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Container ───────────────────────────────────── */
  .profile-strip {
    padding: 14px 14px 12px !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
  }

  /* ── Main flex wrapper ───────────────────────────── */
  .profile-strip-inner {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  /* ── Avatar: 52px, top-aligned ───────────────────── */
  .profile-strip-inner>.profile-avatar-wrap {
    display: flex !important;
    width: 52px !important;
    height: 52px !important;
    flex-shrink: 0 !important;
    align-self: flex-start !important;
    margin: 0 !important;
  }

  .profile-avatar {
    width: 52px !important;
    height: 52px !important;
  }

  /* ── Meta: takes remaining row width ─────────────── */
  .profile-meta {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    /* Remove any injected resets */
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;
  }

  /* Name */
  .profile-name {
    font-size: 17px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    /* gradient text kept as-is */
  }

  /* Address + rank badges */
  .profile-addr-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 !important;
  }

  .addr-copy-btn {
    font-size: 10px !important;
    padding: 2px 7px !important;
  }

  .rank-badge {
    font-size: 10px !important;
    padding: 2px 7px !important;
  }

  /* Rating chips — side by side, full width */
  .rating-dual {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    margin-top: 4px !important;
  }

  .rating-chip {
    flex: 1 1 120px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 8px !important;
  }

  .rc-label {
    font-size: 9px !important;
    white-space: nowrap !important;
  }

  .rc-value {
    font-size: 15px !important;
    font-weight: 800 !important;
  }

  .rc-bar-wrap {
    width: 36px !important;
    flex-shrink: 0 !important;
  }

  .rc-next {
    display: none !important;
  }

  /* Mini info row: since / games / wins / wr */
  .profile-meta>div[style*="display:flex"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
    margin-top: 2px !important;
  }

  /* ── Stats area: new FULL-WIDTH row, 2-col grid ──── */
  .profile-stats-area {
    flex: 0 0 100% !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(165, 200, 255, 0.08) !important;
    /* override column flex from desktop */
    flex-direction: unset !important;
    align-items: unset !important;
  }

  .game-type-stats {
    min-width: 0 !important;
    width: 100% !important;
    padding: 9px 10px !important;
    border-radius: 10px !important;
  }

  .gts-header {
    margin-bottom: 6px !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
  }

  .game-type-badge {
    font-size: 9px !important;
    padding: 1px 6px !important;
  }

  .gts-total {
    font-size: 10px !important;
  }

  .gts-cols {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
  }

  .gts-val {
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  .gts-lbl {
    font-size: 9px !important;
    margin-top: 1px !important;
  }

  /* ── Action buttons: new FULL-WIDTH row, horizontal ── */
  .profile-strip-inner>div:last-child {
    flex: 0 0 100% !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(165, 200, 255, 0.08) !important;
  }

  .profile-strip-inner>div:last-child>* {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
    font-size: 11px !important;
    padding: 7px 6px !important;
    white-space: nowrap !important;
    border-radius: 10px !important;
  }
}
/* ─── Footer Attribution ─────────────────────────────────────────────────────── */
.site-footer {
  width: 100%;
  text-align: center;
  padding: 32px 20px 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid rgba(165, 200, 255, 0.06);
  margin-top: auto;
  line-height: 1.6;
}

.site-footer a {
  color: var(--primary-dim);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.site-footer .footer-heart {
  color: var(--lose);
  display: inline-block;
  margin: 0 3px;
  animation: heartbeat 2s ease infinite;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  10% { transform: scale(1.15); }
  20% { transform: scale(1); }
  30% { transform: scale(1.15); }
  40% { transform: scale(1); }
}
