/* ===========================================================================
   TAX VEGAS STUDIO — shell, stage, theme, console
   PCS Tax Service & Academy
   ===========================================================================

   The stage is composed at a FIXED pixel size (1080x1920 and friends) and
   then scaled to fit the window. That means the framing a presenter sets up
   is pixel-identical on a laptop and a studio monitor, and a screen capture
   of the stage is exactly the right aspect ratio.

   Every size inside the stage is expressed in terms of --u, a per-format
   unit, so switching from 9:16 to 16:9 re-proportions the whole layout
   instead of letting elements fall out of frame.
   =========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  /* brand colours — JS overwrites these from the Brand tab */
  --c-navy: #1e3a8a;
  --c-blue: #3b82f6;
  --c-gold: #ffd700;
  --c-gold-deep: #f59e0b;

  /* logo display geometry — JS overwrites these from the measured crop */
  --logo-aspect: 3.07;
  --logo-w: 100%;
  --logo-l: 0%;
  --logo-h: 100%;
  --logo-t: 0%;
  --logo-width: 46%;
  --logo-nudge: 0px;
  --logo-glow: 0.55;

  /* stage geometry — JS sets these from the chosen format */
  --stg-w: 1080px;
  --stg-h: 1920px;
  --stg-scale: 1;
  --u: 1;

  --font-display: "Archivo Black", "Arial Black", "Haettenschweiler", Impact, system-ui, sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Night — the default, and the right ground for a Vegas marquee */
:root[data-theme="night"] {
  /* The wheel/roulette hub stays dark in BOTH themes so its white lettering
     is always legible; it is a physical prop, not a surface. */
  --c-hub: #070b1a;
  --c-stage-deep: #05070f;
  --c-stage-1: #0b1226;
  --c-stage-2: #131c3d;
  --c-text: #ffffff;
  --c-muted: rgba(255, 255, 255, .72);
  --c-faint: rgba(255, 255, 255, .14);
  --c-card: rgba(255, 255, 255, .07);
  --c-card-line: rgba(255, 255, 255, .16);

  --ui-bg: #0a0e1a;
  --ui-panel: #111827;
  --ui-line: #1f2a44;
  --ui-text: #e8edf7;
  --ui-muted: #93a2bf;
  --ui-input: #0d1322;
}

/* Day — same structure, lighter ground, for daytime recording or a light brand */
:root[data-theme="day"] {
  --c-hub: #0b1226;
  --c-stage-deep: #e8ecf7;
  --c-stage-1: #f4f6fc;
  --c-stage-2: #ffffff;
  --c-text: #0b1226;
  --c-muted: rgba(11, 18, 38, .72);
  --c-faint: rgba(11, 18, 38, .12);
  --c-card: rgba(255, 255, 255, .78);
  --c-card-line: rgba(11, 18, 38, .14);

  --ui-bg: #eef1f8;
  --ui-panel: #ffffff;
  --ui-line: #d6dcea;
  --ui-text: #101828;
  --ui-muted: #5a6880;
  --ui-input: #f6f8fd;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA rule with almost no specificity, so any
   component rule that sets `display` silently overrides it and the element
   stays on screen while JS believes it is hidden. Everything in this app that
   toggles visibility uses `hidden`, so it is enforced once, here. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* ---------------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: 1fr 408px;
  height: 100vh;
  width: 100vw;
}
.app.is-presenting { grid-template-columns: 1fr 0; }
.app.is-presenting .console { display: none; }
.app.is-presenting .console-reveal { display: block; }

.stagewrap {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% 0%, rgba(59, 130, 246, .10), transparent 70%),
    var(--ui-bg);
  display: block;
}

/* ----------------------------------------------------------------- stage */
.stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--stg-w);
  height: var(--stg-h);
  transform: translate(-50%, -50%) scale(var(--stg-scale));
  transform-origin: center center;
  overflow: hidden;
  background: var(--c-stage-deep);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .55);
  isolation: isolate;
}

/* ------------------------------------------------------------ stage back */
.stage-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.stage-bg::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--c-stage-2), transparent 62%),
    radial-gradient(100% 60% at 50% 100%, var(--c-stage-1), transparent 60%),
    linear-gradient(180deg, var(--c-stage-deep), var(--c-stage-1) 55%, var(--c-stage-deep));
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(calc(90px * var(--u)));
  opacity: .5;
}
.bg-glow-a {
  width: calc(760px * var(--u)); height: calc(760px * var(--u));
  left: -18%; top: 6%;
  background: var(--c-blue);
  animation: drift-a 19s ease-in-out infinite alternate;
}
/* Gold reads much hotter than blue at the same opacity, so this one is
   deliberately held back — it is a warm edge, not a wash over the stage. */
.bg-glow-b {
  width: calc(560px * var(--u)); height: calc(560px * var(--u));
  right: -22%; bottom: 4%;
  background: var(--c-gold);
  opacity: .17;
  animation: drift-b 23s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(12%, 8%, 0) scale(1.14); } }
@keyframes drift-b { to { transform: translate3d(-10%, -8%, 0) scale(1.1); } }

/* sweeping showroom rays */
.bg-rays {
  position: absolute; inset: -30%;
  background: repeating-conic-gradient(
    from 0deg at 50% 0%,
    rgba(255, 255, 255, .055) 0deg 5deg,
    transparent 5deg 16deg);
  animation: rays 48s linear infinite;
  opacity: .5;
}
@keyframes rays { to { transform: rotate(360deg); } }

.bg-grain {
  position: absolute; inset: 0;
  opacity: .22;
  background-image: radial-gradient(rgba(255, 255, 255, .11) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* marquee bulb strips, top and bottom */
.bulbs {
  position: absolute; left: 0; right: 0;
  height: calc(16px * var(--u));
  background-image: radial-gradient(circle, var(--c-gold) 0 32%, rgba(255, 215, 0, .12) 34%, transparent 60%);
  background-size: calc(44px * var(--u)) 100%;
  background-repeat: repeat-x;
  opacity: .9;
  animation: chase 1.1s steps(2) infinite;
}
.bulbs-top { top: 0; }
.bulbs-bottom { bottom: 0; }
@keyframes chase { to { background-position: calc(44px * var(--u)) 0; } }

/* --------------------------------------------------------------- marquee */
.marquee {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: calc(44px * var(--u)) calc(56px * var(--u)) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(14px * var(--u));
  flex: 0 0 auto;
}

/* The logo gets its own deliberate band with real breathing room, rather
   than being tucked into a corner. */
.logo-plate {
  position: relative;
  width: var(--logo-width);
  margin-top: var(--logo-nudge);
  padding: calc(10px * var(--u));
  display: flex;
  justify-content: center;
}
.logo-plate::before {
  content: "";
  position: absolute;
  inset: calc(-26px * var(--u)) calc(-34px * var(--u));
  border-radius: 999px;
  background: radial-gradient(60% 70% at 50% 50%, rgba(255, 215, 0, .55), transparent 70%);
  opacity: var(--logo-glow);
  filter: blur(calc(26px * var(--u)));
  z-index: -1;
}
/* A lit marquee plate: deliberate placement with real breathing room, and
   enough contrast for navy artwork to read on a night stage or on camera. */
.logo-plate.has-plate {
  background: linear-gradient(180deg, #ffffff, #f2f5fb);
  border-radius: calc(26px * var(--u));
  padding: calc(26px * var(--u)) calc(40px * var(--u));
  box-shadow: 0 calc(20px * var(--u)) calc(54px * var(--u)) rgba(0, 0, 0, .55),
              0 0 0 calc(3px * var(--u)) var(--c-gold),
              0 0 calc(44px * var(--u)) rgba(255, 215, 0, .35);
}

/* The crop window. Only the artwork box is painted; the file's empty margin
   is simply not shown. No pixel of the artwork is altered or stretched. */
.logo-mark {
  position: relative;
  width: 100%;
  aspect-ratio: var(--logo-aspect);
  overflow: hidden;
}
.logo-mark img {
  position: absolute;
  width: var(--logo-w);
  height: var(--logo-h);
  left: var(--logo-l);
  top: var(--logo-t);
  object-fit: contain;
  display: block;
}
/* untrimmed mode: show the whole file, still never distorted */
.logo-mark.no-trim { aspect-ratio: auto; }
.logo-mark.no-trim img {
  position: static;
  width: 100%;
  height: auto;
}

/* The logo width is a percentage of the stage, so a wide frame would render
   it far larger than a tall one at the same setting. These factors keep the
   lockup optically the same size whatever the format, while the operator's
   slider still controls it. */
.stage[data-format="1x1"]  .logo-plate { width: calc(var(--logo-width) * 0.86); }
.stage[data-format="3x4"]  .logo-plate { width: calc(var(--logo-width) * 0.98); }
/* Landscape puts the plate in an auto-sized grid column, where a percentage
   width has nothing stable to resolve against and collapses — so this one is
   an explicit width that still tracks the format unit. */
.stage[data-format="16x9"] .logo-plate { width: calc(760px * var(--u)); }

/* Landscape puts the logo beside the wordmark instead of above it, which is
   the only way to keep the game large in a short frame. */
.stage[data-format="16x9"] .marquee {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  column-gap: calc(44px * var(--u));
  row-gap: 0;
  padding: calc(22px * var(--u)) calc(50px * var(--u)) 0;
}
.stage[data-format="16x9"] .logo-plate { grid-row: 1 / 3; grid-column: 1; margin-top: 0; }
.stage[data-format="16x9"] .wordmark { grid-column: 2; grid-row: 1; }
.stage[data-format="16x9"] .wordmark-sub { grid-column: 2; grid-row: 2; text-align: left; }
.stage[data-format="16x9"] .view { padding: calc(14px * var(--u)) calc(50px * var(--u)) calc(22px * var(--u)); gap: calc(14px * var(--u)); }

.wordmark {
  display: flex;
  align-items: baseline;
  gap: calc(16px * var(--u));
  font-family: var(--font-display);
  letter-spacing: .02em;
  line-height: .92;
}
.wm-tax {
  font-size: calc(96px * var(--u));
  color: var(--c-text);
  text-shadow: 0 calc(4px * var(--u)) calc(26px * var(--u)) rgba(0, 0, 0, .55);
}
.wm-vegas {
  font-size: calc(96px * var(--u));
  background: linear-gradient(180deg, #fff8d2, var(--c-gold) 42%, var(--c-gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 calc(6px * var(--u)) calc(22px * var(--u)) rgba(245, 158, 11, .5));
}
.wordmark-sub {
  font-size: calc(23px * var(--u));
  letter-spacing: .34em;
  color: var(--c-muted);
  font-weight: 700;
  text-align: center;
}

/* Pale gold on a pale ground fails badly on camera, so Day swaps the bright
   gold fills for a deeper bronze range and adds a hairline for separation.
   The gold stays gold on the Night stage, where it belongs. */
:root[data-theme="day"] .wm-vegas {
  background: linear-gradient(180deg, #b8860b, #8a5a00);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 calc(2px * var(--u)) calc(6px * var(--u)) rgba(0, 0, 0, .22));
}
:root[data-theme="day"] .wm-tax { color: var(--c-navy); }
:root[data-theme="day"] .wordmark-sub { color: rgba(11, 18, 38, .78); }
:root[data-theme="day"] .intro-url,
:root[data-theme="day"] .end-url { color: #8a5a00; }
:root[data-theme="day"] .winner-eyebrow { color: #8a5a00; }
:root[data-theme="day"] .prize-label { color: #8a5a00; }
:root[data-theme="day"] .winner-name {
  background: linear-gradient(180deg, var(--c-navy), #0b1226);
  -webkit-background-clip: text; background-clip: text;
}
:root[data-theme="day"] .sample-flag { color: #7a4a00; background: rgba(245, 158, 11, .26); }
:root[data-theme="day"] .end-url-plate { background: rgba(255, 255, 255, .72); }

/* ----------------------------------------------------------------- views */
.view {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  padding: calc(26px * var(--u)) calc(56px * var(--u)) calc(44px * var(--u));
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(22px * var(--u));
  min-height: 0;
}
.stage[data-view="intro"]  .view-intro  { display: flex; }
.stage[data-view="game"]   .view-game   { display: flex; }
.stage[data-view="winner"] .view-winner { display: flex; }
.stage[data-view="end"]    .view-end    { display: flex; }

/* ----------------------------------------------------------------- intro */
.intro-frame {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: calc(260px * var(--u));
  max-height: calc(880px * var(--u));
  border-radius: calc(28px * var(--u));
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 calc(3px * var(--u)) var(--c-gold),
              0 calc(28px * var(--u)) calc(70px * var(--u)) rgba(0, 0, 0, .6);
  display: grid;
  place-items: center;
}
/* contain, never cover — uploaded media keeps its proportions and nothing
   important is cropped off the edges */
.intro-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.intro-media[hidden] { display: none; }

.intro-sheen {
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .16) 48%, transparent 58%);
  transform: translateX(-60%);
  animation: sheen 5.5s ease-in-out infinite;
}
@keyframes sheen { 55%, 100% { transform: translateX(60%); } }

.intro-fallback {
  display: grid;
  place-items: center;
  gap: calc(14px * var(--u));
  text-align: center;
  color: var(--c-muted);
  padding: calc(30px * var(--u));
}
.intro-fallback-mark {
  font-family: var(--font-display);
  font-size: calc(92px * var(--u));
  color: var(--c-gold);
  opacity: .75;
}
.intro-fallback p { font-size: calc(22px * var(--u)); margin: 0; }

/* built-in animated opening — no file, drawn entirely here */
.intro-anim {
  position: absolute; inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 70% at 50% 40%, rgba(59, 130, 246, .40), transparent 68%),
    linear-gradient(180deg, #05070f, #111c3f 60%, #05070f);
  overflow: hidden;
}
.intro-anim[hidden] { display: none; }
.ia-rings { position: absolute; inset: 0; }
.ia-rings i {
  position: absolute;
  left: 50%; top: 50%;
  width: calc(240px * var(--u)); height: calc(240px * var(--u));
  margin: calc(-120px * var(--u)) 0 0 calc(-120px * var(--u));
  border: calc(3px * var(--u)) solid var(--c-gold);
  border-radius: 50%;
  opacity: 0;
  animation: ia-ring 3.2s ease-out infinite;
}
.ia-rings i:nth-child(2) { animation-delay: .8s; }
.ia-rings i:nth-child(3) { animation-delay: 1.6s; }
.ia-rings i:nth-child(4) { animation-delay: 2.4s; }
@keyframes ia-ring {
  0%   { transform: scale(.3); opacity: .85; }
  100% { transform: scale(3.4); opacity: 0; }
}
.ia-core {
  position: relative;
  text-align: center;
  font-family: var(--font-display);
  display: grid;
  justify-items: center;
  gap: calc(6px * var(--u));
}
.ia-core .ia-t {
  display: block;
  font-size: calc(74px * var(--u));
  line-height: 1;
  color: #fff;
  letter-spacing: .04em;
  animation: ia-in .9s var(--ease) both;
}
.ia-core .ia-v {
  display: block;
  font-size: calc(118px * var(--u));
  line-height: 1;
  background: linear-gradient(180deg, #fff8d2, var(--c-gold) 45%, var(--c-gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ia-in .9s .18s var(--ease) both;
}
.ia-core .ia-s {
  display: block;
  margin-top: calc(12px * var(--u));
  font-family: var(--font-ui);
  font-size: calc(21px * var(--u));
  letter-spacing: .3em;
  color: rgba(255, 255, 255, .8);
  animation: ia-in .9s .36s var(--ease) both;
}
@keyframes ia-in {
  from { opacity: 0; transform: translateY(calc(26px * var(--u))) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.intro-headline {
  font-family: var(--font-display);
  font-size: calc(62px * var(--u));
  line-height: 1.02;
  margin: 0;
  text-align: center;
  text-wrap: balance;
  max-width: 94%;
}
.intro-subline {
  margin: calc(-8px * var(--u)) 0 0;
  font-size: calc(26px * var(--u));
  color: var(--c-muted);
  text-align: center;
}
.intro-url, .cta-url {
  margin: 0;
  font-size: calc(26px * var(--u));
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--c-gold);
}

/* countdown */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(3, 6, 15, .62);
  backdrop-filter: blur(calc(3px * var(--u)));
}
.countdown[hidden] { display: none; }
.countdown-num {
  font-family: var(--font-display);
  font-size: calc(300px * var(--u));
  line-height: 1;
  color: var(--c-gold);
  text-shadow: 0 0 calc(60px * var(--u)) rgba(245, 158, 11, .8);
  animation: cd-pop .92s var(--ease);
}
@keyframes cd-pop {
  from { transform: scale(1.6); opacity: 0; }
  60%  { transform: scale(1); opacity: 1; }
  to   { transform: scale(.92); opacity: .9; }
}

.intro-controls {
  display: flex;
  gap: calc(16px * var(--u));
  flex-wrap: wrap;
  justify-content: center;
}

/* ------------------------------------------------------------ game chrome */
.prize-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4px * var(--u));
  padding: calc(12px * var(--u)) calc(32px * var(--u));
  border-radius: 999px;
  background: var(--c-card);
  border: calc(2px * var(--u)) solid var(--c-gold);
  backdrop-filter: blur(calc(8px * var(--u)));
  max-width: 92%;
  flex: 0 0 auto;
}
.prize-label {
  font-size: calc(17px * var(--u));
  letter-spacing: .3em;
  color: var(--c-gold);
  font-weight: 800;
}
.prize-name {
  font-family: var(--font-display);
  font-size: calc(34px * var(--u));
  text-align: center;
  line-height: 1.1;
  word-break: break-word;
}

.game-pane { display: none; width: 100%; flex: 1 1 auto; min-height: 0; }
.stage[data-game="wheel"]    .game-pane[data-game-name="wheel"],
.stage[data-game="slots"]    .game-pane[data-game-name="slots"],
.stage[data-game="roulette"] .game-pane[data-game-name="roulette"] {
  display: grid;
  place-items: center;
}

/* live readout of whoever is under the pointer — works at any pool size */
.now-reading {
  min-height: calc(48px * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(12px * var(--u));
  font-size: calc(28px * var(--u));
  font-weight: 800;
  color: var(--c-muted);
  text-align: center;
  max-width: 92%;
  flex: 0 0 auto;
}
.now-reading b {
  color: var(--c-text);
  font-family: var(--font-display);
  font-weight: 400;
}

.spin-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(12px * var(--u));
  flex: 0 0 auto;
}
.pool-note {
  margin: 0;
  font-size: calc(19px * var(--u));
  color: var(--c-muted);
}
.sample-flag {
  display: none;
  margin: 0;
  padding: calc(6px * var(--u)) calc(18px * var(--u));
  border-radius: 999px;
  background: rgba(245, 158, 11, .18);
  border: calc(2px * var(--u)) solid var(--c-gold-deep);
  color: var(--c-gold);
  font-size: calc(18px * var(--u));
  font-weight: 800;
  letter-spacing: .14em;
}
.sample-flag.is-on { display: inline-block; }

/* ---------------------------------------------------------------- winner */
.view-winner { justify-content: center; }
.winner-eyebrow {
  margin: 0;
  font-size: calc(24px * var(--u));
  letter-spacing: .4em;
  color: var(--c-gold);
  font-weight: 800;
}
.winner-card {
  width: 100%;
  padding: calc(44px * var(--u)) calc(38px * var(--u));
  border-radius: calc(30px * var(--u));
  background: var(--c-card);
  border: calc(3px * var(--u)) solid var(--c-gold);
  backdrop-filter: blur(calc(14px * var(--u)));
  text-align: center;
  box-shadow: 0 calc(30px * var(--u)) calc(80px * var(--u)) rgba(0, 0, 0, .55);
  animation: win-in .7s var(--ease) both;
}
@keyframes win-in {
  from { opacity: 0; transform: translateY(calc(30px * var(--u))) scale(.94); }
  to   { opacity: 1; transform: none; }
}
.winner-prize {
  margin: 0 0 calc(12px * var(--u));
  font-size: calc(24px * var(--u));
  letter-spacing: .22em;
  color: var(--c-muted);
  font-weight: 800;
}
/* Long names shrink by step rather than overflowing the card. */
.winner-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(84px * var(--u));
  line-height: 1.02;
  text-wrap: balance;
  word-break: break-word;
  background: linear-gradient(180deg, #ffffff, #ffe9a8 60%, var(--c-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.winner-name.len-m { font-size: calc(64px * var(--u)); }
.winner-name.len-l { font-size: calc(50px * var(--u)); }
.winner-name.len-xl { font-size: calc(38px * var(--u)); }
.winner-rule {
  height: calc(4px * var(--u));
  width: calc(140px * var(--u));
  margin: calc(22px * var(--u)) auto;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.winner-tag { margin: 0; color: var(--c-muted); font-size: calc(22px * var(--u)); }

.burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.burst i {
  position: absolute;
  top: 46%; left: 50%;
  width: calc(12px * var(--u)); height: calc(12px * var(--u));
  border-radius: 2px;
  background: var(--c-gold);
  opacity: 0;
  animation: burst 1.5s var(--ease) forwards;
}
.burst i:nth-child(1) { --bx: -320px; --by: -260px; background: var(--c-blue); }
.burst i:nth-child(2) { --bx:  300px; --by: -300px; animation-delay: .07s; }
.burst i:nth-child(3) { --bx: -260px; --by:  240px; animation-delay: .13s; background: #fff; }
.burst i:nth-child(4) { --bx:  340px; --by:  200px; animation-delay: .2s; }
.burst i:nth-child(5) { --bx:  -60px; --by: -360px; animation-delay: .26s; background: var(--c-blue); }
.burst i:nth-child(6) { --bx:   90px; --by:  340px; animation-delay: .33s; }
@keyframes burst {
  0%   { opacity: 1; transform: translate(0, 0) scale(.4) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(var(--bx) * var(--u)), calc(var(--by) * var(--u))) scale(1.4) rotate(220deg); }
}

/* -------------------------------------------------------------- end card */
.end-head {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(78px * var(--u));
  text-align: center;
  line-height: 1;
}
.end-sub { margin: 0; color: var(--c-muted); font-size: calc(26px * var(--u)); text-align: center; }
.end-url-plate {
  padding: calc(20px * var(--u)) calc(36px * var(--u));
  border-radius: calc(18px * var(--u));
  border: calc(3px * var(--u)) solid var(--c-gold);
  background: rgba(0, 0, 0, .28);
}
.end-url {
  font-family: var(--font-display);
  font-size: calc(40px * var(--u));
  color: var(--c-gold);
  word-break: break-all;
}
.end-fine { margin: 0; color: var(--c-muted); font-size: calc(18px * var(--u)); text-align: center; max-width: 80%; }

/* ------------------------------------------------------------- cta strip */
.cta-bar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  width: 100%;
  padding: calc(16px * var(--u)) calc(40px * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(18px * var(--u));
  background: linear-gradient(90deg, var(--c-navy), var(--c-blue) 50%, var(--c-navy));
  border-top: calc(3px * var(--u)) solid var(--c-gold);
}
.cta-bar[hidden] { display: none; }
.cta-bar-tag {
  padding: calc(5px * var(--u)) calc(16px * var(--u));
  border-radius: 999px;
  background: var(--c-gold);
  color: #11131f;
  font-weight: 900;
  font-size: calc(18px * var(--u));
  letter-spacing: .16em;
  white-space: nowrap;
}
.cta-bar-url {
  font-weight: 800;
  font-size: calc(26px * var(--u));
  color: #fff;
  letter-spacing: .02em;
}
.cta-bar-rot {
  font-size: calc(20px * var(--u));
  color: rgba(255, 255, 255, .85);
  white-space: nowrap;
}

/* --------------------------------------------------------------- buttons */
/* Signature interaction: the fill sweeps in on hover, and a press shows a
   brief loading sweep before the action commits. */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  border: 2px solid var(--c-gold);
  border-radius: 999px;
  background: transparent;
  color: var(--c-text);
  font-family: var(--font-ui);
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  padding: .8em 1.8em;
  font-size: 15px;
  line-height: 1;
  transition: transform .14s var(--ease), box-shadow .22s var(--ease), color .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--c-gold), var(--c-gold-deep));
  transform: translateX(-101%);
  transition: transform .38s var(--ease);
  z-index: 0;
}
.btn:hover::before, .btn:focus-visible::before { transform: translateX(0); }
.btn:hover, .btn:focus-visible { color: #10131f; box-shadow: 0 10px 30px rgba(245, 158, 11, .35); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 3px; }
.btn-label { position: relative; z-index: 1; }

.btn.is-loading { pointer-events: none; color: #10131f; }
.btn.is-loading::before { transform: translateX(0); }
.btn.is-loading::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: rgba(16, 19, 31, .85);
  transform-origin: left;
  animation: btn-load .5s var(--ease) forwards;
  z-index: 2;
}
@keyframes btn-load { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.btn-xl {
  font-size: calc(30px * var(--u));
  padding: calc(22px * var(--u)) calc(60px * var(--u));
  border-width: calc(3px * var(--u));
  letter-spacing: .06em;
}
.btn-gold { border-color: var(--c-gold); }
.btn-blue { border-color: var(--c-blue); }
.btn-blue::before { background: linear-gradient(90deg, var(--c-blue), var(--c-navy)); }
.btn-blue:hover, .btn-blue:focus-visible { color: #fff; }
.btn-ghost { border-color: var(--ui-line); color: var(--ui-text); }
.btn-ghost::before { background: linear-gradient(90deg, var(--c-blue), var(--c-navy)); }
.btn-ghost:hover, .btn-ghost:focus-visible { color: #fff; }
.btn-block { display: flex; width: 100%; }

.cta { flex: 0 0 auto; }

/* ================================================================ console */
.console {
  background: var(--ui-panel);
  border-left: 1px solid var(--ui-line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ui-line);
  flex: 0 0 auto;
}
.console-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; letter-spacing: .14em; font-weight: 700;
  color: var(--ui-muted);
}
.console-brand b { color: var(--ui-text); }
.cb-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 12px var(--c-gold);
}
.console-head-actions { display: flex; gap: 6px; }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--ui-line);
  background: var(--ui-input);
  color: var(--ui-text);
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.icon-btn:hover { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.icon-btn:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }

.console-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--ui-line);
  flex: 0 0 auto;
}
.ctab {
  padding: 11px 4px;
  border: 0;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
}
.ctab:hover { color: var(--ui-text); }
.ctab.is-on { color: var(--c-gold); border-bottom-color: var(--c-gold); }
.ctab:focus-visible { outline: 2px solid var(--c-blue); outline-offset: -2px; }

.console-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }
.panel { display: none; }
.panel.is-on { display: block; }

.console-foot {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid var(--ui-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.foot-note { font-size: 11px; color: var(--ui-muted); }

/* ------------------------------------------------------- console widgets */
.field { margin-bottom: 18px; }
.lbl {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ui-muted);
  margin-bottom: 7px;
  letter-spacing: .03em;
}
.lbl.sm { margin-top: 10px; font-size: 11px; }
.lbl b { color: var(--ui-text); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.lbl-row .lbl { margin: 0; }
.lbl-actions { display: flex; gap: 5px; flex-wrap: wrap; }

.inp {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--ui-line);
  background: var(--ui-input);
  color: var(--ui-text);
  font-size: 13px;
  font-family: inherit;
}
.inp:focus { outline: 2px solid var(--c-blue); outline-offset: -1px; border-color: var(--c-blue); }
.inp.ta { resize: vertical; line-height: 1.5; min-height: 90px; }
.inp.sm { padding: 7px 10px; font-size: 12px; }
.inp.file { padding: 7px; font-size: 12px; }
select.inp { cursor: pointer; }

.rng {
  width: 100%;
  accent-color: var(--c-gold);
  margin: 4px 0 2px;
  cursor: pointer;
}
.rng:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 3px; }

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--ui-input);
  border: 1px solid var(--ui-line);
  flex-wrap: wrap;
}
.seg-btn {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.seg-btn:hover { color: var(--ui-text); }
.seg-btn.is-on { background: var(--c-blue); color: #fff; }
.seg-btn:focus-visible { outline: 2px solid var(--c-gold); outline-offset: -2px; }

.chk {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--ui-text);
}
.chk input { width: 16px; height: 16px; accent-color: var(--c-gold); cursor: pointer; flex: 0 0 auto; }
.chk.big { font-weight: 700; }
.chk input:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }

.mini-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--ui-line);
  background: var(--ui-input);
  color: var(--ui-text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.mini-btn:hover { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.mini-btn.danger:hover { background: #b4232f; border-color: #b4232f; }
.mini-btn:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.mini-btn[disabled] { opacity: .4; pointer-events: none; }

.row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.hint { font-size: 11px; color: var(--ui-muted); line-height: 1.55; margin: 6px 0; }
.hint.warn { color: var(--c-gold-deep); }

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sw { display: grid; gap: 5px; justify-items: center; font-size: 10px; color: var(--ui-muted); cursor: pointer; }
.sw input {
  width: 100%; height: 34px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-input);
  cursor: pointer;
  padding: 2px;
}

/* confirm-before-import gate */
.confirm-box {
  margin: 14px 0;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid var(--c-gold);
  background: rgba(245, 158, 11, .09);
}
.confirm-box[hidden] { display: none; }
.confirm-head { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--c-gold); }
.confirm-stats { margin: 0 0 10px; padding-left: 18px; font-size: 12px; line-height: 1.75; }
.confirm-stats b { color: var(--ui-text); }
.confirm-preview {
  max-height: 120px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ui-input);
  border: 1px solid var(--ui-line);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ui-muted);
  margin-bottom: 10px;
}
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn { flex: 1 1 auto; font-size: 12px; padding: .7em 1em; }

/* lists */
.pool-list, .winner-log, .media-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-input);
}
.winner-log { counter-reset: w; }
.pool-list li, .winner-log li, .media-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  font-size: 12px;
  border-bottom: 1px solid var(--ui-line);
}
.pool-list li:last-child, .winner-log li:last-child, .media-list li:last-child { border-bottom: 0; }
.pool-list li.empty, .winner-log li.empty, .media-list li.empty {
  color: var(--ui-muted);
  justify-content: center;
  font-style: italic;
}
.pool-list .nm, .winner-log .nm, .media-list .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto;
}
.pool-list .meta, .winner-log .meta { color: var(--ui-muted); font-size: 11px; flex: 0 0 auto; }
.tag-sample {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, .2);
  color: var(--c-gold-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}
.media-list li.is-on { background: rgba(59, 130, 246, .16); }
.x-btn {
  border: 0; background: transparent; color: var(--ui-muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 5px;
  flex: 0 0 auto;
}
.x-btn:hover { color: #fff; background: #b4232f; }
.x-btn:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 1px; }

.scrub-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.scrub-time { font-size: 11px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }

/* ---- sound slots ---- */
.slot-list { display: grid; gap: 8px; margin-top: 12px; }
.slot {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--ui-line);
  background: var(--ui-input);
}
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-name { font-size: 12px; font-weight: 700; color: var(--ui-text); }
.slot-hint { font-size: 10px; color: var(--ui-muted); margin: 2px 0 7px; }
.slot-row { display: flex; align-items: center; gap: 6px; }
.slot-row select { flex: 1 1 auto; min-width: 0; }
.slot-vol { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.slot-vol .rng { margin: 0; flex: 1 1 auto; }
.slot-vol span { font-size: 10px; color: var(--ui-muted); width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.slot.is-none { opacity: .72; }

.clip-list {
  list-style: none; margin: 8px 0 0; padding: 0;
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-input);
}
.clip-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; font-size: 12px;
  border-bottom: 1px solid var(--ui-line);
}
.clip-list li:last-child { border-bottom: 0; }
.clip-list li.empty { justify-content: center; color: var(--ui-muted); font-style: italic; }
.clip-list .nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-list .meta { flex: 0 0 auto; color: var(--ui-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.clip-tag {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 999px;
  font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(59,130,246,.18); color: var(--c-blue);
}
.clip-tag.t-tick { background: rgba(148,163,184,.2); color: #94a3b8; }
.clip-tag.t-win  { background: rgba(255,215,0,.2); color: var(--c-gold-deep); }
.clip-tag.t-bed, .clip-tag.t-loop { background: rgba(16,185,129,.18); color: #10b981; }

/* docs */
.h3 { margin: 0 0 4px; font-size: 15px; }
.h4 { margin: 18px 0 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--c-gold); }
.doc-list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.8; color: var(--ui-text); }
.doc-list b { color: var(--c-gold); font-weight: 700; }
.doc-list code {
  background: var(--ui-input); padding: 1px 5px; border-radius: 4px;
  font-size: 11px; border: 1px solid var(--ui-line);
}
.stamp { font-size: 11px; color: var(--ui-muted); margin: 2px 0 0; }

/* console reveal button, shown only in presentation mode */
.console-reveal {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  z-index: 50;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ui-line);
  background: rgba(10, 14, 26, .82);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  cursor: pointer;
  opacity: .22;
  transition: opacity .25s;
}
.console-reveal:hover, .console-reveal:focus-visible { opacity: 1; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  padding: 11px 20px;
  border-radius: 999px;
  background: #101828;
  color: #fff;
  border: 1px solid var(--c-gold);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 80vw;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------------------------------------------- responsive */
/* The console drops below the stage on narrow screens so the studio is
   still usable on a tablet or phone. */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 52vh 48vh; }
  .app.is-presenting { grid-template-rows: 100vh 0; }
  .console { height: auto; border-left: 0; border-top: 1px solid var(--ui-line); }
  .console-tabs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .swatches { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------- reduced motion */
/* Decorative motion is removed entirely; the games switch to a short settle
   handled in JS rather than a long spin. */
@media (prefers-reduced-motion: reduce) {
  .bg-glow-a, .bg-glow-b, .bg-rays, .bulbs, .intro-sheen, .ia-rings i { animation: none !important; }
  .burst i { display: none; }
  .winner-card, .ia-core .ia-t, .ia-core .ia-v, .ia-core .ia-s { animation: none !important; }
  .countdown-num { animation: none !important; }
  * { scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] .bg-glow-a,
:root[data-motion="reduce"] .bg-glow-b,
:root[data-motion="reduce"] .bg-rays,
:root[data-motion="reduce"] .bulbs,
:root[data-motion="reduce"] .intro-sheen,
:root[data-motion="reduce"] .ia-rings i { animation: none !important; }
:root[data-motion="reduce"] .burst i { display: none; }

/* ------------------------------------------------------------------ print */
@media print { .console, .console-reveal { display: none !important; } }
