/* CSBL: dark fight-night look. Near-black canvas, red for the cage and actions, gold for wins and perfects.
   Layout: single phone-width column, sticky top bar, tab bar fixed to the bottom. */
:root {
  --bg: #0d0d10;
  --panel: #16161b;
  --panel-2: #1f1f26;
  --line: #2b2b34;
  --text: #f4efe6;
  --muted: #9b97a3;
  --red: #e0283a;
  --red-deep: #9e1623;
  --red-soft: rgba(224, 40, 58, .14);
  --blue: #4a8cf0;
  --blue-soft: rgba(74, 140, 240, .14);
  --gold: #e0b14a;
  --gold-soft: rgba(224, 177, 74, .14);
  --green: #46c986;
  --green-soft: rgba(70, 201, 134, .13);
  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-label: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --tabbar: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--f-body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 24px);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 20; background: rgba(13, 13, 16, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.top-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.top img { width: 38px; height: 38px; }
.top h1 { font-family: var(--f-display); font-weight: 800; font-size: 24px; letter-spacing: .02em; margin: 0; text-transform: uppercase; line-height: 1; }
.top .who { margin-left: auto; font-family: var(--f-label); color: var(--muted); font-size: 14px; letter-spacing: .04em; }

main { max-width: 720px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #111115; border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.tabs-inner { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar); }
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  color: var(--muted); font-family: var(--f-label); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"] svg { stroke: var(--red); }

/* type */
h2 { font-family: var(--f-display); font-weight: 800; font-size: 28px; line-height: 1; margin: 0; text-transform: uppercase; text-wrap: balance; letter-spacing: .01em; }
h3 { font-family: var(--f-label); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px;
  font-family: var(--f-label); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.live { background: var(--red); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 6px; border: 1px solid var(--red); background: var(--red); color: #fff; cursor: pointer;
  font-family: var(--f-label); font-weight: 700; font-size: 16px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
}
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; text-decoration: underline; font: inherit; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row > .field { flex: 1 1 140px; }
.field > span { font-family: var(--f-label); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 16px;
}
input:focus, select:focus { border-color: var(--gold); outline: none; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.error { color: #ff8a95; background: var(--red-soft); border-radius: 6px; padding: 10px 12px; font-size: 15px; }
.notice { background: var(--gold-soft); color: var(--text); border-radius: 6px; padding: 10px 12px; font-size: 15px; }
.notice b { color: var(--gold); }

/* password rules: always on screen, ticking off as you type */
.rules { list-style: none; margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--panel-2); display: grid; gap: 6px; }
.rules li { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.rules li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.rules li.ok { color: var(--text); }
.rules li.ok::before { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230d0d10' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }

/* auth screen */
.auth { max-width: 420px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 18px; padding-top: 8px; }
.auth .logo { width: 180px; height: 180px; align-self: center; }
.seg-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 8px; padding: 4px; }
.seg-tabs button { border: 0; background: none; min-height: 40px; border-radius: 6px; cursor: pointer; font-family: var(--f-label); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.seg-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* event header */
.ev-head { display: flex; flex-direction: column; gap: 6px; }
.ev-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-family: var(--f-label); font-size: 14px; color: var(--muted); letter-spacing: .04em; }
.matchup { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; background: var(--panel-2); font-size: 15px; }
.matchup b { color: var(--gold); }

/* bouts */
.bout { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.bout:first-of-type { border-top: 0; padding-top: 0; }
.bout.cancelled { opacity: .55; }
.bout-meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--f-label); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.corners { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.vs { align-self: center; font-family: var(--f-display); font-weight: 900; color: var(--muted); font-size: 16px; }
.fighter {
  display: flex; flex-direction: column; gap: 4px; justify-content: center; min-width: 0; min-height: 64px; padding: 10px 12px;
  border-radius: 6px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; text-align: left;
  font-family: var(--f-display); font-weight: 800; font-size: 19px; line-height: 1.05; text-transform: uppercase; overflow-wrap: break-word; hyphens: auto;
}
.fighter.b { text-align: right; align-items: flex-end; }
.fighter.long { font-size: 16px; }
.fighter small { font-family: var(--f-label); font-weight: 600; font-size: 11.5px; letter-spacing: .1em; color: var(--muted); }
.fighter .dog { color: var(--gold); }
.fighter.a.on { border-color: var(--red); background: var(--red-soft); }
.fighter.b.on { border-color: var(--blue); background: var(--blue-soft); }
.fighter.won { box-shadow: inset 0 0 0 1px var(--gold); }
.fighter:disabled { cursor: default; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  min-height: 38px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
  font-family: var(--f-label); font-weight: 600; font-size: 15px; letter-spacing: .04em;
}
.opt.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.opt:disabled { cursor: default; opacity: .4; }
.opt.on:disabled { opacity: 1; }
.result { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 6px; background: var(--panel-2); font-size: 15px; }
.pts { font-family: var(--f-display); font-weight: 800; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.pts.hit { color: var(--green); }
.pts.perfect { color: var(--gold); }
.pts.zero { color: var(--muted); }
details.others { font-size: 14.5px; }
details.others summary { cursor: pointer; color: var(--muted); font-family: var(--f-label); letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.others ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.others li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.savebar {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; background: #1b1b21; border: 1px solid var(--line); font-size: 14.5px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--green); }
.dot.busy { background: var(--gold); }

/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font-family: var(--f-label); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.l, td.l { text-align: left; }
td.name { font-weight: 600; white-space: normal; min-width: 90px; }
td.rank { font-family: var(--f-display); font-weight: 800; font-size: 20px; width: 34px; color: var(--muted); }
td.big { font-family: var(--f-display); font-weight: 800; font-size: 22px; }
tr.me td { background: rgba(224, 177, 74, .07); }
tr.first td.rank { color: var(--gold); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }

/* snapshot tiles on the picks page */
.snap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.snap a { text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.snap .big { font-family: var(--f-display); font-weight: 800; font-size: 30px; line-height: 1; }
.snap .big small { font-size: 16px; color: var(--muted); }

/* bracket */
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.round { display: flex; flex-direction: column; gap: 10px; }
.round-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.round-head.now { border-color: var(--red); }
.match { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.match .p { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; }
.match .p + .p { border-top: 1px solid var(--line); }
.match .p.win { background: var(--gold-soft); }
.match .p.win .nm { color: var(--gold); font-weight: 700; }
.match .p.me .nm::after { content: " (you)"; color: var(--muted); font-weight: 400; }
.match .p.lose .nm { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(155,151,163,.5); }
.match .why { font-size: 12px; color: var(--muted); padding: 4px 10px 6px; border-top: 1px dashed var(--line); }
.champ { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--gold-soft), transparent); border: 1px solid rgba(224,177,74,.35); }
.champ .belt { font-family: var(--f-display); font-weight: 900; font-size: 26px; color: var(--gold); text-transform: uppercase; }

/* lists */
.list { display: flex; flex-direction: column; }
.list a, .list .li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.list a:last-child, .list .li:last-child { border-bottom: 0; }
.list .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list .t b { font-weight: 600; }
.list .r { text-align: right; flex: none; }
.chev::after { content: "›"; color: var(--muted); font-size: 22px; margin-left: 6px; }

/* stats bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 26px minmax(70px, 120px) 1fr 40px; gap: 8px; align-items: center; font-size: 15px; }
.bar .track { height: 12px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--red); border-radius: 3px; }
.bar.gold .fill { background: var(--gold); }
.bar .n { text-align: right; font-family: var(--f-display); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.bar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .rk { font-family: var(--f-display); font-weight: 800; color: var(--muted); }

.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty strong { font-family: var(--f-display); font-weight: 800; font-size: 22px; color: var(--text); text-transform: uppercase; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 16px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: 15px;
}
.loading { text-align: center; color: var(--muted); padding: 40px 0; font-family: var(--f-label); letter-spacing: .1em; text-transform: uppercase; }
.admin-bout { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.admin-bout:first-child { border-top: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 380px) { .fighter { font-size: 17px; } h2 { font-size: 25px; } }
