/* ======================================================================
   GLANCE Zone - browser player.
   A dumb display device: it shows the engine's rendered zone full-screen,
   set-and-forget. No app chrome. Mirrors the Roku PlayerScene look.
   ====================================================================== */

/* Orbitron: the wordmark face the Roku bundles (pair screen v2). @import must precede all rules. */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

:root { --gz-ink: #e9edf2; --gz-dim: #8b93a1; --gz-accent: #4cc2ff; }

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; width: 100%;
  background: #000; color: var(--gz-ink); overflow: hidden;
  font-family: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; cursor: none;
}
body.gz-paused { cursor: default; }      /* show cursor in pairing/diag */

/* ---------- the display stage (letterboxed to the engine aspect) ------ */
#gzStage {
  position: fixed; inset: 0; margin: auto;
  /* size + offset set inline by JS so the 1280x720 surface scales to fit */
  background: #000; overflow: hidden;
}

/* a single card box on the grid; clips its content (scroll / crossfade) */
.gz-card { position: absolute; overflow: hidden; background: #000; }

/* static-card page images stacked + crossfaded by opacity */
.gz-page {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; opacity: 0; transition: opacity var(--fade, 350ms) ease-in-out;
}
.gz-page.gz-on { opacity: 1; }
/* 4x4 card (2026-10-21, player.js tallBuild): the 4x3 pages in a 15%-taller inner box, over a tiny canvas stretched
   to the whole card (smooth upscale = soft blur) */
.gz-tall { position: absolute; left: 0; width: 100%; overflow: hidden; }
.gz-tall-bd { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Page transition styles (Zone setting, 2026-10-02). Default = the crossfade above.
   swipe: pages wait off the right edge, slide in, and the old one slides off left.
   none:  instant switch. The card box clips anything outside it. */
.gz-t-swipe .gz-page { opacity: 1; transform: translateX(100%); transition: transform var(--fade, 350ms) ease-in-out; }
.gz-t-swipe .gz-page.gz-on { transform: translateX(0); }
.gz-t-swipe .gz-page.gz-out { transform: translateX(-100%); }
.gz-t-none .gz-page { transition: none; }

/* scrolling-card marquee: a track of chips translated left, wrapped seamlessly */
.gz-track {
  /* promoted to its own compositor layer: with mp4 chips decoding inside the
     strip, an unpromoted track repaints every frame and the scroll stutters */
  will-change: transform;
 position: absolute; top: 0; left: 0; height: 100%; display: flex; will-change: transform; }
.gz-chip  { height: 100%; flex: 0 0 auto; }

/* video-clip overlay: an mp4 takeover over the grid (fullscreen / card / tile).
   A fixed BODY child positioned from the stage rect, above cards, bar, overlay. */
/* Clip overlay: the LAYER fades in/out (so takeovers ease over / back to the
   zone screen), and the TWO stacked videos crossfade between playlist parts -
   the hidden one preloads the next mp4 while the visible one plays. */
.gz-clip { position: fixed; display: none; z-index: 40; background: #000; overflow: hidden;
           opacity: 0; transition: opacity .3s ease; }
.gz-clip.gz-on { opacity: 1; }
.gz-clip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
                 background: #000; opacity: 0; transition: opacity .28s ease; }
.gz-clip video.gz-on { opacity: 1; }
/* EMBED mode: a chip-sized video that GLIDES inside a scrolling card at the
   ticker's own speed - the scroll never stops. Sits under .gz-clip takeovers. */
.gz-embed { position: fixed; z-index: 35; overflow: hidden; background: #000; }
.gz-embed video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.gz-chip img, .gz-chip video { display: block; height: 100%; width: 100%; object-fit: fill; }

/* ---------- pairing / status screens (centered card on black) --------- */
#gzOverlay {
  position: fixed; inset: 0; display: none; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #0c1118 0%, #000 70%);
  z-index: 10; padding: 6vmin; text-align: center;
}
#gzOverlay.gz-show { display: grid; }

.gz-panel { max-width: min(720px, 88vw); }
.gz-brand { font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
            font-size: clamp(13px, 1.6vw, 18px); color: var(--gz-dim); margin-bottom: 3vmin; }
.gz-brand b { color: var(--gz-accent); }
.gz-title { font-size: clamp(20px, 3.2vw, 34px); font-weight: 700; margin: 0 0 1.5vmin; }
.gz-sub   { font-size: clamp(14px, 1.8vw, 19px); color: var(--gz-dim); line-height: 1.5; margin: 0 0 4vmin; }
.gz-sub a { color: var(--gz-accent); text-decoration: none; }

.gz-code {
  display: inline-flex; gap: clamp(8px, 1.4vw, 16px); margin: 1vmin 0 3vmin;
}
.gz-code span {
  font-variant-numeric: tabular-nums; font-weight: 800;
  font-size: clamp(40px, 9vw, 96px); line-height: 1;
  padding: clamp(10px, 1.8vw, 22px) clamp(12px, 2vw, 26px);
  border-radius: 14px; background: #11161e; border: 1px solid #1e2530;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.4);
}
.gz-hint { font-size: clamp(12px, 1.5vw, 16px); color: var(--gz-dim); }

/* sign-in form (the browser pairs by username) */
.gz-login { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 1vmin 0 2vmin; }
.gz-input {
  flex: 1 1 220px; max-width: 320px; padding: 14px 16px; font-size: 17px; color: var(--gz-ink);
  background: #11161e; border: 1px solid #1e2530; border-radius: 12px; outline: none;
}
.gz-input:focus { border-color: var(--gz-accent); }
.gz-btn {
  padding: 14px 22px; font-size: 16px; font-weight: 700; cursor: pointer;
  color: #04121b; background: var(--gz-accent); border: 0; border-radius: 12px;
}
.gz-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.gz-chip-btn {
  padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--gz-ink);
  background: #11161e; border: 1px solid #1e2530; border-radius: 999px;
}
.gz-chip-btn:hover { border-color: var(--gz-accent); color: var(--gz-accent); }
.gz-msg { margin-top: 16px; font-size: 14px; color: var(--gz-dim); min-height: 1.2em; }
.gz-msg.gz-err { color: #ff8a8a; }
.gz-spin { margin-top: 4vmin; width: 26px; height: 26px; display: inline-block;
           border: 3px solid #1e2530; border-top-color: var(--gz-accent);
           border-radius: 50%; animation: gz-rot 900ms linear infinite; }
@keyframes gz-rot { to { transform: rotate(360deg); } }
.gz-err { color: #ff8a8a; }

/* ---------- cold-boot loader ("Building your zone…") ------------------- */
/* An equalizer-style row of bars "glancing" up and down while the first
   screen downloads, plus a thin progress meter that fills as tiles arrive. */
.gz-glance { display: flex; gap: clamp(5px, .8vw, 9px); justify-content: center;
             align-items: flex-end; height: clamp(34px, 6vw, 60px); margin: 1vmin 0 3vmin; }
.gz-glance span {
  width: clamp(6px, 1vw, 10px); height: 100%; border-radius: 999px;
  background: linear-gradient(180deg, var(--gz-accent), #2a7fb0);
  transform-origin: bottom; animation: gz-glance 1.1s ease-in-out infinite;
}
.gz-glance span:nth-child(2) { animation-delay: .15s; }
.gz-glance span:nth-child(3) { animation-delay: .30s; }
.gz-glance span:nth-child(4) { animation-delay: .45s; }
.gz-glance span:nth-child(5) { animation-delay: .60s; }
@keyframes gz-glance { 0%, 100% { transform: scaleY(.28); opacity: .55; }
                       50% { transform: scaleY(1); opacity: 1; } }

.gz-prog {
  width: min(360px, 70vw); height: 6px; margin: 1vmin auto 0;
  background: #11161e; border: 1px solid #1e2530; border-radius: 999px; overflow: hidden;
}
.gz-prog i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #2a7fb0, var(--gz-accent));
  border-radius: 999px; transition: width .3s ease;
}

/* ---------- top control bar (fades in on mouse move while playing) ----- */
#gzBar {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 25;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,.62) 0%, rgba(0,0,0,0) 100%);
  opacity: 0; pointer-events: none; transition: opacity .35s ease;
}
body.gz-active #gzBar { opacity: 1; pointer-events: auto; }
body.gz-active { cursor: default; }                 /* reveal the cursor with the bar */
.gz-bar-user { font-size: 13px; color: #b9c0cc; letter-spacing: .02em;
               text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.gz-bar-user b { color: #e9edf2; }
.gz-bar-out {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 8px 0 14px; border: 0; border-radius: 10px;
  background: transparent; color: #9aa0ab; cursor: pointer;
  font: inherit; font-size: 14px; transition: color .15s, background .15s;
}
.gz-bar-out:hover { color: #fff; background: rgba(255,255,255,.08); }
.gz-bar-x { font-size: 24px; line-height: 1; font-weight: 400; }

/* ---------- diagnostics strip (toggle with the ? key) ----------------- */
#gzDiag {
  position: fixed; left: 0; bottom: 0; z-index: 20; display: none;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #9fe7ff; background: rgba(0,0,0,.72); padding: 8px 12px;
  max-width: 100vw; white-space: pre-wrap;
}
#gzDiag.gz-show { display: block; }

/* ---------- QR pairing mode (device side) ------------------------------ */
.gz-alt { margin-top: 18px; font-size: 14.5px; }
.gz-alt a { color: #0a84ff; text-decoration: none; }
.gz-qrbox { display: grid; place-items: center; margin: 14px 0 6px; }
.gz-qrbox img { width: min(300px, 56vmin); height: auto; border-radius: 12px;
                background: #fff; padding: 10px; }
.gz-code { font: 700 34px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .4em;
           text-indent: .4em; color: #e7e9ee; margin: 6px 0 2px; }

/* ---------- DEBUG OVERLAY (D key / ?debug=1 / 5 taps top-left) ---------- */
.gz-dbg { position: fixed; inset: auto 0 0 0; z-index: 30; display: none; max-height: 62vh;
  background: rgba(0,0,0,.88); color: #d9f4ff; border-top: 1px solid #1fd6e6;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; display: none; flex-direction: column; }
.gz-dbg.gz-show { display: flex; }
.gz-dbg-bar { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: #0b1a20; border-bottom: 1px solid #143842; }
.gz-dbg-bar b { color: #1fd6e6; margin-right: auto; }
.gz-dbg-bar button { font: inherit; padding: 4px 10px; border-radius: 6px; border: 1px solid #1fd6e6; background: transparent; color: #d9f4ff; cursor: pointer; }
.gz-dbg-bar button:hover { background: #12303a; }
.gz-dbg-state { padding: 6px 10px; color: #9fe7ff; white-space: pre-wrap; border-bottom: 1px solid #143842; }
.gz-dbg-cards { padding: 4px 10px; max-height: 26vh; overflow: auto; border-bottom: 1px solid #143842; }
.gz-dbg-card { padding: 4px 0; }
.gz-dbg-ch b { color: #fff; }
.gz-dbg-pages { margin: 2px 0 2px 18px; padding: 0; color: #8fb3c0; }
.gz-dbg-pages li.cur { color: #fff; font-weight: 700; }
.gz-dbg-pages em { color: #3ee08a; font-style: normal; }
.gz-dbg .bad { color: #ff5b6e; font-style: normal; font-weight: 700; }
.gz-dbg-log { margin: 0; padding: 6px 10px; overflow: auto; flex: 1; white-space: pre-wrap; color: #cfe9f3; }

/* ======================================================================
   PAIR SCREEN v2 (2026-09-22, founder): mirror of the Roku firmware's
   startPairMode - wordmark, "Let's connect this screen", GLANCE Setup app
   instruction, then QR LEFT | divider | big green code RIGHT, with the
   Roku's exact captions/footers and its logo-green (#00A651).
   Stacks vertically on phones.
   ====================================================================== */

.gz-pairwrap {
  min-height: 100vh; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; background: #000; padding: 4vmin; box-sizing: border-box;
}
.gz-pair-brand {
  font-family: 'Orbitron', ui-sans-serif, sans-serif;
  font-size: clamp(28px, 4.2vw, 58px); font-weight: 700;
  letter-spacing: .05em; color: #fff; text-transform: none;
}
.gz-pair-brand b { color: #00A651; }
.gz-pair-hello { font-size: clamp(17px, 2.4vw, 30px); color: #e7e9ee; margin: 2.2vmin 0 3vmin; }
.gz-pair-cta   { font-size: clamp(15px, 1.9vw, 23px); font-weight: 700; color: #fff; margin-bottom: 4.5vmin; }
.gz-pair-split { display: flex; align-items: stretch; justify-content: center; }
.gz-pair-half {
  width: min(42vw, 470px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1vmin 4vmin;
}
.gz-pairwrap .gz-qrbox { margin: 0; }
.gz-pairwrap .gz-qrbox img { width: min(340px, 34vmin); border-radius: 12px; }
.gz-pair-code {
  font: 700 clamp(44px, 7.4vw, 118px)/1.15 ui-monospace, Menlo, monospace;
  letter-spacing: .18em; color: #00A651; text-indent: .18em; /* balance the tracking */
}
.gz-pair-cap  { color: #8b93a1; font-size: clamp(12px, 1.4vw, 17px); margin-top: 2.4vmin; }
.gz-pairwrap .gz-msg { margin-top: 3.5vmin; min-height: 22px; }
.gz-pair-foot { color: #5a5f6a; font-size: clamp(11px, 1.25vw, 15px); margin-top: 1.2vmin; }

@media (max-width: 640px), (orientation: portrait) {
  .gz-pair-split { flex-direction: column; align-items: center; }
  .gz-pair-half  { width: auto; padding: 3vmin 0; }
}

/* ---------- support-log box (hold L / the top-left corner 5s) --------- */
.gz-toast { position: fixed; left: 50%; bottom: 7vh; transform: translate(-50%, 12px); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-radius: 14px;
  background: rgba(16, 18, 22, .94); border: 1px solid #2a2f37; color: #f5f6f8;
  font: 600 18px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: min(560px, 90vw); }
.gz-toast.gz-show { opacity: 1; transform: translate(-50%, 0); }
.gz-toast-spin { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 3px solid #3a3f48; border-top-color: #30d158; animation: gzSpin .8s linear infinite; }
.gz-toast.gz-ok .gz-toast-spin { animation: none; border-color: #30d158; background: #30d158; }
.gz-toast.gz-err .gz-toast-spin { animation: none; border-color: #ff6b5f; background: #ff6b5f; }
@keyframes gzSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gz-toast-spin { animation-duration: 2.4s; } }
