:root {
  --ink: #17162b;
  --ink-2: #4a4862;
  --ink-3: #807e96;
  --line: #e6e4ef;
  --bg: #f6f5fb;
  --card: #fff;
  --brand: #4b3fe0;
  --brand-2: #3a2fc4;
  --brand-soft: #ecebfd;
  --hot: #ff5a3c;
  --hot-soft: #fff0ec;
  --gold: #f5b400;
  --ok: #128a5a;
  --ok-soft: #e5f6ee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 22, 43, .06), 0 6px 24px rgba(23, 22, 43, .06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.45; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); letter-spacing: -.03em; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 .8em; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 640px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo img { width: 30px; height: 30px; }
.top nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; margin-left: 14px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 20px; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; min-height: 48px; transition: background .15s, transform .05s; }
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.hot { background: var(--hot); }
.btn.hot:hover { background: #ee4728; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: .92rem; border-radius: 10px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.danger { color: #c62828; }

/* hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: start; padding: 26px 0 40px; }
.hero .lede { font-size: 1.16rem; color: var(--ink-2); max-width: 30em; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; color: var(--ink-2); }
.ticks li::before { content: "✓"; color: var(--ok); font-weight: 800; margin-right: 8px; }
.kicker { display: inline-block; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--hot); background: var(--hot-soft); padding: 5px 10px; border-radius: 99px; margin-bottom: 14px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 22px; padding-top: 6px; } }

/* cards + forms */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
label.field { display: block; font-weight: 700; font-size: .95rem; margin: 0 0 14px; }
label.field > span.hint { font-weight: 500; color: var(--ink-3); }
input[type=text], textarea, select { display: block; width: 100%; margin-top: 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea { resize: vertical; min-height: 190px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 13px; font-weight: 600; font-size: .9rem; cursor: pointer; min-height: 38px; }
.chip[aria-pressed=true] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; margin: 2px 0 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.meter { font-size: .9rem; color: var(--ink-3); margin: -6px 0 14px; }
.meter b { color: var(--ink); }
.err { color: #c62828; font-weight: 600; min-height: 1.2em; margin: 8px 0 0; }

/* sections */
section.band { padding: 34px 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.steps > div { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.steps > div::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 10px; }
.steps p { color: var(--ink-2); margin: 0; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
details.faq { background: var(--card); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow); }
details.faq summary { font-weight: 700; cursor: pointer; }
details.faq p { color: var(--ink-2); margin: 10px 0 0; }
.mine { display: grid; gap: 8px; }
.mine a { display: flex; justify-content: space-between; gap: 10px; background: var(--card); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.mine a small { color: var(--ink-3); font-weight: 600; }
footer.foot { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 0 40px; color: var(--ink-3); font-size: .92rem; }
footer.foot a { color: var(--ink-2); margin-right: 14px; }

/* bracket page */
.bhead { padding: 6px 0 14px; }
.bhead h1 { font-size: clamp(1.7rem, 5.5vw, 2.4rem); margin-bottom: 6px; word-break: break-word; }
.sub { color: var(--ink-2); font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--hot-soft); color: var(--hot); padding: 5px 10px; border-radius: 99px; }
.pill.done { background: #fff6d6; color: #8a6400; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.tabs { display: flex; gap: 6px; background: #e9e7f3; padding: 4px; border-radius: 12px; margin: 0 0 16px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--ink-2); cursor: pointer; min-height: 42px; }
.tabs button[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.match { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 14px; }
.match .mlabel { font-size: .78rem; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin: 2px 4px 10px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.vs .v { align-self: center; font-weight: 900; color: var(--ink-3); font-size: .85rem; }
.side { position: relative; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 16px 12px; min-height: 84px; font-weight: 800; font-size: 1.05rem; cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: border-color .12s, background .12s, transform .08s; overflow-wrap: anywhere; }
.side:hover { border-color: #c9c5f6; }
.side:active { transform: scale(.98); }
.side .seed { font-size: .72rem; font-weight: 700; color: var(--ink-3); }
.side[aria-pressed=true] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.side[aria-pressed=true]::after { content: "✓"; position: absolute; top: 6px; right: 9px; font-size: .9rem; }
.side[disabled] { cursor: default; }
.side.won { border-color: var(--ok); background: var(--ok-soft); }
.side.lost { opacity: .55; }
.bar { width: 100%; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.side .count { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.side .who { font-size: .74rem; font-weight: 600; color: var(--ink-3); line-height: 1.25; }

.dock { position: sticky; bottom: 0; z-index: 5; background: rgba(246, 245, 251, .94); backdrop-filter: blur(8px); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); margin-top: 8px; }
.dock .in { display: flex; gap: 10px; align-items: center; }
.dock input { margin: 0; flex: 1; min-width: 0; }
.dock .count { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.dock .btn { flex: none; }
.notice { border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-weight: 600; }
.notice.ok { background: var(--ok-soft); color: #0d6b45; }
.notice.info { background: var(--brand-soft); color: var(--brand-2); }
.notice.warn { background: #fff6d6; color: #7a5800; }

.side-panel .card { margin-bottom: 16px; padding: 18px; }
.side-panel h3 { font-size: 1rem; }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.people li { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.people li span.tag { font-size: .78rem; font-weight: 700; color: var(--ink-3); }
.people li span.tag.yes { color: var(--ok); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }

/* bracket diagram */
.tree-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.tree { display: flex; gap: 22px; min-width: min-content; }
.col { display: flex; flex-direction: column; min-width: 150px; max-width: 190px; }
.colbody { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.col h4 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.tm { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; font-size: .9rem; }
.tm div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; font-weight: 600; }
.tm div + div { border-top: 1px solid var(--line); }
.tm .w { font-weight: 800; background: var(--ok-soft); }
.tm .l { color: var(--ink-3); }
.tm .tbd { color: var(--ink-3); font-style: italic; font-weight: 500; }
.tm .n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.champ-col .colbody { justify-content: center; }
.champ-mini { background: linear-gradient(135deg, #fff6d6, #ffe7a3); border-radius: 12px; padding: 14px; font-weight: 800; text-align: center; }

/* champion */
.champion { text-align: center; background: linear-gradient(160deg, var(--brand) 0%, #7a3fe0 100%); color: #fff; border-radius: 22px; padding: 30px 20px 24px; margin-bottom: 18px; box-shadow: 0 10px 40px rgba(75, 63, 224, .35); position: relative; overflow: hidden; }
.champion .trophy { font-size: 3.2rem; line-height: 1; }
.champion .label { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 800; opacity: .85; margin-top: 10px; }
.champion .name { font-size: clamp(1.9rem, 7vw, 2.8rem); font-weight: 900; letter-spacing: -.02em; margin: 6px 0; overflow-wrap: anywhere; }
.champion .score { opacity: .9; font-weight: 600; }
.champion .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.champion .btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .4); }
.champion .btn.light { background: #fff; color: var(--brand-2); }
.next-cta { text-align: center; }

/* sheet + toast */
.backdrop { position: fixed; inset: 0; background: rgba(23, 22, 43, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); max-height: 90vh; overflow: auto; }
@media (min-width: 640px) { .backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet .acts { display: flex; gap: 10px; margin-top: 8px; }
.sheet .acts .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 30; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.sharebox { display: flex; gap: 8px; }
.sharebox input { margin: 0; font-size: .9rem; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.hidden { display: none !important; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, #eceaf4, #f6f5fb, #eceaf4); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.prose { max-width: 680px; }
.prose h2 { margin-top: 1.4em; }
.prose p, .prose li { color: var(--ink-2); }
