/* ==========================================================================
   Beltchecker Brackets: the design tokens and the shared components (UI sweep, approved 28 Nov 2026).
   Loaded FIRST on every Brackets page (the organizer's app, the public page, the tournament app, the staff tools,
   the screens in the hall, Events check-in). The page styles only add what is their own; the palette lives here.
   Source: mockups/brackets-2026-11/mock.css. Rules: colour, outline and opacity show state; nothing changes size on
   hover or press (no transform: scale on :active); motion is transform/opacity and respects prefers-reduced-motion.
   Themes: dark by default (the Club TV look), html[data-theme="light"] for the light theme, and html[data-bk-staff]
   for the staff screens, which are always dark whatever the phone's theme; .bk-dark keeps a part of a light page dark
   (Matches, the Live room).
   Components: .bk-sh (the staff header), .bkb (bkButton), .bk-tag (bkStatusChip), .pill (the small mono status pill), .bk-toast (bkToast, scripts/bc-bk-ui.js)
   and .is-arming (bkConfirm: tap twice, the countdown runs on the button itself).
   ========================================================================== */
:root, :root[data-bk-staff][data-theme="light"], .bk-dark {
  /* palette */
  --bg: #07070b; --panel: #0e0e15; --sheet: #13131b;
  --ink: #f6f6f9; --ink-2: #d4d4dd; --muted: #8f8f9e;
  --line: rgba(255, 255, 255, 0.09); --line-2: rgba(255, 255, 255, 0.16);
  --card: rgba(255, 255, 255, 0.045); --card-2: rgba(255, 255, 255, 0.08); --card-3: rgba(255, 255, 255, 0.12);
  --cyan: #03c3e3; --violet: #6d5cf0; --magenta: #b04ac0; --amber: #f5b23c; --green: #22c55e; --red: #ff4d5e;
  --blue: #2f8bff; --gold: #f5c542; --lime: #a3e635; --orange: #ff7a59;
  /* text on a filled colour */
  --on-green: #04170b; --on-amber: #1a1205; --on-cyan: #04121a; --on-red: #ffffff;
  --grad: linear-gradient(115deg, #03c3e3 0%, #5b4bd1 42%, #9a3ea8 70%, #e0835a 100%);
  color-scheme: dark;
}
:root {
  /* type */
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-base: 16px; --fs-lg: 17px; --fs-xl: 19px; --fs-2xl: 22px; --fs-3xl: 28px; --fs-4xl: 32px;
  /* radii */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 18px; --r: 20px; --r-xl: 22px; --r-2xl: 28px; --r-pill: 999px;
  /* spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  /* touch targets (bkButton sizes) */
  --tap: 56px; --tap-lg: 64px; --tap-xl: 76px;
  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1); --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* the mats' colours, the same as bkMatColor() in functions_brackets_team.php */
  --mat-1: #03c3e3; --mat-2: #6d5cf0; --mat-3: #f5b23c; --mat-4: #22c55e; --mat-5: #ff7a59; --mat-6: #b04ac0;
  --mat-7: #2f8bff; --mat-8: #e8c547; --mat-9: #4fd1c5; --mat-10: #ff5e8a; --mat-11: #9ad34a; --mat-12: #c084fc;
  /* the staff screens (always dark): solid cards on near black */
  --staff-bg: #06070b; --staff-card: #12131a; --staff-card-2: #1a1b24; --staff-muted: #9a9caa; --staff-line: #262834;
}
:root[data-theme="light"] {
  --bg: #f6f6fa; --panel: #ffffff; --sheet: #ffffff;
  --ink: #101018; --ink-2: #3b3b48; --muted: #5d5d6c;
  --line: rgba(16, 16, 24, 0.08); --line-2: rgba(16, 16, 24, 0.14);
  --card: rgba(255, 255, 255, 0.82); --card-2: rgba(16, 16, 24, 0.05); --card-3: rgba(16, 16, 24, 0.1);
  --cyan: #0891b2; --green: #16a34a; --amber: #c27a0a; --gold: #b8860b; --red: #e11d48; --blue: #2563eb;
  --field: #ffffff; --pop: #ffffff;
  color-scheme: light;
}
:root[data-bk-staff] {
  --bg: var(--staff-bg); --card: var(--staff-card); --card-2: var(--staff-card-2); --muted: var(--staff-muted); --line: var(--staff-line);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- bkStaffScreen (UI sweep step 3, owner 28 Nov 2026)
   Every staff tool is always dark and full screen: html[data-bk-staff].bk-staff (bkStaffHtml() in
   functions_brackets.php). In the app's Staff tab the tool's frame covers the whole screen, the tab bar too
   (styles/bk-staffapp.css .st-tool), and keeps clear of the notch and the home bar. */
html.bk-staff { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
html.bk-staff body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
/* The one staff header (bkStaffHeader()): Back, station, tournament, the page's extra, Online / Offline with the Undo
   slot in the same place, Lock. The pill and Undo share one cell, so nothing moves when Undo comes and goes. */
.bk-sh { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; min-height: 64px; box-sizing: border-box;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bk-sh-t { display: grid; min-width: 0; flex: 1; line-height: 1.2; }
.bk-sh-t small { font: 700 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-sh-t b { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-sh-logo { flex: none; width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; }
.bk-sh-ib { flex: none; width: 48px; height: 48px; padding: 0; border-radius: 14px; border: 0; display: grid; place-items: center; background: var(--card-2); color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 0.15s; }
.bk-sh-ib:hover { background: var(--card-3); }
.bk-sh-ib:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.bk-sh-ib svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bk-sh-st { position: relative; flex: none; display: flex; align-items: center; }
.bk-sh-net { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r-pill); font: 700 var(--fs-xs) var(--mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); transition: opacity 0.15s, background-color 0.2s, color 0.2s; }
.bk-sh-net i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bk-sh-net.is-off { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.bk-sh-net.is-off i { animation: bk-blink 1s ease-in-out infinite; }
.bk-sh-undo { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 1; }
.bk-sh-undo:empty { display: none; }
.bk-sh-undo button { height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card-3); color: var(--ink); font: 700 15px var(--font); cursor: pointer; }
.bk-sh-st:has(.bk-sh-undo:not(:empty)) .bk-sh-net { opacity: 0; }
@media (max-width: 380px) { .bk-sh-net span { display: none; } .bk-sh-net { padding: 0 10px; } }
@media (prefers-reduced-motion: reduce) { .bk-sh-net.is-off i { animation: none; } }

/* ---------------------------------------------------------------- bkButton: 56 / 64 / 76 px
   .bkb (56) .bkb.lg (64) .bkb.xl (76); .primary (the brand gradient), .secondary (the default), .go (green: approve),
   .danger (red), .ghost. Hover and press change colour only. */
.bkb { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 0 20px; border-radius: var(--r-lg);
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--ink); font: 700 var(--fs-lg)/1.15 var(--font); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color 0.15s, border-color 0.15s, filter 0.15s, color 0.15s; }
.bkb:hover { background: var(--card-3); }
.bkb.w { width: 100%; }
.bkb.lg { min-height: var(--tap-lg); font-size: var(--fs-xl); border-radius: var(--r); }
.bkb.xl { min-height: var(--tap-xl); font-size: var(--fs-2xl); border-radius: var(--r-xl); }
.bkb.primary { background: var(--grad); background-origin: border-box; border-color: transparent; color: #fff; }   /* origin border-box: no sliver of the gradient repeating under the transparent border (Christian, 1 Dec 2026) */
.bkb.go { background: var(--green); border-color: transparent; color: var(--on-green); }
.bkb.danger { background: var(--red); border-color: transparent; color: var(--on-red); }
.bkb.primary:hover, .bkb.go:hover, .bkb.danger:hover { filter: brightness(1.08); }
.bkb.ghost { background: transparent; }
.bkb.ghost:hover { background: var(--card); }
.bkb:disabled, .bkb[aria-disabled="true"] { opacity: 0.5; cursor: default; filter: none; }
.bkb:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.bkb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- bkStatusChip: .bk-tag with a state */
.bk-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--r-pill); font: 700 var(--fs-sm)/1 var(--font);
  background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
/* The status chips of the desks (check-in and weigh-in lists, result cards) take the same states */
.bk-tag.ok, .wpill.ok, .cil-state .pill.ok, .ci-state .pill.ok, .wres .pill.ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.bk-tag.bad, .wpill.bad, .ci-state .pill.bad { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.bk-tag.warn, .wpill.warn, .ci-state .pill.warn { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.bk-tag.cy, .bk-tag.info, .wpill.open { background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); }
.bk-tag.self, .cil-state .pill.self { background: rgba(20, 184, 166, 0.14); color: #0f9c8d; }
.bk-tag.sm { min-height: 22px; padding: 0 8px; font-size: var(--fs-xs); }

/* The small mono pill (Live, Open, Done ...), once in bk-app.css, bk-staffapp.css and bk-yourday.css */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--r-pill); font: 700 var(--fs-xs) var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.pill.live, .pill.ready { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: bk-blink 1.4s ease-in-out infinite; }
.pill.open { background: color-mix(in srgb, var(--cyan) 14%, transparent); color: var(--cyan); }
.pill.done { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
.pill.paused, .pill.alone { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.pill.vio { background: color-mix(in srgb, var(--c, var(--violet)) 30%, transparent); color: #d9d4ff; }
@keyframes bk-blink { 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------- bkToast (scripts/bc-bk-ui.js)
   One toast for every Brackets page: bottom centre, a tick or "!", the words, an Undo (7 s) when the action can be
   taken back, and a thin bar that runs out with the time left. */
.bk-toast { position: fixed; left: 50%; bottom: calc(24px + var(--bk-toast-lift, 0px) + env(safe-area-inset-bottom, 0px)); z-index: 100060; display: flex; align-items: center; gap: 12px;
  min-width: 240px; max-width: min(480px, calc(100vw - 32px)); padding: 14px 16px 16px 18px; overflow: hidden; border-radius: var(--r-md);
  background: #111318; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.6);
  font: 600 15px/1.35 var(--font); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.25s var(--ease); }
.bk-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
/* Taps go through the toast to the buttons under it; only its Undo takes a tap */
.bk-toast.is-on .tundo { pointer-events: auto; }
.bk-toast .ti { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; background: var(--green); color: var(--on-green); }
.bk-toast.is-bad { border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.bk-toast.is-bad .ti { background: var(--red); color: #fff; }
.bk-toast.is-ask .ti { background: var(--amber); color: var(--on-amber); }
.bk-toast.is-on .ti { animation: bk-pop 0.4s var(--spring) both; }
.bk-toast span { min-width: 0; white-space: pre-line; }
.bk-toast .tundo { margin-left: auto; flex: none; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; font: 700 14px var(--font); cursor: pointer; }
.bk-toast .tundo:hover { background: rgba(255, 255, 255, 0.24); }
.bk-toast .tbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--green); transform-origin: left; }
.bk-toast.is-bad .tbar { background: var(--red); }
.bk-toast.is-ask .tbar { background: var(--amber); }
.bk-toast.is-on .tbar { animation: bk-drain var(--bk-toast-ms, 3200ms) linear forwards; }
@keyframes bk-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes bk-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- bkConfirm: tap twice, the countdown on the button
   The button keeps its size (its width and height are pinned while it asks), turns amber, says "Tap again" and a
   bar drains over it; a second tap within the time does it, otherwise it goes back. */
.is-arming { position: relative; overflow: hidden; background: var(--amber) !important; border-color: var(--amber) !important; color: var(--on-amber) !important; white-space: nowrap; text-overflow: ellipsis; filter: none !important; }
.is-arming::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.35); transform-origin: left; animation: bk-drain var(--bk-arm-ms, 4000ms) linear forwards; }

@media (prefers-reduced-motion: reduce) {
  .bk-toast { transition: opacity 0.01ms; }
  .bk-toast.is-on .ti, .pill.live::before { animation: none; }
}
/* The toast stays clear of what is fixed at the bottom: the one scanner's buttons, the app's tab bar */
body:has(.bks) .bk-toast { --bk-toast-lift: 126px; }
@media print { .bk-toast { display: none !important; } }
/* Powered by Beltchecker Brackets carries the Beltchecker logo (Christian, 29 Nov 2026) */
.bk-pw-logo { width: 16px; height: 16px; flex: none; object-fit: contain; border-radius: 4px; vertical-align: middle; }
.k-powered .bk-pw-logo { width: 2.2vh; height: 2.2vh; border-radius: 0.5vh; }
