:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #191c22;
  --muted: #667085;
  --line: #d9dee8;
  --green: #23856d;
  --blue: #2d6cdf;
  --amber: #c47a16;
  --red: #c24545;
  --shadow: 0 18px 50px rgba(25, 28, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.topbar__meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 46px;
}

.panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.swiss-panel {
  color: #e7f7ee;
  border-color: rgba(90, 210, 140, 0.25);
  background: linear-gradient(135deg, #102d19, #183f23 54%, #102716);
  box-shadow: 0 20px 60px rgba(11, 40, 20, 0.2);
}

.swiss-panel .eyebrow,
.swiss-panel h2 {
  color: #e7f7ee;
}

.stage-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  margin: -4px -4px 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(179, 240, 199, 0.16);
}

.stage-nav button {
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  padding: 6px 11px;
  color: #edf7ef;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.stage-nav button::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: #44e181;
  vertical-align: middle;
}

.stage-nav button.is-active {
  color: #a9e9ff;
  background: rgba(68, 148, 178, 0.46);
}

.stage-nav .refresh-btn {
  width: 32px;
  padding: 0;
  font-size: 23px;
}

.stage-nav .refresh-btn::before {
  content: none;
}

.scenario-heading {
  align-items: center;
}

.scenario-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.scenario-tab {
  min-height: 34px;
  border: 1px solid rgba(179, 240, 199, 0.3);
  border-radius: 999px;
  padding: 7px 11px;
  color: #d9f5e3;
  background: rgba(8, 32, 18, 0.55);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.scenario-tab.is-active {
  color: #062111;
  border-color: #42df83;
  background: #42df83;
}

.swiss-layout {
  position: relative;
  min-height: 560px;
}

.swiss-bracket {
  display: grid;
  grid-template-columns: 1.12fr repeat(3, 0.92fr);
  gap: 9px;
  overflow-x: auto;
  padding-right: clamp(240px, 24vw, 340px);
  padding-bottom: 4px;
}

.round-column {
  min-width: 184px;
}

.round-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-bottom: 6px;
  color: #c8efd4;
  font-size: 13px;
  font-weight: 900;
}

.record-group {
  margin-bottom: 9px;
}

.record-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 20px;
  margin-bottom: 4px;
  color: #b7cabd;
  font-size: 14px;
  font-style: italic;
  font-weight: 900;
}

.record-group--advance .record-label {
  color: #eaffef;
}

.record-group--elim .record-label {
  color: #ffdbe1;
}

.match-card {
  display: grid;
  gap: 5px;
  margin-bottom: 5px;
  border: 1px solid rgba(179, 240, 199, 0.18);
  border-radius: 6px;
  padding: 7px;
  background: rgba(5, 25, 13, 0.68);
}

.match-card.is-advance {
  border-color: rgba(71, 223, 132, 0.55);
  background: rgba(18, 95, 57, 0.78);
}

.match-card.is-elim {
  border-color: rgba(225, 74, 91, 0.55);
  background: rgba(94, 25, 38, 0.78);
}

.team-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.team-row.is-winner .team-name,
.team-row.is-winner .score {
  color: #47df84;
}

.logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(218, 250, 228, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.logo img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.team-name {
  overflow: hidden;
  color: #f7fff9;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score {
  color: #d7ebdc;
  font-size: 13px;
  font-weight: 900;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #93b99f;
  font-size: 11px;
}

.scenario-outcomes {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: clamp(220px, 23vw, 320px);
  display: grid;
  gap: 8px;
}

.outcome-pool {
  border: 1px solid rgba(179, 240, 199, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(8, 32, 18, 0.56);
}

.outcome-pool--advance {
  background: rgba(18, 118, 64, 0.72);
}

.outcome-pool--decider {
  background: rgba(129, 88, 22, 0.74);
}

.outcome-pool--elim {
  background: rgba(132, 25, 45, 0.78);
}

.outcome-title {
  margin-bottom: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.outcome-icons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.outcome-team {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.outcome-team span:last-child {
  overflow: hidden;
  max-width: 76px;
  color: #effff3;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decider-list {
  display: grid;
  gap: 7px;
}

.decider-match {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px 34px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.decider-match .logo {
  width: 34px;
  height: 34px;
}

.decider-match .logo img {
  width: 28px;
  height: 28px;
}

.decider-match span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decider-match b {
  color: #ffe0a1;
  font-size: 10px;
  text-align: center;
}

.stage-placeholder {
  grid-column: 1 / -1;
  display: grid;
  align-content: center;
  min-height: 360px;
  border: 1px dashed rgba(218, 250, 228, 0.38);
  border-radius: 8px;
  padding: 24px;
  background: rgba(5, 25, 13, 0.42);
  text-align: center;
}

.stage-placeholder strong {
  color: #fff;
  font-size: 22px;
}

.stage-placeholder span {
  margin-top: 8px;
  color: #b7cabd;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel--lead {
  min-height: 278px;
}

.pick-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.3fr 0.8fr;
  gap: 14px;
}

.pick-list {
  display: grid;
  gap: 8px;
}

.pick-list--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pick-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.pick-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

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

.bar {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f6;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar--green > i {
  background: var(--green);
}

.bar--red > i {
  background: var(--red);
}

.kpi-panel {
  display: grid;
  align-content: stretch;
  gap: 10px;
}

.metric {
  display: grid;
  align-content: center;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcff;
}

.metric__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 6px;
  font-size: 30px;
}

.table-heading {
  align-items: center;
}

.search {
  width: min(260px, 100%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 1100px) {
  .swiss-layout {
    min-height: 0;
  }

  .swiss-bracket {
    grid-template-columns: 1.08fr repeat(3, 0.86fr);
    padding-right: 0;
  }

  .scenario-outcomes {
    position: static;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 10px;
  }

  .outcome-icons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decider-match {
    grid-template-columns: 30px 1fr;
  }

  .decider-match b,
  .decider-match .logo:nth-of-type(2),
  .decider-match span:nth-of-type(2) {
    display: none;
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__meta {
    justify-content: flex-start;
  }

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

  .pick-list--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .swiss-panel {
    padding: 10px;
  }

  .swiss-bracket {
    gap: 5px;
    overflow-x: auto;
  }

  .round-column {
    min-width: 132px;
  }

  .round-title {
    min-height: 24px;
    font-size: 10px;
  }

  .record-label {
    min-height: 14px;
    font-size: 11px;
  }

  .match-card {
    padding: 4px;
  }

  .team-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 4px;
    min-height: 34px;
  }

  .logo {
    width: 34px;
    height: 34px;
  }

  .logo img {
    width: 29px;
    height: 29px;
  }

  .team-name {
    font-size: 10px;
  }

  .score {
    font-size: 10px;
  }

  .match-meta {
    display: none;
  }

  .scenario-outcomes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-nav {
    gap: 5px;
    overflow-x: auto;
  }

  .stage-nav button {
    flex: 0 0 auto;
    padding: 5px 8px;
    font-size: 11px;
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding-inline: 10px;
  }

  .panel {
    padding: 14px;
  }

  .panel__heading,
  .scenario-heading,
  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .scenario-tabs {
    justify-content: flex-start;
  }

  .scenario-tab {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .swiss-bracket {
    margin-inline: -8px;
  }

  .round-column {
    min-width: 96px;
  }

  .team-row {
    grid-template-columns: 34px auto;
  }

  .team-name {
    display: none;
  }

  .outcome-team span:last-child {
    display: none;
  }

  .scenario-outcomes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-inline: -4px;
  }

  .outcome-pool {
    padding: 7px 4px;
  }

  .outcome-title {
    font-size: 11px;
  }

  .outcome-icons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .pick-list--compact {
    grid-template-columns: 1fr;
  }
}
