:root {
  --bg: #08090d;
  --panel: rgba(20, 22, 29, 0.82);
  --panel-strong: #14161d;
  --ink: #f5f7fb;
  --muted: #a7adba;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #e23b28;
  --accent-2: #ffb43b;
  --good: #63e6a5;
  --bad: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 12%, rgba(226, 59, 40, 0.26), transparent 32%),
    radial-gradient(circle at 82% 8%, rgba(255, 180, 59, 0.16), transparent 30%),
    linear-gradient(135deg, #090a0e 0%, #10121a 48%, #09090d 100%);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 190px 1fr 190px;
  align-items: center;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(8, 9, 13, 0.76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand img,
.admin-login img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 26px rgba(226, 59, 40, 0.5);
}

.tabs {
  justify-self: center;
  display: flex;
  max-width: 100%;
  min-width: 0;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.tabs a {
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tabs a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.tabs a.active {
  color: var(--ink);
  background: rgba(226, 59, 40, 0.18);
  box-shadow: inset 0 0 0 1px rgba(226, 59, 40, 0.36);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: clamp(24px, 5vw, 76px);
  padding: 52px 0;
}

.hero-copy,
.prize-panel,
.section,
.tool-panel {
  max-width: 100%;
  min-width: 0;
}

.hero-copy,
.prize-panel {
  width: 100%;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin-bottom: 18px;
  font-size: 92px;
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 14px;
  font-size: 48px;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 18px;
}

.lede {
  max-width: min(620px, 100%);
  color: var(--muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.55;
}

.hero-actions,
.dialog-actions,
.panel-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
}

.button.primary {
  border-color: rgba(226, 59, 40, 0.75);
  background: linear-gradient(135deg, var(--accent), #a51918);
  box-shadow: 0 14px 32px rgba(226, 59, 40, 0.28);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.045);
}

.prize-panel,
.tool-panel,
.admin-login,
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.prize-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 38px);
}

.prize-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.live-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 22px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 18px var(--good);
  animation: pulse 1.4s ease-in-out infinite;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 26px;
}

.stat-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.stat-grid strong,
.stat-grid span {
  display: block;
}

.stat-grid strong {
  font-size: 24px;
}

.stat-grid span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.section {
  padding: 64px 0;
}

.page-head {
  min-height: calc(100vh - 74px);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

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

.team-card,
.match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.team-card {
  padding: 18px;
}

.team-card h3 {
  margin-bottom: 14px;
  text-transform: uppercase;
}

.player-row,
.match-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.player-row span,
.muted {
  color: var(--muted);
}

.member-card {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.member-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
}

.member-card.compact {
  grid-template-columns: 68px minmax(0, 1fr);
  min-height: 78px;
  padding: 9px;
}

.member-skin {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 20%, rgba(226, 59, 40, 0.22), rgba(255, 255, 255, 0.04));
  overflow: hidden;
}

.member-card.compact .member-skin {
  width: 58px;
  height: 58px;
}

.member-skin img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform: none;
  image-rendering: pixelated;
}

.member-card.compact .member-skin img {
  width: 100%;
  height: 100%;
  transform: none;
}

.member-main {
  min-width: 0;
}

.member-main strong,
.member-main > span {
  display: block;
}

.member-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-main > span {
  margin-top: 3px;
  font-size: 12px;
}

.member-discord {
  justify-self: start;
  margin-top: 8px;
  min-width: 0;
  text-align: left;
}

.member-discord span,
.member-discord strong {
  display: block;
}

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

.member-discord strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--good);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discord-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(99, 230, 165, 0.12);
  color: var(--good);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discord-pill.warn {
  color: var(--accent-2);
  background: rgba(255, 180, 59, 0.12);
}

.role-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 180, 59, 0.16);
  color: var(--accent-2);
  font-size: 11px;
  text-transform: uppercase;
}

.captain-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 180, 59, 0.34);
  border-radius: 8px;
  background: rgba(255, 180, 59, 0.12);
  color: var(--accent-2);
}

.captain-code strong {
  color: var(--ink);
  letter-spacing: 0.08em;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #1b1d25;
  font: inherit;
}

.bracket-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.bracket-column {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 280px;
}

.bracket-column h3 {
  color: var(--accent-2);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.match-card {
  position: relative;
  overflow: hidden;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
}

.match-card::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -14px;
  width: 14px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.8;
}

.match-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.match-logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 900;
}

.match-logo-chip img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(226, 59, 40, 0.52);
}

.match-slot {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  justify-content: start;
  min-height: 70px;
  padding: 8px;
}

.match-slot.winner {
  color: var(--good);
}

.match-slot.eliminated {
  color: #ff8d8d;
}

.match-bust {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.match-bust img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 7px;
  image-rendering: pixelated;
}

.match-slot.winner .match-bust {
  border-color: rgba(255, 180, 59, 0.7);
  box-shadow: 0 0 20px rgba(255, 180, 59, 0.18);
}

.match-slot.eliminated .match-bust {
  border-color: rgba(226, 59, 40, 0.72);
  background: rgba(226, 59, 40, 0.14);
}

.match-slot.eliminated .match-bust img {
  filter: grayscale(0.55) sepia(0.35) hue-rotate(310deg) saturate(1.8);
  opacity: 0.72;
}

.winner-crown {
  position: absolute;
  z-index: 2;
  top: -12px;
  left: 50%;
  width: 30px;
  height: 19px;
  transform: translateX(-50%);
  background:
    linear-gradient(135deg, transparent 0 16%, var(--accent-2) 16% 34%, transparent 34% 48%, var(--accent-2) 48% 65%, transparent 65% 78%, var(--accent-2) 78%) top / 100% 11px no-repeat,
    linear-gradient(var(--accent-2), #d88c19) bottom / 100% 8px no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.match-team-text {
  min-width: 0;
}

.match-team-text strong,
.match-team-text span {
  display: block;
}

.match-team-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-team-text span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.winner-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.winner-actions button {
  width: 100%;
  padding: 8px;
}

.rules-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.rules-list li {
  padding: 16px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 0 8px 8px 0;
}

.register-form,
.stack-form,
.dialog-form {
  display: grid;
  gap: 16px;
}

.register-form {
  max-width: 760px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  font: inherit;
  text-transform: none;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(226, 59, 40, 0.5);
  border-color: var(--accent);
}

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

.captcha-box {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.captcha-box strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.bot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.player-fieldset {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.player-fieldset h3 {
  margin: 0;
}

.form-message {
  min-height: 24px;
  color: var(--accent-2);
}

.admin-shell {
  padding: 42px 0;
}

.admin-login {
  width: min(430px, 100%);
  margin: 8vh auto;
  padding: 28px;
}

.admin-login img {
  width: 64px;
  height: 64px;
}

.hidden {
  display: none !important;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 16px;
}

.tool-panel {
  padding: 18px;
}

.tool-panel.wide {
  grid-column: 1 / -1;
}

.panel-title-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-team {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.captain-member-card {
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
}

.captain-member-card .member-skin {
  grid-row: span 4;
}

.admin-team-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
}

dialog {
  width: min(760px, calc(100% - 24px));
  color: var(--ink);
  padding: 20px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.reveal {
  animation: rise 620ms ease both;
}

.delay-1 {
  animation-delay: 120ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.45);
    opacity: 0.55;
  }
}

@media (max-width: 820px) {
  .topbar,
  .admin-header {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
  }

  .hero,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    display: block;
    min-height: auto;
    padding-top: 36px;
  }

  .prize-panel {
    margin-top: 28px;
  }

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

@media (max-width: 1100px) {
  h1 {
    font-size: 68px;
  }

  h2 {
    font-size: 38px;
  }
}

@media (max-width: 560px) {
  main {
    width: min(calc(100% - 32px), 420px);
  }

  h1 {
    font-size: 34px;
    line-height: 0.98;
  }

  h2 {
    font-size: 28px;
    line-height: 1.06;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .captcha-box {
    grid-template-columns: 1fr;
  }

  .member-card {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .member-discord {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }

  .prize-panel {
    padding: 24px;
  }
}
