/* Try a real LaserCube. Colours from the LaserCube brand guide (black, Ultra MK2 blue-green). */
@font-face { font-family: Inter; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #000;
  --surface: #0f0f10;
  --raised: #17171b;
  --quiet: #21212b;
  --line: #2c2f38;
  --line-2: #505a69;
  --subtle: #889ab3;
  --text: #fff;
  --muted: #b9c3d2;
  --blue: #479bf6;
  --green: #7ef281;
  --live: #ff3b4e;
  --grad: linear-gradient(-110deg, #479bf6 0%, #cde5ff 46%, #7ef281 100%);
  --radius: 16px;
  --header: 53px;
  --gap: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10; height: var(--header);
  display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand img { width: 132px; height: auto; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--quiet); color: var(--subtle);
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); }
.live[data-on="true"] { background: rgba(255, 59, 78, .14); color: #ffd3d8; }
.live[data-on="true"] .dot { background: var(--live); box-shadow: 0 0 0 0 rgba(255, 59, 78, .6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 78, .55); } 70% { box-shadow: 0 0 0 8px rgba(255, 59, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 78, 0); } }
@media (prefers-reduced-motion: reduce) { .live[data-on="true"] .dot { animation: none; } }
.watchers { margin-left: auto; font-size: 13px; color: var(--subtle); white-space: nowrap; }
.shop-link { display: none; font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); }
@media (min-width: 640px) { .shop-link { display: inline-block; } }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

/* video: stays in view while you pick shows, so you see the laser react */
.stage { margin: 0 -16px; padding-top: 0; position: sticky; top: var(--header); z-index: 5; background: var(--bg); }
.screen {
  position: relative; aspect-ratio: 16 / 9; background: #050507; overflow: hidden;
}
@media (min-width: 640px) {
  .stage { margin: 0; padding-top: 16px; }
  .screen { border-radius: var(--radius); border: 1px solid var(--line); }
}
/* Narrow screens: one column, and the wrappers step aside so the video stays pinned down the whole page. */
@media (max-width: 999px) { .col-a, .col-b { display: contents; } }
/* Short phones held sideways: no pinned video (it would fill the screen), and a video that fits the height. */
@media (max-height: 520px) {
  .stage { position: static; }
  .screen { width: min(100%, calc((100vh - var(--header) - 24px) * 16 / 9)); margin: 0 auto; }
}

/* Your turn, pinned under the video on phones. */
.strip { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--raised); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.strip[hidden] { display: none; }
.strip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip.warn .strip-text { color: #ffd166; }
.strip-btn { flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 600; cursor: pointer; }
@media (min-width: 640px) { .strip { border-radius: 0 0 12px 12px; } }
@media (min-width: 1000px) { .strip { display: none; } }

/* Wide screens: video + your turn on the left (pinned), controls on the right. */
@media (min-width: 1000px) {
  main { max-width: 1280px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 32px; align-items: start; }
  .stage { position: static; }
  .col-a { position: sticky; top: var(--header); padding-bottom: 16px; }
  .col-b { padding-top: 16px; }
  .col-b .panel { margin-top: 0; }
}
@media (min-width: 1000px) and (max-height: 760px) { .col-a { position: static; } }
.screen video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  background: radial-gradient(ellipse at center, rgba(71, 155, 246, .10), rgba(0, 0, 0, .82) 70%);
}
.overlay[hidden] { display: none; }
.overlay p { margin: 0; max-width: 34ch; font-size: 15px; color: var(--muted); }
.now {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px);
  display: flex; gap: 8px; align-items: baseline;
  padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .62);
  font-size: 13px; line-height: 1.3;
}
.now[hidden] { display: none; }
.now-pl { color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; flex: 0 1 auto; }
.now-cue { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound {
  position: absolute; right: 10px; bottom: 10px; padding: 6px 12px; border-radius: 10px; border: 0;
  background: rgba(0, 0, 0, .62); font-size: 13px; cursor: pointer;
}

/* text */
.intro { margin-top: 24px; }
h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 36px); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
.intro p { margin: 0; color: var(--muted); }

/* turn */
.turn {
  margin-top: 20px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.turn-status { margin: 0; font-size: 18px; font-weight: 700; }
.turn-sub { margin: 4px 0 0; font-size: 14px; color: var(--subtle); min-height: 1.5em; }
.turn-sub.warn { color: #ffd166; }
.bar { margin-top: 12px; height: 6px; border-radius: 6px; background: var(--quiet); overflow: hidden; }
.bar[hidden] { display: none; }
.bar span { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: left; transition: transform .25s linear; }
.turn-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
}
.btn[hidden] { display: none; }
.btn.primary { background: var(--grad); color: #04121f; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.turn .btn { flex: 1 1 200px; }

/* controls */
.panel { margin-top: 20px; }
.locked {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px;
  background: var(--raised); color: var(--subtle); border: 1px dashed var(--line-2);
}
.panel[data-active="true"] .locked { display: none; }
.panel[data-active="false"] .ctl { cursor: default; }
.label { margin: 22px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }

.transport { display: flex; gap: 10px; }
.tbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 56px; height: 52px; padding: 0 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600;
}
.tbtn.wide { flex: 1; }
.tbtn svg { width: 22px; height: 22px; fill: currentColor; }
.tbtn[aria-pressed="true"] { border-color: var(--blue); background: rgba(71, 155, 246, .12); }
/* Watching: controls look locked; a tap explains how to take control (app.js act()). */
.panel[data-active="false"] input[type="range"] { pointer-events: none; }
.panel[data-active="false"] .tbtn { color: var(--subtle); }
.panel[data-active="false"] input[type="range"] { opacity: .55; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 3px; margin: -3px; padding-bottom: 7px; scrollbar-width: none; }
@media (min-width: 640px) { .chips { flex-wrap: wrap; overflow: visible; } }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; font-weight: 600; white-space: nowrap;
  max-width: min(80vw, 360px); overflow: hidden; text-overflow: ellipsis;
}
.chip[aria-pressed="true"] { background: var(--text); color: #000; border-color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); min-width: 0;
}
.tile .pic { aspect-ratio: 1; border-radius: 10px; background: #000 center / cover no-repeat; overflow: hidden; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.tile .name { font-size: 12.5px; line-height: 1.25; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.5em; }
.tile[aria-pressed="true"] { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; border: 2px solid transparent; padding: 5px; }
.tile[aria-pressed="true"] .name { color: var(--text); font-weight: 600; }
.fx .tile .name { min-height: 0; }
.fx .none .pic { display: grid; place-items: center; color: var(--subtle); font-size: 13px; }
.empty { grid-column: 1 / -1; margin: 0; padding: 18px; text-align: center; color: var(--subtle); font-size: 14px; border: 1px dashed var(--line); border-radius: 12px; }

.tabs { display: inline-flex; padding: 3px; gap: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.tab { border: 0; background: transparent; min-height: 36px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.tab[aria-pressed="true"] { background: var(--quiet); color: var(--text); }

.sliders { display: grid; gap: 14px; }
.srow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.srow label { font-size: 15px; font-weight: 600; }
.srow output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.srow input { grid-column: 1 / -1; width: 100%; accent-color: var(--blue); height: 28px; }

.cta {
  margin-top: 32px; padding: 22px; border-radius: var(--radius);
  background: radial-gradient(120% 140% at 0% 0%, rgba(71, 155, 246, .16), transparent 60%), var(--surface);
  border: 1px solid var(--line);
}
.cta h2 { margin: 0 0 6px; font-size: 22px; }
.cta p { margin: 0 0 16px; color: var(--muted); }
.fine { margin-top: 24px; font-size: 13px; color: var(--subtle); display: grid; gap: 6px; }
.fine p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--line-2); box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
  font-size: 15px;
}
.toast[hidden] { display: none; }
