:root {
  color-scheme: dark;
  --bg: #03070d;
  --surface: #07111d;
  --surface-2: #0b1624;
  --surface-3: #101b29;
  --line: #16283b;
  --line-bright: #27415d;
  --text: #f5f7fb;
  --muted: #9aa7b7;
  --soft: #c4cdd9;
  --purple: #8d42ff;
  --purple-2: #6c28d9;
  --amber: #f3b33e;
  --cyan: #41d9ff;
  --green: #4ee2a0;
  --danger: #ff5f7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(6, 15, 26, 0.92), rgba(3, 7, 13, 0.98)),
    radial-gradient(circle at 12% 8%, rgba(141, 66, 255, 0.16), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(65, 217, 255, 0.1), transparent 26%),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1760px, calc(100% - 56px));
  min-height: 100vh;
  margin: 24px auto;
  border: 1px solid #132236;
  background:
    linear-gradient(180deg, rgba(8, 15, 25, 0.94), rgba(4, 9, 16, 0.98)),
    var(--bg);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 320px) minmax(390px, 1fr) auto;
  align-items: center;
  min-height: 86px;
  padding: 0 38px;
  border-bottom: 1px solid #101e31;
  background: rgba(3, 7, 13, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(141, 66, 255, 0.2), rgba(65, 217, 255, 0.05)),
    #08121f;
  border: 1px solid rgba(141, 66, 255, 0.35);
  overflow: hidden;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  position: absolute;
  content: "";
  border-radius: 5px;
  background: linear-gradient(135deg, #9f5bff, #6b25ff 48%, #2dbfff);
  transform-origin: center;
}

.brand-mark::before {
  width: 13px;
  height: 36px;
  left: 13px;
  top: 6px;
  transform: rotate(28deg);
}

.brand-mark::after {
  width: 13px;
  height: 36px;
  right: 13px;
  top: 6px;
  transform: rotate(-28deg);
}

.brand-mark span {
  width: 12px;
  height: 24px;
  bottom: 6px;
  left: 18px;
  transform: rotate(90deg);
  background: linear-gradient(90deg, #b47cff, #41d9ff);
}

.brand-copy {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  font-weight: 850;
  line-height: 1.05;
  text-transform: none;
}

.nav-links {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(18px, 3vw, 54px);
  height: 86px;
  min-width: 0;
  scrollbar-width: none;
}

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

.nav-links a {
  position: relative;
  display: grid;
  place-items: center;
  color: #aeb8c7;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--purple);
  content: "";
}

.top-actions,
.panel-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 850;
  text-transform: uppercase;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(180deg, #8e43ff, #6724c9);
  box-shadow: 0 12px 30px rgba(141, 66, 255, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 16px 34px rgba(141, 66, 255, 0.34);
}

.btn-ghost {
  border-color: #26384d;
  background: rgba(6, 12, 20, 0.64);
}

.btn-outline {
  border-color: var(--purple);
  background: rgba(141, 66, 255, 0.08);
  color: #cdaeff;
}

.wide {
  width: 100%;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
  padding: 22px 38px 0;
}

.bracket-panel,
.side-panel,
.feature-strip {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(10, 20, 33, 0.94), rgba(6, 13, 22, 0.94)),
    var(--surface);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.tournament-title-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.trophy-icon,
.modal-icon,
.signup-icon {
  display: grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  color: var(--purple);
}

.trophy-icon svg,
.modal-icon svg,
.signup-icon svg {
  width: 36px;
  height: 36px;
  stroke-width: 2.5;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: #f8fbff;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  line-height: 1.2;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 5px;
  background: rgba(141, 66, 255, 0.22);
  color: #d8c4ff;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin: 12px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
  list-style: none;
  text-transform: uppercase;
}

.meta-list li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.meta-list svg {
  width: 14px;
  height: 14px;
  color: #9aa7b7;
}

.bracket-map {
  position: relative;
  min-height: 606px;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 46%, rgba(65, 217, 255, 0.12), transparent 44%),
    radial-gradient(circle at 15% 12%, rgba(141, 66, 255, 0.08), transparent 34%),
    #07111d;
}

.map-shade {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 20% 35%, rgba(140, 160, 190, 0.14) 0 1px, transparent 1.3px),
    radial-gradient(circle at 43% 30%, rgba(140, 160, 190, 0.12) 0 1px, transparent 1.2px),
    radial-gradient(circle at 64% 43%, rgba(140, 160, 190, 0.11) 0 1px, transparent 1.2px),
    radial-gradient(circle at 74% 62%, rgba(140, 160, 190, 0.1) 0 1px, transparent 1.2px);
  background-size:
    18px 18px,
    21px 21px,
    17px 17px,
    20px 20px;
  mask-image:
    radial-gradient(ellipse 22% 16% at 24% 34%, #000 52%, transparent 58%),
    radial-gradient(ellipse 26% 15% at 46% 28%, #000 55%, transparent 62%),
    radial-gradient(ellipse 22% 19% at 60% 48%, #000 52%, transparent 59%),
    radial-gradient(ellipse 12% 17% at 72% 66%, #000 55%, transparent 62%);
  pointer-events: none;
}

.bracket-scroll {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  padding: 24px 26px 18px;
  scrollbar-color: #334961 #07111d;
}

.bracket-grid {
  --round-gap: 38px;
  display: grid;
  grid-template-columns: 160px repeat(5, 150px) 110px;
  gap: var(--round-gap);
  min-width: 1120px;
  align-items: start;
}

.round {
  min-width: 0;
}

.round-head {
  display: grid;
  gap: 4px;
  min-height: 52px;
  text-align: center;
}

.round-head strong {
  color: #f0f4fb;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.round-head span {
  color: var(--muted);
  font-size: 0.75rem;
}

.match-list {
  position: relative;
  display: grid;
}

.round-one {
  gap: 4px;
}

.round-two {
  gap: 47px;
  padding-top: 28px;
}

.round-three {
  gap: 102px;
  padding-top: 70px;
}

.round-four {
  gap: 126px;
  padding-top: 112px;
}

.round-five {
  gap: 152px;
  padding-top: 153px;
}

.round-six {
  gap: 50px;
  padding-top: 252px;
}

.match {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 27px;
  border: 1px solid #23364a;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(22, 33, 47, 0.94), rgba(12, 20, 31, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #d8e0ec;
  font-size: 0.74rem;
}

.match:not(.spacer)::after {
  position: absolute;
  top: 50%;
  right: calc((var(--round-gap) + 1px) * -1);
  width: var(--round-gap);
  height: 1px;
  background: rgba(206, 215, 226, 0.7);
  content: "";
}

.round-six .match::after {
  width: var(--round-gap);
  right: calc((var(--round-gap) + 1px) * -1);
}

.match span {
  color: #dfe6f2;
  text-align: center;
}

.match b {
  min-width: 0;
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match em {
  color: #aab6c6;
  font-style: normal;
  text-align: center;
}

.match.empty {
  grid-template-columns: minmax(0, 1fr) 18px;
  padding-left: 12px;
}

.match.spacer {
  grid-template-columns: 1fr;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #b8c2d0;
  text-align: center;
}

.final-round {
  padding-top: 0;
}

.winner-card {
  display: grid;
  width: 92px;
  height: 68px;
  margin: 280px auto 0;
  place-items: center;
  border: 1px solid var(--amber);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(243, 179, 62, 0.1), rgba(16, 27, 41, 0.9));
  color: var(--amber);
  box-shadow: 0 0 24px rgba(243, 179, 62, 0.12);
}

.winner-card svg {
  width: 34px;
  height: 34px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 28px 22px;
  padding: 15px 18px;
  border: 1px solid rgba(39, 65, 93, 0.4);
  border-radius: 6px;
  background: rgba(16, 30, 48, 0.62);
  color: #aab5c5;
  font-size: 0.84rem;
}

.notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--purple);
}

.side-column {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.side-panel {
  padding: 26px 18px 18px;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px 18px;
}

.side-head svg {
  width: 28px;
  height: 28px;
  color: var(--purple);
}

.side-head h2,
.signup-panel h2,
.modal-head h2 {
  color: #f6f8fc;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #a3adbd;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tabs button.active {
  border-bottom-color: var(--purple);
  color: #d8c4ff;
}

.tournament-list {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.tournament-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 18px;
  min-height: 146px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(6, 13, 22, 0.72);
}

.game-badge {
  display: grid;
  min-width: 0;
  height: 122px;
  place-items: center;
  border: 1px solid rgba(141, 66, 255, 0.24);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(141, 66, 255, 0.26), rgba(65, 217, 255, 0.1)),
    #0d1624;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tournament-info {
  min-width: 0;
  padding: 2px 0;
}

.item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  margin-bottom: 10px;
}

.item-title h3 {
  min-width: 0;
  color: #f5f7fb;
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.25;
}

.item-meta {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.76rem;
}

.item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.item-meta svg {
  width: 14px;
  height: 14px;
  color: var(--amber);
}

.item-action {
  min-height: 40px;
  padding: 0 18px;
  border-color: #7c43d8;
  color: #d7bdff;
  font-size: 0.78rem;
}

.signup-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 36px 40px 28px;
  text-align: center;
}

.signup-panel p {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 22px 38px 28px;
  overflow: hidden;
}

.feature-strip article {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  min-height: 116px;
  padding: 28px;
  border-right: 1px solid var(--line);
}

.feature-strip article:last-child {
  border-right: 0;
}

.feature-strip svg {
  width: 36px;
  height: 36px;
  color: var(--purple);
}

.feature-strip h3 {
  margin-bottom: 8px;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.feature-strip p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.register-modal {
  width: min(650px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.register-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 22px;
  padding: 30px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(12, 23, 37, 0.98), rgba(6, 13, 22, 0.98)),
    var(--surface);
  box-shadow: var(--shadow);
}

.icon-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(4, 9, 16, 0.72);
  color: var(--soft);
}

.icon-close svg {
  width: 18px;
  height: 18px;
}

.modal-head {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-right: 40px;
}

.modal-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #dce4ee;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #25384e;
  border-radius: 5px;
  background: rgba(4, 9, 16, 0.86);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(141, 66, 255, 0.16);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-transform: none;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--purple);
}

.modal-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: min(420px, calc(100% - 44px));
  min-height: 52px;
  padding: 16px 18px;
  border: 1px solid rgba(78, 226, 160, 0.45);
  border-radius: 6px;
  background: rgba(6, 17, 20, 0.94);
  color: #ddfff0;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 26px 18px;
  }

  .nav-links {
    justify-content: flex-start;
    height: auto;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-links a {
    min-height: 44px;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .side-column {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.65fr);
    align-items: start;
  }
}

@media (max-width: 1500px) and (min-width: 1281px) {
  .topbar {
    grid-template-columns: minmax(210px, 285px) minmax(360px, 1fr) auto;
    padding: 0 26px;
  }

  .brand-copy {
    font-size: 1.05rem;
  }

  .nav-links {
    gap: 24px;
  }

  .btn {
    padding: 0 18px;
  }

  .dashboard {
    grid-template-columns: minmax(0, 1fr) 340px;
    padding-right: 26px;
    padding-left: 26px;
  }

  .bracket-grid {
    --round-gap: 14px;
    grid-template-columns: 134px repeat(5, 116px) 78px;
    min-width: 876px;
  }

  .round-head strong {
    font-size: 0.74rem;
  }

  .round-head span {
    font-size: 0.7rem;
  }

  .match {
    font-size: 0.68rem;
  }

  .tournament-item {
    grid-template-columns: 66px 1fr;
  }

  .game-badge {
    height: 118px;
  }

  .feature-strip {
    margin-right: 26px;
    margin-left: 26px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .dashboard,
  .feature-strip {
    margin-left: 0;
    margin-right: 0;
  }

  .dashboard {
    padding: 14px 12px 0;
  }

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

  .panel-actions,
  .top-actions {
    width: 100%;
  }

  .panel-actions .btn,
  .top-actions .btn {
    flex: 1 1 180px;
  }

  .bracket-map {
    min-height: 540px;
  }

  .side-column,
  .feature-strip {
    grid-template-columns: 1fr;
  }

  .feature-strip {
    margin: 14px 12px 18px;
  }

  .feature-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-strip article:last-child {
    border-bottom: 0;
  }

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

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 20px 16px 16px;
  }

  .brand-copy {
    font-size: 1rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .btn {
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.76rem;
  }

  .tournament-title-block,
  .modal-head {
    align-items: flex-start;
  }

  .title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .meta-list {
    gap: 10px;
  }

  .bracket-scroll {
    padding: 18px 16px;
  }

  .notice {
    align-items: flex-start;
    margin: 0 16px 18px;
  }

  .tournament-item {
    grid-template-columns: 58px 1fr;
    gap: 12px;
  }

  .game-badge {
    height: 112px;
    font-size: 0.82rem;
  }

  .signup-panel {
    padding: 30px 22px 24px;
  }

  .feature-strip article {
    grid-template-columns: 42px 1fr;
    padding: 22px 20px;
  }
}
