/* Court view (js/ui-court.js): the live game page and the #/watch replay. Uses the tokens from style.css. */

/* ---------- live page: text or court ---------- */
.lv-views { display: flex; justify-content: center; margin: 0 0 14px; }
.lv-view {
  min-height: 44px; padding: 0 18px; flex: 0 1 auto; min-width: 0;
  font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: .12em;
  background: var(--bg3); color: var(--text2); border: 1px solid var(--line2); cursor: pointer;
}
.lv-view + .lv-view { border-left: 0; }
.lv-view:hover { color: var(--gold2); }
.lv-view.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #111; border-color: var(--gold); }
.lv-view:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }

/* ---------- the court ---------- */
.ct-host { margin-bottom: 18px; }
.ct-host[hidden] { display: none; }
.ct-wrap { max-width: 1180px; margin: 0 auto; background: #050505; border: 1px solid var(--line); border-bottom: 3px solid var(--gold); border-radius: 10px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .55); }

.ct-strip {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 8px 12px; background: linear-gradient(180deg, #141416, #050505); border-bottom: 1px solid var(--line);
}
.ct-tm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ct-tm-h { justify-content: flex-end; }
.ct-tm b { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .08em; color: var(--text2); }
.ct-pts { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--text2); font-variant-numeric: tabular-nums; min-width: 1.7em; }
.ct-tm:not(.ct-tm-h) .ct-pts { margin-left: auto; text-align: right; }
.ct-tm-h .ct-pts { margin-right: auto; text-align: left; }
.ct-pts.lead { color: #fff; text-shadow: 0 0 14px rgba(245, 215, 110, .35); }
.ct-clk { display: inline-flex; align-items: baseline; gap: 8px; padding: 4px 12px; background: #000; border: 1px solid var(--gold-dim); border-radius: 6px; box-shadow: 0 0 12px rgba(243, 207, 94, .15); font-family: var(--display); font-variant-numeric: tabular-nums; }
.ct-clk b { color: var(--gold2); font-weight: 600; letter-spacing: .1em; font-size: 14px; }
.ct-time { color: #fff; font-size: 18px; font-weight: 600; min-width: 2.8em; text-align: right; }
.ct-time:empty { display: none; }

.ct-stage { position: relative; }
.ct-svg { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ct-apron { fill: #0a0a0b; }
.ct-plank { fill: #b98445; }
.ct-plank2 { fill: #8a5c2a; }
.ct-end { font-family: var(--display); font-weight: 700; font-size: 3.4px; letter-spacing: .5px; fill: #fff; opacity: .55; text-anchor: middle; dominant-baseline: central; }
.ct-mid-fill { opacity: .45; }
.ct-seam { stroke: rgba(60, 34, 10, .45); stroke-width: .07; fill: none; }
.ct-ln { fill: none; stroke: rgba(255, 255, 255, .88); stroke-width: .17; }
.ct-edge { stroke-width: .3; }
.ct-dash { stroke-dasharray: .8 .6; }
.ct-paint { opacity: .78; }
.ct-board { stroke: #e9e9ee; stroke-width: .32; }
.ct-rim { fill: none; stroke: #ff7a1a; stroke-width: .2; }
.ct-mid { display: none; font-family: var(--display); font-weight: 700; font-size: 3.2px; letter-spacing: .3px; fill: var(--gold); opacity: .22; text-anchor: middle; dominant-baseline: central; }

.ct-dot { cursor: pointer; }
.ct-dot.gone { pointer-events: none; }
.ct-hit { fill: rgba(0, 0, 0, 0); pointer-events: all; }
.ct-body { stroke-width: .35; }
.ct-dot.ball .ct-body { stroke-width: .5; }
.ct-dot.sel .ct-body { stroke: var(--gold2); stroke-width: .6; }
.ct-ini { font-family: var(--display); font-weight: 600; font-size: 1.55px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ct-nm { display: none; font-family: var(--display); font-size: 1.1px; letter-spacing: .06px; fill: var(--text2); text-anchor: middle; dominant-baseline: hanging; pointer-events: none; paint-order: stroke; stroke: #000; stroke-width: .25px; }
.ct-svg.ct-names .ct-nm { display: inline; }
.ct-ball { fill: #e8772e; stroke: #5a2a0a; stroke-width: .12; pointer-events: none; }
.ct-shadow { fill: #000; opacity: .45; pointer-events: none; }
.ct-body { filter: drop-shadow(0 .25px .3px rgba(0, 0, 0, .6)); }
.ct-ball { filter: drop-shadow(0 0 .5px rgba(255, 160, 60, .9)); }
.ct-tags { pointer-events: none; }
.ct-tag { font-family: var(--display); font-weight: 700; font-size: 1.45px; letter-spacing: .08px; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: #000; stroke-width: .35px; }
.ct-tag.pts { font-size: 2.3px; fill: var(--gold2); }
.ct-tag.big { font-size: 1.9px; fill: var(--gold2); }
.ct-tag.foul { fill: #ffb4b4; }
.ct-tag.miss { fill: var(--muted); }
.ct-tag.kind { font-size: 1.15px; fill: var(--gold); }
.ct-tag.sub { fill: var(--text2); font-size: 1.2px; }
.ct-ringfx { fill: none; stroke: var(--gold2); stroke-width: .3; }

.ct-banner {
  border-radius: 6px; backdrop-filter: blur(3px);
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none;
  padding: 10px 22px; background: rgba(0, 0, 0, .82); border: 1px solid var(--gold); border-left-width: 4px;
  font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .18em; color: var(--gold2); white-space: nowrap;
}
.ct-banner.show { animation: ctPop .35s ease; }
@keyframes ctPop { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.ct-card {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 52px 6px 12px;
  background: var(--bg2); border-top: 1px solid var(--line); border-left: 3px solid var(--gold);
}
.ct-card.empty { border-left-color: var(--line2); }
.ct-hint { font-family: var(--display); font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.ct-x { position: absolute; top: 4px; right: 0; width: 44px; height: 44px; background: none; border: 0; color: var(--muted); font-family: var(--display); font-size: 16px; cursor: pointer; }
.ct-x:hover { color: var(--gold2); }
.ct-cn { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ct-cn b { font-family: var(--display); font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-cn small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ct-cl { display: flex; gap: 18px; margin-left: auto; }
.ct-cl span { display: flex; flex-direction: column; font-family: var(--display); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.ct-cl b { font-size: 22px; letter-spacing: 0; color: #fff; line-height: 1.05; font-variant-numeric: tabular-nums; }

.ct-line { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg2); font-size: 14px; color: var(--text2); }
.ct-line.made { color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.ct-line.made .ct-lx { font-weight: 600; }
.ct-lt { display: flex; align-items: center; gap: 8px; flex: none; }
.ct-lt .logo { flex: none; }
.ct-lc { font-family: var(--display); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 60px; }
.ct-lx { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.ct-ctrl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.ct-ctrl .btn { min-height: 44px; min-width: 52px; }
.ct-play { min-width: 92px !important; }
.ct-spd.on, .ct-spd.on:hover:not(:disabled) { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #111; border-color: var(--gold); }

.ct-floor-list { padding: 0 12px 12px; display: grid; gap: 6px; }
.ct-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ct-chip {
  display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 4px 6px;
  background: var(--bg3); border: 1px solid var(--line); color: var(--text2); cursor: pointer; font: inherit; font-size: 13px; text-align: left;
}
.ct-chip:hover { border-color: var(--gold-dim); }
.ct-chip.on { border-color: var(--gold); color: #fff; }
.ct-chip i {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--cf); color: var(--ct); box-shadow: inset 0 0 0 2px var(--cr);
  font-style: normal; font-family: var(--display); font-weight: 600; font-size: 11px;
}
.ct-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 560px) {
  .lv-view { flex: 1 1 0; padding: 0 8px; font-size: 13px; }
  .ct-strip { padding: 6px 8px; gap: 6px; }
  .ct-strip .logo { --sz: 22px !important; }
  .ct-tm { gap: 5px; }
  .ct-tm b { font-size: 13px; }
  .ct-pts { font-size: 24px; }
  .ct-clk { padding: 3px 8px; gap: 6px; }
  .ct-time { font-size: 15px; }
  .ct-banner { font-size: 18px; padding: 8px 14px; letter-spacing: .14em; }
  .ct-line { font-size: 13px; padding: 6px 10px; }
  .ct-lc { min-width: 50px; font-size: 11px; }
  .ct-ctrl { gap: 6px; padding: 8px; }
  .ct-ctrl .btn { padding: 0 10px; min-width: 46px; font-size: 12px; }
  .ct-play { min-width: 76px !important; }
  .ct-floor-list { padding: 0 8px 8px; }
  .ct-row { gap: 4px; }
  .ct-chip { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 2px; font-size: 10px; text-align: center; }
  .ct-chip span { max-width: 100%; }
  .ct-chip i { width: 22px; height: 22px; font-size: 10px; }
}

/* the live page hides its text-mode parts in court view (a display rule must not bring them back) */
#lvControls[hidden], #lvGrid[hidden], #lvCourt[hidden] { display: none !important; }
.ct-sfx.on { border-color: var(--gold); color: var(--gold); }

@media (min-width: 1000px) {
  .ct-strip { padding: 12px 20px; }
  .ct-pts { font-size: 40px; }
  .ct-tm b { font-size: 18px; }
  .ct-time { font-size: 22px; }
  .ct-line { font-size: 16px; min-height: 56px; padding: 10px 18px; }
  .ct-ctrl { padding: 14px; gap: 10px; }
  .ct-floor-list { padding: 0 18px 16px; }
  .ct-chip { font-size: 14px; min-height: 48px; }
}

/* ---------- full screen watch mode: everything on one screen, nothing to scroll ---------- */
body.ct-full-on { overflow: hidden; }
.ct-wrap.ct-full {
  position: fixed; inset: 0; z-index: 70; max-width: none; margin: 0; border: 0; border-radius: 0;
  display: flex; flex-direction: column; background: #050505;
  height: 100vh; height: 100dvh; padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.ct-full .ct-strip { flex: none; padding-top: calc(6px + env(safe-area-inset-top)); }
.ct-full .ct-stage { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.ct-full .ct-svg { width: 100%; height: 100%; max-height: 100%; }
.ct-full .ct-card, .ct-full .ct-line, .ct-full .ct-ctrl, .ct-full .ct-floor-list { flex: none; }
.ct-full .ct-line { min-height: 40px; padding: 6px 12px; }
.ct-full .ct-ctrl { padding: 6px 8px; gap: 6px; }
.ct-full .ct-ctrl .btn { min-height: 38px; padding: 0 10px; font-size: 12px; }
.ct-full .ct-floor-list { padding: 4px 8px 8px; gap: 4px; }
.ct-full .ct-chip { min-height: 38px; }
.ct-full .ct-card { min-height: 46px; }
@media (max-height: 760px) {
  .ct-full .ct-line { min-height: 32px; font-size: 12px; padding: 3px 10px; }
  .ct-full .ct-card { min-height: 38px; }
  .ct-full .ct-cl b { font-size: 18px; }
  .ct-full .ct-chip { min-height: 32px; }
  .ct-full .ct-chip i { width: 18px; height: 18px; font-size: 9px; }
  .ct-full .ct-ctrl .btn { min-height: 32px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .ct-full .ct-card { display: none; }
  .ct-full .ct-floor-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ct-full .ct-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ct-full .ct-chip { flex-direction: column; font-size: 9px; min-height: 28px; padding: 1px; }
}

/* substitutions strip, live box score and plays */
.ct-sub { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 10px; background: rgba(0, 0, 0, .82); border-left: 3px solid var(--gold); font-family: var(--display); font-size: 13px; letter-spacing: .08em; color: var(--text2); pointer-events: none; text-align: center; }
.ct-sub[hidden] { display: none; }
.ct-pnl { border-top: 1px solid var(--line); background: #08080a; }
.ct-pnl[hidden] { display: none; }
.ct-ptabs { display: flex; gap: 6px; padding: 8px 10px 0; }
.ct-ptab { background: var(--bg3); color: var(--text2); border: 1px solid var(--line2); padding: 6px 12px; font-family: var(--display); letter-spacing: .12em; font-size: 12px; cursor: pointer; }
.ct-ptab.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #111; border-color: var(--gold); }
.ct-pbody { padding: 8px 10px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 340px; overflow-y: auto; }
.ct-bx { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ct-bx th { font-family: var(--display); letter-spacing: .1em; font-size: 12px; color: var(--gold2); text-align: right; padding: 3px 6px; border-bottom: 1px solid var(--line); }
.ct-bx td { text-align: right; padding: 3px 6px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.ct-bx .l { text-align: left; max-width: 0; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-bx tr.on td { color: #fff; }
.ct-bx tr:not(.on) td { color: var(--muted); }
.ct-bx td i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold2); margin-right: 6px; }
.ct-feed { list-style: none; margin: 0; padding: 0; grid-column: 1 / -1; display: grid; gap: 3px; font-size: 13px; }
.ct-feed li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.ct-feed small { flex: none; min-width: 64px; color: var(--muted); letter-spacing: .06em; }
.ct-feed li.sub { color: var(--gold2); }
.ct-full .ct-pnl { flex: none; }
.ct-pnl.ct-pnl-over { position: absolute; inset: 0; z-index: 8; overflow-y: auto; background: #050507; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.ct-pnl.ct-pnl-over .ct-ptabs { padding-top: calc(8px + env(safe-area-inset-top)); }
.ct-pnl.ct-pnl-over .ct-pbody { max-height: none; }
@media (max-width: 560px) { .ct-pbody { grid-template-columns: minmax(0, 1fr); } .ct-sub { font-size: 11px; } }
.ct-ptabs { position: sticky; top: 0; z-index: 2; background: #08080a; padding-bottom: 8px; align-items: center; }
.ct-pscore { margin-left: auto; font-family: var(--display); letter-spacing: .08em; font-size: 13px; color: var(--text2); white-space: nowrap; }
.ct-pclose { flex: none; min-height: 36px; padding: 0 14px; background: var(--gold); color: #111; border: 0; font-family: var(--display); font-weight: 700; letter-spacing: .12em; font-size: 13px; cursor: pointer; }
.ct-pclose:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ct-pbody { display: block; }
.ct-bxw { overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.ct-bx { min-width: 520px; }
.ct-bx td, .ct-bx th { padding: 3px 5px; white-space: nowrap; }
.ct-bx td small { color: var(--muted); font-size: 10px; margin-left: 4px; }
.ct-bx .l { max-width: 170px; min-width: 120px; position: sticky; left: 0; background: #08080a; }
.ct-bx tr.tot td { font-family: var(--display); letter-spacing: .06em; color: var(--text2); border-top: 1px solid var(--line2); }
@media (min-width: 900px) { .ct-pnl:not(.ct-pnl-over) .ct-pbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .ct-bx { min-width: 0; } }
