* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0e1014; --surface: #171a21; --surface2: #1f232c; --line: #2a2f3a;
  --fg: #eceef3; --muted: #8b93a3;
  --tyler: #5aa9ff; --tyler-bg: rgba(90,169,255,.14);
  --jean: #ff86c8;  --jean-bg: rgba(255,134,200,.14);
  --good: #3ddc91; --amber: #ffb84d; --red: #e10600;
  --r: 18px;
}
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 96px);
  -webkit-tap-highlight-color: transparent;
}
main { padding: 0 16px; max-width: 620px; margin: 0 auto; }

/* ---------- header ---------- */
header { padding: 26px 20px 16px; max-width: 620px; margin: 0 auto; }
h1 { font-size: 21px; font-weight: 750; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.tag { background: var(--red); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 6px; }
#sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.prog { height: 4px; border-radius: 3px; background: var(--surface2); margin-top: 12px; overflow: hidden; }
.prog > i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), #ff6b5e); border-radius: 3px; }

/* ---------- versus card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
#board { padding: 22px 18px 18px; margin-bottom: 18px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; }
.side { text-align: center; padding: 14px 4px; border-radius: 14px; border: 1px solid transparent; transition: .2s; }
.side.win { background: var(--accb); border-color: color-mix(in srgb, var(--acc) 35%, transparent); }
.side-flag { font-size: 18px; }
.side-name { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-top: 4px; }
.side.win .side-name { color: var(--fg); }
.side-score { display: block; font-size: 34px; font-weight: 800; line-height: 1.1; margin-top: 6px;
  color: var(--acc); font-variant-numeric: tabular-nums; }
.gap { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface2);
  padding: 4px 8px; border-radius: 20px; white-space: nowrap; }
.share { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: var(--surface2); margin-top: 18px; }
.share > i { display: block; height: 100%; }
.key { display: flex; justify-content: center; gap: 18px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.key b { font-weight: 400; }
.key .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 4px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); border: 0;
  padding: 9px; border-radius: 9px; font-size: 13px; font-weight: 650; transition: .15s; }
.tabs button.active { background: var(--surface2); color: var(--fg); }

/* ---------- category rows ---------- */
.cat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.cat[open] { border-color: #3a4150; }
.cat > summary { list-style: none; cursor: pointer; padding: 15px 38px 15px 16px; position: relative; }
.cat > summary::-webkit-details-marker { display: none; }
.cat > summary::after {
  content: ""; position: absolute; right: 16px; top: 20px; width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.cat[open] > summary::after { transform: rotate(225deg); }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cat-name { font-weight: 650; font-size: 15px; }
.cat-scores { display: flex; gap: 6px; flex-shrink: 0; }
.chip { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px;
  padding: 2px 9px; border-radius: 8px; opacity: .5; }
.chip.hi { opacity: 1; }
.chip.t { color: var(--tyler); background: var(--tyler-bg); }
.chip.j { color: var(--jean); background: var(--jean-bg); }
.cat-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; background: var(--surface2); margin-top: 11px; }
.cat-bar > i { display: block; height: 100%; }
.cat-bar > i.t { background: var(--tyler); } .cat-bar > i.j { background: var(--jean); }
.cat-status { display: inline-block; margin-top: 9px; font-size: 11.5px; color: var(--amber); }
.cat-status.done { color: var(--muted); }

/* ---------- detail ---------- */
.detail { padding: 6px 16px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 2px; }
.detail table { width: 100%; border-collapse: collapse; }
.detail td { padding: 5px 8px 5px 0; vertical-align: top; line-height: 1.4; }
.detail .ok { color: var(--good); } .detail .no { color: var(--muted); } .detail .pend { color: var(--amber); }
.mini { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.mini + .mini { border-top: 1px solid var(--line); }
.mini b { color: var(--fg); font-weight: 600; }

/* ---------- standings tables ---------- */
.sec-title { font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; }
#actual .card, #info .card { padding: 16px; margin-bottom: 12px; }
.stbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stbl tr:last-child td { border-bottom: 0; }
.stbl td:first-child { color: var(--muted); width: 26px; }
.stbl td:last-child { text-align: right; color: var(--muted); }

.warn { background: #2a1e0a; border: 1px solid #5a3f10; color: var(--amber);
  font-size: 12.5px; padding: 11px 13px; border-radius: 11px; margin-bottom: 12px; }
.info p { margin-bottom: 11px; color: var(--muted); font-size: 13px; }
.info p b { color: var(--fg); }

/* ---------- refresh ---------- */
#refresh { position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: 54px; height: 54px; border-radius: 50%; background: var(--red); color: #fff; border: 0;
  font-size: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.45); display: grid; place-items: center; }
#refresh.spin { animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
