:root {
  --panel-border: rgba(255,255,255,0.08);
  --player-card-width: 240px;
  --player-card-height: 104px;
}

html,
body {
  overflow-x: hidden;
}

.tournament-hero {
  position: relative;
  padding: 60px 8vw 40px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background:
    linear-gradient(180deg, rgba(10,6,22,0.9), rgba(10,6,22,0.7)),
    url('../img/headerballistic.jpg') center/cover no-repeat;
}

.tournament-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
}

.tournament-hero h1 {
  margin: 6px 0 10px;
  font-family: "Bebas Neue", "Impact", sans-serif;
  font-size: clamp(40px, 8vw, 72px);
  letter-spacing: 2px;
}

.hero-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.hero-meta span {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.hero-info {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.hero-info .detail-card {
  background: rgba(10,8,20,0.7);
  border: 1px solid rgba(255,255,255,0.08);
}

.hero-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
  color: var(--ink);
}

.status-open {
  background: rgba(0,255,136,0.15);
  color: #7bf6c0;
}

.status-closed {
  background: rgba(255,184,77,0.18);
  color: #ffcf7a;
}

.tournament-main {
  padding: 24px 8vw 80px;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.35);
  position: relative;
  min-width: 0;
}

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

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.detail-card {
  background: rgba(10,8,20,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

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

.registrations-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(4, var(--player-card-height));
  grid-auto-columns: var(--player-card-width);
  gap: 12px;
  justify-items: start;
  width: max-content;
}

.registration-card {
  background: rgba(10,8,20,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.registration-card span {
  color: var(--muted);
  font-size: 12px;
}

.registration-card.mini {
  justify-content: flex-start;
  gap: 10px;
}

.registration-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.registrations-scroll {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 8px 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  scroll-snap-type: x mandatory;
  scroll-padding: 8px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.registrations-grid > * {
  scroll-snap-align: start;
}

.carousel-nav {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(10, 16, 30, 0.75);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: border 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.carousel-nav:hover:not(:disabled) {
  border-color: rgba(234, 255, 76, 0.6);
  color: #ffe258;
  transform: translateY(-2px) scale(1.05);
}

.carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.player-chip {
  --chip-border: rgba(255, 255, 255, 0.18);
  --chip-glow: rgba(255, 255, 255, 0.12);
  --chip-accent: rgba(255, 255, 255, 0.18);
  --chip-border-start: rgba(255, 255, 255, 0.6);
  --chip-border-end: rgba(255, 255, 255, 0.2);
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--chip-border);
  background: rgba(255,255,255,0.06);
  font-size: 13px;
  min-height: var(--player-card-height);
  height: var(--player-card-height);
  width: var(--player-card-width);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset, 0 10px 18px rgba(0,0,0,0.35), 0 0 18px var(--chip-glow);
}

.player-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, var(--chip-border-start), var(--chip-border-end));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.9;
  pointer-events: none;
  z-index: 3;
}

.player-chip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 0%, var(--chip-accent), transparent 65%),
    linear-gradient(120deg, var(--chip-accent), transparent 70%);
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}

.player-chip.is-reserve {
  opacity: 0.75;
}

.player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 12px 0 0 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,140,43,0.2);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-info {
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 10px 12px;
  text-align: left;
  justify-items: start;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
}

.player-trophy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(8, 10, 18, 0.7);
  color: #ffe39a;
  font-size: 11px;
  line-height: 1;
}

.player-trophy svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.player-nick {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-chip--max {
  --chip-border: rgba(255, 208, 122, 0.7);
  --chip-glow: rgba(255, 208, 122, 0.25);
  --chip-accent: rgba(255, 208, 122, 0.3);
  --chip-border-start: rgba(255, 210, 110, 0.98);
  --chip-border-end: rgba(120, 20, 20, 0.95);
}

.player-chip--casual {
  --chip-border: rgba(210, 214, 222, 0.75);
  --chip-glow: rgba(200, 205, 214, 0.28);
  --chip-accent: rgba(200, 205, 214, 0.3);
  --chip-border-start: rgba(210, 218, 228, 0.98);
  --chip-border-end: rgba(22, 88, 52, 0.95);
}

.player-chip--kids {
  --chip-border: rgba(255, 190, 220, 0.75);
  --chip-glow: rgba(255, 190, 220, 0.28);
  --chip-accent: rgba(255, 190, 220, 0.3);
  --chip-border-start: rgba(255, 184, 224, 0.95);
  --chip-border-end: rgba(160, 210, 255, 0.95);
}

.player-chip--mad,
.player-chip--default {
  --chip-border: rgba(255, 140, 80, 0.6);
  --chip-glow: rgba(255, 140, 80, 0.22);
  --chip-accent: rgba(255, 140, 80, 0.28);
  --chip-border-start: rgba(255, 156, 96, 0.9);
  --chip-border-end: rgba(120, 40, 20, 0.9);
}

.stars {
  display: flex;
  gap: 2px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  justify-content: flex-start;
}

.star.filled {
  color: #ffcf7a;
}

.registration-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.registration-name {
  font-size: 14px;
  font-weight: 600;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(calc(var(--player-card-width) + 32px), 1fr));
  gap: 16px;
}


.team-card {
  background: rgba(10,8,20,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.team-card-header {
  position: relative;
}

.team-card-thumb {
  position: relative;
  height: 120px;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.team-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.team-card-title {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%);
  letter-spacing: 0.6px;
}

.team-card-players {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(10,8,20,0.82);
  justify-items: center;
}

.team-card-players .player-chip {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.team-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #dbe2f4;
}

.team-card li.reserve {
  color: var(--muted);
  font-style: italic;
}

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket {
  display: flex;
  gap: 24px;
  min-width: 700px;
}

.round-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.round-column h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-align: center;
}

.match-card {
  background: rgba(10,8,20,0.85);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 200px;
}

.match-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.match-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.match-team.is-winner {
  color: #7bf6c0;
  font-weight: 700;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.result-card {
  background: rgba(10,8,20,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.result-card strong {
  font-size: 16px;
}

.final-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 720px) {
  .tournament-hero {
    padding: 48px 6vw 28px;
  }

  .tournament-hero h1 {
    font-size: clamp(32px, 10vw, 48px);
  }

  .tournament-main {
    padding: 20px 6vw 60px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .details-grid,
  .teams-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .registration-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .registration-card.mini {
    flex-direction: row;
  }

  .bracket {
    gap: 16px;
    min-width: 520px;
  }

  .registrations-grid {
    grid-template-rows: repeat(4, var(--player-card-height));
    grid-auto-columns: var(--player-card-width);
  }

  .teams-grid {
    position: relative;
    display: block;
    height: calc(120px + (var(--player-card-height) * 6) + 120px);
    min-height: 720px;
    overflow: visible;
    perspective: 900px;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .teams-grid .team-card {
    position: absolute;
    left: 50%;
    top: 0;
    width: min(340px, 86vw);
    transition: transform 240ms ease, opacity 240ms ease;
    transform-origin: center;
  }

  .teams-grid .team-card.is-center {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    z-index: 3;
  }

  .teams-grid .team-card.is-left {
    transform: translateX(-120%) scale(0.9) rotateY(8deg);
    opacity: 0.8;
    z-index: 2;
    filter: blur(2px);
  }

  .teams-grid .team-card.is-right {
    transform: translateX(20%) scale(0.9) rotateY(-8deg);
    opacity: 0.8;
    z-index: 2;
    filter: blur(2px);
  }

  .teams-grid .team-card.is-hidden {
    opacity: 0;
    pointer-events: none;
    filter: blur(6px);
  }
}

@media (max-width: 520px) {
  .tournament-hero {
    padding: 40px 5vw 24px;
  }

  .tournament-main {
    padding: 16px 0 52px;
    justify-items: center;
  }

  .panel {
    width: min(92vw, 560px);
  }

  .registration-name {
    word-break: break-word;
  }

  .bracket {
    min-width: 420px;
  }

  .match-card {
    min-width: 170px;
  }
}
