/* ============================================================
   RESPONSIVE MATCHES GRID (Phase 1 Exact Breakpoints)
   - Small mobile (320-374px): 1 column
   - Mobile (375-599px): 1 column
   - Tablet (600-1023px): 1-2 columns
   - Laptop (1024-1439px): 2-3 columns
   - Desktop (1440px+): 3-4 columns
   ============================================================ */
#matches-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 360px));
  justify-content: center;
  align-items: start;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 12px auto 0 auto;
  clear: both;
}

@media (max-width: 640px) {
  #matches-list-container {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 16px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Header Google Sign In & User Pills */
.btn-google-login {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  min-height: var(--btn-h);
  height: var(--btn-h);
}

.btn-google-login .btn-text-short {
  display: none;
}

.btn-google-login:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 85, 0, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 85, 0, 0.25);
}

@media (max-width: 600px) {
  .btn-google-login .btn-text-full {
    display: none;
  }
  .btn-google-login .btn-text-short {
    display: inline;
  }
  .btn-google-login {
    height: var(--btn-h);
    min-height: var(--btn-h);
    padding: 4px 10px;
    font-size: var(--fs-xs);
    gap: 5px;
    border-radius: var(--radius-full);
  }
  .balance-pill {
    height: var(--balance-pill-h);
    min-height: var(--balance-pill-h);
    padding: 3px 8px;
    font-size: 12px;
    gap: 4px;
    border-radius: var(--radius-full);
  }
  .balance-pill .quick-add-btn {
    width: calc(var(--btn-h-sm) - 12px);
    height: calc(var(--btn-h-sm) - 12px);
    flex-basis: calc(var(--btn-h-sm) - 12px);
    font-size: var(--fs-xs);
  }
  .header-user-pill {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 2px;
  }
  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .app-header {
    padding: 4px 10px;
    min-height: 44px;
  }
  .brand-subtitle {
    display: none;
  }
  .brand-title {
    font-size: 15px;
  }
  .brand-logo svg {
    width: 20px;
    height: 20px;
  }
  .icon-btn {
    width: 32px;
    height: var(--icon-btn);
    min-height: var(--icon-btn);
    padding: 0;
  }
}

/* Account Menu & Interactive Dropdown */
.account-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 2px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.header-user-pill:hover,
.header-user-pill.active {
  background: var(--bg-elevated);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.header-user-pill img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
  display: block;
}

.header-user-name {
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tournament Card (Responsive Sizing across Screen Widths) */
.match-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.09), transparent 38%),
    linear-gradient(155deg, rgba(20, 28, 45, 0.98), rgba(10, 15, 25, 0.99));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 0;
  margin: 0 auto;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: auto;
  width: 100%;
  max-width: 360px;
  box-sizing: border-box;
  cursor: pointer;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.match-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), rgba(245, 158, 11, 0.05) 65%);
  z-index: 3;
  pointer-events: none;
}

.match-card:hover {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.46), 0 10px 30px rgba(245, 158, 11, 0.13);
  transform: translateY(-5px);
}

.match-card-banner {
  position: relative;
  width: 100%;
  height: var(--card-art-h);
  background: var(--bg-elevated);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.match-map-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.9;
  filter: brightness(0.76) contrast(1.14) saturate(1.08);
  display: block;
  transition: transform 0.3s ease;
}

.match-card:hover .match-map-thumb {
  transform: scale(1.05);
}

.match-card-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 9, 14, 0.06) 0%, rgba(10, 15, 25, 0.2) 45%, rgba(10, 15, 25, 0.96) 100%);
  pointer-events: none;
}

.match-card-tags {
  position: absolute;
  top: 9px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
  flex-wrap: nowrap;
}

.match-chips-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  max-width: 68%;
  overflow: hidden;
}

.mode-tag {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 15, 25, 0.88);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.mode-tag.map-chip {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.mode-tag.team-chip {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.mode-tag.section-chip {
  font-weight: 800;
  letter-spacing: 0.6px;
}

.mode-tag.section-chip.section-survival {
  background: rgba(234, 179, 8, 0.22);
  border-color: rgba(234, 179, 8, 0.6);
  color: #facc15;
}

.mode-tag.section-chip.section-free {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(251, 191, 36, 0.65);
  color: #fcd34d;
}

.mode-tag.section-chip.section-perkill {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
  color: #f87171;
}

.mode-tag.section-chip.section-cs {
  background: rgba(6, 182, 212, 0.22);
  border-color: rgba(6, 182, 212, 0.6);
  color: #22d3ee;
}

.mode-tag.section-chip.section-lw {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(168, 85, 247, 0.6);
  color: #c084fc;
}

.match-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.match-status-badge.status-upcoming {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.5);
}

.match-status-badge.status-open {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.match-status-badge.status-live {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.5);
}

.match-status-badge.status-full {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.match-status-badge.status-completed {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.match-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.match-code-tag {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.match-info-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.match-info-icon-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.1);
}

.match-title {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.meta-item svg {
  color: var(--primary);
  flex-shrink: 0;
  width: 11px;
  height: 11px;
}

/* Metrics Grid (Fee, Per Kill, Prize) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: rgba(3, 7, 18, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  padding: 8px 6px;
  margin-bottom: 2px;
  text-align: center;
}

.metrics-grid > div + div {
  border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.metric-label {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.metric-value {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.metric-value.highlight {
  color: var(--primary);
  text-shadow: none;
}

/* Slot Progress Bar */
.slot-progress-wrap {
  margin-bottom: 2px;
  margin-top: 2px;
}

.slot-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.slot-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.slot-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ff6b00);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

.match-card-body .btn {
  min-height: var(--btn-h);
  height: var(--btn-h);
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 0 10px;
  border-radius: 10px;
}

.tournament-match-card {
  max-width: 340px;
  border-radius: 14px;
}

.tournament-match-card .match-card-banner {
  height: calc(var(--match-card-art-h) - var(--space-2));
}

.tournament-match-card .match-card-body {
  padding: 10px 12px;
  gap: 5px;
}

.tournament-match-card .match-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--fs-base);
  line-height: 1.2;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.match-title-time {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.match-identity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
  color: var(--text-dim);
  font-size: var(--fs-xs);
}

.match-identity-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-identity-row strong { color: var(--text-main); }

.tournament-match-card .match-meta-row { gap: 8px; font-size: var(--fs-xs); }
.tournament-match-card .slot-progress-labels { margin-bottom: 3px; font-size: var(--fs-xs); }
.tournament-match-card .slot-bar { height: var(--space-1); }
.tournament-match-card .match-card-body .btn { min-height: var(--btn-h-sm); height: var(--btn-h-sm); }

@media (max-width: 599px) {
  #matches-list-container {
    gap: 18px;
  }

  .match-card {
    min-height: 0;
    border-radius: 16px;
  }

  .match-card-banner {
    height: var(--card-art-h);
  }

  .match-card-body {
    padding: 11px 12px 13px;
    gap: 8px;
  }

  .tournament-match-card .match-card-body {
    padding: 9px 11px;
    gap: 4px;
  }

  .match-title {
    font-size: 17px;
  }
}

