/* ============================================================================
   TV menu boards — full-screen digital menu display.
   A distinct surface (a wall-mounted screen), so it carries its own stylesheet.
   The board is letterboxed to its true aspect ratio (16:9 horizontal / 9:16
   vertical) and centered on black, so a portrait board previews correctly even
   in a landscape window and vice-versa. All interior sizing uses container units
   (cqw/cqh) relative to the BOARD, so it scales perfectly at any panel size.
   Theme/accent/font are CSS variables — light/dark/custom colour is a token swap.
   ========================================================================== */
:root {
  --tv-bg: #f4f1ec;
  --tv-panel: #ffffff;
  --tv-ink: #1a1614;
  --tv-ink-soft: #6b6259;
  --tv-line: rgba(0,0,0,.08);
  --tv-accent: #e11d2a;
  --tv-shadow: 0 1.2cqh 3.4cqh rgba(0,0,0,.10);
  --tv-radius: 2.2cqh;
  --tv-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tv[data-theme="dark"] {
  --tv-bg: #17140f;
  --tv-panel: #201c17;
  --tv-ink: #f6f1e8;
  --tv-ink-soft: #b3a894;
  --tv-line: rgba(255,255,255,.10);
  --tv-shadow: 0 1.2cqh 3.8cqh rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

/* The stage fills the viewport and centres the board with black letterbox bars. */
.tv-stage { position: fixed; inset: 0; background: #000; display: grid; place-items: center; overflow: hidden; }

/* The board: a fixed-aspect rectangle sized to fit the viewport, and a size
   container so every cqw/cqh below is relative to the board, not the window. */
.tv {
  aspect-ratio: 16 / 9;
  width: min(100vw, calc(100vh * 16 / 9));
  container-type: size;
  display: flex; flex-direction: column;
  background: var(--tv-bg); color: var(--tv-ink);
  font-family: var(--tv-font);
  padding: 2cqh 2.6cqw; gap: 1.4cqh;
  overflow: hidden;
}
.tv { position: relative; }
.tv[data-orient="vertical"] {
  aspect-ratio: 9 / 16;
  width: min(100vw, calc(100vh * 9 / 16));
  padding: 2.4cqh 3cqw; gap: 2cqh;
}

/* Living background: slow-drifting soft colour blobs (accent + a warm tone) behind the
   whole board, so the screen never looks static. Deliberately low-opacity and slow so it
   reads as ambient motion, never competing with the menu text (no colour-blend). Sits at
   z-index 0; the header/body/footer are lifted above it. */
.tv::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 50% at 12% 16%, color-mix(in srgb, var(--tv-accent) 10%, transparent), transparent 70%),
    radial-gradient(46% 56% at 88% 84%, color-mix(in srgb, #ff9d3c 8%, transparent), transparent 70%);
  background-size: 165% 165%;
  opacity: .28;
  animation: tv-aurora 32s ease-in-out infinite alternate;
}
.tv[data-theme="dark"]::before { opacity: .34; }
.tv > .tv-header, .tv > .tv-body, .tv > .tv-footer { position: relative; z-index: 1; }
@keyframes tv-aurora {
  0%   { background-position:  0% 0%, 100% 100%, 50%  0%; }
  50%  { background-position: 28% 22%,  72% 78%, 42% 34%; }
  100% { background-position: 12% 42%,  90% 58%, 62% 10%; }
}
@media (prefers-reduced-motion: reduce) { .tv::before { animation: none; } }
/* A board that plays a clip parks the drift: compositing an animated full-screen gradient beneath a
   decoding video is what drops frames on a cheap HDMI stick. Same treatment as reduced-motion — the
   colour layer still paints, it just stops moving. Set by tv/screen.php when a video column resolves. */
.tv[data-media="video"]::before { animation: none; }

/* ---- Header / footer (each toggleable) — kept compact so the menu gets the room.
   Both are matched bands: a hairline separating each from the body, equal inner padding,
   so header and footer read as a symmetric pair around the menu. ---- */
.tv-header, .tv-footer { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.tv-header { gap: 2cqw; border-bottom: .2cqh solid var(--tv-line); padding-bottom: 1cqh; }
.tv-brand { display: flex; align-items: center; gap: 1cqw; }
.tv-logo { height: 3.6cqh; width: auto; object-fit: contain; }
/* Branded initials mark used when a restaurant has no logo of its own (never the platform logo). */
.tv-logo-mark { flex: 0 0 auto; display: inline-grid; place-items: center; width: 5cqh; height: 5cqh; border-radius: 1.1cqh;
  background: var(--tv-accent); color: #fff; font-weight: 800; font-size: 2.5cqh; letter-spacing: -.02em; }
/* Cuisine flag beside the header logo — the SAME circular white-bordered badge as the restaurant
   detail page (.qm-rd-flag in restaurant-detail.css), scaled in cqh so it tracks the board size. */
.tv-flag { flex: 0 0 auto; width: 4.6cqh; height: 4.6cqh; border-radius: 50%; overflow: hidden; background: #fff;
  border: .3cqh solid #fff; box-shadow: 0 .5cqh 1.6cqh rgba(0,0,0,.3); }
.tv-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-title { margin: 0; font-size: 2.2cqh; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.tv-tagline { margin: .3cqh 0 0; color: var(--tv-ink-soft); font-size: 1.3cqh; }
.tv-header-note { color: var(--tv-accent); font-weight: 700; font-size: 1.4cqh; text-transform: uppercase; letter-spacing: .1em; }
.tv-footer { border-top: .2cqh solid var(--tv-line); padding-top: 1cqh; color: var(--tv-ink-soft); font-size: 1.4cqh; gap: 2cqw; }
.tv-footer strong { color: var(--tv-ink); }
.tv-powered { display: inline-flex; align-items: center; gap: .8cqw; opacity: .82; white-space: nowrap; }
.tv-powered img { height: 2.6cqh; width: auto; object-fit: contain; }

/* ---- Body: the two layouts ---- */
/* ---- Body = a row of columns (1–4); vertical orientation stacks them. ---- */
.tv-body { flex: 1 1 auto; min-height: 0; display: flex; gap: 2.4cqw; }
.tv[data-orient="vertical"] .tv-body { flex-direction: column; gap: 2cqh; }

/* A column: sized by its span (flex-grow), a vertical stack that fills the board height. */
.tv-col { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* A hairline between adjacent MENU columns only (media columns stay clean, separated by the gap). */
.tv-col-menu + .tv-col-menu { border-inline-start: .14cqh solid var(--tv-line); padding-inline-start: 2.2cqw; }
.tv[data-orient="vertical"] .tv-col-menu + .tv-col-menu { border-inline-start: 0; padding-inline-start: 0; border-block-start: .14cqh solid var(--tv-line); padding-block-start: 1.4cqh; }

/* Media column (image / video / youtube): fills the column with softly rounded corners (per the
   board templates). overflow:hidden clips the img/video/iframe to the radius. Dish thumbnails
   stay square (.tv-thumb has no radius) — only the media panels are rounded. */
/* container-type:size makes the overlay + placeholder inside size to the COLUMN (cq units), not the whole
   board — so a product overlay on a narrow 1-of-4 column scales down instead of overflowing/clipping. */
.tv-col-image, .tv-col-video { position: relative; overflow: hidden; background: #000; border-radius: var(--tv-radius); container-type: size; }
.tv-col-media { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
/* The #000 above is the letterbox behind object-fit:cover — right while a clip is playing, wrong once
   there is no clip. When tv/screen.php removes a video whose file has gone missing it marks the column
   is-empty, and the board background shows through instead of a black rectangle on the wall. */
.tv-col-video.is-empty { background: none; }
/* Placeholder shown for an image/video/feature column with no source yet (templates + editor preview). */
.tv-col-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4cqmin; width: 100%; height: 100%; min-height: 8cqmin; padding: 3cqmin; text-align: center; border: .5cqmin dashed color-mix(in srgb, currentColor 30%, transparent); border-radius: 1.5cqmin; background: color-mix(in srgb, currentColor 6%, transparent); color: var(--tv-accent, #888); }
.tv-col-ph-ic svg { width: 9cqmin; height: 9cqmin; opacity: .85; }
.tv-col-ph-t { font-weight: 700; letter-spacing: .01em; font-size: 3.4cqmin; line-height: 1.3; max-width: 88%; opacity: .9; }

/* Product overlay on a media column: dish name + description + an accent price pill, anchored to one
   of nine points over the image/video. Each anchor sets its own justification so the block stays tidy
   whichever corner/edge it lives on. A soft text shadow keeps it legible over any photo. */
/* --tv-prod-scale (0.7–2.0, from the 0–10 size slider) grows the whole block together. */
.tv-product { --tv-prod-scale: 1; position: absolute; z-index: 2; display: flex; flex-direction: column; gap: calc(1.6cqmin * var(--tv-prod-scale)); max-width: 86%; padding: 1.4cqmin; }
.tv-product-name { color: #fff; font-weight: 800; font-size: calc(4cqmin * var(--tv-prod-scale)); line-height: 1.05; letter-spacing: .01em; text-shadow: 0 .3cqmin 1.6cqmin rgba(0,0,0,.65); }
.tv-product-desc { margin: 0; color: #fff; font-weight: 500; font-size: calc(2.3cqmin * var(--tv-prod-scale)); line-height: 1.3; max-width: 60cqw; text-shadow: 0 .2cqmin 1.2cqmin rgba(0,0,0,.65); }
.tv-product-price { background: var(--tv-accent); color: #fff; font-weight: 800; font-size: calc(3.2cqmin * var(--tv-prod-scale)); line-height: 1; padding: calc(1.2cqmin * var(--tv-prod-scale)) calc(2.6cqmin * var(--tv-prod-scale)); border-radius: 999px; box-shadow: 0 .6cqmin 2cqmin rgba(0,0,0,.32); }
/* 3×3 anchor grid — vertical edge, horizontal edge, and matching justification per cell. */
.tv-product[data-pos="top-left"]      { top: 4cqh;    left: 3cqw;  align-items: flex-start; text-align: left; }
.tv-product[data-pos="top-center"]    { top: 4cqh;    left: 50%;   transform: translateX(-50%);      align-items: center;     text-align: center; }
.tv-product[data-pos="top-right"]     { top: 4cqh;    right: 3cqw; align-items: flex-end;   text-align: right; }
.tv-product[data-pos="middle-left"]   { top: 50%;     left: 3cqw;  transform: translateY(-50%);      align-items: flex-start; text-align: left; }
.tv-product[data-pos="middle-center"] { top: 50%;     left: 50%;   transform: translate(-50%,-50%);  align-items: center;     text-align: center; }
.tv-product[data-pos="middle-right"]  { top: 50%;     right: 3cqw; transform: translateY(-50%);      align-items: flex-end;   text-align: right; }
.tv-product[data-pos="bottom-left"]   { bottom: 4cqh; left: 3cqw;  align-items: flex-start; text-align: left; }
.tv-product[data-pos="bottom-center"] { bottom: 4cqh; left: 50%;   transform: translateX(-50%);      align-items: center;     text-align: center; }
.tv-product[data-pos="bottom-right"]  { bottom: 4cqh; right: 3cqw; align-items: flex-end;   text-align: right; }

/* Feature column: hero cards spread to fill the column height. */
.tv-col-features { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: space-evenly; gap: 2cqh; }

/* Menu column: heading + an item list that fills the column height. Adaptive spacing distributes
   the rows: dense packs tight, sparse breathes (auto), or a fixed gap (cozy / roomy). */
.tv-cat-title {
  display: flex; align-items: center; gap: 1.4cqw; flex: 0 0 auto;
  margin: 0 0 1.5cqh; color: var(--tv-accent);
  font-size: 2cqh; font-weight: 800; text-transform: uppercase; letter-spacing: .16em;
}
.tv-cat-title::after { content: ""; flex: 1 1 auto; height: 0; border-top: .3cqh dotted color-mix(in srgb, var(--tv-accent) 42%, transparent); }
.tv-col-items { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.tv[data-spacing="auto"]  .tv-col-items { justify-content: space-between; }
.tv[data-spacing="cozy"]  .tv-col-items { justify-content: flex-start; gap: .3cqh; }
.tv[data-spacing="roomy"] .tv-col-items { justify-content: flex-start; gap: 2.6cqh; }

/* An item row: optional thumbnail (+ numbered badge), name (+ description), price. No calories. */
.tv-item { display: flex; align-items: center; gap: 1.2cqw; padding: 1cqh 0; border-bottom: .16cqh solid var(--tv-line); }
.tv-item.is-rich { align-items: flex-start; }
.tv-item:last-child { border-bottom: 0; }
.tv-item-num { flex: 0 0 auto; width: 4cqh; height: 4cqh; margin-top: .3cqh; background: var(--tv-accent);
  border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 2cqh; }
.tv-thumb-wrap { position: relative; flex: 0 0 auto; }
/* The badge rides fully inside the image's LEADING corner with a translucent frosted fill.
   `inset-inline-start`, not `left`: the number reads with the dish name beside it, so in Arabic it
   belongs on the right of the photo. It was pinned with `left` and there is no tv.rtl.css, so on an
   Arabic board it sat on the trailing edge, away from the text it labels. The overlay ANCHOR rules
   above deliberately keep `left`/`right` — "top-left" there is a corner a designer chose in the
   editor, not a reading direction, and must not flip. */
.tv-thumb-wrap .tv-item-num { position: absolute; top: .7cqh; inset-inline-start: .7cqh; margin: 0; width: 4.6cqh; height: 4.6cqh;
  font-size: 2.3cqh; background: color-mix(in srgb, var(--tv-accent) 80%, transparent); backdrop-filter: blur(.6cqh); -webkit-backdrop-filter: blur(.6cqh);
  box-shadow: 0 .2cqh .7cqh rgba(0,0,0,.35), inset 0 0 0 .18cqh rgba(255,255,255,.4); text-shadow: 0 .12cqh .35cqh rgba(0,0,0,.5); }
.tv-thumb { flex: 0 0 auto; width: 10cqh; height: 10cqh; object-fit: contain; filter: drop-shadow(0 .8cqh 1.2cqh rgba(0,0,0,.22)); }
/* The slot a dish photo WOULD fill, drawn when the dish has none. It carries .tv-thumb as well, so
   every size rule around it (is-rich / is-compact / vertical / --fit) applies unchanged and the
   outline lands exactly where the photo would sit. currentColor keeps it legible on both the light
   and dark board themes without a second rule, and the drop-shadow is cancelled because it belongs
   to a photograph, not to an empty box. */
.tv-thumb-empty { display: block; filter: none; border-radius: .8cqh;
  border: .22cqh dashed color-mix(in srgb, currentColor 38%, transparent);
  background: color-mix(in srgb, currentColor 7%, transparent); }
.tv-item.is-rich .tv-thumb { width: 12cqh; height: 12cqh; }
.tv-item.is-compact .tv-thumb { width: 7cqh; height: 7cqh; }
.tv[data-orient="vertical"] .tv-item.is-rich .tv-thumb { width: 10cqh; height: 10cqh; }
.tv-item-main { flex: 1 1 auto; min-width: 0; }
.tv-item-name { margin: 0; font-size: 2.3cqh; font-weight: 700; line-height: 1.14; letter-spacing: -.005em; }
.tv-item-desc { margin: .4cqh 0 0; font-size: 1.72cqh; color: var(--tv-ink-soft); line-height: 1.3; }
/* Calories, opt-in per menu column. A dish with no figure keeps the slot as a muted dash so rows stay
   aligned and the board previews true. */
.tv-item-cal { font-size: 1.5cqh; font-weight: 600; letter-spacing: .02em; color: var(--tv-ink-soft); line-height: 1.2; }
.tv-item-cal.is-block { display: block; margin: .3cqh 0 0; }
.tv-item-cal.is-inline { margin-inline-start: .6cqw; font-size: 1.4cqh; white-space: nowrap; }
.tv-item-cal.is-empty { opacity: .45; }
/* The price rail. It holds the price alone unless calories are placed under it, so a single child lays
   out exactly as the bare price did. */
.tv-item-tail { flex: 0 0 auto; align-self: center; display: flex; flex-direction: column; align-items: flex-end; padding-inline-start: 1cqw; }
.tv-item.is-rich .tv-item-tail { align-self: flex-start; margin-top: .3cqh; }
.tv-item-price { color: var(--tv-accent); font-weight: 800; font-size: 2.5cqh; white-space: nowrap; line-height: 1.05; }

/* Auto-fit: a column too tall for its height shrinks its rows uniformly (script sets --fit 0.55–1)
   so a dense image column never clips — it scales to fit while keeping the full column width. */
.tv-col { --fit: 1; }
.tv-col-items .tv-item { padding-block: calc(1cqh * var(--fit)); }
.tv-col-items .tv-item-name { font-size: calc(2.3cqh * var(--fit)); }
.tv-col-items .tv-item-desc { font-size: calc(1.72cqh * var(--fit)); }
.tv-col-items .tv-item-cal { font-size: calc(1.5cqh * var(--fit)); }
.tv-col-items .tv-item-cal.is-inline { font-size: calc(1.4cqh * var(--fit)); }
.tv-col-items .tv-item-price { font-size: calc(2.5cqh * var(--fit)); }
.tv-col-items .tv-item-num { width: calc(4cqh * var(--fit)); height: calc(4cqh * var(--fit)); font-size: calc(2cqh * var(--fit)); }
.tv-col-items .tv-item.is-rich .tv-thumb { width: calc(12cqh * var(--fit)); height: calc(12cqh * var(--fit)); }
.tv-col-items .tv-item.is-compact .tv-thumb { width: calc(7cqh * var(--fit)); height: calc(7cqh * var(--fit)); }
.tv-col-items .tv-thumb-wrap .tv-item-num { width: calc(4.6cqh * var(--fit)); height: calc(4.6cqh * var(--fit)); font-size: calc(2.3cqh * var(--fit)); }

/* Feature card (hero product). */
.tv-feature { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  justify-content: center; gap: 1cqh; padding: 2cqh 1cqw; background: var(--tv-panel); border-radius: var(--tv-radius); box-shadow: var(--tv-shadow); }
.tv-feature-img { width: 82%; max-height: 62%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 1.6cqh 2.4cqh rgba(0,0,0,.28)); }
.tv-feature-name { margin: .4cqh 0 0; font-size: 2.8cqh; font-weight: 800; line-height: 1.12; }
.tv-feature-desc { margin: 0; font-size: 1.8cqh; color: var(--tv-ink-soft); line-height: 1.3; max-width: 92%; }
.tv-feature-price { margin: .6cqh 0 0; color: var(--tv-accent); font-weight: 800; font-size: 3.6cqh; }

/* ============================== SLIDESHOW PLAYER ==============================
   The rotation engine for linked boards (tv-player.js). Two stacked layers
   double-buffer whole board documents; the stage's [data-tr] picks which
   enter/exit pair below plays a swap. GPU-only properties (transform, opacity,
   clip-path) — a wall stick's compositor must own the whole tween, or it
   drops frames the way the ambient layer already taught this stylesheet. */
.qm-tvplay-stage { position: fixed; inset: 0; background: #0b0d10; overflow: hidden; }
.qm-tvplay-layer { position: absolute; inset: 0; z-index: 1; visibility: hidden; will-change: transform, opacity; }
.qm-tvplay-layer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0b0d10; }
.qm-tvplay-layer.is-live { visibility: visible; z-index: 2; }
.qm-tvplay-layer.is-exit { visibility: visible; z-index: 2; }
.qm-tvplay-layer.is-enter { visibility: visible; z-index: 3; }

/* Crossfade — the incoming board dissolves over the outgoing one. */
[data-tr="fade"] .qm-tvplay-layer.is-enter { animation: qmTvFadeIn .85s cubic-bezier(.33, 0, .15, 1) both; }
[data-tr="fade"] .qm-tvplay-layer.is-exit { animation: qmTvFadeOut .85s cubic-bezier(.33, 0, .15, 1) both; }
@keyframes qmTvFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes qmTvFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Slide — the new board glides in over the old one, which eases away under it. */
[data-tr="slide"] .qm-tvplay-layer.is-enter { animation: qmTvSlideIn .85s cubic-bezier(.33, 0, .15, 1) both; }
[data-tr="slide"] .qm-tvplay-layer.is-exit { animation: qmTvSlideUnder .85s cubic-bezier(.33, 0, .15, 1) both; }
@keyframes qmTvSlideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes qmTvSlideUnder { from { transform: none; opacity: 1; } to { transform: translateX(-22%); opacity: .35; } }

/* Push — both boards move as one strip, the old shoved fully off. */
[data-tr="push"] .qm-tvplay-layer.is-enter { animation: qmTvSlideIn .85s cubic-bezier(.33, 0, .15, 1) both; }
[data-tr="push"] .qm-tvplay-layer.is-exit { animation: qmTvPushOut .85s cubic-bezier(.33, 0, .15, 1) both; }
@keyframes qmTvPushOut { from { transform: none; } to { transform: translateX(-100%); } }

/* Wipe — the new board is revealed left-to-right over the resting old one. */
[data-tr="wipe"] .qm-tvplay-layer.is-enter { animation: qmTvWipeIn .9s cubic-bezier(.45, 0, .2, 1) both; }
@keyframes qmTvWipeIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Zoom — the new board settles down onto the stage as the old one recedes. */
[data-tr="zoom"] .qm-tvplay-layer.is-enter { animation: qmTvZoomIn .85s cubic-bezier(.33, 0, .15, 1) both; }
[data-tr="zoom"] .qm-tvplay-layer.is-exit { animation: qmTvZoomOut .85s cubic-bezier(.33, 0, .15, 1) both; }
@keyframes qmTvZoomIn { from { transform: scale(1.07); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes qmTvZoomOut { from { transform: none; opacity: 1; } to { transform: scale(.96); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .qm-tvplay-layer.is-enter, .qm-tvplay-layer.is-exit { animation-duration: .01s !important; }
}

/* ---- The slideshow workbench chrome (admin demo): floating glass controls. ---- */
.qm-tvshow-bar {
  position: fixed; z-index: 10; inset-block-end: 22px; inset-inline: 0;
  display: flex; justify-content: center; pointer-events: none;
}
.qm-tvshow-bar > div {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 16px;
  background: rgba(13, 15, 18, .84); border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  color: #e7eaee; font-size: 13px;
}
.qm-tvshow-bar label { display: flex; align-items: center; gap: 8px; margin: 0; color: #9aa3ad; font-weight: 600; white-space: nowrap; }
.qm-tvshow-bar select, .qm-tvshow-bar input[type="number"] {
  background: rgba(255, 255, 255, .07); color: #fff; border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px; padding: 7px 10px; font: inherit; font-weight: 600;
}
.qm-tvshow-bar select:focus-visible, .qm-tvshow-bar input:focus-visible, .qm-tvshow-btn:focus-visible { outline: 2px solid #ff003d; outline-offset: 2px; }
.qm-tvshow-bar select option { color: #111; }
.qm-tvshow-bar input[type="number"] { width: 64px; text-align: center; }
.qm-tvshow-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07); color: #fff; cursor: pointer; font-size: 13px;
  transition: background .15s ease;
}
.qm-tvshow-btn:hover { background: rgba(255, 255, 255, .16); }
.qm-tvshow-btn--go { background: #ff003d; border-color: #ff003d; }
.qm-tvshow-btn--go:hover { background: #d60036; }
.qm-tvshow-count { min-width: 118px; }
.qm-tvshow-count strong { display: block; color: #fff; font-size: 13.5px; line-height: 1.25; }
.qm-tvshow-count span { color: #9aa3ad; font-size: 12px; }
.qm-tvshow-back {
  position: fixed; z-index: 10; inset-block-start: 18px; inset-inline-start: 18px;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: rgba(13, 15, 18, .84); border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #e7eaee; font-size: 13px; font-weight: 600; text-decoration: none;
}
.qm-tvshow-back:hover { color: #fff; background: rgba(30, 34, 40, .9); }
@media (max-width: 700px) {
  .qm-tvshow-bar > div { flex-wrap: wrap; justify-content: center; max-width: 94vw; row-gap: 8px; }
  .qm-tvshow-count { text-align: center; }
}


/* ==========================================================================
   SCREEN DESIGNER - vendor TV screen form (was inline in vendor/screen-form.php)
   ========================================================================== */
  .tv-editor { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 20px; align-items: stretch; }
  /* Both columns close on one line: the settings card fills its cell, and the
     pairing card grows to meet it (its content stays vertically centred). */
  .tv-settings > .qm-card { height: 100%; margin-bottom: 0; }
  .tv-preview-wrap > .qm-card { margin-bottom: 0; }
  .tv-preview-wrap { display: flex; flex-direction: column; }
  .tv-preview-wrap > .qm-card:last-child { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
  /* The form wraps only the cells that carry fields; display:contents hands its
     children straight to the grid, so the preview column can live OUTSIDE it
     (its pairing panel brings forms of its own — forms cannot nest). */
  #tv-form { display: contents; }
  .tv-settings, .tv-preview-wrap { min-width: 0; }
  .tv-settings { grid-row: 1; grid-column: 1; }
  .tv-preview-wrap { grid-row: 1; grid-column: 2; }
  .tv-columns-wrap { grid-column: 1 / -1; margin-top: 20px; }
  @media (max-width: 992px) {
    .tv-editor { grid-template-columns: 1fr; }
    .tv-settings, .tv-preview-wrap, .tv-columns-wrap { grid-row: auto; grid-column: 1; }
    .tv-settings { order: 1; }
    .tv-preview-wrap { order: 2; }
    .tv-columns-wrap { order: 3; }
  }
  .qm-tv-frame { aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
  .qm-tv-frame.is-vertical { aspect-ratio: 9 / 16; max-width: 300px; margin: 0 auto; }
  .qm-tv-frame iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
  /* Cards divide the full width by their count: 1 = full, 2 = halves, 3 = thirds, 4 = quarters — one row. */
  #tv-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
  /* One switch and the text it unlocks read as one unit: a single frame around
     the pair, the row's own border standing down inside it. */
  /* The settings column's switch+text pairs ride the SAME grouped-switch frame
     the column cards already use (defined below); only the inset text is new. */
  .tv-settings .tv-switch-group { margin-bottom: 10px; }
  .tv-switch-group .form-control { width: calc(100% - 28px); margin: 10px 14px 12px; }
  /* Column-card controls (up / down / remove): one icon-button voice. */
  .tv-colcard-head button { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-600); transition: border-color var(--t-fast), color var(--t-fast); }
  .tv-colcard-head button:hover { border-color: var(--qm-primary); color: var(--qm-primary); }
  .tv-colcard { border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px; min-width: 0; }
  .tv-colcard-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
  .tv-colcard-head select { flex: 0 1 auto; min-width: 0; }
  .tv-colcard-head .grow { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink-600); font-size: 13px; }
  .tv-colcard-head .iconbtn { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; border-radius: var(--r-sm); width: 28px; height: 28px; cursor: pointer; color: var(--ink-600); }
  .tv-colcard-head .iconbtn:hover:not(:disabled) { border-color: var(--qm-primary); color: var(--qm-primary); }
  .tv-colcard-head .iconbtn:disabled { opacity: .4; cursor: default; }
  .tv-colcard .qm-switch-row { padding: 8px 12px; margin-bottom: 0; }
  .tv-switch-group { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
  .tv-switch-group .qm-switch-row { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); align-items: center; }
  .tv-switch-group .qm-switch-row:last-child { border-bottom: 0; }
  .tv-switch-group .qm-switch-row:hover { border-bottom-color: var(--line); }
  .tv-colcard .qm-form-grid { gap: 12px; }
  .tv-colcard .full { grid-column: 1 / -1; }
  /* Menu column: one field per row, full width, stacked under each other. */
  .tv-menu-fields { grid-template-columns: 1fr; gap: 12px; }
  .tv-colcard .form-label { margin-bottom: 3px; font-size: 12.5px; }
  .tv-creatives { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; margin-top: 6px; }
  .tv-creatives label { border-radius: var(--r-sm); overflow: hidden; cursor: pointer; aspect-ratio: 1; }
  .tv-creatives input { position: absolute; opacity: 0; }
  .tv-creatives input:checked + img, .tv-creatives input:checked + video { outline: 3px solid var(--qm-primary); outline-offset: -3px; }
  .tv-creatives img, .tv-creatives video { width: 100%; height: 100%; object-fit: cover; display: block; }
  .tv-posgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 96px; }
  .tv-posgrid button { aspect-ratio: 1; border: 1px solid var(--line); background: transparent; border-radius: var(--r-sm); cursor: pointer; padding: 0; transition: border-color var(--t-fast), background var(--t-fast); }
  .tv-posgrid button:hover { border-color: var(--qm-primary); }
  .tv-posgrid button.is-on { background: var(--qm-primary); border-color: var(--qm-primary); box-shadow: inset 0 0 0 2px #fff; }
  .tv-size-out { min-width: 20px; text-align: center; font-weight: 700; font-size: 13px; color: var(--ink-600); }
  .tv-featlist { max-height: 168px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; }
  .tv-featlist .cat { font-weight: 600; font-size: 12px; color: var(--ink-600); margin: 6px 0 3px; }
  .tv-featlist label { display: block; font-size: 13.5px; padding: 2px 0; color: var(--ink-900); font-weight: 400; }
  .tv-starters-row { border-block: 1px solid var(--line); padding-block: 14px; }
  .tv-starters { display: flex; flex-wrap: wrap; gap: 8px; }
  .tv-starters button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--ink-600); }
  .tv-starters button:hover { border-color: var(--qm-primary); color: var(--qm-primary); }
  .tv-actions-right { display: flex; justify-content: flex-end; gap: 10px; }
  /* Pairing: QR + code form as one compact, centred unit — no full-width empty band. */
