/* ── Reset & base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#march-madness-bracket {
  background: #ffffff;
  color: #1a1a2e;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  padding-bottom: 24px;
  min-width: max-content;
  zoom: 0.8;
}

/* ── Printable version link ── */
#march-madness-bracket .print-link-row {
  text-align: center;
  padding: 8px 0 4px;
}
#march-madness-bracket .print-link {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  background: #1a3a6b;
  padding: 5px 16px;
  border-radius: 4px;
  text-decoration: none;
}
#march-madness-bracket .print-link:hover {
  background: #245299;
}

#march-madness-bracket h1 {
  text-align: center;
  padding: 12px 0 4px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #1a3a6b;
  text-transform: uppercase;
}

#march-madness-bracket .subtitle {
  text-align: center;
  font-size: 11px;
  color: #6677aa;
  margin-bottom: 10px;
}

/* ── Buttons row ── */
#march-madness-bracket #reset-btn,
#march-madness-bracket #fullscreen-btn {
  display: inline-block;
  margin: 0 4px 12px;
  padding: 5px 16px;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#march-madness-bracket .btn-row {
  text-align: center;
  margin-bottom: 4px;
}
#march-madness-bracket #reset-btn {
  background: #c0392b;
}
#march-madness-bracket #reset-btn:hover {
  background: #e74c3c;
}
#march-madness-bracket #fullscreen-btn {
  background: #1a3a6b;
}
#march-madness-bracket #fullscreen-btn:hover {
  background: #245299;
}

/* ── Fullscreen mode: make bracket scrollable ── */
#march-madness-bracket:fullscreen {
  overflow: auto;
  background: #ffffff;
}

/* ── Fake fullscreen (iOS Safari fallback) ── */
#march-madness-bracket.fake-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  overflow: auto;
  background: #ffffff;
}
body.bracket-fullscreen-active {
  overflow: hidden;
}

/* ── Outer layout ── */
#march-madness-bracket .bracket-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 8px 24px;
}

/* ── Champion banner ── */
#march-madness-bracket #champion-banner {
  display: none;
  text-align: center;
  margin-bottom: 20px;
  margin-top: 4px;
}
#march-madness-bracket #champion-banner.visible {
  display: block;
}
#march-madness-bracket #champion-banner .label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #6677aa;
}
#march-madness-bracket #champion-banner .name {
  font-size: 24px;
  font-weight: 900;
  color: #1a3a6b;
  white-space: nowrap;
}

/* ── Half-bracket row (two regions side by side) ── */
#march-madness-bracket .half-bracket {
  display: flex;
  gap: 0;
  width: fit-content;
}

/* ── Single region wrapper ── */
#march-madness-bracket .region-bracket {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

/* Flip the right-side regions so rounds flow inward */
#march-madness-bracket .region-bracket.flip {
  flex-direction: row-reverse;
}

/* ── Round column ── */
#march-madness-bracket .round-col {
  display: flex;
  flex-direction: column;
  width: 190px;
  padding: 0 2px;
}

#march-madness-bracket .round-header {
  flex-shrink: 0;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#march-madness-bracket .round-matchups {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

/* Region label shown above round 1 */
#march-madness-bracket .region-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #1a3a6b;
  padding: 2px 0 3px;
  border-bottom: 2px solid #1a3a6b;
  margin-bottom: 4px;
}

#march-madness-bracket .round-label {
  text-align: center;
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #99aabb;
  margin-bottom: 3px;
}

/* ── Matchup block ── */
#march-madness-bracket .matchup {
  display: flex;
  flex-direction: column;
  margin: 1px 0;
  border: 1px solid #d0d8e8;
  border-radius: 3px;
  overflow: hidden;
  background: #f7f9fc;
  flex-shrink: 0;
}

/* ── Team entry ── */
#march-madness-bracket .team {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  cursor: pointer;
  line-height: 1.3;
  min-height: 20px;
  transition: background 0.12s;
  border-bottom: 1px solid #d0d8e8;
}
#march-madness-bracket .team:last-child {
  border-bottom: none;
}

#march-madness-bracket .team:hover:not(.empty):not(.tbd) {
  background: #e8eef8;
}

#march-madness-bracket .team.winner {
  background: #e6f7ee;
  color: #1a6e3a;
  font-weight: 700;
}

#march-madness-bracket .team.loser {
  color: #aabbcc;
  text-decoration: line-through;
}

#march-madness-bracket .team.empty,
#march-madness-bracket .team.tbd {
  color: #c0ccd8;
  cursor: default;
  font-style: italic;
}

#march-madness-bracket .seed {
  font-size: 9px;
  font-weight: 700;
  color: #8899bb;
  min-width: 13px;
  text-align: right;
  flex-shrink: 0;
}
#march-madness-bracket .team.winner .seed {
  color: #2a8a5a;
}
#march-madness-bracket .team.loser .seed {
  color: #c0ccd8;
}

#march-madness-bracket .team-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
}

/* ── Final Four / Championship area ── */
#march-madness-bracket .final-area {
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  width: fit-content;
}

#march-madness-bracket .ff-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 194px;
}

#march-madness-bracket .ff-label {
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #99aabb;
  margin-bottom: 3px;
}

#march-madness-bracket .champ-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 200px;
}

#march-madness-bracket .champ-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1a3a6b;
  margin-bottom: 4px;
  font-weight: 700;
}

#march-madness-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  #march-madness-bracket #fullscreen-btn {
    display: none;
  }
}