/* SlightBit NBA game screen. Everything is scoped under .nbag so it can't clash with other leagues. */
.nbag {
  --nbag-card2: color-mix(in srgb, var(--card) 82%, var(--text) 8%);
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); color: var(--text); font-family: var(--font);
  -webkit-overflow-scrolling: touch;
}
html.nbag-open, html.nbag-open body { overflow: hidden; }
.nbag-page { max-width: 640px; margin: 0 auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.nbag button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.nbag button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nbag table, .nbag .nbag-kv b, .nbag .nbag-pts, .nbag .nbag-cmp .v, .nbag .nbag-tiles b, .nbag .nbag-line3 b, .nbag .nbag-zones b { font-variant-numeric: tabular-nums; }

/* header */
.nbag-head { padding: calc(8px + env(safe-area-inset-top)) 16px 0; background: linear-gradient(180deg, color-mix(in srgb, var(--card) 70%, var(--bg)), var(--bg)); }
.nbag-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 600; min-height: 40px; }
.nbag-bar > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nbag-back { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--text) !important; margin-left: -6px; padding: 6px 8px 6px 0 !important; }
.nbag-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 0 12px; }
.nbag-tm { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0; }
.nbag-logo { width: 44px; height: 44px; object-fit: contain; }
.nbag-fallback { border-radius: 50%; background: var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.nbag-tm .nm { font-weight: 700; font-size: 15px; }
.nbag-tm .rec { color: var(--muted); font-size: 12px; }
.nbag-mid { display: grid; justify-items: center; gap: 4px; text-align: center; }
.nbag-pts { font-size: 36px; font-weight: 800; letter-spacing: -1px; display: flex; gap: 16px; line-height: 1.1; }
.nbag-pts .dim { color: var(--muted); }
.nbag-tip { font-size: 22px; font-weight: 800; }
.nbag-clock { font-size: 12px; font-weight: 700; color: var(--muted); }
.nbag-clock.live { color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.nbag-clock.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
.nbag-lines { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.nbag-lines th, .nbag-lines td { padding: 3px 4px; text-align: center; color: var(--muted); font-weight: 600; }
.nbag-lines th:first-child, .nbag-lines td:first-child { text-align: left; color: var(--text); }
.nbag-lines .t { color: var(--text); font-weight: 800; }

.nbag-tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nbag-tabs::-webkit-scrollbar { display: none; }
.nbag-tabs button { flex: none; padding: 12px 12px 10px !important; font-size: 14px; font-weight: 700; color: var(--muted) !important; border-bottom: 2px solid transparent !important; }
.nbag-tabs button.on { color: var(--text) !important; border-bottom-color: var(--accent) !important; }

/* body + sections */
.nbag-body { padding: 12px 16px 0; display: grid; gap: 10px; }
.nbag-sec { background: var(--card); border-radius: 16px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.nbag-sec > h3 { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nbag-sec > h3:empty { display: none; }
.nbag-sec > h3 em { font-style: normal; color: var(--accent); letter-spacing: .02em; text-transform: none; font-weight: 700; }
.nbag-tag { font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 2px 6px; border-radius: 6px; background: var(--nbag-card2); color: var(--muted); white-space: nowrap; }
.nbag-tag.hi { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.nbag-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.nbag-empty { background: var(--card); border-radius: 16px; padding: 14px; color: var(--muted); font-size: 14px; }
.nbag-empty.error { color: var(--live); }
.nbag-empty button { color: var(--accent) !important; font-weight: 700; margin-left: 6px; }
.nbag-skel { height: 120px; border-radius: 16px; background: var(--card); opacity: .6; animation: pulse 1.4s infinite; }
.nbag-updated { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.nbag-chart { width: 100%; height: auto; display: block; }
.nbag-chart text { font-family: var(--font); }

.nbag-probrow { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.nbag-probbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; }
.nbag-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.nbag-kv div { background: var(--nbag-card2); border-radius: 10px; padding: 8px; text-align: center; }
.nbag-kv b { display: block; font-size: 16px; }
.nbag-kv span { font-size: 11px; color: var(--muted); }

.nbag-key { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; }
.nbag-key span, .nbag-mini { display: inline-flex; align-items: center; gap: 6px; }
.nbag-key i, .nbag-mini i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.nbag-mini { font-size: 12px; font-weight: 800; }
.nbag-cmp { display: grid; gap: 7px; }
.nbag-cmp-row { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 6px; font-size: 12px; }
.nbag-cmp .v { font-weight: 700; color: var(--muted); }
.nbag-cmp .v.best { color: var(--text); }
.nbag-cmp .v.r { text-align: right; }
.nbag-cmp-mid { display: grid; gap: 3px; min-width: 0; }
.nbag-cmp-mid .lbl { text-align: center; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nbag-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; height: 6px; }
.nbag-bars i { display: block; height: 100%; border-radius: 3px; }
.nbag-bars i:first-child { justify-self: end; }

.nbag-formrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nbag-form { display: flex; gap: 4px; }
.nbag-form span { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.nbag-form .W { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.nbag-form .L { background: color-mix(in srgb, var(--live) 16%, transparent); color: var(--live); }

.nbag-plist { display: grid; gap: 2px; }
.nbag-prow { display: grid !important; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 7px 4px !important; border-radius: 10px; text-align: left; width: 100%; }
.nbag-prow:active, .nbag-prow:hover { background: var(--nbag-card2) !important; }
.nbag-prow .who { min-width: 0; }
.nbag-prow .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nbag-prow .who span { font-size: 11px; color: var(--muted); }
.nbag-prow .stat { font-size: 14px; font-weight: 800; text-align: right; }
.nbag-prow .stat span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.nbag-av { position: relative; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; flex: none; }
.nbag-av span { font-size: 11px; font-weight: 800; color: var(--bg); }
.nbag-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; background: var(--nbag-card2); }

.nbag-run { background: var(--card); font-weight: 800; font-size: 14px; padding: 10px 12px; border-radius: 12px; display: flex; justify-content: space-between; }
.nbag-play { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.nbag-sec > h3 + .nbag-play, .nbag-sec > .nbag-play:first-child { border-top: 0; }
.nbag-play .t { color: var(--muted); font-size: 11px; font-weight: 700; padding-top: 1px; }
.nbag-play .sc { font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.nbag-play.big .d { font-weight: 700; }

.nbag-toggle { display: flex; gap: 6px; }
.nbag-toggle button { flex: 1; padding: 8px !important; border-radius: 10px; background: var(--card) !important; font-weight: 700; font-size: 13px; color: var(--muted) !important; }
.nbag-sec .nbag-toggle button { background: var(--nbag-card2) !important; }
.nbag-toggle button.on { background: var(--accent) !important; color: var(--bg) !important; }

.nbag-box { overflow-x: auto; margin: 0 -12px; padding: 0 12px; }
.nbag-box table { border-collapse: collapse; font-size: 12px; min-width: 100%; white-space: nowrap; }
.nbag-box th { color: var(--muted); font-weight: 700; font-size: 11px; padding: 6px; text-align: right; }
.nbag-box td { padding: 8px 6px; text-align: right; border-top: 1px solid var(--line); }
.nbag-box th:first-child, .nbag-box td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; }
.nbag-box td:first-child button { font-weight: 700; text-align: left; display: inline-flex; align-items: center; gap: 4px; }
.nbag-box td:first-child button span { color: var(--muted); font-weight: 500; font-size: 11px; }
.nbag-box td:first-child button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.nbag-box tr.tot td { font-weight: 800; }
.nbag-box tr.bench td { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.nbag-box tr.dnp td { color: var(--muted); text-align: left; font-size: 11px; }
.nbag-box tr.dnp td:first-child button { font-weight: 600; color: var(--muted); }

.nbag-adv { width: 100%; border-collapse: collapse; font-size: 13px; }
.nbag-adv th { color: var(--muted); font-weight: 700; font-size: 11px; text-align: right; padding: 5px 4px; }
.nbag-adv td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--line); font-weight: 600; }
.nbag-adv th:first-child, .nbag-adv td:first-child { text-align: left; }
.nbag-adv td.best { color: var(--accent); }

.nbag-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); font-weight: 600; }
.nbag-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.nbag-legend i.miss { border: 2px solid var(--text); }
.nbag-zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.nbag-zones div { background: var(--nbag-card2); border-radius: 10px; padding: 8px 4px; }
.nbag-zones b { display: block; font-size: 15px; }
.nbag-zones span { color: var(--muted); font-size: 11px; }

.nbag-recap { margin: 0; font-size: 14px; line-height: 1.5; }
.nbag-recap b { display: block; font-size: 17px; line-height: 1.3; margin-bottom: 4px; text-wrap: balance; }
.nbag-mvp { display: grid !important; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%; }
.nbag-mvp .nbag-av { width: 52px; height: 52px; }
.nbag-mvp .nbag-av span { font-size: 15px; }
.nbag-mvp b { display: block; font-size: 16px; }
.nbag-mvp span { color: var(--muted); font-size: 12px; }
.nbag-mvp .gs { text-align: right; }
.nbag-mvp .gs b { font-size: 24px; color: var(--accent); }

.nbag-inj { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.nbag-inj span { color: var(--muted); font-size: 12px; }
.nbag-inj .st { font-size: 11px; font-weight: 800; text-align: right; }
.nbag-inj .st.out { color: var(--live); }
.nbag-inj .st.q { color: #fbbf24; }
.nbag-inj .st.p { color: var(--accent); }

/* player card */
.nbag-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.nbag-sheet { width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: nbagUp .22s ease-out; }
@keyframes nbagUp { from { transform: translateY(30px); opacity: .4; } }
.nbag-sheet-body { display: grid; gap: 10px; }
.nbag-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
.nbag-sh-head { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; }
.nbag-sh-head .nbag-av { width: 60px; height: 60px; }
.nbag-sh-head .nbag-av span { font-size: 17px; }
.nbag-sh-head b { display: block; font-size: 19px; }
.nbag-sh-head > div > span { color: var(--muted); font-size: 12px; }
.nbag-close { width: 36px; height: 36px; border-radius: 50%; background: var(--card) !important; color: var(--muted) !important; font-size: 16px; }
.nbag-line3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nbag-line3 div { background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; }
.nbag-line3 b { display: block; font-size: 28px; letter-spacing: -.5px; }
.nbag-line3 span { font-size: 11px; color: var(--muted); font-weight: 700; }
.nbag-line3 small { display: block; font-size: 11px; font-weight: 700; margin-top: 2px; }
.nbag .up { color: var(--accent); }
.nbag .down { color: var(--live); }
.nbag-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nbag-tiles div { background: var(--nbag-card2); border-radius: 10px; padding: 8px; min-width: 0; }
.nbag-tiles b { display: block; font-size: 16px; }
.nbag-tiles span { font-size: 11px; color: var(--muted); }
.nbag-share { display: grid; grid-template-columns: 80px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; }
.nbag-share span { color: var(--muted); }
.nbag-share div { height: 6px; border-radius: 3px; background: var(--nbag-card2); overflow: hidden; }
.nbag-share i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.nbag-share b { text-align: right; }
.nbag-bars5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; align-items: end; }
.nbag-bars5 div { display: grid; gap: 4px; justify-items: center; font-size: 11px; color: var(--muted); }
.nbag-bars5 i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; background: var(--accent); }
.nbag-bars5 b { color: var(--text); font-size: 12px; }
.nbag-loading { animation: pulse 1.4s infinite; }

@media (prefers-reduced-motion: reduce) {
  .nbag-sheet, .nbag-loading, .nbag-skel, .nbag-clock.live::before { animation: none; }
}
