/* Create Brackets - the public tournament page and the embed. Tokens come from bracket.css. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 15px/1.5 var(--body); }
a { color: var(--accent-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 18px; }

/* masthead: the tournament's own, in the conference colour */
.mast { background: var(--night); color: #fff; padding-block: 18px 0; position: relative; }
.mast::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.mast-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.org-logo { width: 54px; height: 54px; border-radius: 12px; background: #fff; padding: 5px; object-fit: contain; flex: none; }
.eyebrow { font: 700 12.5px/1.2 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.mast h1 { font: 800 clamp(30px, 4.6vw, 50px)/.98 var(--display); text-transform: uppercase; letter-spacing: .005em; margin: 4px 0 0; text-wrap: balance; }
.mast-sub { color: #a4aab3; font-size: 14px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.state { font: 700 12px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: #1f2227; color: #fff; display: inline-flex; gap: 6px; align-items: center; }
.state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.state.champ-state { background: var(--accent); color: var(--on-accent); }
.mast-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 700 14px var(--body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.dark { background: #1f2227; border-color: #2b2e34; color: #fff; }
.btn.dark:hover { border-color: var(--accent); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.tabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; color: #a4aab3; font: 700 15px var(--display); letter-spacing: .1em; text-transform: uppercase; padding: 10px 14px 13px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; position: relative; z-index: 1; }
.tab[aria-selected="true"] { color: #fff; border-bottom-color: #fff; }
.tab:hover { color: #fff; }

/* sponsors */
.presenting { background: var(--card); border-bottom: 1px solid var(--line); }
.presenting .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.presenting a { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.presenting img { height: 34px; width: auto; max-width: 160px; object-fit: contain; }
.spons-k { font: 700 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.round-sponsor { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin: -4px 0 14px; }
.round-sponsor img { height: 26px; width: auto; max-width: 120px; object-fit: contain; }

main { padding-block: 22px 40px; }
.panel[hidden] { display: none !important; }

/* round picker for phones */
.rounds { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; scrollbar-width: thin; }
.rbtn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font: 700 13px var(--body); cursor: pointer; white-space: nowrap; color: var(--muted); }
.rbtn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.view-toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: 700 13px var(--body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.hint { color: var(--muted); font-size: 13px; }

/* games by date */
.day { margin-bottom: 22px; }
.day h3 { font: 800 18px/1 var(--display); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; }
.day h3 span { font: 600 13px var(--body); color: var(--faint); text-transform: none; letter-spacing: 0; }

/* info */
.info-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.box h2 { font: 800 15px/1.1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 10px; }
.box p { margin: 0 0 10px; max-width: 68ch; }
.box + .box { margin-top: 0; }
.stack { display: grid; gap: 18px; align-content: start; }
.site { padding: 10px 0; border-top: 1px solid var(--line-2); }
.site:first-of-type { border-top: 0; padding-top: 0; }
.site b { display: block; }
.site span { color: var(--muted); font-size: 14px; }
.rules { white-space: pre-wrap; }
dl.contacts { margin: 0; display: grid; gap: 10px; }
dl.contacts dt { font-weight: 700; }
dl.contacts dd { margin: 0; color: var(--muted); font-size: 14px; user-select: all; }

/* follow */
.follow { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.fteam { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; min-width: 0; }
.fteam span { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* game sheet */
dialog.sheet { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(12, 13, 15, .55); }
.sh-head { background: var(--night); color: #fff; padding: 16px 18px 18px; position: relative; }
.sh-head .eyebrow { margin-bottom: 10px; }
.sh-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 10px; border: 0; background: #1f2227; color: #fff; cursor: pointer; font-size: 20px; line-height: 1; }
.sh-team { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 0; }
.sh-team .lg { width: 52px; height: 52px; background: #fff; border-radius: 10px; padding: 4px; }
.sh-team .lg-init { width: 52px; height: 52px; font-size: 18px; }
.sh-team b { font: 800 26px/1 var(--display); text-transform: uppercase; display: block; }
.sh-team small { color: #8b9099; font-size: 12.5px; }
.sh-team .sc { font: 800 40px/1 var(--display); }
.sh-team.lost b, .sh-team.lost .sc { color: #7b818a; }
.sh-body { padding: 16px 18px 20px; display: grid; gap: 14px; }
.sh-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.sh-row svg { width: 20px; height: 20px; color: var(--faint); margin-top: 2px; }
.sh-row b { display: block; }
.sh-row span { color: var(--muted); font-size: 14px; }
.sh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-spons { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.sh-spons img { height: 30px; width: auto; max-width: 140px; object-fit: contain; }

/* pick'em */
.pk-grid { display: grid; gap: 14px; }
.pk-round h3 { font: 800 15px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.pk-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 8px; }
.pk-game { border: 1px solid var(--line); background: var(--card); border-radius: 12px; overflow: hidden; }
.pk-pick { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font-weight: 600; }
.pk-pick + .pk-pick { border-top: 1px solid var(--line-2); }
.pk-pick[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; }
.pk-pick:disabled { cursor: default; color: var(--tbd); }
.pk-pick .ok { font: 700 11px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lb th, .lb td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
.lb th { font: 700 11px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.lb td:last-child, .lb th:last-child { text-align: right; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input { font: 500 15px var(--body); padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-width: 0; }

footer.site-foot { border-top: 1px solid var(--line); padding-block: 18px 30px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--faint); font-size: 13px; }
footer.site-foot img { height: 22px; width: auto; }
.made { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 50; }
.qr { display: grid; justify-items: center; gap: 12px; }
.qr-code { background: #fff; padding: 12px; border-radius: 12px; }
.example-note { background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; padding: 8px 0; }
.example-note .wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* embed: no masthead chrome, bracket first */
body.embed { background: var(--card); }
body.embed .mast { padding-top: 12px; }
body.embed .mast h1 { font-size: 26px; }
body.embed .org-logo { width: 40px; height: 40px; }
body.embed main { padding-block: 14px 10px; }

@media (max-width: 760px) {
    .info-grid { grid-template-columns: minmax(0, 1fr); }
    .mast-actions { margin-left: 0; width: 100%; }
    .mast-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- print: the bracket on paper, no buttons ---- */
@media print {
    @page { size: landscape; margin: 10mm; }
    body { background: #fff; color: #111214; }
    .example-note, .mast-actions, .tabs, .view-toggle, .rounds, .site-foot, dialog, .toast { display: none !important; }
    .mast { background: #fff; color: #111214; padding-top: 0; }
    .mast::after { display: none; }
    .mast h1 { font-size: 30px; }
    .state { border: 1px solid #111214; background: #fff; color: #111214; }
    .presenting { border: 0; }
    main { padding-top: 10px; }
    .panel[hidden] { display: none !important; }
    .gb, .card, .box, .lboard { box-shadow: none; break-inside: avoid; }
    .bwrap { overflow: visible !important; }
}

/* sponsors on the Info tab: each logo links to the sponsor's site */
.spons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.spons-tile { display: grid; justify-items: center; gap: 8px; padding: 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #111214; text-decoration: none; text-align: center; font-size: 13px; }
.spons-tile:hover { border-color: var(--accent); }
.spons-tile img { height: 44px; width: auto; max-width: 100%; object-fit: contain; }
.presenting img { background: #fff; border-radius: 6px; padding: 2px 6px; }

/* sponsor band under the bracket */
.spons-band { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spons-band .wrap { display: grid; justify-items: center; gap: 12px; padding-block: 18px 22px; }
.spons-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 22px; }
.spons-row a, .spons-row span { display: grid; place-items: center; height: 64px; min-width: 120px; padding: 8px 16px; border-radius: 12px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: #111214; }
.spons-row a:hover { border-color: var(--accent); }
.spons-row img { height: 44px; width: auto; max-width: 150px; object-fit: contain; }
body.embed .spons-band .wrap { padding-block: 12px 14px; }
@media print { .spons-band { border: 0; } }
