/* Projector Mode: every style the projector screens use is in this one file.
   Design: claude/projector-mode-design.md.  Behaviour: static/js/projector.js.  Data: tournament/projector.py.

   The screens are drawn on a fixed 1920x1080 stage and scaled to fit whatever screen they are on, so every size below is
   a pixel size on that stage. The numbers (colors, sizes, card layouts) live here and nowhere else; the script only
   chooses class names and sets a few custom properties (--pm-pair-cols, --pm-stand-cols, --pm-row-h, ...).

   Contents: 1 colors and fonts   2 page and stage   3 header   4 cards and panels   5 clock states   6 clock, bars, counts
             7 pairings   8 standings   9 strip and notices   10 rotation dots   11 convention cards   12 controls */


/* ---------------------------------------------------------------- 1 colors and fonts */
:root {
	--pm-bg: #0b1220;
	--pm-surface: #131c30;
	--pm-surface-hi: #1a2540;
	--pm-line: #24304d;
	--pm-line-strong: #4b5a7e;
	--pm-text: #f4f6fb;
	--pm-muted: #9fb0d0;
	--pm-playing: #5aa9ff;
	--pm-done: #3ddc97;
	--pm-warn: #ffb020;
	--pm-warn-line: #6b4e0f;
	--pm-warn-surface: #2a2110;
	--pm-alert: #ff5a5f;
	--pm-alert-line: #7a2a2e;
	--pm-dot: #3a4868;
	--pm-font-display: 'Space Grotesk', Inter, system-ui, sans-serif;
	--pm-font-body: Inter, system-ui, sans-serif;
}


/* ---------------------------------------------------------------- 2 page and stage */
html, body { margin: 0; height: 100%; background: var(--pm-bg); overflow: hidden; }
.pm-body { color: var(--pm-text); font-family: var(--pm-font-body); -webkit-font-smoothing: antialiased; }
.pm-cursor-hidden, .pm-cursor-hidden * { cursor: none !important; }
#pm-viewport { position: fixed; inset: 0; overflow: hidden; }
.pm-stage {
	position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; box-sizing: border-box;
	padding: 40px 48px; display: flex; flex-direction: column; gap: 24px; overflow: hidden;
	transform: translate(-50%, -50%) scale(var(--pm-scale, 1));
}
.pm-main { display: flex; gap: 24px; flex: 1 1 0; min-height: 0; }
.pm-col-left { width: 700px; display: flex; flex-direction: column; gap: 24px; }
.pm-col-right { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 24px; }
.pm-tabular { font-variant-numeric: tabular-nums; }


/* ---------------------------------------------------------------- 3 header */
.pm-header { display: flex; justify-content: space-between; align-items: flex-end; height: 116px; flex: none; }
.pm-header__title { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pm-eyebrow { font-size: 24px; font-weight: 600; letter-spacing: 0.14em; color: var(--pm-muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-title { margin: 0; font-family: var(--pm-font-display); font-size: 80px; line-height: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-header__right { display: flex; align-items: center; gap: 32px; flex: none; }
.pm-header__round { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pm-round { font-family: var(--pm-font-display); font-size: 44px; font-weight: 700; line-height: 1; white-space: nowrap; }
.pm-round__sub { font-size: 24px; color: var(--pm-muted); }
.pm-time { font-family: var(--pm-font-display); font-size: 44px; font-weight: 500; color: var(--pm-muted); line-height: 1; font-variant-numeric: tabular-nums; }
.pm-header__round + .pm-time { border-left: 2px solid var(--pm-line); padding-left: 32px; }
.pm-time--lg { font-size: 56px; }
.pm-pagenote { font-size: 24px; color: var(--pm-muted); margin-right: 24px; }


/* ---------------------------------------------------------------- 4 cards and panels */
.pm-card, .pm-panel { background: var(--pm-surface); border: 2px solid var(--pm-line); border-radius: 20px; box-sizing: border-box; }
.pm-panel { padding: 22px 32px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pm-panel--fill { flex: 1 1 0; overflow: hidden; }
.pm-panel--pinned { flex: 0 0 auto; }
.pm-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 24px; height: 30px; flex: none; }
.pm-label { font-size: 24px; font-weight: 600; letter-spacing: 0.12em; color: var(--pm-muted); text-transform: uppercase; }
.pm-label--playing { color: var(--pm-playing); }
.pm-label--reported { color: var(--pm-done); }
.pm-side { font-size: 20px; color: var(--pm-muted); display: flex; align-items: center; gap: 14px; }


/* ---------------------------------------------------------------- 5 clock states
   One place decides what each clock state looks like. data-state is normal | amber | red | paused | none. */
.pm-state { --pm-state: var(--pm-text); --pm-state-line: var(--pm-line); }
.pm-state[data-state="amber"] { --pm-state: var(--pm-warn); --pm-state-line: var(--pm-warn-line); }
.pm-state[data-state="red"] { --pm-state: var(--pm-alert); --pm-state-line: var(--pm-alert-line); }
.pm-state[data-state="paused"], .pm-state[data-state="none"] { --pm-state: var(--pm-muted); }
.pm-card.pm-state { border-color: var(--pm-state-line); }


/* ---------------------------------------------------------------- 6 clock, bars, counts */
.pm-clock { font-family: var(--pm-font-display); font-weight: 700; line-height: 0.95; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--pm-state); }
.pm-clock--xl { font-size: 220px; line-height: 1; }
.pm-clock--xl.pm-clock--none { font-size: 120px; }
.pm-tag { flex: none; font-size: 22px; font-weight: 700; letter-spacing: 0.1em; color: var(--pm-text); border: 2px solid var(--pm-muted); border-radius: 8px; padding: 2px 12px; }
.pm-tag[hidden] { display: none; }
.pm-bar { height: 16px; background: var(--pm-line); border-radius: 8px; overflow: hidden; }
.pm-bar--outline { background: transparent; border: 2px solid var(--pm-line-strong); }
.pm-bar__fill { height: 100%; background: var(--pm-state); }
.pm-bar--outline .pm-bar__fill { background: var(--pm-done); }
.pm-clockcard { height: 450px; padding: 28px 36px; display: flex; flex-direction: column; justify-content: space-between; }
.pm-clockcard__times { display: flex; justify-content: space-between; font-size: 24px; color: var(--pm-muted); margin-top: 10px; min-height: 30px; }
.pm-gamescard { flex: 1 1 0; padding: 28px 36px; display: flex; flex-direction: column; justify-content: space-between; min-height: 0; }
.pm-count { display: flex; align-items: baseline; gap: 28px; }
.pm-count__num { font-family: var(--pm-font-display); font-size: 140px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-count__num--done { color: var(--pm-done); }
.pm-count__unit { font-size: 36px; font-weight: 600; color: var(--pm-muted); }
.pm-count__togo { margin-left: auto; }
.pm-cells { display: grid; grid-template-columns: repeat(var(--pm-cell-cols, 12), minmax(0, 1fr)); gap: 6px; }
.pm-cell { height: 36px; border-radius: 6px; border: 2px solid var(--pm-line-strong); }
.pm-cell--done { background: var(--pm-done); border-color: var(--pm-done); }


/* ---------------------------------------------------------------- 7 pairings
   --pm-pair-cols is set by the script: with or without the Table column, one cell or two players. */
.pm-pair { display: grid; grid-template-columns: var(--pm-pair-cols); column-gap: 16px; align-items: center; height: var(--pm-row-h, 56px); padding: 0 16px; box-sizing: border-box; border-radius: 10px; }
.pm-pair--head { height: 36px; align-items: end; padding-bottom: 10px; border-bottom: 2px solid var(--pm-line); border-radius: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.1em; color: var(--pm-muted); text-transform: uppercase; }
.pm-pair--playing { background: var(--pm-surface-hi); }
.pm-pair__table { font-family: var(--pm-font-display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-pair--done .pm-pair__table { color: var(--pm-muted); }
.pm-pair__player { font-size: 32px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pm-pair__vs { font-size: 20px; color: var(--pm-muted); text-align: center; }
.pm-pair--done .pm-pair__player { font-weight: 400; color: var(--pm-muted); }
.pm-pair--done .pm-pair__player.is-winner { font-weight: 700; color: var(--pm-text); }
.pm-rows { display: flex; flex-direction: column; gap: 4px; }
.pm-panel--compact .pm-pair__table { font-size: 28px; }
.pm-panel--compact .pm-pair__player { font-size: 27px; }


/* ---------------------------------------------------------------- 8 standings
   --pm-stand-cols is set by the script (the points column only when the skin shows one). */
.pm-stand-cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: start; }
.pm-stand-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pm-stand { display: grid; grid-template-columns: var(--pm-stand-cols); align-items: center; column-gap: 12px; height: 50px; padding: 0 12px; box-sizing: border-box; border-radius: 10px; }
.pm-stand--head { height: 32px; align-items: end; padding-bottom: 8px; border-bottom: 2px solid var(--pm-line); border-radius: 0; font-size: 18px; font-weight: 600; letter-spacing: 0.1em; color: var(--pm-muted); text-transform: uppercase; }
.pm-stand--top { background: var(--pm-surface-hi); }
.pm-stand__rank { font-family: var(--pm-font-display); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-stand--top .pm-stand__rank { color: var(--pm-warn); }
.pm-stand__name { font-size: 28px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pm-stand__record, .pm-stand__points { font-family: var(--pm-font-display); font-size: 28px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-stand__points { color: var(--pm-muted); }
.pm-stand--out .pm-stand__name, .pm-stand--out .pm-stand__record { opacity: 0.45; }
.pm-stand-list { display: flex; flex-direction: column; gap: 4px; }
/* the full-screen version, between rounds and at the end */
.pm-panel--big .pm-stand { height: 72px; border-radius: 12px; }
.pm-panel--big .pm-stand--head { height: 32px; font-size: 20px; }
.pm-panel--big .pm-stand__rank { font-size: 40px; }
.pm-panel--big .pm-stand__name, .pm-panel--big .pm-stand__record, .pm-panel--big .pm-stand__points { font-size: 38px; }
.pm-panel--big .pm-stand-col { gap: 12px; }


/* ---------------------------------------------------------------- 9 strip and notices */
.pm-strip { flex: none; height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 0 36px; }
.pm-strip__left { display: flex; align-items: baseline; gap: 24px; min-width: 0; }
.pm-strip__label { font-size: 24px; font-weight: 700; letter-spacing: 0.12em; color: var(--pm-done); white-space: nowrap; }
.pm-strip__text { font-size: 30px; font-weight: 600; white-space: nowrap; }
.pm-strip__next { font-size: 30px; font-weight: 600; color: var(--pm-muted); white-space: nowrap; }
.pm-notice { flex: 1 1 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 48px; font-weight: 600; color: var(--pm-muted); padding: 0 120px; }
.pm-offline { position: fixed; left: 12px; bottom: 12px; z-index: 10; padding: 6px 14px; font: 600 14px var(--pm-font-body); color: var(--pm-text); background: var(--pm-warn-surface); border: 1px solid var(--pm-warn-line); border-radius: 8px; }
.pm-offline[hidden] { display: none; }


/* ---------------------------------------------------------------- 10 rotation dots */
.pm-pips { display: inline-flex; align-items: center; gap: 8px; }
.pm-pip { width: 10px; height: 10px; border-radius: 5px; background: var(--pm-dot); display: inline-block; }
.pm-pip--on { width: 44px; background: var(--pm-warn); }


/* ---------------------------------------------------------------- 11 convention cards
   One card markup; the size class (chosen by how many cards there are, see projector.js layoutFor) sets these variables:
   --c-pad --c-name --c-round --c-clock --c-num --c-unit.  The card's border and clock color come from section 5. */
.pm-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; flex: 1 1 0; min-height: 0; }
.pm-tcard { padding: var(--c-pad, 24px); display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 0; min-height: 0; overflow: hidden; }
.pm-tcard__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.pm-tcard__name { font-family: var(--pm-font-display); font-size: var(--c-name); font-weight: 700; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pm-tcard__round { font-size: var(--c-round); font-weight: 700; color: var(--pm-muted); white-space: nowrap; }
.pm-tcard__clock { display: flex; flex-direction: column; gap: 12px; }
.pm-tcard__clockrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pm-tcard .pm-clock { font-size: var(--c-clock); }
.pm-tcard .pm-clock--none { font-size: calc(var(--c-clock) * 0.6); }
.pm-tcard .pm-tag { font-size: calc(var(--c-round) * 0.8); }
.pm-tcard .pm-bar { height: calc(var(--c-round) * 0.5); }
.pm-tcard__state { display: flex; flex-direction: column; gap: 6px; }
.pm-tcard__statelabel { font-size: calc(var(--c-round) * 1.1); font-weight: 700; letter-spacing: 0.08em; color: var(--pm-done); text-transform: uppercase; }
.pm-tcard__statenext { font-size: var(--c-round); font-weight: 600; color: var(--pm-muted); }
.pm-tcard__games { display: flex; flex-direction: column; gap: 10px; }
.pm-tcard .pm-count { gap: 12px; }
.pm-tcard .pm-count__num { font-size: var(--c-num); }
.pm-tcard .pm-count__unit { font-size: var(--c-unit); }
.pm-tcard .pm-bar--outline { height: calc(var(--c-round) * 0.55); }

.pm-size-xl1 { --c-pad: 48px 56px; --c-name: 80px; --c-round: 40px; --c-clock: 380px; --c-num: 130px; --c-unit: 40px; }
.pm-size-xl2 { --c-pad: 40px 44px; --c-name: 64px; --c-round: 34px; --c-clock: 300px; --c-num: 120px; --c-unit: 34px; }
.pm-size-l   { --c-pad: 28px 32px; --c-name: 44px; --c-round: 28px; --c-clock: 170px; --c-num: 96px;  --c-unit: 28px; }
.pm-size-mw  { --c-pad: 24px 32px; --c-name: 40px; --c-round: 26px; --c-clock: 176px; --c-num: 66px;  --c-unit: 26px; }
.pm-size-m   { --c-pad: 22px 24px; --c-name: 34px; --c-round: 24px; --c-clock: 150px; --c-num: 60px;  --c-unit: 24px; }
.pm-size-ms  { --c-pad: 20px 22px; --c-name: 30px; --c-round: 22px; --c-clock: 112px; --c-num: 52px;  --c-unit: 22px; }
.pm-size-s   { --c-pad: 14px 24px; --c-name: 30px; --c-round: 22px; --c-clock: 104px; --c-num: 44px;  --c-unit: 22px; }
.pm-size-xs  { --c-pad: 12px 20px; --c-name: 26px; --c-round: 20px; --c-clock: 82px;  --c-num: 38px;  --c-unit: 20px; }
/* the stacked card header (name over round) on the big cards; the elapsed bar is dropped on the smallest cards */
.pm-size-xl1 .pm-tcard__head, .pm-size-xl2 .pm-tcard__head, .pm-size-l .pm-tcard__head { flex-direction: column; align-items: flex-start; gap: 6px; }
.pm-size-s .pm-timebar, .pm-size-xs .pm-timebar { display: none; }
.pm-size-s .pm-tcard__clock, .pm-size-xs .pm-tcard__clock { gap: 0; }


/* ---------------------------------------------------------------- 12 controls (moving the mouse shows them) */
.pm-controls { position: fixed; top: 12px; right: 12px; z-index: 10; display: flex; gap: 8px; padding: 8px; background: rgba(19, 28, 48, 0.94); border: 1px solid var(--pm-line); border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.pm-controls.is-visible { opacity: 1; pointer-events: auto; }
.pm-controls button, .pm-controls a { font: 600 15px var(--pm-font-body); color: var(--pm-text); background: var(--pm-surface-hi); border: 1px solid var(--pm-line-strong); border-radius: 8px; padding: 8px 14px; text-decoration: none; cursor: pointer; }
.pm-controls button:hover, .pm-controls a:hover, .pm-controls button:focus-visible, .pm-controls a:focus-visible { border-color: var(--pm-warn); }
.pm-noscript { color: var(--pm-text); padding: 24px; }
