/* Brunel Pool Society: live scoreboard, referee console, live cam, match timeline.
   Loaded on /livematch, /admin and /tournaments. Works on top of style.css. */

[hidden] { display: none !important; }

/* ---------- balls ---------- */
.ball { --s: 34px; --c: #888; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); color: #111; font-family: var(--font-display); font-weight: 800; box-shadow: inset -3px -4px 7px rgba(0,0,0,.38), 0 2px 5px rgba(0,0,0,.45); }
.ball::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.62), rgba(255,255,255,0) 42%); pointer-events: none; }
.ball i { font-style: normal; display: grid; place-items: center; width: 56%; height: 56%; border-radius: 50%; background: #fff; font-size: calc(var(--s) * .3); line-height: 1; position: relative; z-index: 1; }
.ball.stripe { background: linear-gradient(#f4f4f4 0 24%, var(--c) 24% 76%, #f4f4f4 76% 100%); }
.ball.sm { --s: 22px; }
.ball.xl { --s: 120px; position: absolute; left: 0; top: 0; margin: -60px 0 0 -60px; }
.ball.off { opacity: .28; filter: grayscale(.35); }
.ball.ready { animation: ball-ready 1.1s ease-in-out infinite; }
.ball.point { --c: var(--gold); }
@keyframes ball-ready { 50% { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(255,194,14,.55), 0 0 18px rgba(255,194,14,.7); } }

/* ---------- viewer counter ---------- */
.viewers { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; color: var(--muted); padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.viewers b { color: #fff; font-variant-numeric: tabular-nums; }
.viewers-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--red); animation: ping 1.6s infinite; }
.viewers.bump b { animation: pop .35s ease-out; }

/* ---------- public match card additions ---------- */
.lm-card { position: relative; overflow: hidden; }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; border-radius: inherit; }
.lm-game { padding: .12rem .6rem; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lm-turn { margin: -.4rem 0 1rem; text-align: center; font-family: var(--font-display); font-weight: 700; color: var(--gold); font-size: clamp(.95rem, 2vw, 1.25rem); }
.lm-card .side, .rcard .r-side { border: 1px solid transparent; border-radius: 20px; padding: .6rem .4rem; transition: background .25s, border-color .25s, opacity .4s, filter .4s, transform .4s; }
.lm-card .side.turn, .rcard .r-side.turn { border-color: rgba(255,194,14,.55); background: rgba(255,194,14,.07); box-shadow: 0 0 30px rgba(255,194,14,.12); }
.lm-at { visibility: hidden; font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--bg); background: var(--gold); padding: .1rem .6rem; border-radius: 999px; }
.side.turn .lm-at, .r-side.turn .lm-at { visibility: visible; }
.lm-at.on { visibility: visible; }
.lm-group { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 700; padding: .15rem .7rem; border-radius: 999px; background: rgba(0,0,0,.28); border: 1px solid var(--line); }
.lm-group::before { content: ""; width: .8em; height: .8em; border-radius: 50%; background: var(--dot, #777); box-shadow: inset -1px -1px 2px rgba(0,0,0,.4); }
.lm-group[data-set="spots"][data-g="low"] { --dot: #f2c200; }
.lm-group[data-set="spots"][data-g="high"]::before { background: linear-gradient(#fff 0 25%, #1f4fd1 25% 75%, #fff 75%); }
.lm-group[data-set="reds"][data-g="low"] { --dot: #d8232a; }
.lm-group[data-set="reds"][data-g="high"] { --dot: #f2c200; }
.lm-tray { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 22px; }
.lm-mini { margin: .1rem 0 0; font-size: .72rem; color: var(--muted); }
.lm-centre { display: grid; gap: .35rem; justify-items: center; text-align: center; font-size: .78rem; color: var(--muted); max-width: 160px; }
.lm-open { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.lm-break { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--gold); }
.lm-reds { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 140px; }
.lm-reds i { width: 9px; height: 9px; border-radius: 50%; background: #d8232a; box-shadow: inset -1px -1px 2px rgba(0,0,0,.4); }
.side.lost { opacity: .4; filter: grayscale(.85); transform: scale(.95); }
.side.winner { background: rgba(255,194,14,.1); border-color: rgba(255,194,14,.6); }

.lm-feed { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .3rem; }
.lm-feed-item { display: flex; gap: .5rem; align-items: baseline; padding: .4rem .75rem; border-radius: 10px; background: rgba(0,0,0,.22); border-left: 3px solid transparent; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.lm-feed-item:first-child { color: var(--text); }
.lm-feed-item time { flex: none; color: var(--gold); font-variant-numeric: tabular-nums; font-size: .78rem; }
.lm-feed-item.k-pot, .lm-feed-item.k-break { border-left-color: var(--gold); }
.lm-feed-item.k-foul { border-left-color: var(--red); }
.lm-feed-item.k-eight, .lm-feed-item.k-win { border-left-color: var(--gold); background: rgba(255,194,14,.14); color: #fff; font-weight: 600; }
.lm-feed-item.fresh { animation: feed-in .5s ease-out; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-8px); background: rgba(255,194,14,.35); } }

/* ---------- animations (pot, scratch, 8 ball, win) ---------- */
.fx-drop { position: absolute; top: 24%; width: 38px; height: 38px; z-index: 3; }
.fx-drop.l { left: 14%; } .fx-drop.r { right: 14%; }
.fx-drop .ball { --s: 38px; }
.fx-pocket { position: absolute; top: calc(24% + 84px); width: 46px; height: 46px; margin: 0 -4px; border-radius: 50%; background: radial-gradient(#000 55%, #1c1630); box-shadow: 0 0 0 4px #4a3416, 0 0 22px rgba(0,0,0,.85); }
.fx-pocket.l { left: 14%; } .fx-pocket.r { right: 14%; }
.fx-flash { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; white-space: nowrap; font-family: var(--font-display); font-weight: 800; letter-spacing: .06em; font-size: clamp(1.5rem, 5vw, 3.2rem); padding: .25rem 1.1rem; border-radius: 14px; text-shadow: 0 4px 18px rgba(0,0,0,.6); }
.fx-flash.bad { background: var(--red); color: #fff; }
.fx-flash.warn { background: #ffb300; color: #1a1200; }
.fx-flash.gold { background: rgba(6,9,40,.85); color: var(--gold); border: 2px solid var(--gold); }
.fx-flash.muted { background: rgba(6,9,40,.8); color: var(--muted); font-size: clamp(1rem, 3vw, 1.6rem); }
.fx-burst { position: absolute; left: 50%; top: 45%; width: 0; height: 0; z-index: 4; }
.fx-burst .ring { position: absolute; left: 0; top: 0; width: 150px; height: 150px; border-radius: 50%; border: 5px solid var(--gold); box-shadow: 0 0 30px rgba(255,194,14,.8), inset 0 0 30px rgba(255,194,14,.5); transform: translate(-50%, -50%); opacity: 0; }
.fx-burst .ring.r2 { border-color: #fff; }
.fx-win { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(5,7,47,.84); backdrop-filter: blur(2px); overflow: hidden; border-radius: inherit; }
.fx-win-box { display: grid; gap: .25rem; justify-items: center; text-align: center; padding: 1rem; }
.fx-win-box svg { width: clamp(48px, 9vw, 84px); fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 14px rgba(255,194,14,.7)); }
.fx-win-box small { color: var(--gold); font-weight: 800; letter-spacing: .24em; text-transform: uppercase; }
.fx-win-box strong { font-family: var(--font-display); font-size: clamp(2rem, 7vw, 4.2rem); line-height: 1.05; color: #fff; overflow-wrap: anywhere; }
.fx-win-box .score { font-weight: 700; font-size: clamp(1rem, 2.4vw, 1.5rem); }
.fx-win-box em { font-style: normal; color: var(--muted); }
.confetti { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; }

/* ---------- live cam (public) ---------- */
.cam-stage { margin-bottom: 1.6rem; }
.cam-frame { position: relative; aspect-ratio: 16 / 9; background: #02030f; border-radius: 26px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.cam-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-live { position: absolute; top: 14px; left: 14px; z-index: 5; display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .8rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.cam-live .live-dot { background: #fff; animation: none; }
.cam-unmute { position: absolute; top: 12px; right: 12px; z-index: 5; border: 0; cursor: pointer; padding: .5rem 1rem; border-radius: 999px; background: var(--gold); color: var(--bg); font: 700 .85rem var(--font-body); animation: ping 1.8s infinite; }
.cam-status { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; padding: 1rem; background: rgba(2,3,15,.6); color: #fff; font-weight: 600; }
.cam-audio { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; background: radial-gradient(circle at 50% 40%, rgba(23,34,168,.7), #02030f 70%); padding-bottom: 5rem; }
.cam-audio i { width: 12px; height: 60px; border-radius: 6px; background: var(--gold); animation: eq 1s ease-in-out infinite; transform-origin: bottom; }
.cam-audio i:nth-child(2) { animation-delay: .12s; } .cam-audio i:nth-child(3) { animation-delay: .27s; } .cam-audio i:nth-child(4) { animation-delay: .05s; }
.cam-audio i:nth-child(5) { animation-delay: .4s; } .cam-audio i:nth-child(6) { animation-delay: .2s; } .cam-audio i:nth-child(7) { animation-delay: .33s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1.2); } }
.cam-stage.audio-only .cam-frame { aspect-ratio: auto; min-height: 340px; }

/* the score becomes a TV-style bar along the bottom of the picture */
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 3rem 1rem .8rem; background: linear-gradient(to top, rgba(3,5,30,.95) 35%, rgba(3,5,30,0)); }
.cam-bar:empty { display: none; }
.cam-bar .mcard { margin: 0; padding: .6rem .9rem; border-radius: 18px; background: rgba(6,9,40,.88); border-color: rgba(255,255,255,.18); box-shadow: none; animation: none; }
.cam-bar .mc-head { margin-bottom: .3rem; font-size: .8rem; }
.cam-bar .mc-body { gap: .4rem; }
.cam-bar .side { flex-direction: row; justify-content: space-between; gap: .6rem; padding: .25rem .6rem; text-align: left; flex-wrap: wrap; }
.cam-bar .pname { font-size: clamp(.9rem, 2vw, 1.3rem); }
.cam-bar .pscore { font-size: clamp(1.7rem, 4.2vw, 2.8rem); }
.cam-bar .lm-at, .cam-bar .lm-mini, .cam-bar .mc-foot, .cam-bar .lm-centre { display: none; }
.cam-bar .lm-turn { margin: 0 0 .3rem; font-size: .85rem; }
.cam-bar .lm-feed { margin-top: .4rem; }
.cam-bar .lm-feed-item:nth-child(n+2) { display: none; }
.cam-bar .clock { font-size: clamp(1.1rem, 2.6vw, 1.8rem); }
.cam-bar .lm-tray { flex-basis: 100%; justify-content: flex-start; }
.cam-bar .lm-tray:empty { display: none; }

@media (max-width: 700px) {
  .cam-frame { aspect-ratio: auto; display: flex; flex-direction: column; border-radius: 20px; }
  .cam-frame video { position: relative; aspect-ratio: 16 / 9; height: auto; }
  .cam-stage.audio-only .cam-audio { position: relative; height: 150px; padding: 0; }
  .cam-bar { position: relative; padding: .6rem; background: rgba(3,5,30,.95); }
  .cam-status { position: absolute; }
  .cam-stage.audio-only .cam-frame { min-height: 0; }
}

/* TV mode with the live cam: picture fills the screen, score along the bottom */
body.tv.cam-on .sb-live:empty { display: none; }
body.tv.cam-on .cam-stage { margin: 0; }
body.tv.cam-on .cam-frame { border-radius: 20px; }
body.tv.cam-on .cam-bar .pname { font-size: clamp(1.4rem, 3vw, 3rem); }
body.tv.cam-on .cam-bar .pscore { font-size: clamp(3rem, 7vw, 7rem); }
body.tv.cam-on .cam-bar .clock { font-size: clamp(1.8rem, 4vw, 4rem); }
body.tv .viewers { font-size: clamp(.9rem, 1.4vw, 1.4rem); }
body.tv .lm-feed-item { font-size: clamp(1rem, 1.5vw, 1.6rem); }
body.tv .lm-turn { font-size: clamp(1.2rem, 2vw, 2.2rem); }
body.tv .lm-group { font-size: clamp(.9rem, 1.4vw, 1.5rem); }
body.tv .ball.sm { --s: clamp(22px, 2.2vw, 40px); }
body.tv .lm-mini, body.tv .lm-centre { font-size: clamp(.8rem, 1.2vw, 1.3rem); }

/* ---------- referee console ---------- */
.rcard .lm-game { margin-left: .2rem; }
.rcard .r-side { min-width: 0; }
.rc-break { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; padding: .9rem 1.2rem; border-radius: 16px; background: linear-gradient(120deg, rgba(255,194,14,.22), rgba(255,194,14,.06)); border: 1px solid rgba(255,194,14,.55); }
.rc-break small { color: var(--gold); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: .68rem; }
.rc-break strong { font-family: var(--font-display); font-size: clamp(1.3rem, 4vw, 2rem); flex: 1 1 auto; overflow-wrap: anywhere; }
.rc-note { padding: .8rem 1rem; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--muted); }
.rc-guide { margin: 1rem 0; padding: 1rem 1.2rem; border-radius: 16px; background: rgba(255,194,14,.1); border: 1px solid rgba(255,194,14,.45); }
.rc-guide small { display: block; color: var(--gold); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: .66rem; }
.rc-guide strong { display: block; font-family: var(--font-display); font-size: 1.15rem; margin: .1rem 0 .3rem; }
.rc-guide p { margin: 0; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.rc-next { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.rc-next span { font-size: .78rem; font-weight: 700; padding: .15rem .7rem; border-radius: 999px; background: rgba(0,0,0,.3); color: var(--gold); }

.rack { display: grid; gap: .8rem; margin-top: .4rem; }
.rack-row { display: grid; gap: .35rem; }
.rack-title { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rack-balls { display: flex; flex-wrap: wrap; gap: .55rem; }
.rball { background: none; border: 2px solid transparent; border-radius: 50%; padding: 2px; cursor: pointer; touch-action: manipulation; transition: transform .1s, border-color .15s; }
.rball .ball { --s: clamp(40px, 11vw, 54px); }
.rball:active { transform: scale(.9); }
.rball.down { opacity: .18; cursor: not-allowed; }
.rball.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,194,14,.35); }
.rc-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; align-items: stretch; }
.rc-actions .btn { min-height: 52px; }
.rc-actions .btn.big { flex: 1 1 220px; }
.btn-eight { background: #0d0d0d; color: #fff; border: 2px solid var(--gold); font-weight: 800; letter-spacing: .06em; }
.rc-confirm { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .8rem; border-radius: 14px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.rc-confirm > span { flex: 1 1 100%; font-weight: 600; }
.rc-confirm .warn { color: #ffb4b4; }
.snk-balls { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: .55rem; margin-top: .4rem; }
.snk { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 .95rem var(--font-body); cursor: pointer; text-align: left; }
.snk .ball { --s: 26px; }
.snk em { margin-left: auto; font-style: normal; color: var(--muted); }
.snk.on { border-color: var(--gold); background: rgba(255,194,14,.14); }
.snk:disabled { opacity: .3; cursor: not-allowed; }
.rc-foulrow { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.rc-foulrow > span { font-size: .85rem; color: var(--muted); }
.rc-stats { margin-top: 1rem; display: grid; gap: .15rem; }
.rc-stat { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; text-align: center; align-items: center; }
.rc-stat span { color: var(--muted); font-size: .78rem; min-width: 7rem; }
.rc-stat b { overflow-wrap: anywhere; }
.rc-stat.head b { color: var(--gold); }
.rc-feed { margin-top: 1rem; }
.rc-feed small { color: var(--muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.rc-feed .lm-feed { margin-top: .4rem; max-height: 280px; overflow: auto; }
.rc-fold { margin-top: .9rem; border: 1px solid var(--line); border-radius: 14px; padding: .4rem .9rem; background: rgba(0,0,0,.16); }
.rc-fold > summary { cursor: pointer; color: var(--gold); font-weight: 600; font-size: .88rem; padding: .35rem 0; }
.rules-body ul { margin: .5rem 0 .3rem; padding-left: 1.1rem; display: grid; gap: .35rem; color: var(--text); font-size: .9rem; }
.viewers + .conn { margin-left: .2rem; }
.console-head .sb-tools { flex-wrap: wrap; }

/* live cam (referee panel) */
.cam-panel { margin-top: 2rem; }
.cam-preview video { width: 100%; max-height: 280px; border-radius: 14px; background: #000; object-fit: cover; }
.cam-btns { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- players / who's on top (admin) ---------- */
.merge-bar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin: 1rem 0; }
.merge-bar label { flex: 1 1 220px; }
.people-list .admin-item { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.person-pick { display: flex; align-items: center; gap: .6rem; font-size: 1rem; color: var(--text); }
.person-pick strong { color: var(--text); }
.similar { color: var(--gold); }
.entry-list { list-style: none; margin: .4rem 0; padding: 0; display: grid; gap: .6rem; }
.entry-list li { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; }
.entry-list li > span { flex: 1 1 100%; overflow-wrap: anywhere; }
.entry-list em { color: var(--muted); font-style: normal; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input { width: auto; flex: 1 1 170px; }

/* ---------- match page (timeline) ---------- */
.vs-inline { color: var(--muted); font-size: .6em; letter-spacing: .12em; text-transform: uppercase; margin: 0 .3em; }
.lm-matchpage { display: grid; gap: 1.6rem; max-width: 860px; }
.lm-stats { display: grid; gap: .4rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.lm-stat { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; text-align: center; align-items: center; }
.lm-stat span { text-align: left; color: var(--muted); font-size: .85rem; }
.lm-stat.head b { color: var(--gold); }
.lm-stat b { overflow-wrap: anywhere; }
.lm-feed.full .lm-feed-item { font-size: .95rem; }
.lm-feed.full .lm-feed-item:first-child { color: var(--muted); }
.mtag.link { display: block; margin-top: .3rem; color: var(--gold); text-decoration: none; font-weight: 600; }
.mtag.link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .lm-card .side { padding: .4rem .2rem; }
  .lm-centre { max-width: none; }
  .rack-balls { gap: .4rem; }
  .rc-stat span { min-width: 5rem; }
  .lm-stat { grid-template-columns: 1.2fr 1fr 1fr; }
  .fx-drop.l, .fx-pocket.l { left: 8%; } .fx-drop.r, .fx-pocket.r { right: 8%; }
}

@media (prefers-reduced-motion: reduce) {
  .ball.ready, .viewers-dot, .cam-audio i, .cam-unmute { animation: none !important; }
}

/* ---- members-only code page and the admin lock panel ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gate .eyebrow { margin-bottom: .3rem; }
.gate-code { width: 100%; text-align: center; font: 700 clamp(1.8rem, 9vw, 2.6rem)/1.2 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: .28em; text-indent: .28em; text-transform: uppercase; padding: .6rem .4rem; border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.06); color: var(--text, #fff); }
.gate-code::placeholder { color: rgba(255,255,255,.28); letter-spacing: .28em; }
.gate-code:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,194,14,.2); }
.gate-panel { margin-top: 2rem; }
.gate-panel h3 { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.gate-pill { font: 700 .72rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: .25rem .7rem; border-radius: 999px; border: 1px solid currentColor; }
.gate-pill.on { color: #46d17a; } .gate-pill.off { color: var(--gold); }
.gate-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.gate-row form { margin: 0; }
.gate-show { font: 700 clamp(1.6rem, 6vw, 2.2rem)/1 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: .18em; padding: .5rem .9rem; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px dashed rgba(255,255,255,.3); user-select: all; }
.gate .message-logo { display: block; margin: 0 auto 1rem; }
.gate .eyebrow { display: block; }
.nw { white-space: nowrap; }

/* ---- console: all finished matches ---- */
.all-done { margin-top: 1rem; }
.all-done-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0; }
.all-done-bar select, .all-done-bar input { flex: 1 1 180px; min-width: 0; }
.all-done .locked { white-space: nowrap; }

/* ---- simple 8 ball console (Update 8) ---- */
.rack-row { padding: .6rem .7rem; border-radius: 14px; border: 2px solid transparent; transition: border-color .2s, background .2s, opacity .2s; }
.rack-row.playing { border-color: var(--gold); background: rgba(255,194,14,.09); box-shadow: 0 0 0 3px rgba(255,194,14,.12); }
.rack-row.playing .rack-title { color: var(--gold); }
.rack-row.theirs { opacity: .72; }
.rack-row.special .rack-balls { gap: .9rem; }
.rball.white, .rball.black { display: inline-flex; flex-direction: column; align-items: center; gap: .2rem; border-radius: 14px; padding: 4px 8px; }
.rball em { font-style: normal; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rball.sel em { color: var(--gold); }
.ball.cue { --c: #f4f4f0; }
.rball .ball.cue { --s: clamp(40px, 11vw, 54px); }
.rc-preview { margin-top: .9rem; padding: .8rem 1rem; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.25); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.rc-preview.idle { color: var(--muted); font-weight: 500; }
.rc-preview.ok { border-color: rgba(80,200,120,.6); background: rgba(80,200,120,.1); }
.rc-preview.foul, .rc-preview.lose { border-color: rgba(255,90,90,.7); background: rgba(255,90,90,.12); }
.rc-preview.win { border-color: var(--gold); background: rgba(255,194,14,.14); }
.rc-preview.warn { border-color: var(--gold); }
.rc-row2 { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rc-row3 { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: .6rem; }
.btn.btn-danger { background: #b3261e; color: #fff; border: 2px solid #ff8a80; font-weight: 800; }
.btn-danger-soft { background: rgba(179,38,30,.16); color: #ffb4ab; border: 2px solid rgba(255,138,128,.6); font-weight: 800; }
.btn.armed.armed { background: var(--gold); color: #111; font-weight: 800; border: 2px solid #fff; animation: ball-ready 1s ease-in-out infinite; }
.r-clockrow { flex-wrap: wrap; gap: .5rem; }
.t-board { margin: .8rem 0; border: 1px solid var(--line); border-radius: 14px; padding: .2rem 1rem .8rem; background: var(--surface); }
.t-board > summary { cursor: pointer; padding: .8rem 0; display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; }
.rc-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-width: 0; }
.rc-row2 .btn { min-width: 0; white-space: normal; line-height: 1.2; padding-left: .6rem; padding-right: .6rem; }
.rc-controls, .rc-actions { min-width: 0; }

/* ---- brackets pop-up ---- */
.bk-dlg { width: min(1100px, 96vw); max-height: 90dvh; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: #0b1040; color: var(--text); }
.bk-dlg::backdrop { background: rgba(0,0,0,.7); }
.bk-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: #0b1040; border-bottom: 1px solid var(--line); }
.bk-head h2 { margin: 0; font-size: 1.2rem; margin-right: auto; }
.bk-head select { max-width: 55vw; padding: .45rem .6rem; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.bk-body { padding: 1rem; overflow: auto; max-height: calc(90dvh - 4rem); }
.bk-body .group-title { margin: 1rem 0 .6rem; }
.bk-body a { pointer-events: none; }

/* ---- TV mode: no scrolling at any size, site header stays ---- */
html:has(body.tv), body.tv { height: 100dvh; overflow: hidden; }
body.tv { display: flex; flex-direction: column; }
body.tv .nav-wrap { display: block !important; position: static; flex: none; }
body.tv .nav { padding: .3rem 0; }
body.tv .nav-links { display: none !important; }
body.tv .nav-toggle { display: none !important; }
body.tv .nav-actions { display: none !important; }
body.tv .sb { flex: 1 1 auto; min-height: 0 !important; padding: 0 !important; display: block; overflow: hidden; }
body.tv .sb > .container { height: 100%; display: flex; flex-direction: column; min-height: 0; width: min(1800px, 100% - 3vw); }
body.tv .sb-head { margin: .4rem 0; flex: none; justify-content: flex-end; }
body.tv .sb-head > div:first-child { display: none; }
body.tv #bracketBtn { display: none; }
body.tv .sb-cols, body.tv .sb-next { display: none !important; }
body.tv .tv-area { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
body.tv .tv-area > * { width: 100%; margin-bottom: 0; }
body.tv.cam-on .sb-head { display: flex; }
body.tv.cam-on .cam-stage { flex: 1 1 auto; min-height: 0; margin: 0; }
body.tv.cam-on .cam-frame { aspect-ratio: auto; height: 100%; }
body.tv.cam-on .tv-area { display: none; }
body.tv .sb-empty { padding: 1rem; }

/* ---- admin tabs ---- */
main.admin > section[hidden] { display: none !important; }
.subnav { gap: .4rem; }
.subnav a.active { background: var(--gold); border-color: var(--gold); color: #111; }
.subnav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; -webkit-overflow-scrolling: touch; }
.subnav a { white-space: nowrap; flex: none; }
main.admin .page-hero.compact { padding-bottom: 1rem; }

/* ======== Referee console, compact design (Update 10) ======== */
.rcard.rc2 { padding: .8rem; border-radius: 18px; display: grid; gap: .65rem; }
.rc2 .rc-top { display: grid; grid-template-columns: 1fr auto; gap: .5rem .8rem; align-items: center; }
.rc2 .rc-where { min-width: 0; display: grid; }
.rc2 .rc-where strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc2 .rc-where span { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc2 .rc-clockbox { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.rc2 .rc-clockbox .clock { font-size: clamp(1.5rem, 5vw, 2.2rem); padding: .15rem .6rem; border-radius: 12px; line-height: 1.1; }
.rc2 .rc-clockbtns { display: flex; gap: .3rem; }
.rc2 .rc-tools { grid-column: 1 / -1; display: flex; gap: .4rem; justify-content: flex-end; }
.rc2 .btn-small { padding: .35rem .7rem; font-size: .8rem; min-height: 34px; }
.rc2 .rc-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.rc2 .rc-breakline { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .35rem .7rem; border-radius: 10px; background: rgba(255,194,14,.1); font-weight: 700; font-size: .88rem; }
.rc2 .rc-tile { min-width: 0; padding: .55rem .7rem; border-radius: 14px; border: 2px solid var(--line); background: rgba(0,0,0,.22); display: grid; grid-template-columns: 1fr auto; grid-template-areas: "top score" "sub score"; gap: .15rem .5rem; align-items: center; }
.rc2 .rc-tile.on { border-color: var(--gold); background: rgba(255,194,14,.1); box-shadow: 0 0 0 3px rgba(255,194,14,.14); }
.rc2 .rc-tile-top { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; min-width: 0; }
.rc2 .rc-name { font-weight: 800; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rc2 .rc-score { grid-area: score; font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 8vw, 3rem); line-height: 1; }
.rc2 .rc-tile-sub { grid-area: sub; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-height: 22px; }
.rc2 .rc-at { font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: .1rem .5rem; border-radius: 999px; background: var(--gold); color: #111; }
.rc2 .lm-tray { gap: 2px; justify-content: flex-start; margin: 0; }
.rc2 .lm-tray .ball.sm { --s: 15px; }
.rc2 .rc-guideline { padding: .45rem .7rem; border-radius: 12px; background: rgba(255,194,14,.09); border: 1px solid rgba(255,194,14,.4); }
.rc2 .rc-guiderow { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.rc2 .rc-guiderow strong { font-size: .95rem; min-width: 0; }
.rc2 .rc-guideline p { margin: .3rem 0 0; font-size: .85rem; line-height: 1.4; }
.rc2 .rc-q { min-width: 34px; }
.rc2 .rc-controls { display: grid; gap: .55rem; }
.rc2 .rack { gap: .35rem; margin: 0; }
.rc2 .rack-row { padding: .3rem .5rem; border-radius: 12px; gap: .2rem; }
.rc2 .rack-balls { gap: .3rem; align-items: center; }
.rc2 .rball .ball { --s: clamp(34px, 9.4vw, 46px); }
.rc2 .rball .ball.cue { --s: clamp(34px, 9.4vw, 46px); }
.rc2 .rball.white, .rc2 .rball.black { flex-direction: row; gap: .35rem; padding: 3px 8px 3px 3px; }
.rc2 .rc-seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.rc2 .rc-seg .btn { border: 0; border-radius: 0; min-height: 40px; padding: .3rem .9rem; font-weight: 800; }
.rc2 .rc-seg .btn.on { background: #1f8a4c; color: #fff; }
.rc2 .rc-seg .btn.on.bad { background: #b3261e; }
.rc2 .rc-preview { margin: 0; padding: .5rem .8rem; font-size: .9rem; }
.rc2 .rc-actions { margin: 0; gap: .45rem; }
.rc2 .rc-actions .btn { min-height: 46px; }
.rc2 .rc-row2 { grid-template-columns: 1fr 1fr; }
.rc2 .rc-row2 .btn-small { min-height: 34px; }
.rc2 .rc-more { display: grid; gap: .6rem; }



/* console mode: tighter so it always fits */
.rc2 .rc-row3 { display: flex; flex-wrap: wrap; gap: .4rem; }
.rc2 .rc-tile { grid-template-columns: minmax(0, 1fr) auto; }
.rc2 .rc-top { grid-template-columns: minmax(0, 1fr) auto; }

/* ---- console mode: the same card as on the admin page, scaled to fill one screen ---- */
.cmode { position: fixed; inset: 0; z-index: 200; background: #060928; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; padding: 0; }
.cmode[hidden] { display: none; }
html.cmode-on, html.cmode-on body { overflow: hidden; }
.cm-stage { flex: none; display: block; }
.cm-stage .rcard.rc2 { margin: 0; height: 100%; border-radius: 0; border: 0; box-shadow: none; align-content: space-between; padding: max(.8rem, env(safe-area-inset-top)) .8rem max(.8rem, env(safe-area-inset-bottom)); }
.cm-stage .rcard.main { grid-template-rows: none; }
.cm-stage .cm-sheet { display: none; overflow-y: auto; align-content: start; }
.cm-stage.showing-more .cm-sheet { display: grid; }
.cm-stage.showing-more .rcard.main { display: none; }
.rc-limit { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.18); }
.rc-limit select { padding: .45rem .6rem; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); font: inherit; }
.rc-limit span { font-weight: 700; }
/* Legal / Foul: in the middle of the controls, hard to miss */
.rc-judge { display: flex; align-items: center; justify-content: center; gap: .7rem; flex-wrap: wrap; padding: .45rem .6rem; border-radius: 14px; border: 2px dashed var(--line); background: rgba(0,0,0,.2); }
.rc-judge.ready { border: 2px solid var(--gold); background: rgba(255,194,14,.08); }
.rc-judge > span { font-weight: 800; font-size: .85rem; letter-spacing: .04em; }
.rc-judge .rc-seg { margin: 0; }
.rc-judge .rc-seg .btn { min-height: 46px; min-width: 104px; font-size: 1rem; }
.rc-judge:not(.ready) .rc-seg { opacity: .45; }
.rc-judge.white > span { color: #ffb4ab; }
.rc-judge.white .rc-seg { opacity: 1; }

.cm-stage .rcard.cm-sheet { align-content: start; }
.cm-sheet .rc-tools { grid-column: auto; }
.cm-sheet .rc-top { margin-bottom: .2rem; }
