:root {
    --primary: #C5B358;
    --secondary: #000000;
    --bg: #f7f5fb;
    --card: #fff;
    --text: #1e1b24;
    --muted: #6d6478;
    --line: #e8e2ee;
    --good: #137333;
    --warn: #b06000;
    --bad: #b3261e;
    --shadow: 0 16px 50px rgba(32, 20, 48, .12);
    --radius: 22px;
    --connector: rgba(64, 49, 113, .68);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(90,4,126,.12), transparent 32rem), var(--bg);
    color: var(--text);
}

.container { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }

.site-header {
    background: linear-gradient(135deg, var(--primary), #000);
    color: #fff;
    padding: 34px 0 26px;
}

.header-content { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand-row { display: flex; align-items: center; gap: 28px; }
.brand-row img {
  width: 140px;
  height: 140px;
  object-fit: contain;
}
.brand-row h1 {
  font-size: clamp(1.5rem, 3vw, 4.8rem);
  line-height: 0.95;
}

.tournament-logo {
    width: 86px;
    height: 86px;
    object-fit: contain;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 20px;
    padding: 10px;
}

.eyebrow {
    margin: 0 0 6px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 12px;
    font-weight: 800;
}

h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 54px); line-height: 1; }
h2 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 34px); }

.muted { color: var(--muted); }
.site-header .muted { color: rgba(255,255,255,.82); }

.header-actions { display: flex; gap: 10px; align-items: center; }

select,.btn {
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    padding: 0 16px;
    font-weight: 800;
}

select { background: #fff; color: var(--text); max-width: 260px; }
.btn { cursor: pointer; background: var(--secondary); color: #fff; }

.tabs {
    display: flex;
    gap: 10px;
    margin: 22px 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
    color: var(--text);
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.panel { display: none; }
.panel.active { display: block; }

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

.team-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.team-card,.game-card,.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.team-card {
    padding: 18px 22px;
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 18px;
    align-items: center;
    width: 100%;
}

.team-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-seed {
    font-size: 15px;
    font-weight: 900;
    color: var(--primary);
}

.team-card-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

@media(max-width:760px) {
    .team-card {
        grid-template-columns: 60px 1fr;
    }

    .team-card-right {
        grid-column: 2;
        justify-content: flex-start;
    }
}

.team-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: contain;
    background: #f0edf4;
    border: 1px solid var(--line);
    padding: 8px;
}

.team-name { font-size: 17px; font-weight: 950; margin: 0 0 6px; }

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    background: #eee8f5;
    color: var(--primary);
}

.badge.approved { background: #e6f4ea; color: var(--good); }
.badge.pending { background: #fff4df; color: var(--warn); }
.badge.waitlist { background: #fce8e6; color: var(--bad); }

.iframe-wrap {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.iframe-wrap iframe {
    display: block;
    width: 100%;
    min-height: 1400px;
    border: 0;
}

/* Bracket */
.bracket-board {
    width: calc(100vw - 28px);
    margin-left: calc((1180px - min(1180px, calc(100vw - 28px))) / -2);
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 0 64px;
}

.bracket-inner {
    position: relative;
    min-width: 1500px;
    display: grid;
    grid-template-columns: 300px 300px 300px 300px;
    gap: 120px;
    align-items: start;
    padding: 0 26px;
}

.connector-svg {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 0;
}

.bracket-col {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.bracket-col-title {
    color: var(--primary);
    font-weight: 950;
    font-size: 17px;
    margin: 0 0 16px;
}

.bracket-col-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    margin: -7px 0 12px;
}

.bracket-stack {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.bracket-stack.qf-stack { gap: 28px; }
.bracket-stack.sf-stack { padding-top: 58px; gap: 116px; }
.bracket-stack.champ-stack { padding-top: 222px; }

.bracket-game {
    position: relative;
    border-radius: 14px;
}

.bracket-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.bracket-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
    background: rgba(242,237,247,.95);
    color: #5b4e70;
    border-bottom: 1px solid var(--line);
    padding: 10px 13px;
    font-size: 12px;
    font-weight: 950;
}

.bracket-meta {
    text-align: right;
    font-weight: 800;
    line-height: 1.25;
}

.bracket-team-row {
    min-height: 61px;
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
}

.bracket-team-row:last-child { border-bottom: 0; }

.bracket-team-row.winner {
    background: rgba(19,115,51,.08);
    font-weight: 950;
}

.bracket-team-row.placeholder {
    color: var(--primary);
    font-weight: 900;
}

.bracket-team-row.placeholder .inline-logo {
    border: 1.5px dashed rgba(90,4,126,.28);
    background: transparent;
}

.inline-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 10px;
    background: #f2edf6;
    padding: 4px;
}

.seed-line {
    display: flex;
    gap: 8px;
    align-items: center;
}

.seed-num {
    min-width: 18px;
    color: var(--text);
    font-weight: 950;
}

.team-subline {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    margin-top: 2px;
}

.bracket-score,.winner-check {
    font-size: 18px;
    font-weight: 950;
    color: #000;
}

.bracket-legend {
    display: flex;
    gap: 22px;
    width: fit-content;
    margin: -42px 0 22px auto;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255,255,255,.62);
    color: #51456c;
    font-size: 13px;
}

.bracket-legend span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.legend-line {
    width: 22px;
    height: 0;
    border-top: 2px solid var(--connector);
}

.legend-dot {
    width: 22px;
    height: 22px;
    border: 1.5px dashed rgba(90,4,126,.32);
    border-radius: 999px;
}

.bracket-note {
    display: inline-flex;
    color: #51456c;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,.56);
    font-size: 13px;
}

.games-list { display: grid; gap: 14px; }
.game-card { padding: 16px; }

.game-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 12px;
}

.matchup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.matchup .vs { font-weight: 950; color: var(--secondary); }

.inline-team {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.status-banner {
    margin-top: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 6px solid var(--secondary);
    box-shadow: var(--shadow);
    border-radius: 18px;
    padding: 14px 16px;
}

.hidden { display: none !important; }

.empty {
    background: rgba(255,255,255,.72);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.site-footer {
    padding: 36px 0;
    color: var(--muted);
    text-align: center;
}

@media(max-width:760px) {
    .header-content { align-items: flex-start; flex-direction: column; }
    .header-actions { width: 100%; }
    select,.btn { width: 100%; }
    .brand-row { align-items: flex-start; }
    .tournament-logo { width: 68px; height: 68px; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .team-grid { grid-template-columns: 1fr; }
    .matchup { grid-template-columns: 1fr; }
    .matchup .vs { text-align: center; }
    .iframe-wrap iframe { min-height: 900px; }

    .bracket-board {
        width: 100%;
        margin-left: 0;
        overflow-x: auto;
    }

    .bracket-inner {
        min-width: 1440px;
        grid-template-columns: 290px 290px 290px 290px;
        gap: 105px;
        padding: 0 4px;
    }

    .bracket-legend {
        margin: -34px 0 22px 0;
    }
}

.inline-team.placeholder {
    color: var(--primary);
    font-weight: 900;
}

.inline-team.placeholder .inline-logo {
    border: 1.5px dashed rgba(90,4,126,.28);
    background: transparent;
}


/* v1.2.1 Score Entry UI Restore */
.score-action-row {
    display: flex;
    justify-content: flex-end;
    padding: 10px 13px 12px;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.76);
}

.score-entry-button,
.score-submit-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 950;
    padding: 10px 16px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(32,20,48,.12);
}

.score-entry-button:hover,
.score-submit-btn:hover {
    filter: brightness(.98);
    transform: translateY(-1px);
}

.game-card .score-entry-button {
    margin-top: 14px;
}

.score-modal.hidden {
    display: none !important;
}

.score-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 18px;
}

.score-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 28, .46);
    backdrop-filter: blur(4px);
}

.score-modal-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 24px 90px rgba(0,0,0,.25);
    padding: 24px;
}

.score-modal-card h2 {
    margin-bottom: 8px;
}

.score-modal-matchup {
    margin-bottom: 18px;
}

.score-modal-close {
    position: absolute;
    right: 14px;
    top: 12px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.score-entry-form {
    display: grid;
    gap: 14px;
}

.score-entry-form label {
    display: grid;
    gap: 6px;
    font-weight: 900;
}

.score-entry-form input {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 12px;
    font: inherit;
}

.score-modal-error {
    border-radius: 12px;
    background: #fce8e6;
    color: var(--bad);
    font-weight: 800;
    padding: 10px 12px;
}

.inline-team.placeholder {
    color: var(--primary);
    font-weight: 900;
}

.inline-team.placeholder .inline-logo,
.bracket-team-row.placeholder .inline-logo {
    border: 1.5px dashed var(--primary);
    background: transparent;
}

.score-modal.is-busy .score-entry-form label {
    opacity: .55;
}

.score-modal-busy {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    background: rgba(197,179,88,.12);
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 900;
    color: var(--text);
}

.score-modal-busy.hidden {
    display: none !important;
}

.score-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(90,4,126,.18);
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: scoreSpin .8s linear infinite;
}

@keyframes scoreSpin {
    to { transform: rotate(360deg); }
}

.score-submit-btn:disabled,
.score-entry-form input:disabled {
    cursor: wait;
    opacity: .7;
}

.btn {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    padding: 0 18px;
    min-height: 44px;
    font-weight: 850;
    letter-spacing: .02em;
    backdrop-filter: blur(8px);
    transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.48);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Mobile game score alignment */
@media (max-width: 768px) {

    .game-card .game-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .game-card .game-team {
        flex: 1;
        min-width: 0;
    }

    .game-card .game-score {
        min-width: 42px;
        text-align: right;
        font-size: 1.05rem;
        font-weight: 900;
    }

    /* Winning team accent */
    .game-card .game-row.winner {
        background: rgba(76, 42, 133, 0.10);
        border-left: 4px solid var(--primary);
        border-radius: 12px;
        padding-left: 10px;
    }

    .game-card .game-row.winner .game-team-name {
        font-weight: 900;
        color: var(--primary);
    }

    .game-card .game-row.winner .game-score {
        color: var(--primary);
    }
}

/* Games tab mobile scoring layout */
.game-matchup {
    display: grid;
    gap: 8px;
}

.game-team-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 12px;
}

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

.game-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-score {
    min-width: 42px;
    text-align: right;
    font-size: 1.1rem;
    font-weight: 950;
}

.game-team-row.winner {
    background: rgba(19,115,51,.08);
    border-left: 4px solid rgba(19, 115, 51, 0.51);
}

.game-team-row.winner .game-team-name,
.game-team-row.winner .game-score {
    font-weight: 950;
}

.game-team-row.placeholder {
    color: var(--primary);
    font-weight: 900;
}

.game-team-row.placeholder .inline-logo {
    border: 1.5px dashed rgba(90, 4, 126, .28);
    background: transparent;
}

@media (min-width: 769px) {
    .game-matchup {
        gap: 10px;
    }
}

/* Mobile-friendly SportsEngine standings iframe */
.iframe-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.iframe-wrap iframe {
    display: block;
    width: 100%;
    min-height: 1200px;
    border: 0;
}

@media (max-width: 768px) {
    .iframe-wrap {
        border-radius: 18px;
        overflow-x: auto;
    }

    .iframe-wrap iframe {
        width: 980px;          /* gives SportsEngine room to render desktop table */
        max-width: none;
        min-height: 1400px;
        transform: scale(0.82);
        transform-origin: top left;
    }

    .iframe-wrap::after {
        content: "Swipe sideways to view full standings";
        display: block;
        padding: 10px 14px;
        font-size: 12px;
        font-weight: 800;
        color: var(--muted);
        background: rgba(255,255,255,.75);
    }
}


/* Bracket zoom controls */
.bracket-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

#bracketZoom {
  transform-origin: 0 0;
  width: max-content;
}

@media (max-width: 768px) {
  .bracket-scroll {
    overflow: hidden;
    touch-action: none;
    position: relative;
    height: 75vh;
  }

  #bracketZoom {
    transform-origin: 0 0;
    will-change: transform;
  }
}

@media (max-width: 768px) {
  .bracket-toolbar {
    display: none;
  }
}

@media (max-width: 768px) {
  .bracket-toolbar {
    display: none !important;
  }

  .bracket-scroll {
    height: 75vh;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: contain;
    position: relative;
  }

  #bracketZoom {
    transform-origin: 0 0;
    will-change: transform;
    width: max-content;
  }

  .bracket-board {
    overflow: visible !important;
  }

  .connector-svg {
    pointer-events: none;
  }
}