:root {
  --bg: #07102c;
  --panel: rgba(9, 20, 56, 0.88);
  --panel-strong: rgba(14, 31, 79, 0.96);
  --line: rgba(126, 177, 255, 0.26);
  --line-strong: rgba(126, 210, 255, 0.52);
  --text: #f6f8ff;
  --muted: #a9b7dd;
  --soft: #dfe7ff;
  --gold: #f3c46b;
  --teal: #3ce0c6;
  --red: #ff7171;
  --green: #5ee49b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(5, 10, 31, 0.1), rgba(5, 10, 31, 0.92)),
    url("./assets/stadium-bg.png") center top / cover fixed,
    var(--bg);
}

.page {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 14px;
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(7, 16, 44, 0.54);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.hero {
  display: grid;
  align-items: end;
  min-height: 74vh;
  padding: 44px 0 24px;
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(7, 16, 44, 0.62);
  color: var(--soft);
  font-size: 13px;
}

.hero h1 {
  margin: 18px 0 12px;
  font-family: Arial, sans-serif;
  font-size: clamp(36px, 9vw, 78px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 680px;
  margin: 0 0 24px;
  color: var(--soft);
  font-size: 17px;
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin: 22px auto;
}

.stat {
  text-align: left;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 44, 0.72);
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
}

.stat-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

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

.btn.primary {
  background: linear-gradient(135deg, #3ce0c6, #f3c46b);
  color: #07102c;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: rgba(7, 16, 44, 0.62);
}

.btn.small {
  min-height: 36px;
  padding: 0 11px;
  font-size: 13px;
}

.btn.icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.section {
  margin-top: 20px;
}

.site-footer {
  margin: 28px auto 18px;
  padding: 0 16px;
  color: rgba(223, 231, 255, 0.58);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.risk-note {
  max-width: 860px;
  margin: 0 auto 10px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 177, 255, 0.2);
  border-radius: 8px;
  background: rgba(7, 16, 44, 0.48);
  color: rgba(223, 231, 255, 0.74);
  text-align: left;
}

.site-footer a {
  color: rgba(223, 231, 255, 0.68);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

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

.bracket-tools {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.annotation-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 10px;
}

.step-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-control input {
  width: 58px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 10, 31, 0.78);
  color: var(--text);
}

.annotation-move-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.progress {
  flex-shrink: 0;
  min-width: 76px;
  color: var(--teal);
  font-weight: 900;
  text-align: right;
}

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

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

.group-panel {
  padding: 14px;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.group-title strong {
  font-size: 15px;
}

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

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

.team-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(60, 224, 198, 0.15);
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

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

.team-name {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-row-flag {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 18px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

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

.team-name span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.move-buttons {
  display: flex;
  gap: 5px;
}

.move-buttons button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.move-buttons button:disabled {
  color: rgba(255, 255, 255, 0.26);
  cursor: not-allowed;
}

.sticky-footer {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin: 16px -14px -44px;
  padding: 12px 14px 18px;
  border-top: 1px solid var(--line);
  background: rgba(5, 10, 31, 0.88);
  backdrop-filter: blur(16px);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1120px);
  margin: 0 auto;
  gap: 12px;
}

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

.qualify-panel {
  padding: 14px;
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 4px 5px 4px 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
}

.third-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.third-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.third-option.selected {
  border-color: rgba(60, 224, 198, 0.82);
  background: rgba(60, 224, 198, 0.14);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.slot-select {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.slot-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.slot-select strong {
  color: var(--gold);
  font-size: 13px;
}

.auto-slot .team-chip {
  width: 100%;
  margin: 0;
  border-radius: 7px;
}

.slot-select select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 10, 31, 0.88);
  color: var(--text);
}

.team-inline {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.flag-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  font-size: 14px;
  line-height: 1;
}

.team-inline-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.team-inline-text strong,
.team-inline-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-inline-text small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.team-stack {
  display: grid;
  grid-template-rows: var(--flag-h, 16px) var(--name-h, 14px);
  justify-items: center;
  align-items: center;
  min-width: 0;
  width: var(--team-node-w, 48px);
  height: var(--team-node-h, 32px);
  gap: 1px;
  line-height: 1.1;
}

.flag-tile {
  display: grid;
  place-items: center;
  width: 28px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 17px;
  line-height: 1;
}

.flag-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.placeholder-flag::before {
  content: "";
  width: 36%;
  height: 36%;
  border: 1px solid rgba(223, 231, 255, 0.38);
  border-radius: 2px;
}

.team-stack-name {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  color: var(--soft);
  font-size: 9px;
  font-weight: 800;
  line-height: var(--name-h, 14px);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-bracket .team-inline {
  gap: 4px;
}

.split-bracket .team-inline-text strong {
  font-size: 9px;
}

.split-bracket .team-inline-text small {
  display: none;
}

.split-bracket .flag-badge {
  width: 16px;
  height: 16px;
  font-size: 10px;
}

.split-bracket .flag-tile {
  width: var(--flag-w, 24px);
  height: var(--flag-h, 16px);
  border-radius: 2px;
  font-size: var(--flag-font, 13px);
}

.split-bracket .team-stack-name {
  max-width: 42px;
  font-size: var(--team-font, 8px);
}

.bracket {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket-viewport {
  position: relative;
  overflow: auto;
  max-height: 72vh;
  cursor: grab;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 177, 255, 0.5) rgba(7, 16, 44, 0.45);
}

.bracket-viewport.dragging {
  cursor: grabbing;
  user-select: none;
}

.split-bracket {
  display: grid;
  grid-template-columns: var(--bracket-col, 220px) var(--bracket-final, 64px) var(--bracket-col, 220px);
  align-items: center;
  justify-content: center;
  column-gap: var(--round-gap, 16px);
  row-gap: 0;
  overflow-x: hidden;
  padding: 2px calc(var(--round-gap, 16px) * 2) 8px;
  min-width: var(--bracket-min, 640px);
}

.half-bracket {
  display: grid;
  gap: var(--round-gap, 16px);
  width: var(--bracket-col, 220px);
  min-width: var(--bracket-col, 220px);
  align-items: stretch;
}

.upper-half {
  grid-template-columns: var(--match-w, 120px) var(--vertical-match-w, 64px) var(--vertical-match-w, 64px) var(--vertical-match-w, 64px);
}

.lower-half {
  grid-template-columns: var(--vertical-match-w, 64px) var(--vertical-match-w, 64px) var(--vertical-match-w, 64px) var(--match-w, 120px);
}

.final-column {
  position: relative;
  display: grid;
  grid-template-rows: auto 18px auto 1fr;
  align-content: start;
  justify-items: center;
  justify-self: center;
  gap: 0;
  width: var(--bracket-final, 120px);
  min-width: var(--bracket-final, 120px);
  min-height: var(--bracket-height, 420px);
  align-self: center;
}

.final-stage-title {
  box-sizing: border-box;
  grid-row: 1;
  align-self: start;
  justify-self: center;
  margin-top: 0;
  margin-left: auto;
  margin-right: auto;
  width: var(--vertical-match-w, 64px);
  min-width: 0;
  padding: 4px 0;
  border: 1px solid rgba(243, 196, 107, 0.62);
  border-radius: 6px;
  background: rgba(243, 196, 107, 0.14);
  color: var(--gold);
  font-size: 13px;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 0 18px rgba(243, 196, 107, 0.12);
}

.final-column .match {
  grid-row: 3;
  align-self: start;
  justify-self: center;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0;
  transform: none;
}

.half-title {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.round {
  width: var(--vertical-match-w, 64px);
  min-width: var(--vertical-match-w, 64px);
  display: flex;
  min-height: var(--bracket-height, 420px);
  flex-direction: column;
}

.round-r32 {
  width: var(--match-w, 120px);
  min-width: var(--match-w, 120px);
}

.round h3 {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 11px;
  text-align: center;
}

.round-matches {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-around;
  gap: 6px;
}

.match {
  margin-bottom: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 44, 0.74);
}

.split-bracket .match {
  position: relative;
  box-sizing: border-box;
  width: var(--vertical-match-w, 64px);
  min-height: var(--pick-h, 36px);
  padding: 4px;
  border: 2px solid rgba(243, 196, 107, 0.68);
  border-radius: 7px;
  background: rgba(18, 30, 76, 0.72);
  box-shadow: 0 0 0 1px rgba(60, 224, 198, 0.16), 0 8px 20px rgba(0, 0, 0, 0.2);
}

.round-r32 .match {
  width: var(--match-w, 120px);
}

.final-column .match {
  width: var(--vertical-match-w, 64px);
}

.split-bracket .match::after {
  content: "";
  position: absolute;
  left: 50%;
  right: calc(var(--round-gap, 16px) * -1);
  top: 50%;
  height: 1px;
  background: rgba(126, 177, 255, 0.28);
  pointer-events: none;
  z-index: 0;
}

.round-r32 .match::after {
  left: calc(100% - 2px);
  right: calc(var(--round-gap, 16px) * -1);
  height: 2px;
  background: linear-gradient(90deg, rgba(60, 224, 198, 0.75), rgba(126, 177, 255, 0.32));
}

.lower-half .round-r32 .match::after {
  left: calc(var(--round-gap, 16px) * -1);
  right: calc(100% - 2px);
  background: linear-gradient(90deg, rgba(126, 177, 255, 0.32), rgba(60, 224, 198, 0.75));
}

.split-bracket .match-teams {
  position: relative;
  z-index: 1;
}

.lower-half .match::after {
  left: calc(var(--round-gap, 16px) * -1);
  right: 50%;
}

.match-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.split-bracket .match-label {
  display: none;
}

.pick-team {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: var(--pick-h, 36px);
  min-height: var(--pick-h, 36px);
  margin-top: 2px;
  padding: 3px 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.split-bracket .pick-team {
  position: relative;
  width: 100%;
  height: var(--pick-h, 36px);
  min-height: var(--pick-h, 36px);
  margin-top: 0;
  border-color: rgba(126, 177, 255, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
}

.match-teams {
  display: grid;
  grid-template-columns: var(--pick-w, 52px) 12px var(--pick-w, 52px);
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.round-r32 .match-teams {
  grid-template-columns: 1fr 12px 1fr;
  width: 100%;
}

.final-column .match-teams {
  grid-template-columns: 1fr;
  width: 100%;
  gap: 2px;
}

.final-column .versus-mini {
  display: none;
}

.round:not(.round-r32) .match-teams {
  grid-template-columns: 1fr;
  width: 100%;
  gap: 1px;
}

.round:not(.round-r32) .versus-mini {
  display: none;
}

.round:not(.round-r32) .split-bracket .pick-team,
.round:not(.round-r32) .pick-team {
  height: var(--pick-h, 36px);
  min-height: var(--pick-h, 36px);
}

.versus-mini {
  color: rgba(223, 231, 255, 0.72);
  font-size: 7px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.pick-team .team-inline {
  overflow: hidden;
}

.pick-team.selected {
  border-color: rgba(60, 224, 198, 0.8);
  background: rgba(60, 224, 198, 0.2);
  box-shadow: inset 0 0 0 1px rgba(60, 224, 198, 0.42);
}

.pick-team:disabled {
  cursor: default;
  opacity: 0.42;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  min-width: var(--bracket-min, 640px);
  pointer-events: none;
}

.annotation-box {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(243, 196, 107, 0.95);
  border-radius: 6px;
  background: rgba(243, 196, 107, 0.12);
  color: var(--gold);
  cursor: move;
  font-size: 12px;
  font-weight: 900;
  pointer-events: auto;
}

.annotation-box.active {
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(243, 196, 107, 0.18);
}

.annotation-box.dragging {
  opacity: 0.86;
}

.annotation-delete {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(5, 10, 31, 0.95);
  color: var(--gold);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.annotation-resize {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  cursor: nwse-resize;
}

.readonly-teams {
  gap: 2px;
}

.stack-chip {
  justify-content: center;
  margin: 0;
  padding: 4px;
}

.split-bracket .team-chip {
  border-radius: 6px;
}

.result-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.winner-panel {
  min-height: 360px;
  padding: 24px;
  background: linear-gradient(145deg, rgba(9, 20, 56, 0.94), rgba(44, 31, 91, 0.82));
}

.winner-label {
  color: var(--muted);
  font-weight: 800;
}

.winner-name {
  margin: 18px 0 8px;
  font-size: clamp(38px, 8vw, 72px);
  line-height: 1;
  font-weight: 950;
}

.winner-trophy {
  margin: 20px 0;
  font-size: 64px;
  line-height: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
}

.summary-value {
  margin-top: 6px;
  font-weight: 900;
}

.summary-value .team-inline {
  margin: 4px 4px 4px 0;
}

.team-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.versus {
  display: inline-flex;
  margin: 0 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.vote-panel,
.intel-panel,
.login-panel {
  padding: 18px;
}

.vote-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.vote-button {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
  cursor: pointer;
}

.vote-button strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.vote-button.active.support {
  border-color: rgba(94, 228, 155, 0.8);
  background: rgba(94, 228, 155, 0.16);
}

.vote-button.active.oppose {
  border-color: rgba(255, 113, 113, 0.8);
  background: rgba(255, 113, 113, 0.16);
}

.rate-bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 113, 113, 0.26);
}

.rate-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
}

.muted {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 5, 18, 0.72);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(100%, 420px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 10px;
}

.privacy-note {
  margin: 10px 0 0;
  padding: 9px 10px;
  border: 1px solid rgba(126, 177, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(223, 231, 255, 0.78);
  font-size: 12px;
  line-height: 1.6;
}

.poster-backdrop {
  align-items: start;
  overflow: auto;
  padding: 18px 12px 28px;
}

.poster-modal {
  width: min(100%, 520px);
  padding: 14px;
}

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

.poster-head h2 {
  margin-bottom: 4px;
}

.poster-head .btn {
  flex-shrink: 0;
}

.poster-preview-wrap {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(126, 177, 255, 0.26);
  border-radius: 8px;
  background: rgba(2, 5, 18, 0.55);
}

.poster-preview {
  display: block;
  width: min(100%, 360px);
  height: auto;
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}

.poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.poster-tip {
  margin: 10px 2px 0;
  color: rgba(223, 231, 255, 0.72);
  font-size: 12px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}

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

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(90vw, 460px);
  padding: 11px 14px;
  border-radius: 8px;
  background: rgba(5, 10, 31, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

.empty {
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(7, 16, 44, 0.58);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 920px) {
  .groups-grid,
  .qualify-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .third-picker,
  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .page {
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    gap: 6px;
  }

  .brand-sub {
    display: none;
  }

  .hero {
    min-height: 70vh;
    padding-top: 28px;
  }

  .section-head {
    display: block;
  }

  .bracket-tools {
    margin-top: 8px;
  }

  .progress {
    margin-top: 8px;
    text-align: left;
  }

  .footer-inner,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .btn.icon,
  .btn.small {
    width: auto;
  }

  .top-actions .btn.small {
    min-width: 40px;
    padding: 0 9px;
  }

  .split-bracket {
    grid-template-columns: 1fr;
    overflow-x: visible;
    min-width: 0;
    width: 100%;
  }

  .half-bracket,
  .upper-half,
  .lower-half {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .final-column {
    min-width: 0;
    order: 2;
  }

  .upper-half {
    order: 1;
  }

  .lower-half {
    order: 3;
  }

  .summary-grid,
  .vote-buttons,
  .third-picker,
  .slot-grid,
  .poster-actions {
    grid-template-columns: 1fr;
  }

  .poster-head {
    display: block;
  }

  .poster-head .btn {
    margin-top: 10px;
  }

  .poster-preview {
    width: 100%;
  }
}
