/* =========================
   PAGE
   ========================= */
.bracket-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  overflow: hidden;
}

/* =========================
   HEADER CARD
========================= */
.bracket-header {
  background: #ffffff;
  border-radius: 12px 12px 0 0;   /* top only */
  padding: 16px 20px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  margin-bottom: 10px;
}

/* HEADER TOP ROW */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-top h1 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

/* PRINT BUTTON */
.print-btn {
    background: #2563eb;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.print-btn img {
    height: 16px;
    width: auto;
    display: block;
    cursor: pointer;
}

.print-btn:hover {
    background: #1d4ed8;
}

/* =========================
   ROUND GRID (KEY PART)
========================= */
.round-header {
  display: grid;

  grid-template-columns:
    150px  /* Round 1 */
    130px  /* Round 2 */
    110px  /* Sweet 16 */
    110px   /* Elite 8 */
    110px   /* Final Four */
    110px   /* Championship (center anchor) */
    110px
    110px
    110px
    130px
    150px;

  justify-content: start;
}

/* =========================
   COLUMN
========================= */
.round-col {
  text-align: center;
}

/* TITLE */
.round-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

/* DATE */
.round-date {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* =========================
   BRACKET CONTAINER
   ========================= */
.bracket-container {
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  width: 100%;
}

.bracket-inner {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* each row */
.bracket-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 150px;
}

/* center row (finals) */
.center-row {
  justify-content: center;
  align-items: center;
}

/* =========================
   LEFT/RIGHT SIDE STACK
   ========================= */
.left-side,
.right-side {
  display: flex;
  flex-direction: column;
  gap: 0;                 /* space BETWEEN regions */
}

/* =========================
   REGION
   ========================= */
.region {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.left-side h3 {
  text-align: left;      /* left align */
  margin-left: 0;        /* ensure no offset */
  font-size: 13px;
  color: #6b7280;
}

.right-side h3 {
  text-align: right;      /* right align */
  margin-left: 0;        /* ensure no offset */
  font-size: 13px;
  color: #6b7280;
}

/* =========================
   REGION BRACKET (ROUNDS)
   ========================= */
.region-bracket {
  display: flex;
  align-items: flex-start;   /* CRITICAL: no vertical centering */
}

/* =========================
   LEFT SIDE (NORMAL FLOW ?)
   ========================= */
.left-side .region-bracket {
  flex-direction: row;
  gap: 0;
}

.left-side .round {
  display: flex;
  flex-direction: column;
}

/* spacing between rounds */
.left-side .round:nth-child(1) { margin-right: 30px; }
.left-side .round:nth-child(2) { margin-right: -70px; }
.left-side .round:nth-child(3) { margin-right: 10px; }

/* round spacing */
.left-side .round:nth-child(1) { gap: 20px; }

.left-side .round:nth-child(2) {
  gap: 120px;
  padding-top: 50px;
}

.left-side .round:nth-child(3) {
  gap: 320px;
  padding-top: 150px;
}

.left-side .round:nth-child(4) {
  gap: 0;
  padding-top: 350px;
  margin-left: -75px;
}

/* =========================
   RIGHT SIDE (MIRRORED ?)
   ========================= */
.right-side .region-bracket {
  flex-direction: row-reverse;
  gap: 0;
}

.right-side .round {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* spacing between rounds (MIRRORED) */
.right-side .round:nth-child(1) { margin-left: 30px; }
.right-side .round:nth-child(2) { margin-left: -70px; }
.right-side .round:nth-child(3) { margin-left: 10px; }

/* round spacing (same vertical math) */
.right-side .round:nth-child(1) { gap: 20px; }

.right-side .round:nth-child(2) {
  gap: 120px;
  padding-top: 50px;
}

.right-side .round:nth-child(3) {
  gap: 320px;
  padding-top: 150px;
}

.right-side .round:nth-child(4) {
  gap: 0;
  padding-top: 350px;
  margin-right: -75px;   /* mirrored from left */
}

/* =========================
   GAME CARD
   ========================= */
.game {
  position: relative;
  width: 165px;
  height: 80px;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.team {
  font-size: 12px;
  padding: 4px;
}

/* ========================================
   ROUND 5 (FINAL FOUR & CHAMPIONSHIOP)
   ===================================== */
.finals {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.finals .championship {
  width: 225px;
  height: 100px;
}

/* =========================
   FIRST FOUR SECTION
   ========================= */
.first-four {
  margin-top: 40px;
  padding-top: 20px;
  text-align: center;
}

/* INNER WRAPPER (KEY FIX) */
.first-four-inner {
  width: fit-content;      
  margin: 0 auto;          
}

.ff-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.ff-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
  margin-bottom: 10px;
}

/* ROW */
.first-four-row {
  display: flex;
  gap: 30px;
}

/* GAME CARD */
.ff-game {
  width: 160px;
  height: 60px; /* slightly taller for date */
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* TEAMS */
.ff-game .team {
  font-size: 12px;
  color: #374151;
}

/* DATE LINE */
.ff-date {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  margin-top: 4px;
}

/* TBD */
.tbd-img {
  height: 40px;
  opacity: 0.5;
}

/* =========================
   CONNECTORS
========================= */
/* ROUND 1 — LEFT SIDE */

/* Curves */
.left-side .region-bracket .round:nth-child(1) .game:nth-child(odd)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 13px;
  height: 15px;
  border-top: 2px solid #d1d5db;
  border-right: 2px solid #d1d5db;
  border-top-right-radius: 15px;
  transform: translateY(-50%);
}

.left-side .region-bracket .round:nth-child(1) .game:nth-child(even)::before {
  content: "";
  position: absolute;
  bottom: 50%;
  left: 100%;
  width: 13px;
  height: 15px;
  border-bottom: 2px solid #d1d5db;
  border-right: 2px solid #d1d5db;
  border-bottom-right-radius: 15px;
  transform: translateY(50%);
}

/* Vertical spine */
.left-side .region-bracket .round:nth-child(1) .game:nth-child(odd)::after {
  content: "";
  position: absolute;
  right: -15px;
  top: 50%;
  width: 2px;
  height: calc(100% + 20px);
  background: #d1d5db;
}

/* ROUND 1 — RIGHT SIDE */

/* Curves */
.right-side .region-bracket .round:nth-child(1) .game:nth-child(odd)::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: 13px;
  height: 15px;
  border-top: 2px solid #d1d5db;
  border-left: 2px solid #d1d5db;
  border-bottom: none;
  border-right: none;
  border-top-left-radius: 15px;
  transform: translateY(-50%);
}

.right-side .region-bracket .round:nth-child(1) .game:nth-child(even)::before {
  content: "";
  position: absolute;
  bottom: 50%;
  right: 100%;
  width: 13px;
  height: 15px;
  border-bottom: 2px solid #d1d5db;
  border-left: 2px solid #d1d5db;
  border-top: none;
  border-right: none;
  border-bottom-left-radius: 15px;
  transform: translateY(50%);
}

/* Vertical spine */
.right-side .region-bracket .round:nth-child(1) .game:nth-child(odd)::after {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  width: 2px;
  height: calc(100% + 20px);
  background: #d1d5db;
}

/* ROUND 2 — CENTERED SPINE */
.left-side .region-bracket .round:nth-child(2) .game:nth-child(odd)::after,
.right-side .region-bracket .round:nth-child(2) .game:nth-child(odd)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% + 40px);
  width: 2px;
  height: calc(100% + 70px);
  background: #d1d5db;
  transform: translateX(-50%);
}

.left-side .region-bracket .round:nth-child(2) .game::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  width: 15px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

.right-side .region-bracket .round:nth-child(2) .game::before {
  content: "";
  position: absolute;
  right: -15px;
  top: 50%;
  width: 15px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

/* Game A ? down */
.left-side .region-bracket .round:nth-child(3) .game:nth-child(odd)::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 100%;
  width: 2px;
  height: 120px;
  background: #d1d5db;
}

/* Game B ? up */
.left-side .region-bracket .round:nth-child(3) .game:nth-child(even)::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: 100%;
  width: 2px;
  height: 120px;
  background: #d1d5db;
}

/* Game A ? down */
.right-side .region-bracket .round:nth-child(3) .game:nth-child(odd)::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 100%;
  width: 2px;
  height: 120px;
  background: #d1d5db;
}

/* Game B ? up */
.right-side .region-bracket .round:nth-child(3) .game:nth-child(even)::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 100%;
  width: 2px;
  height: 120px;
  background: #d1d5db;
}

.left-side .region-bracket .round:nth-child(3) .game::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

.left-side .region-bracket .round:nth-child(3) .game::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

.finals .game {
  position: relative;
}

/* LEFT ? Championship */
.finals .game:first-child::after {
  content: "";
  position: absolute;
  right: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

/* RIGHT ? Championship */
.finals .game:last-child::after {
  content: "";
  position: absolute;
  left: -20px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}




