#main.has-bracket-board {
  max-width: 1730px;
  padding-bottom: 26px;
}

#main:has(.history-toolbar) .mini-hero { padding-block: 30px 24px; }
#main:has(.history-toolbar) .mini-hero p { margin-top: 12px; }
#main:has(.history-toolbar) .section-flower { font-size: 52px; }

.history-toolbar, .history-board-guide, .history-key {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.history-toolbar {
  justify-content: space-between;
  padding-block: 12px;
  border-block: 1px solid var(--line);
}

.history-toolbar p, .history-board-guide p, .history-key {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.history-toolbar p { font-variant-numeric: tabular-nums; }

.history-layout {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--inset);
}

.history-layout button, .history-jump button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding-inline: 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.history-layout .icon { width: 16px; height: 16px; }
.history-layout button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.history-layout button[aria-pressed="false"]:hover, .history-jump button:hover { background: var(--raised); }

.history-jump, .history-phone { display: none; }

.history-board-guide {
  justify-content: space-between;
  padding: 14px 0;
}

.history-key { list-style: none; padding: 0; }
.history-key li { display: inline-flex; align-items: center; gap: 6px; }
.history-key .icon { width: 15px; height: 15px; }
.history-key-winner { color: var(--gold); }
.history-key-live { color: var(--berry); }
.history-key-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.history-key-upcoming::before { content: ''; width: 11px; height: 9px; border: 1px dashed currentColor; border-radius: 2px; }

.history-board-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 44%, #254333, #10291f 66%);
  scrollbar-color: #789281 var(--inset);
}

.history-board {
  --history-gap: 20px;
  --history-wire: #64806e;
  --history-wire-active: #b99a66;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: var(--history-gap);
  min-width: 1344px;
  padding: 10px 18px 16px;
}

.history-round {
  display: grid;
  grid-template-rows: 36px repeat(8, 92px);
  min-width: 0;
}

.history-round h2 {
  align-self: center;
  margin: 0;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .075em;
  text-align: center;
  text-transform: uppercase;
}

.history-round[data-side="final"] h2 { color: var(--gold); }

.history-slot {
  position: relative;
  display: grid;
  align-items: center;
  grid-row: span var(--match-span);
  min-width: 0;
}

.history-slot::after, .history-incoming {
  position: absolute;
  width: calc(var(--history-gap) / 2 + 1px);
  border-color: var(--connector-color, var(--history-wire));
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}

.history-round:not([data-side="final"]) .history-slot::after { content: ''; }
.history-round[data-side="left"] .history-slot::after { left: 100%; border-right-width: 1px; }
.history-round[data-side="right"] .history-slot::after { right: 100%; border-left-width: 1px; }
.history-slot[data-branch="upper"]::after { top: 50%; height: calc(50% + 1px); border-top-width: 1px; }
.history-slot[data-branch="lower"]::after { bottom: 50%; height: 50%; border-bottom-width: 1px; }
.history-slot[data-branch="straight"]::after { top: 50%; border-width: 1px 0 0; }
.history-slot[data-advanced="true"]::after, .history-incoming[data-fed="true"] { --connector-color: var(--history-wire-active); }

.history-incoming {
  right: 100%;
  top: 50%;
  border-top-width: 1px;
}

.history-round[data-side="right"] .history-incoming, .history-incoming-right { right: auto; left: 100%; }

.history-match {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 18px repeat(2, 30px);
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid #577563;
  border-radius: 5px;
  background: #1a372c;
  color: var(--ink);
  text-align: left;
}

button.history-match:hover { border-color: var(--gold); background: #254537; }
.history-match.is-live { border-color: #d98b7d; }
.history-round[data-side="final"] .history-match:not(.is-live) { border-color: #917b54; }

.history-match-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-inline: 7px;
  border-bottom: 1px solid #476556;
  color: var(--muted);
  background: #122b22;
  font-size: 10px;
  line-height: 1;
}

.history-live-label {
  color: var(--berry);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.history-match-song {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0 4px;
  padding-inline: 7px;
  font-size: 12px;
  line-height: 1.15;
}

.history-match-song + .history-match-song { border-top: 1px solid #476556; }
.history-match-song.is-winner { color: #ffdfac; background: #49422b; font-weight: 750; }
.history-match-song b { grid-column: 3; font-size: 11px; font-variant-numeric: tabular-nums; }
.history-match-song .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.history-match-title {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-ghost {
  grid-template-rows: repeat(2, 1fr);
  height: 80px;
  border: 1px dashed #61776a;
  background: #132d24;
}

.history-ghost span + span { border-top: 1px solid #2c4b3d; }
.history-ghost span::after {
  content: '';
  display: block;
  width: 36%;
  height: 3px;
  margin: 18px 9px;
  border-radius: 5px;
  background: #4a6555;
}

.history-champion {
  position: absolute;
  inset: auto 0 calc(50% + 60px);
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 5px;
  color: var(--gold);
  text-align: center;
}

.history-champion .icon { width: 28px; height: 28px; margin-bottom: 4px; }
.history-champion span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.history-champion strong { color: var(--ink); font: 700 19px/1.1 Georgia, serif; overflow-wrap: anywhere; }
.history-champion small { color: var(--muted); font-size: 11px; }
.history-champion.is-crowned { border: 1px solid #917b54; border-radius: 7px; background: #443d2b; }

.history-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.history-matchup-modal .bracket-card { padding: 0; border: 0; }
.history-matchup-modal .history-vote-link { margin-top: 16px; }

@media (max-width: 1430px) {
  .history-jump {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    gap: 5px;
    padding: 6px 0;
    background: var(--evergreen);
    border-bottom: 1px solid var(--line);
  }

  .history-jump button { min-height: 44px; padding-inline: 10px; border-color: var(--line); color: var(--mint); }
}

@media (max-width: 740px), (max-width: 950px) and (pointer: coarse) {
  #main:has(.history-toolbar) .mini-hero { padding-top: 24px; }
  #main:has(.history-toolbar) .mini-hero h1 { font-size: clamp(36px, 9.5vw, 45px); }
  .history-key { gap: 6px 12px; }
  .history-layout button { min-height: 44px; }
  .history-toolbar p { font-size: 11px; }
  .history-jump, .history-board-scroll, .history-board-guide > p { display: none; }
  #main:has(.history-toolbar) .round-tabs { flex-wrap: wrap; }

  .history-phone {
    display: block;
    max-width: 35rem;
    margin-inline: auto;
  }

  .history-phone-tools {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-bottom: 8px;
  }

  .history-phone-round {
    display: grid;
    gap: 5px;
    flex: 1 1 11rem;
    min-width: 0;
    color: var(--mint);
    font-size: 12px;
    font-weight: 650;
  }

  .history-phone button:not(.history-match), .history-phone select {
    min-height: 44px;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 650;
  }

  .history-phone select { width: 100%; font-size: 16px; }
  .history-phone button.history-phone-today { color: var(--gold); }
  .history-phone-today small { margin-left: 3px; color: var(--muted); }

  .history-phone-pager {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .history-phone-pager p { margin: 0; color: var(--muted); text-align: center; }
  .history-phone-pager button { display: grid; place-items: center; }
  .history-phone-pager button:disabled { opacity: .45; }
  .history-phone-pager button:first-child .icon { transform: rotate(180deg); }

  .history-phone-diagram {
    --phone-feeder-gap: 12px;
    --phone-wire: #64806e;
    display: grid;
    padding: 14px 12px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: radial-gradient(ellipse at 50% 44%, #254333, #10291f 78%);
  }

  .history-phone-diagram h2 {
    margin: 0 0 9px;
    color: var(--mint);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
  }

  .history-phone-feeders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--phone-feeder-gap); }
  .history-phone-destination { width: min(100%, 17rem); margin-inline: auto; }

  .history-phone .history-match { grid-template-rows: auto repeat(2, minmax(42px, 1fr)); }
  .history-phone .history-match-date { min-height: 24px; padding-inline: 8px; font-size: 11px; }
  .history-phone .history-match-song { padding: 5px 8px; font-size: 14px; line-height: 1.25; }
  .history-phone .history-match-title { display: block; overflow: visible; }
  .history-phone .history-match-song b { font-size: 12px; }

  .history-phone-empty {
    display: grid;
    place-items: center;
    min-height: 110px;
    padding: 8px;
    border: 1px dashed #61776a;
    border-radius: 5px;
    background: #132d24;
    color: var(--muted);
    text-align: center;
  }

  .history-phone-wires { position: relative; height: 32px; }
  .history-phone-wires span { position: absolute; border-color: var(--phone-wire); border-style: solid; border-width: 0; }
  .history-phone-wires span[data-fed="true"] { border-color: var(--gold); }
  .history-phone-wires span:nth-child(-n+2) {
    top: 0;
    width: calc(25% + var(--phone-feeder-gap) / 4);
    height: 15px;
    border-bottom-width: 1px;
  }
  .history-phone-wires span:first-child { right: 50%; border-left-width: 1px; }
  .history-phone-wires span:nth-child(2) { left: 50%; border-right-width: 1px; }
  .history-phone-wires .history-phone-stem { left: 50%; top: 14px; height: 15px; border-left-width: 1px; }

  .history-phone button.history-phone-follow {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--mint);
  }

  .history-phone .history-champion {
    position: static;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    gap: 3px 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    text-align: left;
  }

  .history-phone .history-champion .icon { grid-row: 1 / span 3; margin: 0; }
  .history-phone .history-champion > :not(.icon) { grid-column: 2; }
  .history-phone .history-champion:not(.is-crowned) { margin: 12px 0 0; }
}
