:root {
  --purple: #341C50; --purple-2: #4A2E6B; --purple-ink: #26143B;
  --gold: #DDA939; --gold-soft: #F6E7C3; --tan: #AF8758; --silver: #9C9FA5;
  --ink: #1D1C17; --muted: #6E6680; --line: #E1DBE9; --tint: #F4F1F8; --bg: #F7F5FA; --card: #fff;
  --live: #D9342B; --win: #1D1C17;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif; --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }

/* header */
.top { background: var(--purple); color: #fff; border-bottom: 4px solid var(--gold); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 16px; }
.top img.logo { height: 64px; width: auto; display: block; }
.top .ttl { font-family: var(--cond); font-weight: 800; font-size: 30px; letter-spacing: .5px; line-height: 1; text-transform: uppercase; }
.top .sub { font-family: var(--cond); font-weight: 600; color: var(--gold); letter-spacing: 1.6px; font-size: 13px; text-transform: uppercase; margin-top: 4px; }
.top .dog { height: 56px; margin-left: auto; }
.pulse { display: inline-flex; align-items: center; gap: 6px; font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 1.2px; color: #CFC4DE; text-transform: uppercase; margin-top: 6px; }
.pulse i { width: 8px; height: 8px; border-radius: 50%; background: #4CC37A; box-shadow: 0 0 0 0 rgba(76,195,122,.6); animation: ping 2s infinite; }
.pulse.off i { background: #B9B0C6; animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(76,195,122,.6); } 80%,100% { box-shadow: 0 0 0 8px rgba(76,195,122,0); } }

/* tabs */
.tabs { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.tabs-in { max-width: 1240px; margin: 0 auto; padding: 0 8px; display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 0 0 auto; background: none; border: 0; padding: 14px 14px 12px; font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button.on { color: var(--purple); border-color: var(--gold); }
.tabs button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
h2.sec { font-family: var(--cond); font-weight: 800; font-size: 22px; letter-spacing: 1px; color: var(--purple); text-transform: uppercase; margin: 22px 0 10px; }
h2.sec:first-child { margin-top: 4px; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }

/* controls */
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 6px; font-family: var(--cond); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--purple); color: #fff; }
select.flt { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; font-family: var(--cond); font-weight: 600; letter-spacing: .5px; color: var(--purple); }

/* game cards */
.slot-h { font-family: var(--cond); font-weight: 800; font-size: 18px; color: var(--purple); margin: 18px 0 8px; display: flex; align-items: center; gap: 10px; }
.slot-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.game { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; }
.game::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--purple); }
.game.b-gold::before { background: var(--gold); } .game.b-silver::before { background: var(--silver); } .game.b-bronze::before { background: var(--tan); }
.game.live { border-color: var(--live); box-shadow: 0 0 0 1px var(--live); }
.meta { display: flex; align-items: center; gap: 6px; padding: 8px 10px 6px 14px; font-family: var(--cond); font-size: 12.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.meta .wh { flex-basis: 100%; color: var(--muted); }
.meta .gid { color: var(--purple); font-weight: 800; font-size: 14px; }
.meta .st { margin-left: auto; font-weight: 800; letter-spacing: 1px; }
.meta .st.live { color: var(--live); display: inline-flex; align-items: center; gap: 5px; }
.meta .st.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: blink 1.2s infinite; }
.meta .st.final { color: var(--purple); }
@keyframes blink { 50% { opacity: .25; } }
.chip { display: inline-block; padding: 1px 6px; border-radius: 3px; font-weight: 800; font-size: 11px; letter-spacing: .8px; color: var(--purple-ink); background: var(--tint); }
.chip.gold { background: var(--gold); } .chip.silver { background: #D6D8DB; } .chip.bronze { background: #DCC4A6; }
.team { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px 7px 14px; border-top: 1px solid var(--line); min-height: 38px; }
.team .nm { font-family: var(--cond); font-weight: 600; font-size: 18px; line-height: 1.1; }
.team .sc { font-family: var(--cond); font-weight: 700; font-size: 20px; min-width: 30px; text-align: right; color: var(--muted); }
.team.tbd .nm { color: #A79FB3; font-weight: 500; font-size: 15px; }
.team.win .nm, .team.win .sc { font-weight: 800; color: var(--win); }
.team.win .sc::after { content: " ◂"; font-size: 13px; color: var(--gold); }
.team.lose .nm, .team.lose .sc { color: #8E869C; }
.game.live .team .sc { color: var(--ink); }

/* live strip */
.livebox { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 18px; }
.livebox h3 { margin: 0 0 10px; font-family: var(--cond); font-size: 16px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--live); display: flex; align-items: center; gap: 8px; }

/* pools */
.pools { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.pool { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pool-h { background: var(--purple); color: #fff; padding: 9px 12px; display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--gold); }
.pool-h b { font-family: var(--cond); font-weight: 800; font-size: 22px; color: var(--gold); }
.pool-h span { font-family: var(--cond); font-weight: 600; letter-spacing: 1.6px; font-size: 13px; }
.pool-h em { margin-left: auto; font-style: normal; font-family: var(--cond); font-size: 12px; letter-spacing: 1px; color: #CFC4DE; text-transform: uppercase; }
.pool table { width: 100%; border-collapse: collapse; }
.pool th { font-family: var(--cond); font-weight: 700; font-size: 11.5px; letter-spacing: 1px; color: var(--muted); text-align: right; padding: 6px 10px 4px; }
.pool th:first-child, .pool td:first-child { text-align: left; }
.pool td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: right; font-family: var(--cond); font-size: 16px; font-weight: 600; }
.pool td.t { font-size: 17px; }
.pool td .pl { display: inline-block; width: 20px; font-weight: 800; color: var(--muted); font-size: 13px; }
.pool tr.adv td .pl { color: var(--purple); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .8px; padding: 1px 5px; border-radius: 3px; margin-left: 6px; vertical-align: 2px; }
.tag.gold { background: var(--gold); color: var(--purple-ink); } .tag.silver { background: #D6D8DB; } .tag.bronze { background: #DCC4A6; }
.pool .nt { font-size: 12px; color: var(--muted); padding: 6px 10px 9px; border-top: 1px solid var(--line); }

/* bracket */
.bk-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.bk-head .sw { width: 14px; height: 30px; border-radius: 3px; }
.bk-head h2 { margin: 0; font-family: var(--cond); font-weight: 800; font-size: 26px; color: var(--purple); text-transform: uppercase; letter-spacing: .8px; }
.bk-head p { margin: 0; color: var(--muted); font-size: 13px; }
.bk { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.bk .col { display: flex; flex-direction: column; scroll-snap-align: start; }
.bk .col h4 { margin: 0 0 10px; font-family: var(--cond); font-weight: 800; letter-spacing: 1.3px; font-size: 13px; text-transform: uppercase; color: var(--purple); padding-bottom: 6px; border-bottom: 2px solid var(--gold); }
.bk .stack { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; flex: 1; }
.champ { background: var(--purple); color: #fff; border-radius: 10px; padding: 16px; text-align: center; border: 2px solid var(--gold); }
.champ small { display: block; font-family: var(--cond); font-weight: 700; letter-spacing: 2px; color: var(--gold); font-size: 13px; text-transform: uppercase; }
.champ b { display: block; font-family: var(--cond); font-weight: 800; font-size: 26px; margin-top: 6px; }
.champ b.tbd { color: #8F80A6; font-weight: 600; font-size: 18px; }
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.standings { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.standings ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.standings li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); font-family: var(--cond); font-size: 17px; font-weight: 600; }
.standings li span { width: 34px; font-weight: 800; color: var(--purple); font-size: 14px; }
.standings li em { font-style: normal; color: #A79FB3; font-weight: 500; font-size: 15px; }
.standings li:first-child span { color: var(--purple-ink); background: var(--gold); border-radius: 3px; text-align: center; }

/* footer */
footer { border-top: 1px solid var(--line); background: #fff; }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; font-family: var(--cond); font-weight: 600; letter-spacing: 1px; font-size: 12.5px; text-transform: uppercase; color: var(--muted); }
.credit { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.credit img { height: 16px; }

/* admin */
.login { max-width: 360px; margin: 50px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.login h2 { margin: 0 0 6px; font-family: var(--cond); color: var(--purple); text-transform: uppercase; letter-spacing: 1px; }
input.txt { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
.btn { border: 0; border-radius: 8px; padding: 10px 14px; font-family: var(--cond); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 14px; cursor: pointer; }
.btn.pri { background: var(--purple); color: #fff; } .btn.gold { background: var(--gold); color: var(--purple-ink); }
.btn.live { background: var(--live); color: #fff; } .btn.ghost { background: var(--tint); color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--live); font-size: 13px; min-height: 18px; margin-top: 8px; }
.arow { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.arow.live { border-color: var(--live); } .arow.final { background: #FBFAFD; }
.arow .who { display: grid; gap: 6px; }
.arow .who label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--cond); font-weight: 600; font-size: 17px; }
.arow .who label.tbd { color: #A79FB3; }
.arow input.num { width: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; text-align: center; font-size: 18px; font-family: var(--cond); font-weight: 700; }
.arow .acts { display: flex; flex-direction: column; gap: 6px; }
.arow .m { grid-column: 1 / -1; }
.seedrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.seedrow select { padding: 7px; border: 1px solid var(--line); border-radius: 6px; font-family: var(--cond); font-size: 15px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--purple); color: #fff; padding: 10px 16px; border-radius: 8px; font-family: var(--cond); letter-spacing: .8px; font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; }

@media (max-width: 640px) {
  .top img.logo { height: 50px; } .top .ttl { font-size: 23px; } .top .sub { font-size: 11px; letter-spacing: 1.2px; } .top .dog { display: none; }
  .bk { grid-template-columns: repeat(4, 84%); }
  .tabs button { flex: 1 0 auto; padding: 13px 8px 11px; font-size: 14px; letter-spacing: .8px; }
  .tabs button .dot { margin-right: 4px; }
}
