:root {
  --tb-gold: #f4c95d;
  --tb-gold-strong: #ffd978;
  --tb-text: #f4f0e6;
  --tb-muted: #a9adba;
  --tb-panel: rgba(12, 14, 20, 0.88);
  --tb-line: rgba(244, 201, 93, 0.42);
  --tb-win: #8fe7a8;
  --tb-live: #ff6b6b;
}

body.tournament-page {
  color: var(--tb-text);
  background: #05070b;
}

body.tournament-page .nk-header {
  position: relative;
  z-index: 1200;
}

@media (min-width: 992px) {
  body.tournament-page .nk-navbar .nk-nav .nk-drop-item:hover > .dropdown,
  body.tournament-page .nk-navbar .nk-nav .nk-drop-item.open > .dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
  }
}

.tournament-background {
  background:
    radial-gradient(circle at 12% 12%, rgba(244, 201, 93, 0.2), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(95, 144, 255, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(3, 6, 12, 0.38), rgba(3, 6, 12, 0.92)),
    url("/img/HH/wallpaper/wallpaper-hh.png") center top / cover no-repeat;
}

body.tournament-page .nk-main {
  overflow: visible !important;
  height: auto !important;
}

body.tournament-page .nk-box.tournament-shell,
.tournament-shell {
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
  padding: 118px 0 90px;
  background: transparent !important;
}

.tournament-container {
  max-width: 1560px;
}

.tournament-hero,
.tournament-panel,
.tb-bracket-stack,
.tournament-roster {
  border: 1px solid rgba(244, 201, 93, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    var(--tb-panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.tournament-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 48px);
  margin-bottom: 28px;
}

.tournament-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0%, rgba(244, 201, 93, 0.12) 48%, transparent 72%),
    radial-gradient(circle at 86% 12%, rgba(244, 201, 93, 0.18), transparent 22%);
}

.tournament-kicker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 7px 13px;
  border: 1px solid rgba(244, 201, 93, 0.3);
  border-radius: 999px;
  color: var(--tb-gold-strong);
  background: rgba(244, 201, 93, 0.09);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tournament-kicker.is-live {
  color: #ffd0d0;
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.12);
}

.tournament-kicker.is-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tb-live);
  box-shadow: 0 0 12px var(--tb-live);
  animation: tb-pulse 1.4s ease-in-out infinite;
}

.tournament-kicker.is-completed {
  color: var(--tb-win);
  border-color: rgba(143, 231, 168, 0.4);
  background: rgba(143, 231, 168, 0.1);
}

.tournament-hero h1 {
  position: relative;
  margin: 0 0 12px;
  color: var(--tb-text);
  font-family: "Marcellus SC", serif;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.6);
}

.tournament-subtitle,
.tournament-note {
  position: relative;
  max-width: 720px;
  margin: 0;
  color: var(--tb-muted);
  font-size: 18px;
  line-height: 1.6;
}

.tournament-note {
  margin-top: 14px;
  color: #d7ded9;
}

.tournament-cta-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.tournament-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--tb-gold-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tournament-form label span {
  color: var(--tb-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.tournament-form input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(244, 201, 93, 0.28);
  background: rgba(0, 0, 0, 0.35);
  color: var(--tb-text);
}

.tournament-form input[type="text"]:focus {
  outline: none;
  border-color: var(--tb-gold-strong);
}

.tournament-alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #2e7d32;
  background: rgba(46, 125, 50, 0.18);
  color: #b9f6ca;
}

.tournament-alert.is-err {
  border-color: #b71c1c;
  background: rgba(183, 28, 28, 0.18);
  color: #ffcdd2;
}

.tournament-meta-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.tournament-meta-card {
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}

.tournament-meta-card span {
  display: block;
  color: var(--tb-gold-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tournament-meta-card strong {
  display: block;
  margin-top: 8px;
  color: #fff8df;
  font-size: 22px;
  line-height: 1.2;
}

.tournament-panel {
  overflow: visible;
  padding: clamp(22px, 3vw, 34px);
  margin-bottom: 28px;
}

.tournament-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.tournament-panel-heading h2 {
  margin: 0;
  color: #fff2be;
  font-family: "Marcellus SC", serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  text-transform: uppercase;
}

.tournament-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--tb-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tournament-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
}

.legend-win { background: var(--tb-gold); box-shadow: 0 0 10px var(--tb-gold); }
.legend-tbd { background: #6d7382; }
.legend-out { background: #8a4a4a; }

.tb-bracket {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  overflow: visible;
  padding: 4px 0 8px;
}

.tb-side {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

.tb-round {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
}

.tb-side--left .tb-round {
  padding-right: 22px;
}

.tb-side--right .tb-round {
  padding-left: 22px;
}

.tb-round-title,
.tb-stack-round h3,
.tb-champion-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--tb-gold-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.tb-round-title::before,
.tb-round-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 201, 93, 0.35), transparent);
}

.tb-round-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tb-pair {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 108px;
}

.tb-pair--single {
  min-height: 0;
}

.tb-match-wrap {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  min-height: 118px;
  padding: 8px 0;
}

.tb-side--left .tb-pair:not(.tb-pair--single)::before,
.tb-side--right .tb-pair:not(.tb-pair--single)::before {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  width: 16px;
  border: 2px solid var(--tb-line);
  pointer-events: none;
}

.tb-side--left .tb-pair:not(.tb-pair--single)::before {
  right: -22px;
  border-left: 0;
  border-radius: 0 10px 10px 0;
}

.tb-side--right .tb-pair:not(.tb-pair--single)::before {
  left: -22px;
  border-right: 0;
  border-radius: 10px 0 0 10px;
}

.tb-side--left .tb-pair::after,
.tb-side--right .tb-pair::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 2px;
  margin-top: -1px;
  background: var(--tb-line);
  pointer-events: none;
}

.tb-side--left .tb-pair::after {
  right: -22px;
  width: 22px;
}

.tb-side--right .tb-pair::after {
  left: -22px;
  width: 22px;
}

.tb-bracket--sides-3 .tb-slot-body strong,
.tb-bracket--sides-4 .tb-slot-body strong {
  font-size: 12px;
}

.tb-bracket--sides-4 .tb-finals {
  min-width: 150px;
  width: 170px;
}

.tb-match {
  width: 100%;
  overflow: visible;
  padding: 6px;
  border: 1px solid rgba(244, 201, 93, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(6, 8, 14, 0.82);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.tb-match.has-winner {
  border-color: rgba(244, 201, 93, 0.48);
  box-shadow:
    0 0 0 1px rgba(244, 201, 93, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.32);
}

.tb-match.is-ready:not(.has-winner) {
  border-color: rgba(244, 201, 93, 0.32);
}

.tb-slot {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.tb-slot-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6d7382;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.tb-slot-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tb-slot-body strong {
  color: #f6f4ed;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tb-slot-body small {
  color: var(--tb-muted);
  font-size: 11px;
  letter-spacing: 0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tb-slot-score {
  color: var(--tb-gold-strong);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  min-width: 1.2em;
}

.tb-match-vs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 8px;
  color: var(--tb-gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.tb-match-vs::before,
.tb-match-vs::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 201, 93, 0.28), transparent);
}

.tb-slot.is-empty .tb-slot-body strong,
.tb-slot.is-empty .tb-slot-body small {
  color: #7d8390;
  font-weight: 600;
}

.tb-slot.is-winner {
  background: linear-gradient(90deg, rgba(244, 201, 93, 0.2), rgba(244, 201, 93, 0.06));
}

.tb-slot.is-winner .tb-slot-mark {
  background: var(--tb-gold);
  box-shadow: 0 0 10px var(--tb-gold);
}

.tb-slot.is-winner .tb-slot-body strong {
  color: #fff6d7;
}

.tb-slot.is-loser {
  opacity: 0.5;
}

.tb-slot.is-loser .tb-slot-mark {
  background: #8a4a4a;
}

.tb-match-note {
  margin: 6px 8px 2px;
  color: var(--tb-muted);
  font-size: 10px;
}

.tb-finals {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 0 1 240px;
  width: 240px;
  max-width: 28%;
  min-width: 180px;
  margin: 0 4px;
  padding: 0 6px;
}

.tb-finals-match {
  position: relative;
}

.tb-finals-match .tb-match {
  border-color: rgba(244, 201, 93, 0.55);
  box-shadow:
    0 0 0 1px rgba(244, 201, 93, 0.12),
    0 0 28px rgba(244, 201, 93, 0.12);
}

.tb-champion {
  margin-top: 16px;
  padding: 16px 14px 14px;
  border: 1px solid rgba(244, 201, 93, 0.42);
  border-radius: 14px;
      background:
    radial-gradient(circle at 50% 0%, rgba(244, 201, 93, 0.22), transparent 62%),
    rgba(0, 0, 0, 0.34);
  text-align: center;
  box-shadow: inset 0 0 40px rgba(244, 201, 93, 0.06);
}

.tb-champion-kicker {
  display: block;
  margin-bottom: 8px;
}

.tb-champion-kicker::before,
.tb-champion-kicker::after {
  content: none;
}

.tb-champion strong {
  display: block;
  color: #fff6d7;
  font-family: "Marcellus SC", serif;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.tb-champion small {
  display: block;
  margin-top: 6px;
  color: var(--tb-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tb-champion.has-champion {
  box-shadow: 0 0 32px rgba(244, 201, 93, 0.2);
}

.tb-bracket-stack {
  display: none;
  padding: 8px 0 0;
}

.tb-playin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.tb-playin-card {
  padding: 16px;
  border: 1px solid rgba(255, 107, 107, 0.32);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 107, 107, 0.12), transparent 46%),
    rgba(0, 0, 0, 0.28);
}

.tb-playin-card h3 {
  margin: 0 0 12px;
  color: #ffb4b4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.tb-stack-round + .tb-stack-round {
  margin-top: 22px;
}

.tb-stack-matches {
  display: grid;
  gap: 10px;
}

.tournament-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding: 18px;
}

.tournament-entrant {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}

.tournament-entrant span {
  display: block;
  color: var(--tb-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tournament-entrant strong {
  display: block;
  margin-top: 6px;
  color: #fff2be;
  font-size: 18px;
}

.tournament-entrant small {
  display: block;
  margin-top: 4px;
  color: var(--tb-muted);
}

.tournament-entrant.is-champion {
  border-color: rgba(244, 201, 93, 0.45);
  background: rgba(244, 201, 93, 0.1);
}

.tournament-empty,
.tb-empty {
  margin: 0;
  padding: 18px;
  color: var(--tb-muted);
  text-align: center;
}

@keyframes tb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}

@media (max-width: 1199px) {
  .tournament-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .tb-bracket--desktop {
    display: none;
  }

  .tb-bracket-stack {
    display: block;
  }

  .tournament-shell {
    padding-top: 100px;
  }
}

@media (max-width: 767px) {
  .tournament-meta-grid,
  .tournament-roster {
    grid-template-columns: 1fr;
  }

  .tournament-hero,
  .tournament-panel {
    padding: 22px 16px;
  }
}

body.tournament-admin-page .tb-slot[data-match-pick]:not(:disabled) {
  cursor: pointer;
}

body.tournament-admin-page .tb-slot[data-match-pick]:not(:disabled):hover {
  background: rgba(244, 201, 93, 0.16);
}
