/* Shared tokens. Themes in themes.css override them per [data-theme]. */
:root {
  /* Action Overlays brand v1 (same system as the website): floodlight navy + sunrise orange/amber */
  --bg: linear-gradient(180deg, rgba(22, 30, 54, 0.97), rgba(11, 16, 32, 0.97));
  --bg-2: rgba(255, 255, 255, 0.06);
  --fg: #ffffff;
  --muted: rgba(196, 205, 230, 0.72);
  --tint: rgba(255, 255, 255, 0.12); /* chips, balls, empty cells: works on any dark theme */
  --line: rgba(148, 163, 209, 0.12);
  --border: rgba(148, 163, 209, 0.2);
  --hilite: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --accent: #ff5c25;
  --accent-2: #ffb21e;
  --on-accent: #160d08;
  --gold: #ffc542; /* winners, stoppage time, crowns */
  --glow: rgba(255, 178, 30, 0.3);
  --plum: #582864;
  --good: #22c55e;
  --warn: #f2b731;
  --bad: #e85c3c;
  --live: #e11d2e;
  --sunrise: linear-gradient(100deg, #ff4d1f 0%, #ff6a2b 40%, #ffb21e 100%);
  --four: linear-gradient(135deg, #1d4ed8, #38bdf8);
  --six: linear-gradient(135deg, #6d28d9, #c084fc);
  --wkt: linear-gradient(135deg, #b42318, #ff5c25);
  --xtra: linear-gradient(135deg, #b45309, #f2b731);
  --snake: #34d399;
  --snake-head: #059669;
  --ladder: #ffb21e;
  --radius: 6px;
  --cut: 14px; /* the angled broadcast corner */
  --plate: #f5f3ef; /* score plate: paper with navy numbers, most legible on busy video */
  --plate-ink: #0b1020;
  --card-filter: drop-shadow(0 18px 30px rgba(4, 6, 16, 0.55));
  --shadow: 0 18px 50px rgba(4, 6, 16, 0.55);
  --font: "Manrope", "Nunito", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Inter", sans-serif; /* scores, labels */
  --font-poster: "Big Shoulders", "Barlow Condensed", sans-serif; /* names, titles */
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --a: #3b82f6; /* side A colour, set per overlay */
  --b: #ef4444; /* side B colour */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: transparent; }
body { font-family: var(--font); color: var(--fg); -webkit-font-smoothing: antialiased; }
body.still *, body.still #card { animation: none !important; transition: none !important; }
/* Preview backdrop that looks like a floodlit stadium (app preview only, never in OBS). */
body.stage {
  background:
    radial-gradient(ellipse 22% 18% at 12% 6%, rgba(255, 236, 190, .42), transparent 70%),
    radial-gradient(ellipse 22% 18% at 88% 6%, rgba(255, 236, 190, .38), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 120%, rgba(0, 0, 0, .5), transparent),
    linear-gradient(180deg, #05070f 0%, #0b1020 30%, #131a30 48%, #0e1426 48.2%, #0e1426 60%,
      #ff5c25 60%, #ffb21e 61.6%, #2a7a44 61.7%, #124a27 100%);
}
body.stage::before {
  content: ""; position: fixed; left: 0; right: 0; top: 48.2%; height: 11.8%; pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 197, 66, .55) 1.2px, transparent 1.8px),
    radial-gradient(circle, rgba(148, 163, 209, .45) 1.2px, transparent 1.8px);
  background-size: 11px 9px, 17px 13px; background-position: 0 0, 5px 4px;
}
body.stage::after {
  content: ""; position: fixed; left: 0; right: 0; top: 61.7%; bottom: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .05) 0 4%, transparent 4% 9%);
}
body.preview { background: repeating-conic-gradient(#1f2937 0 25%, #111827 0 50%) 0 0 / 32px 32px; }

#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; }
#stage.vertical { width: 1080px; height: 1920px; }
#card { position: absolute; transform-origin: 0 0; transition: transform .45s cubic-bezier(.2,.9,.2,1); }
#fx { position: absolute; inset: 0; pointer-events: none; }

#status {
  position: fixed; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(239, 68, 68, .9); font: 600 14px var(--font);
}

/* ---------- building blocks ---------- */
.panel {
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--hilite), var(--shadow);
  backdrop-filter: blur(14px); overflow: hidden; border: 1px solid var(--border);
}
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.display { font-family: var(--font-display); letter-spacing: .02em; text-transform: uppercase; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-2); font: 700 15px var(--font); text-transform: uppercase; letter-spacing: .08em;
}
.title-bar {
  padding: 8px 20px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  font: 800 18px var(--font-display); letter-spacing: .12em; text-transform: uppercase;
}
.swatch { width: 10px; align-self: stretch; }
.logo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--bg-2); flex: none; }
.logo.round { border-radius: 50%; }
.initials {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; flex: none;
  font: 800 22px var(--font-display); color: #fff;
}
.serve-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s ease; }

/* ---------- motion ---------- */
.card-enter { animation: card-in .7s cubic-bezier(.2,.9,.2,1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(.96); } }

.bump { animation: bump .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes bump { 40% { transform: scale(1.28); color: var(--accent-2); } }

.flash { animation: flash 1.2s ease; }
@keyframes flash { 20% { box-shadow: 0 0 0 4px var(--accent-2), 0 0 60px var(--accent-2); } }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.blink { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Big event banner (FOUR!, GOAL!, WICKET...) */
.banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  padding: 26px 80px; border-radius: 26px; font: 800 132px/1 var(--font-display);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  background: var(--banner, linear-gradient(135deg, var(--accent), var(--accent-2))); color: var(--banner-fg, var(--on-accent));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: banner 2.6s cubic-bezier(.2,.9,.2,1) both;
}
.banner small { display: block; font: 800 36px var(--font); letter-spacing: .1em; opacity: .85; margin-top: 8px; text-align: center; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-6deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(1deg); }
  20%, 80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.9); }
}
.banner.good { --banner: linear-gradient(135deg, #0b7e00, #34b32a); --banner-fg: #fff; }
.banner.bad { --banner: linear-gradient(135deg, #b42318, #e85c3c); --banner-fg: #fff; }
.banner.gold { --banner: linear-gradient(135deg, #ff5c25, #ffc542); }
.banner.purple { --banner: linear-gradient(135deg, #582864, #886192); --banner-fg: #fff; }
.banner.yellow { --banner: #ffc542; }
.banner.red { --banner: #e85c3c; --banner-fg: #fff; }

/* Small toast under the card */
.toast {
  position: absolute; padding: 10px 22px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font: 800 22px var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  animation: toast 2.2s ease both;
}
@keyframes toast { 0% { opacity: 0; transform: translateY(12px); } 12%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Confetti */
.confetti { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(1150px) rotate(720deg); opacity: .9; } }

/* Ripple rings for six / goal */
.ring {
  position: absolute; left: 50%; top: 42%; width: 40px; height: 40px; margin: -20px; border-radius: 50%;
  border: 6px solid var(--accent-2); animation: ring 1.4s ease-out forwards;
}
@keyframes ring { to { transform: scale(26); opacity: 0; } }

/* ---------- vertical (9:16) scorebug, see js/vertical.js ----------
   Sized for the 1080px-wide phone canvas: full width, top third, big type. */
.vbug { width: 1000px; font-family: var(--font-display); color: #fff; filter: drop-shadow(0 24px 40px rgba(8, 5, 18, .55)); }
.vb-top { gap: 14px; margin: 0 0 0 28px; }
.vb-tag, .vb-live { padding: 10px 22px; border-radius: 18px 18px 0 0; font-size: 30px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.vb-tag { background: rgba(14, 10, 26, .92); color: var(--accent-2); max-width: 760px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-live { background: #e11d2e; font-style: normal; display: inline-flex; align-items: center; gap: 10px; }
.vb-live::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: vbPulse 1.4s infinite; }
@keyframes vbPulse { 50% { opacity: .3; } }
.vb-row { height: 172px; border-radius: 30px 30px 0 0; overflow: hidden; background: rgba(14, 10, 26, .94); align-items: stretch; }
.vb-team { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px; min-width: 0; padding: 0 16px; background: var(--c); color: var(--ink); font-size: 66px; font-weight: 800; text-transform: uppercase; }
.vb-team span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-team img { width: 78px; height: 78px; object-fit: contain; border-radius: 14px; flex: none; }
.vb-score { display: flex; align-items: center; justify-content: center; white-space: nowrap; min-width: 190px; padding: 0 22px; background: #fff; color: #0c0a14; font-size: 118px; font-weight: 800; line-height: 1; }
.vb-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 170px; padding: 0 18px; text-align: center; }
.vb-mid .display { font-size: 58px; font-weight: 800; line-height: .95; }
.vb-mid small { font-family: var(--font); font-size: 26px; font-weight: 800; color: var(--muted); margin-top: 4px; }
.vb-one .vb-team { flex: 1.1; }
.vb-one .vb-score { flex: 1.6; font-size: 132px; }
.vb-one .vb-mid { flex: 1; }
.vb-strip { padding: 16px 28px; border-radius: 0 0 30px 30px; text-align: center; font-size: 52px; font-weight: 800; text-transform: uppercase; letter-spacing: .01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.vb-strip.warm { background: linear-gradient(90deg, #b45309, #f2b731); color: #1b1226; }
.vb-strip.hot { background: linear-gradient(90deg, #b42318, #ff5c25); color: #fff; }
.vb-strip.done { background: linear-gradient(90deg, #ffc542, #fff2c4); color: #1b1226; }
/* table layout (tennis, badminton) */
.vb-table .vb-body { border-radius: 30px 30px 0 0; overflow: hidden; background: rgba(14, 10, 26, .94); }
.vb-trow { height: 112px; align-items: stretch; }
.vb-trow + .vb-trow { border-top: 2px solid var(--line); }
.vb-tname { flex: 1; display: flex; align-items: center; gap: 16px; padding: 0 28px; border-left: 16px solid var(--c); font-size: 60px; font-weight: 800; text-transform: uppercase; min-width: 0; }
.vb-tname span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-trow.winner .vb-tname { color: var(--gold); }
.vb-serve { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-2); flex: none; box-shadow: 0 0 18px var(--glow); }
.vb-tcell { display: grid; place-items: center; min-width: 104px; padding: 0 14px; font-size: 70px; font-weight: 800; color: rgba(255, 255, 255, .85); }
.vb-tcell.hot { background: #fff; color: #0c0a14; min-width: 140px; }
.vbug .num.bump { animation: bump .6s cubic-bezier(.2,.9,.2,1); }

/* vertical "hero" layout (timer, counter, workout): one huge value */
.vb-hero .vb-hbody { gap: 30px; padding: 30px 36px; border-radius: 30px 30px 0 0; background: rgba(14, 10, 26, .94); align-items: center; }
.vb-hmain { flex: 1; min-width: 0; }
.vb-htitle { font-size: 54px; font-weight: 800; text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-hbig { font-size: 170px; font-weight: 800; line-height: .95; margin-top: 6px; }
.vb-hbig:empty { display: none; }
.vb-hbig .mono { font-family: var(--font-mono); font-size: .78em; letter-spacing: -.02em; }
.vb-hsub { font-family: var(--font); font-size: 30px; font-weight: 800; color: var(--muted); margin-top: 10px; }
.vb-next { color: var(--accent-2); margin-top: 6px; }
.vb-hbar { background: rgba(14, 10, 26, .94); padding: 0 36px 24px; }
.vb-hbar i { display: block; height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.vb-ring { position: relative; width: 230px; height: 230px; flex: none; }
.vb-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.vb-ring .track { fill: none; stroke: var(--tint); stroke-width: 14; }
.vb-ring .prog { fill: none; stroke: var(--accent-2); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.vb-ring .mono { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 58px; font-weight: 700; }
/* timer states + workout phases recolour the strip */
.vb-hero.warn .vb-strip { background: linear-gradient(90deg, #b45309, #f2b731); color: #1b1226; }
.vb-hero.danger .vb-strip, .vb-hero.done .vb-strip { background: linear-gradient(90deg, #b42318, #ff5c25); color: #fff; }
.vb-hero.danger .vb-hbig { color: #ff8a6a; }
.vb-hero[data-phase="work"] .vb-strip { background: linear-gradient(90deg, #15803d, #34d399); color: #052e1c; }
.vb-hero[data-phase="rest"] .vb-strip { background: linear-gradient(90deg, #1d4ed8, #38bdf8); color: #fff; }
.vb-hero[data-phase="rest"] .vb-ring .prog { stroke: #38bdf8; }
.vb-hero[data-phase="done"] .vb-strip { background: linear-gradient(90deg, #ffc542, #fff2c4); color: #1b1226; }
