@font-face { font-family: "Outfit"; src: url("../vendor/fonts/outfit-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
/* The twinklegrid web app. Dark by default (it sits next to a glowing panel). A light theme and an accent color are
   per-device choices (U-026): js/theme.js puts data-theme and data-accent on <html>. Colors come from these tokens;
   only LED surfaces (the preview, thumbnails) are hard-coded, because a panel is black whatever the theme. */
:root {
  --bg: #0d0e12;
  --panel: #15171d;
  --panel-2: #1c1f27;
  --panel-3: #252935;
  --border: #2a2e3a;
  --border-2: #3a3f4e;
  --text: #e9ebf1;
  --muted: #9aa1b2;
  --faint: #6b7283;
  --accent: #ff3d7f;
  --on-accent: #fff;                         /* text on an accent fill */
  --accent-2: #39d0ff;
  --on-accent-2: #00131c;
  --ok: #3ddc97;
  --warn: #ffb020;
  --danger: #ff5160;
  --accent-soft: rgba(255, 61, 127, 0.14);
  --accent-2-soft: rgba(57, 208, 255, 0.08);
  --ok-soft: rgba(61, 220, 151, 0.12);
  --warn-soft: rgba(255, 176, 32, 0.12);
  --danger-soft: rgba(255, 81, 96, 0.12);
  --focus: rgba(57, 208, 255, 0.24);
  --knob: #fff;
  --glass: rgba(21, 23, 29, 0.9);            /* bars that float over the page */
  --scrim: rgba(0, 0, 0, 0.6);
  --check-a: #16181e;
  --check-b: #1b1d24;
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 62px;
  --side-w: 232px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --card-shadow: none;
  --lift: 0 8px 22px rgba(0, 0, 0, 0.4);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --display: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;   /* headings and names (F-060) */
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --panel-2: #f2f3f7;
  --panel-3: #e6e8ee;
  --border: #e2e5ec;
  --border-2: #ccd1db;
  --text: #161920;
  --muted: #586072;
  --faint: #838a99;
  --accent: #e5266d;
  --accent-2: #0b78ad;
  --on-accent-2: #fff;
  --ok: #0e8a58;
  --warn: #a86300;
  --danger: #d32a3c;
  --accent-soft: rgba(229, 38, 109, 0.1);
  --accent-2-soft: rgba(11, 120, 173, 0.08);
  --ok-soft: rgba(14, 138, 88, 0.11);
  --warn-soft: rgba(168, 99, 0, 0.11);
  --danger-soft: rgba(211, 42, 60, 0.1);
  --focus: rgba(11, 120, 173, 0.22);
  --glass: rgba(255, 255, 255, 0.9);
  --scrim: rgba(22, 25, 32, 0.45);
  --check-a: #e6e8ee;
  --check-b: #f5f6f9;
  --shadow: 0 14px 36px rgba(22, 25, 40, 0.16);
  --card-shadow: 0 1px 2px rgba(22, 25, 40, 0.05);
  --lift: 0 8px 20px rgba(22, 25, 40, 0.13);
  color-scheme: light;
}
/* Accent colors: a bright one for dark, a deeper one for light, each with a text color that reads on it. */
:root[data-accent="blue"] { --accent: #4f8cff; --on-accent: #fff; }
:root[data-accent="teal"] { --accent: #19c3b1; --on-accent: #00201c; }
:root[data-accent="green"] { --accent: #3ddc97; --on-accent: #00210f; }
:root[data-accent="amber"] { --accent: #ffb020; --on-accent: #251700; }
:root[data-accent="violet"] { --accent: #9d7bff; --on-accent: #12072e; }
:root[data-theme="light"][data-accent="blue"] { --accent: #2563eb; --on-accent: #fff; }
:root[data-theme="light"][data-accent="teal"] { --accent: #0a8377; --on-accent: #fff; }
:root[data-theme="light"][data-accent="green"] { --accent: #0e8a58; --on-accent: #fff; }
:root[data-theme="light"][data-accent="amber"] { --accent: #b56600; --on-accent: #fff; }
:root[data-theme="light"][data-accent="violet"] { --accent: #6d45e8; --on-accent: #fff; }
/* Tints follow whichever accent is chosen (the rgba values above are the fallback for older browsers). */
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --accent-2-soft: color-mix(in srgb, var(--accent-2) 8%, transparent);
    --focus: color-mix(in srgb, var(--accent-2) 26%, transparent);
  }
  :root[data-theme="light"] { --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent); }
}
/* LED surfaces stay dark in the light theme, so what sits on them keeps the dark theme's colors. */
.led-frame, .led-full, .meter, .caption-preview, .icon-pick button, .tilt-pad, .orient-opt .pv, .crop-picker {
  --text: #e9ebf1; --muted: #9aa1b2; --faint: #6b7283; --border-2: #3a3f4e; --accent-2: #39d0ff; --on-accent-2: #00131c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--display); }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pair-code { font-size: 22px; font-weight: 700; letter-spacing: .08em; }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- shell ---------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px;
}
.brand { display: flex; align-items: center; padding: 6px 10px 20px; }
.brand img { width: 100%; max-width: 172px; height: auto; }       /* the mark and the name, in the panel's own dots (brand.py) */
.brand .on-light, :root[data-theme="light"] .brand .on-dark { display: none; }
:root[data-theme="light"] .brand .on-light { display: block; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 550;
}
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--text); }
.nav-link.active svg { color: var(--accent); }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px 32px; border-left: 1px solid var(--border); }
.nav-sub a { padding: 5px 12px; font-size: 13px; color: var(--muted); text-decoration: none; border-radius: 0 8px 8px 0; }
.nav-sub a:hover { color: var(--text); background: var(--panel-2); }
.nav-sub a.active { color: var(--text); border-left: 2px solid var(--accent); margin-left: -1px; }
.side { overflow-y: auto; }
[id^="set-"] { scroll-margin-top: 16px; }
.chips.settings-jump { display: none; }   /* the sidebar lists the groups; phones get this row instead */
/* Settings is one page (U-073): a search over it, every group in turn. A card the search leaves out is hidden where
   it stands (its slot takes no room of its own, so the cards stay evenly spaced). */
.settings-search { width: 100%; margin: 0 0 14px; }
.settings-none { margin: 4px 0 0; }
.set-slot { display: contents; }
.set-slot[hidden], .settings-group[hidden], .settings-jump[hidden] { display: none !important; }
.side .spacer { flex: 1; }
.side .status-mini { padding: 10px 12px; font-size: 12px; color: var(--faint); text-decoration: none; display: flex; align-items: center; gap: 8px; border-radius: var(--radius-sm); }
.side .status-mini:hover { background: var(--panel-2); color: var(--muted); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); flex: none; }
.health-dot.ok { background: var(--ok); }
.health-dot.warn { background: var(--warn); }
.health-dot.bad { background: var(--danger); animation: pulse 1.2s infinite; }
.main { min-width: 0; }
.page { padding: 24px 28px 48px; max-width: 1200px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { flex: 1 0 auto; min-width: 0; }   /* a title never shrinks under its buttons: they wrap below it */

.bottom-nav { display: none; }

@media (max-width: 820px) {
  .hide-sm { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .chips.settings-jump { display: flex; flex-wrap: nowrap; overflow-x: auto; position: sticky; top: 0; z-index: 30;
    margin: -4px -16px 12px; padding: 8px 16px; background: var(--bg); scrollbar-width: none; }
  .settings-jump::-webkit-scrollbar { display: none; }
  .settings-jump .chip { text-decoration: none; padding: 6px 12px; font-size: 13px; }
  .settings-jump .chip.on { background: var(--accent-soft); color: var(--text); }
  [id^="set-"] { scroll-margin-top: 60px; }
  .page { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600;
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--text); }
  .bottom-nav a.active svg { color: var(--accent); }
  .editor-mode .bottom-nav { display: none; }
  .editor-mode .page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
}

/* ---- controls ------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--panel-2); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none; user-select: none; touch-action: manipulation;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 0; width: 38px; }
.btn.icon.small { width: 30px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

input[type=text], input[type=number], input[type=url], input[type=search], input[type=datetime-local],
input[type=time], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-2); outline: none;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--focus); }
input[type=number] { font-family: var(--mono); }
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239aa1b2' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input.inline-name { background: transparent; border-color: transparent; font-size: 18px; font-weight: 700; padding-left: 6px; min-width: 0; }
input.inline-name:hover { border-color: var(--border); }
input.inline-name:focus { background: var(--bg); }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--border-2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--border-2); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--text);
  border: 3px solid var(--accent); margin-top: -8px;
}
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field-label { font-size: 13px; color: var(--muted); font-weight: 550; display: flex; justify-content: space-between; gap: 8px; }
.field .help { font-size: 12px; color: var(--faint); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 24px; border-radius: 12px; background: var(--border-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus); }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--panel-3); color: var(--text); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; }

.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type=color] { width: 38px; height: 38px; border: 1px solid var(--border-2); border-radius: 8px; padding: 2px; background: var(--bg); cursor: pointer; flex: none; }
.color-input input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-input input[type=text] { font-family: var(--mono); text-transform: lowercase; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip svg { width: 13px; height: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
button.chip { border: 1px solid transparent; cursor: pointer; padding: 6px 12px; font-size: 13px; }
button.chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

/* ---- cards ---------------------------------------------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-title h2 { flex: 1; }
.section { margin-top: 26px; }
.section > h3 { margin-bottom: 10px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.scene-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.scene-card .thumb { aspect-ratio: 2 / 1; background: #000; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; min-height: 0; }
.scene-card .thumb img { max-height: 100%; }
.scene-card .thumb.portrait { aspect-ratio: 2 / 1; }
.scene-card .thumb img { image-rendering: pixelated; max-width: 100%; max-height: 100%; height: 100%; }
.scene-card .thumb.portrait img { height: 100%; width: auto; }
.scene-card .meta { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.scene-card .meta .name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.scene-card .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.scene-card.mismatch .thumb { opacity: 0.45; }
.scene-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.scene-card .check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; }
.scene-card.selected .check { background: var(--accent); border-color: var(--accent); }
.scene-card .check svg { width: 14px; height: 14px; }

.pixelated { image-rendering: pixelated; }
.led-thumb { background: #000; border-radius: 6px; image-rendering: pixelated; display: block; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .thumb-sm { width: 64px; height: 32px; background: #000; border-radius: 4px; image-rendering: pixelated; flex: none; object-fit: contain; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius); }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 8px; }
.empty .btn svg { width: 18px; height: 18px; color: inherit; margin-bottom: 0; }   /* the big picture is the page's, not the button's */
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 0 16px; }

/* ---- LED view ------------------------------------------------------------------------------- */
.led-wrap { position: relative; width: 100%; --bezel: 10px; }
.led-wrap.bare .led-frame { padding: 0; border-color: transparent; border-radius: 3px; box-shadow: none; background: #000; }
.led-wrap.bare .led-frame .overlay, .led-wrap.bare .led-offline { inset: 0; }
.led-frame { position: relative; background: #050506; border-radius: 10px; padding: 10px; border: 1px solid #23252d; box-shadow: inset 0 0 0 1px #000, 0 8px 30px rgba(0,0,0,.4); }
.led-frame canvas { display: block; width: 100%; height: auto; border-radius: 3px; }
.led-frame.portrait { max-width: 320px; margin: 0 auto; }
.led-frame .overlay { position: absolute; inset: 10px; }
.led-toolbar { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.led-offline { position: absolute; inset: 10px; display: flex; align-items: center; justify-content: center; color: #9aa1b2; font-size: 13px; background: rgba(5,5,6,.7); border-radius: 4px; }
.actual-size .led-frame { width: max-content; }
.led-wrap.led-full { max-width: none !important; margin: 0; }
.led-full { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.led-full { --bezel: clamp(8px, 1.6vmin, 22px); }
.led-full .led-frame, .led-full .led-frame.portrait { max-width: none; margin: 0; padding: var(--bezel); border-radius: calc(var(--bezel) * 1.2); box-shadow: inset 0 0 0 1px #000, 0 0 60px rgba(0,0,0,.6); }
.led-full.bare .led-frame, .led-full.bare .led-frame.portrait { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.led-full.bare .led-frame canvas { border-radius: 0; }
.led-full-bar { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 6px; cursor: default; }
.led-full-bar > .btn { color: #fff; opacity: .55; background: rgba(255,255,255,.08); }
.led-full-bar > .btn:hover, .led-full-bar > .btn.on { opacity: 1; }
.led-look-menu { --bg: #0d0e12; --panel-3: #2a2e3a; --knob: #fff; position: absolute; top: calc(100% + 8px); right: 0; background: #181a21; color: var(--text); border: 1px solid var(--border-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; width: max-content; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.look-switches { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.led-look-menu .look-switches { flex-direction: column; }

/* ---- now playing ---------------------------------------------------------------------------- */
.now-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); grid-template-areas: "led side" "show side"; gap: 18px; align-items: start; }
.now-led { grid-area: led; }
.now-side { grid-area: side; }
.now-show { grid-area: show; }
.now-show > h3 { margin-bottom: 10px; }
@media (max-width: 980px) { .now-grid { grid-template-columns: 1fr; grid-template-areas: "led" "side" "show"; } }
.now-title { font-size: 20px; font-weight: 700; }
.progress { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s linear; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }   /* room for a name beside ✎ and ⋯ */
@media (max-width: 520px) { .quick-grid { grid-template-columns: repeat(2, 1fr); } }
.quick { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; }
.quick:hover { border-color: var(--border-2); }
.quick.playing { border-color: var(--accent); }
.quick img { width: 100%; aspect-ratio: 2/1; object-fit: contain; background: #000; image-rendering: pixelated; display: block; }
.quick { position: relative; }
.quick-meta { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; }
.quick-meta > span:first-child { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-meta .btn { flex: none; color: var(--faint); }
.quick-meta .btn:hover { color: var(--text); }
.chip.tiny { padding: 1px 6px; font-size: 10px; }

/* ---- modal / sheet -------------------------------------------------------------------------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: pop .18s ease-out; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.modal-head h2 { flex: 1; font-size: 17px; }
.modal-body { padding: 4px 18px 18px; overflow: auto; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
@media (max-width: 820px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; max-height: 88dvh; padding-bottom: env(safe-area-inset-bottom); animation: slideup .22s ease-out; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

.action-list { display: flex; flex-direction: column; gap: 6px; }
.action-list .btn { justify-content: flex-start; min-height: 46px; }
/* "Start from a layout": each layout as a small picture of the panel, its name under it (U-069). */
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.layout-grid.portrait { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.layout-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; min-width: 0; text-align: left; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font: inherit;
}
.layout-tile:hover { border-color: var(--border-2); }
.layout-tile:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.layout-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.layout-pic {
  aspect-ratio: 2 / 1; background: #000; border-radius: 7px; overflow: hidden; color: #5b6072;
  display: flex; align-items: center; justify-content: center;
}
.layout-grid.portrait .layout-pic { aspect-ratio: 1 / 2; }
.layout-pic img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.layout-pic svg { width: 22px; height: 22px; }
.layout-name { font-size: 13px; font-weight: 600; line-height: 1.25; padding: 0 2px; overflow-wrap: break-word; }

.type-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-card { text-align: left; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.type-card:hover { border-color: var(--accent); }
.type-card svg { width: 26px; height: 26px; color: var(--accent); }
.type-card b { font-size: 15px; }
.type-card span { font-size: 13px; color: var(--muted); }

.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 820px) { .toasts { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); } }
.toast { background: var(--panel-3); border: 1px solid var(--border-2); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: pop .15s; }
.toast.error { border-color: var(--danger); }

/* ---- editors -------------------------------------------------------------------------------- */
.editor-head { position: sticky; top: 0; z-index: 30; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.editor-head .save-state { font-size: 12px; color: var(--faint); white-space: nowrap; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; align-items: start; }
.editor .side-panel { display: flex; flex-direction: column; gap: 14px; }
.editor .stage { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 980px) {
  .editor { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 32px; gap: 14px; }
  .editor .stage { top: 58px; z-index: 20; background: var(--bg); padding-bottom: 8px; }
  .editor .stage.no-stick { position: static; }
}

.gadget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.gadget-tile { padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer; overflow: hidden; text-align: left; }
.gadget-tile img { display: block; width: 100%; aspect-ratio: 2/1; background: #000; image-rendering: pixelated; object-fit: contain; }
.gadget-tile > span { display: block; padding: 6px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gadget-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
.palette-opt { height: 30px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; position: relative; }
.palette-opt.on { border-color: var(--text); }
.palette-opt span { position: absolute; left: 6px; bottom: 2px; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }

.dropzone { border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 30px 16px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 36px; height: 36px; color: var(--accent); }
.dropzone b { display: block; color: var(--text); margin: 6px 0 2px; }

.crop-picker { position: relative; border-radius: 8px; overflow: hidden; background: #000; touch-action: none; cursor: crosshair; user-select: none; }
.crop-picker img { display: block; width: 100%; height: auto; opacity: 0.55; pointer-events: none; }
.crop-picker .crop { position: absolute; border: 2px solid var(--accent-2); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }

/* widget layout overlay */
.wbox { position: absolute; border: 1px dashed rgba(255,255,255,.35); cursor: move; touch-action: none; }
.wbox.sel { border: 1.5px solid var(--accent-2); background: var(--accent-2-soft); z-index: 2; }
.wbox .wlabel { position: absolute; left: -1px; bottom: 100%; display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 1px 2px 1px 5px; background: var(--accent-2); color: var(--on-accent-2); border-radius: 4px 4px 0 0; white-space: nowrap; pointer-events: none; }
/* the trash can on the selected box's name tab (U-058) */
.wbox .wdel { pointer-events: auto; display: grid; place-items: center; width: 22px; height: 20px; padding: 0; border: 0; border-radius: 3px; background: none; color: inherit; cursor: pointer; }
.wbox .wdel:hover, .wbox .wdel:focus-visible { background: rgba(0, 0, 0, .25); }
.wbox .wdel svg { width: 13px; height: 13px; }
@media (pointer: coarse) { .wbox .wdel { width: 34px; height: 30px; } .wbox .wdel svg { width: 16px; height: 16px; } }
.wbox:not(.sel) .wlabel { display: none; }
.wbox.right .wlabel { left: auto; right: -1px; }                 /* a box on the right: its name tab stays on the preview */
.wbox .handle { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-2); border: 2px solid #000; cursor: nwse-resize; touch-action: none; }
.wbox:not(.sel) .handle { display: none; }
.widget-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.widget-row:hover { background: var(--panel-2); }
.widget-row.on { background: var(--accent-soft); border-color: var(--accent); }
.widget-row .wname { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.widget-row .wfade { font-size: 11px; font-weight: 700; color: var(--accent-2); border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; }
.widget-row .wdim { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* canvas editor */
.paint { display: grid; grid-template-columns: 52px minmax(0, 1fr) 300px; gap: 14px; padding: 14px 16px 30px; align-items: start; max-width: 1500px; margin: 0 auto; }
.toolbar-v { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 72px; }
.tool { width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.tool svg { width: 22px; height: 22px; }
.tool:hover { background: var(--panel-2); color: var(--text); }
.tool.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.tool .kbd { position: absolute; right: 3px; bottom: 1px; font-size: 9px; color: var(--faint); font-family: var(--mono); }
.tool-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.paint-stage { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.paint-scroll { overflow: auto; background: repeating-conic-gradient(var(--check-a) 0% 25%, var(--check-b) 0% 50%) 50% / 20px 20px; border-radius: 10px; border: 1px solid var(--border); position: relative; max-height: calc(100dvh - 260px); display: grid; place-items: center; min-height: 200px; }
.paint-scroll canvas { display: block; touch-action: none; image-rendering: pixelated; margin: 16px; }
.paint-side { display: flex; flex-direction: column; gap: 14px; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.swatch { aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(255,255,255,.12); cursor: pointer; padding: 0; }
.swatch.on { outline: 2px solid var(--text); outline-offset: 1px; }
.cur-colors { display: flex; align-items: center; gap: 10px; }
.cur-color { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--border-2); position: relative; overflow: hidden; }
.cur-color input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); cursor: pointer; opacity: 0; }
.layer-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.layer-row.on { background: var(--accent-soft); border-color: var(--accent); }
.layer-row canvas { width: 48px; height: 24px; background: #000; border-radius: 3px; image-rendering: pixelated; flex: none; }
.layer-row.portrait canvas { width: 16px; height: 32px; }
.layer-row .lname { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; background: transparent; border: 0; padding: 2px 4px; min-height: 0; }
.frames { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; }
.frame-thumb { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.frame-thumb.on { border-color: var(--accent); }
.frame-thumb canvas { width: 64px; height: 32px; background: #000; image-rendering: pixelated; border-radius: 3px; }
.frame-thumb.portrait canvas { width: 24px; height: 48px; }
.frame-thumb span { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.mobile-tools { display: none; }
@media (max-width: 1100px) { .paint { grid-template-columns: 52px minmax(0, 1fr); } .paint-side { grid-column: 1 / -1; } }
@media (max-width: 820px) {
  .paint { grid-template-columns: 1fr; padding: 10px 10px 30px; gap: 10px; }
  .toolbar-v { display: none; }
  .mobile-tools { display: flex; gap: 4px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
  .mobile-tools .tool { flex: none; width: 42px; height: 42px; }
  .paint-scroll { max-height: 56dvh; }
  .paint-scroll canvas { margin: 10px; }
}

/* schedule */
.week { display: grid; grid-template-columns: 38px 1fr; gap: 4px 8px; align-items: center; }
.week .day { font-size: 12px; color: var(--muted); font-weight: 600; }
.week .bar { position: relative; height: 22px; background: var(--bg); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.week .seg-block { position: absolute; top: 0; bottom: 0; border-radius: 3px; opacity: .85; }
.week .now-line { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); box-shadow: 0 0 6px var(--text); }
.week .hours { grid-column: 2; display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); font-family: var(--mono); }
.days-pick { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.days-pick .dbtn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--bg); color: var(--muted); font-weight: 700; font-size: 12px; cursor: pointer; padding: 0; }
.days-pick .dbtn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rule-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.orient-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.orient-opt { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.orient-opt.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.orient-opt .pv { background: #000; border-radius: 4px; border: 2px solid #444; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: var(--accent-2); }
.orient-opt.on .pv { border-color: var(--accent); }

details.adv > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
details.adv > summary::before { content: "▸"; transition: transform .15s; }
details.adv[open] > summary::before { transform: rotate(90deg); }
details.adv > .stack { margin-top: 12px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
h1 svg, h2 svg, h3 svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; color: var(--muted); }

.dur-input { width: 92px; flex: none; }
@media (max-width: 520px) {
  .hide-xs { display: none; }
  .dur-input { width: 64px; }
  .list-item { gap: 8px; padding: 10px 8px; flex-wrap: wrap; }
  .list-item .grow { flex-basis: calc(100% - 80px); }
  .list-item .thumb-sm { width: 56px; height: 28px; }
}
.mic-dot svg { width: 11px; height: 11px; vertical-align: -1px; color: var(--accent-2); }
.meter { display: flex; align-items: flex-end; gap: 2px; height: 48px; padding: 6px; background: #000; border-radius: 8px; }
.meter div { flex: 1; background: linear-gradient(0deg, var(--accent), var(--accent-2)); border-radius: 2px 2px 0 0; min-height: 1px; transition: height .08s linear; }
.level { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.level > div { height: 100%; background: var(--ok); transition: width .08s linear; }
.beat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--panel-3); flex: none; transition: background .1s; }
.beat-dot.on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.sound-hint { align-items: flex-start; }
.sound-hint > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-2); }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-pick button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-2); background: #000; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); padding: 0; }
.icon-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.needs { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.need-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.need-row svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.need-label { color: var(--muted); font-weight: 600; width: 84px; flex: none; }
.need-state { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.need-state.warn { color: var(--warn); }
.need-note { display: flex; gap: 6px; align-items: baseline; margin-top: 4px; }
.need-note svg { width: 12px; height: 12px; flex: none; color: var(--accent-2); }
.tilt-live { display: flex; gap: 14px; align-items: center; }
.tilt-pad { position: relative; width: 120px; height: 120px; flex: none; border-radius: 50%; background: radial-gradient(circle, #10141c 0%, #05070a 70%); border: 1px solid var(--border-2); touch-action: none; }
.tilt-pad.editable { cursor: grab; border-color: var(--accent-2); }
.tilt-ring { position: absolute; inset: 35%; border-radius: 50%; border: 1px dashed var(--border-2); }
.tilt-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: left .08s, top .08s; }
.tilt-down { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--faint); pointer-events: none; }
@media (max-width: 520px) { .tilt-live { flex-direction: column; align-items: flex-start; } }

/* collapsible sections */
.section-head { gap: 8px; }
.section-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; flex: 1; min-width: 0; text-align: left; }
.section-toggle .chev svg { width: 16px; height: 16px; color: var(--faint); margin: 0; }
.section-card.closed { gap: 0; }
.paste-target { margin-top: 10px; max-width: 360px; font-size: 13px; text-align: center; background: var(--panel); }

/* wide editor: landscape scenes put the preview across the top and settings in columns underneath */
@media (min-width: 981px) {
  .editor.wide { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .editor.wide .stage { position: sticky; top: 58px; z-index: 20; background: var(--bg); padding: 8px 0 10px; }
  .editor.wide .stage .led-wrap { max-width: min(100%, calc(44vh * 2 + 22px)); margin: 0 auto; }
  .editor.wide .stage > .row { justify-content: center; }
  .editor.wide .side-panel { display: block; column-width: 330px; column-gap: 16px; }
  .editor.wide .side-panel > * { break-inside: avoid; margin-bottom: 16px; }
}
.scene-card.clickable { cursor: pointer; }
.scene-card.clickable:hover { border-color: var(--border-2); }
.scene-card.clickable:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* widget editor modes */
.mode-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.boxes.locked .wbox { cursor: pointer; touch-action: auto; border-style: dotted; border-color: rgba(255,255,255,.18); }
.boxes.locked .wbox.sel { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.boxes.locked .wbox .handle { display: none; }
.boxes.locked .wbox .wlabel { background: var(--accent); color: var(--on-accent); }
.photo-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.photo { position: relative; width: 84px; height: 56px; border-radius: 6px; overflow: hidden; background: #000; border: 1px solid var(--border-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.55); }
.photo-tools .btn { min-height: 22px; width: 24px; }
.photo.add { display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; border-style: dashed; }
.photo.add svg { width: 22px; height: 22px; }
.mic-pill { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px;
  background: var(--panel-3); border: 1px solid var(--accent); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.mic-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* About: address, version and updates (F-037) */
.spinner { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.update-run { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; font-weight: 550; }
.update-note { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.update-note.bad { color: var(--danger); }
.update-note svg { width: 15px; height: 15px; flex: none; }
.about-row { min-height: 30px; }
.about-row a { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* First-run welcome (F-037) */
.welcome { gap: 20px; }
.welcome h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 14px; }
.welcome .orient-opts { grid-template-columns: repeat(2, 1fr); }
.welcome-place { padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); }
.welcome-place svg, .welcome-tip svg { width: 15px; height: 15px; vertical-align: -2px; }
@media (max-width: 820px) { .mic-pill { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); } }
.secure-hint { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); border: 1px solid var(--warn); }
.secure-hint svg { width: 16px; height: 16px; flex: none; color: var(--warn); margin-top: 2px; }
.device-mic { padding: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.caption-preview { background: #000; color: var(--text); border-radius: 8px; padding: 8px 10px; min-height: 40px; font-family: var(--mono); }
.caption-preview .partial { color: var(--warn); }
.ok-text { color: var(--ok); }
.browse-all { align-self: flex-start; }
@media (max-width: 520px) { .browse-all { align-self: stretch; justify-content: center; } }
@media (max-width: 520px) {
  .show-recent .quick-grid, .show-mine .quick-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 40%;
    overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .show-recent .quick-grid::-webkit-scrollbar, .show-mine .quick-grid::-webkit-scrollbar { display: none; }
  .show-recent .quick, .show-mine .quick { scroll-snap-align: start; }
}
/* A portrait preview at full phone width is two screens tall; keep it to ~40% of the screen on Display. */
@media (max-width: 820px) { .now-led .led-frame.portrait { max-width: min(320px, calc(20vh + 20px)); } }

/* one shape for every editor: preview on the left, one settings column on the right (U-011) */
.settings-card h2 { margin: 0; min-width: 0; }
.settings-foot { gap: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.more-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.more-toggle svg { width: 14px; height: 14px; }
.more-toggle:hover { color: var(--text); }
.widget-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.widget-chips .chip { cursor: pointer; border: 1px solid transparent; font-size: 13px; padding: 5px 10px; }
.widget-chips .chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.editor-head .inline-name { min-width: 0; }
@media (min-width: 981px) {
  .editor.wide { grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; }
  .editor.wide .stage { position: sticky; top: 72px; padding: 0; background: none; }
  .editor.wide .stage .led-wrap { max-width: none; }
  .editor.wide .side-panel { display: flex; flex-direction: column; gap: 14px; column-width: auto; }
  .editor.wide .side-panel > * { margin-bottom: 0; }
}
/* editing settings (not arranging): boxes are just tap targets; only the selected one gets a quiet outline */
.boxes.locked .wbox { border-color: transparent; background: none; }
.boxes.locked .wbox .wlabel, .boxes.locked .wbox .handle { display: none; }
.boxes.locked .wbox.sel { border: 1px solid rgba(255, 255, 255, 0.55); }
.scene-card .meta { display: flex; align-items: center; gap: 6px; }
.scene-card .type-icon { color: var(--faint); display: inline-flex; }
.scene-card .type-icon svg { width: 14px; height: 14px; }

/* ---- Display (U-016): now-showing card, one chooser, extras last ----------------------------- */
.display-page { max-width: 1100px; }
.power-toggle { display: flex; align-items: center; gap: 8px; }
.power-toggle svg { width: 16px; height: 16px; color: var(--muted); }
.now-card { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; align-items: start; margin-bottom: 22px; }
.now-card .now-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
/* Under the picture: what belongs to the picture itself (how bright, the info bar, how big to look at it), so the
   column beside it is free for the screen's name and its own settings. */
.now-under { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.now-bright { display: flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 0; margin: 0; color: var(--muted); }
.now-bright svg { width: 16px; height: 16px; flex: none; }
.now-bright input { flex: 1; min-width: 60px; }
.now-bright .mono { font-size: 12px; min-width: 4ch; text-align: right; }
.now-under .overlay-switch { gap: 6px; flex: none; }
.now-view { display: flex; gap: 2px; flex: none; margin-left: auto; }
.now-preview > .help { margin-top: 6px; }
.now-led canvas { filter: brightness(var(--dim, 1)); }
.now-card .device-mic-row svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.now-card .divider { margin: 2px 0; }
@media (max-width: 760px) { .now-card { grid-template-columns: 1fr; gap: 12px; } }
.now-preview .led-frame.portrait { max-width: min(240px, calc(22vh + 20px)); }
.chooser { margin-bottom: 22px; }
.chooser-head { display: flex; align-items: center; gap: 12px; }
.chooser-head h2 { flex: 1; margin: 0; font-size: 18px; }
.chooser-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--panel-3); color: var(--text); }
.chooser-search { flex: 1; min-width: 140px; max-width: 260px; margin-left: auto; }
@media (max-width: 520px) {
  .chooser-bar .tabs { width: 100%; }
  .chooser-bar .tab { flex: 1; padding: 7px 6px; font-size: 13px; }
  .chooser-search { max-width: none; margin-left: 0; }
}
.quick { position: relative; }
.quick .playing-badge { position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700;
  background: var(--accent); color: var(--on-accent); padding: 2px 7px 2px 5px; border-radius: 999px; }
.quick .playing-badge svg { width: 10px; height: 10px; }
.quick-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.quick-kind { font-size: 11px; font-weight: 500; color: var(--faint); }
.now-extras { max-width: 100%; }
.toast { display: flex; align-items: center; gap: 14px; pointer-events: auto; }   /* the host lets clicks through; Undo needs them */
.toast-action { background: none; border: 0; color: var(--accent-2); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.scene-card .card-trash { flex: none; color: var(--faint); margin: -4px -6px -4px 0; }
.scene-card .card-trash:hover { color: var(--danger); }
.library-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.library-filters { flex: 1; min-width: 0; }
.library-search { max-width: 240px; }
@media (max-width: 520px) {
  .library-filters { flex-wrap: nowrap; overflow-x: auto; flex-basis: 100%; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .library-filters::-webkit-scrollbar { display: none; }
  .library-search { max-width: none; flex-basis: 100%; }
}
@media (max-width: 520px) {
  .cat-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .cat-chips::-webkit-scrollbar { display: none; }
}
.display-page .page-head h1 { flex: 1; }
.rotate-btn { gap: 5px; }
.rotate-btn svg { width: 15px; height: 15px; }
@media (max-width: 350px) { .rotate-btn span { display: none; } }
@media (max-width: 420px) { .power-toggle .small { display: none; } }
@media (min-width: 821px) { .only-sm { display: none !important; } }   /* a shorter label for narrow screens */
/* four choices don't fit one row on a phone: two rows of two, not three and a stray */
@media (max-width: 520px) {
  .mute-seg { width: 100%; }
  .mute-seg .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .mute-seg .seg button { justify-content: center; }
}

/* Screen creator palette (U-019) */
.add-panel .tabs { padding: 2px; }
.add-panel .tab { padding: 5px 10px; font-size: 13px; }
.add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.add-tile { display: flex; flex-direction: column; gap: 4px; padding: 0 0 6px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; overflow: hidden; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: grab; text-align: left; }
.add-tile:hover { border-color: var(--accent-2); }
.add-tile img, .add-tile .add-tile-blank { width: 100%; aspect-ratio: 2/1; object-fit: contain; background: #000; image-rendering: pixelated; display: flex;
  align-items: center; justify-content: center; color: var(--faint); }
.add-tile .add-tile-blank svg { width: 22px; height: 22px; flex: none; }   /* or the plus grows and the tile with it */
.add-tile > span:last-child { padding: 0 7px; }
.drop-target { position: relative; }

/* Diagnostics (F-024) */
.diagnostics .chip.bad { background: var(--danger-soft); color: var(--danger); }
.diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 16px 0; }
.diagnostics h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.diagnostics h2 svg { width: 18px; height: 18px; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; margin-top: 6px; }
.check.warn .dot { background: var(--warn); }
.check.bad .dot { background: var(--danger); }
.metric .big { display: block; }
.kv { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.kv:last-child { border-bottom: 0; }
.kv .mono { text-align: right; overflow-wrap: anywhere; }
.big { font-size: 26px; font-weight: 700; min-width: 80px; }
.spark { flex: 1; height: 40px; max-width: 220px; }
.bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.bar > div { height: 100%; background: var(--accent-2); }
.bar.warn > div { background: var(--warn); }
.bar.bad > div { background: var(--danger); }
.cores { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.core { display: flex; flex-direction: column; gap: 4px; }
pre.log { margin: 0; max-height: 360px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-warning { color: var(--warn); }
.log-error, .log-critical { color: var(--danger); }
.danger-text { color: var(--danger); }
.save-state { color: var(--faint); transition: color .2s; }
.save-state.saving { color: var(--muted); }
.save-state.saved { color: var(--ok); }

/* Settings groups (U-003) */
.settings-groups { gap: 28px; }
/* Group headings are the page's landmarks (U-034): large, and the current one stays pinned while its cards scroll by. */
.settings-group > .group-title { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--text); background: var(--bg);
  margin: 0 -4px; padding: 10px 4px; border-bottom: 2px solid var(--border-2); }
.settings-group > .group-title::before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: var(--accent); }
@media (max-width: 820px) {
  .settings-group > .group-title { top: 45px; font-size: 18px; margin: 0 -16px; padding: 8px 16px; }   /* under the jump chips */
}
.clip-crop { gap: 10px; } .clip-crop input { flex: 1; }
.multi-pick .chip { border: 1px solid transparent; cursor: pointer; padding: 5px 11px; font-size: 13px; }
.multi-pick .chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

/* Built-in browser shelves (U-025) */
.shelf { margin-top: 6px; }
.shelf-head { display: flex; align-items: center; gap: 2px; }
.shelf-head h3 { font-size: 14px; display: flex; align-items: center; gap: 6px; margin: 0; }
.shelf-head h3 svg { width: 15px; height: 15px; color: var(--warn); }
.shelf-count { font-size: 12px; font-weight: 600; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-padding: 0 2px; padding-bottom: 6px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.shelf-row > * { scroll-snap-align: start; }
.see-all { color: var(--accent-2); }
@media (hover: none) { .shelf-arrow { display: none; } }
@media (max-width: 520px) { .shelf-row { grid-auto-columns: 42%; } }
.chip-count { margin-left: 6px; font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
/* Favorite star on the thumbnail's corner: shown when starred, on hover/focus, and faintly on touch screens. */
.quick > .fav { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; opacity: 0;
  transition: opacity .12s; }
.quick > .fav svg { width: 16px; height: 16px; }
.quick > .fav.on { opacity: 1; color: #ffb020; }   /* on the black thumbnail in either theme */
.quick:hover > .fav, .quick:focus-within > .fav { opacity: 1; }
@media (hover: none) { .quick > .fav:not(.on) { opacity: .7; } }
/* Built-ins by kind (U-060): a card per category instead of a shelf per category. */
.browse-title { font-size: 14px; margin: 8px 0 0; display: flex; align-items: baseline; gap: 8px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-width: 0; transition: border-color .12s, transform .12s; }
.cat-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.cat-card:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.cat-card img { width: 92px; aspect-ratio: 2/1; object-fit: contain; background: #000; image-rendering: pixelated; border-radius: 7px; flex: none; }
.cat-card-name { font-weight: 650; font-size: 15px; min-width: 0; flex: 1; }
.cat-card > svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
@media (max-width: 520px) { .cat-grid { grid-template-columns: 1fr; } .cat-card img { width: 80px; } }
/* Quick settings (U-061) */
.quick-settings { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.quick-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.quick-settings-head svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
.quick-settings .quick-reset { color: var(--accent-2); padding: 3px 8px; }
/* A quick setting's color is a swatch to tap; its code is in the picker that opens, not beside it. */
.quick-settings .color-input input[type="text"] { display: none; }
.quick-settings .color-input input[type="color"] { width: 100%; max-width: 120px; }
.quick-settings .stack { gap: 10px; }

/* Info bar settings (F-036, U-055) */
.overlay-preview { max-width: 360px; }
.overlay-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 6px; display: flex; align-items: center; gap: 8px; min-height: 40px; }
.overlay-item input[type=text] { flex: 1; min-width: 0; }
.overlay-colors { gap: 18px; }
.overlay-colors label { gap: 6px; }
.overlay-add .chip svg { width: 14px; height: 14px; }

/* ---- Skin (U-026): light and dark, accent colors, the now-playing bar ------------------------------- */
.card, .scene-card, .quick { box-shadow: var(--card-shadow); }
.quick, .scene-card.clickable { transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
@media (hover: hover) {
  .quick:hover, .scene-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--lift); }
}
/* One focus ring everywhere, for keyboards only. */
:where(a, button, summary, [role="tab"], [role="radio"], [tabindex]):focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
:root[data-theme="light"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23586072' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::selection { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Sidebar foot: the health light and the theme button share a row. */
.side-foot { display: flex; align-items: center; gap: 4px; }
.side-foot .status-mini { flex: 1; min-width: 0; }
.theme-btn { flex: none; color: var(--faint); }
.theme-btn:hover { color: var(--text); }
.nav-link { position: relative; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }

/* Accent color swatches (Settings > Appearance on this device). */
.accent-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.accent-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--panel); background: var(--dot); cursor: pointer; padding: 0;
  box-shadow: 0 0 0 1px var(--border-2); transition: transform .12s ease; }
.accent-dot:hover { transform: scale(1.08); }
.accent-dot.on { box-shadow: 0 0 0 2px var(--text); }

/* The now-playing bar: a floating strip with what the panel shows, on every page but Display and the editors. */
.nowbar {
  position: fixed; z-index: 45; bottom: 18px; left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); transform: translateX(-50%);
  width: min(600px, calc(100vw - var(--side-w) - 48px));
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 18px;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-2); box-shadow: var(--shadow);
}
.nowbar-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; color: inherit; border-radius: 12px; }
.nowbar-led { flex: none; width: 88px; height: 44px; border-radius: 8px; background: #000; overflow: hidden; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset; }
.nowbar-led canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
.nowbar-led.portrait { width: 44px; }
.nowbar.off .nowbar-led canvas { opacity: .25; }
.nowbar-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.nowbar-sub { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowbar-name { font-weight: 650; font-size: 14px; }
.nowbar-bright { display: flex; align-items: center; gap: 6px; width: 132px; flex: none; color: var(--faint); }
.nowbar-bright svg { width: 16px; height: 16px; flex: none; }
.nowbar-power { flex: none; display: inline-flex; }
.nowbar-power .switch { margin: 0; }
.has-nowbar .page { padding-bottom: 104px; }
.has-nowbar .toasts { bottom: 92px; }
.has-nowbar .mic-pill { bottom: 92px; }
@media (max-width: 1100px) { .nowbar-bright { display: none; } }
@media (max-width: 820px) {
  .nowbar { left: 10px; right: 10px; width: auto; transform: none; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); border-radius: 16px; padding-right: 10px; }
  .nowbar-led { width: 72px; height: 36px; }
  .nowbar-led.portrait { width: 36px; }
  .has-nowbar .page { padding-bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
  .has-nowbar .toasts { bottom: calc(var(--nav-h) + 76px + env(safe-area-inset-bottom)); }
  .has-nowbar .mic-pill { bottom: calc(var(--nav-h) + 72px + env(safe-area-inset-bottom)); }
}

/* ---- Library that scales (U-027): sort row, details sheet, hidden built-ins, quick find -------------------- */
.grid-tools { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.grid-tools .grid-count { flex: 1; min-width: 0; }
.sort-pick { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.sort-pick svg { width: 14px; height: 14px; }
.sort-select { width: auto; padding: 3px 24px 3px 8px; font-size: 13px; background-position: right 7px center; border-color: transparent; background-color: transparent; color: var(--muted); }
.sort-select:hover, .sort-select:focus { border-color: var(--border-2); color: var(--text); }

.tile-more svg { width: 16px; height: 16px; }
.quick-meta .btn + .btn { margin-left: -4px; }
.quick.dim img { opacity: .45; }
.quick.dim .quick-name { color: var(--muted); }
.hidden-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; }
.hidden-toggle { color: var(--muted); }
.hidden-toggle .faint { margin-left: 2px; }

.details-led { max-width: 420px; margin: 0 auto; width: 100%; }
.details-led.portrait { max-width: 190px; }
.details-led .led-frame { padding: 8px; }
.details-facts { justify-content: center; }
.details-desc { margin: 0; text-align: center; color: var(--muted); }
.details-show { display: flex; gap: 8px; flex-wrap: wrap; }
.details-show .btn { flex: 1 1 auto; justify-content: center; }
.details-show .btn.primary { flex: 2 1 100%; }
.action-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel-2); }
.action-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--text); font: inherit; font-weight: 550; text-align: left; cursor: pointer; }
.action-row:first-child { border-top: 0; }
.action-row:hover { background: var(--accent-soft); }
.action-row svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.action-row.on svg { color: #ffb020; }
.action-row.danger, .action-row.danger svg { color: var(--danger); }
.action-row.danger:hover { background: var(--danger-soft); }
.playlist-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 12px 44px; border-top: 1px solid var(--border); }

.picker-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.picker-bar .library-search { flex: 1 1 160px; min-width: 0; }
.quick.pick.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.pick-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; }
.pick-check svg { width: 13px; height: 13px; }

@media (max-width: 820px) {
  .playlist-pick { padding-left: 14px; }
}
@media (max-width: 520px) {
  /* Narrow tiles: the name matters more than a second button, and ⋯ opens the sheet that has Edit / Make your own version. */
  .quick-meta .btn:not(.tile-more) { display: none; }
  .action-row .small { display: none; }
}

/* An inline warning inside a card (a schedule rule with nothing to show). */
.note { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel-3); }
.note.warn { background: var(--warn-soft); color: var(--text); }
.note.warn svg { color: var(--warn); width: 16px; height: 16px; flex: none; margin-top: 1px; }
a.chip { text-decoration: none; }
.day-sets { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; }
.day-sets .chip { padding: 4px 10px; font-size: 12px; }

/* Tiles: a long name takes a second line instead of being cut to "Flights ov…" beside ✎ and ⋯. */
.quick-meta > .quick-name { white-space: normal; align-self: stretch; justify-content: center; min-height: 36px; }
.quick-name > .ellipsis { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; letter-spacing: -.01em; }
.quick { display: flex; flex-direction: column; }
.quick-meta { flex: 1; padding-left: 8px; }
.quick-meta .btn.icon.small { width: 26px; min-width: 26px; padding-left: 0; padding-right: 0; }   /* room for a 9-letter name ("Dashboard") on one line */
/* The star is always there (faint until you point at the tile), so "tap ☆" has something to point to. */
.quick > .fav:not(.on) { opacity: .45; }

/* A link under a setting to where you get the key or token it needs (U-046). */
.param-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--accent-2); text-decoration: none; }
.param-link:hover { text-decoration: underline; }
.param-link svg { width: 14px; height: 14px; }
.zone-row { gap: 6px; align-items: center; }
.zone-row .zone-label { width: 64px; flex: none; text-transform: uppercase; font-weight: 600; }
.zone-row .zone-city { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A row that needs a key: its state on the first line, the links (get a key, where to paste it) under it. */
.need-row.with-links { flex-wrap: wrap; }
.need-row.with-links .need-state { white-space: normal; }
.need-links { display: flex; flex-wrap: wrap; gap: 4px 14px; flex-basis: 100%; padding-left: 114px; }
@media (max-width: 480px) { .need-links { padding-left: 22px; } }

/* Messages (F-052): people on the left, the conversation on the right; one column on a phone. */
.count-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; flex: none; font-variant-numeric: tabular-nums; }
.bottom-nav a { position: relative; }
.bottom-nav a .count-badge { position: absolute; top: 4px; left: 50%; margin-left: 6px; }
.waiting-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--accent-soft); border-bottom: 1px solid var(--accent); color: var(--text); }
.waiting-bar > svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.waiting-bar.urgent { background: var(--danger-soft); border-bottom-color: var(--danger); }
.waiting-bar.urgent > svg { color: var(--danger); }
.msg-waiting { gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); }
.messages-page > * + * { margin-top: 16px; }
.msg-layout { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
.msg-people { gap: 4px; min-width: 0; }
.msg-person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-decoration: none; color: var(--text); }
.msg-person:hover { background: var(--panel-2); }
.msg-person.active { background: var(--accent-soft); }
.msg-person.off { opacity: .6; }
.msg-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-3); color: var(--muted); display: flex; align-items: center;
  justify-content: center; font-weight: 700; flex: none; }
.msg-person.active .msg-avatar { background: var(--accent); color: #fff; }
.msg-thread { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.msg-thread-head { gap: 8px; flex-wrap: wrap; }
.msg-back { display: none; }
.msg-pick { min-height: 160px; align-items: center; justify-content: center; }
.msg-manage { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.msg-manage > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.msg-manage[open] > summary { margin-bottom: 10px; }
.msg-log { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; min-height: 120px; overflow-y: auto; padding: 4px 2px; }
.msg-none { margin: auto; text-align: center; max-width: 320px; }
.msg-bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; background: var(--panel-2); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-bubble.out { align-self: flex-end; background: var(--accent-soft); }
/* what someone sent, in the color and with the picture they chose for it (U-066); the picture lit on black, as on the panel */
.msg-bubble.in { border-left: 3px solid var(--sent, transparent); }
.msg-icon { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 5px; background: #0d0e12; vertical-align: -5px; margin-right: 7px; }
.msg-bubble.urgent { border: 1px solid var(--danger); }
.msg-bubble small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.msg-bubble.urgent small b { color: var(--danger); }
.msg-quick { flex-wrap: wrap; }
.chip.static { padding-right: 4px; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 2px; display: inline-flex; border-radius: 50%; }
.chip-x:hover { background: var(--border-2); }
.msg-empty h2 { margin: 0; }
@media (max-width: 760px) {
  .msg-layout { grid-template-columns: minmax(0, 1fr); }
  .msg-layout.has-thread .msg-people { display: none; }
  .msg-back { display: inline-flex; }
  .msg-pick { display: none; }
  .msg-bubble { max-width: 90%; }
  .msg-log { max-height: 52vh; }
}

/* ---- Playlist: the sidebar section, drag handles, the settings page (U-053) ------------------- */
.only-phone { display: none; }
@media (max-width: 820px) { .only-phone { display: flex; } }
/* The twinkle mark beside the Display title on a phone, where the sidebar and its logo are hidden (U-067). */
.brand-mark { display: none; flex: none; width: 28px; height: 28px; border-radius: 7px; }
@media (max-width: 820px) { .brand-mark { display: block; } }
.sort-handle { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 28px; color: var(--faint);
  cursor: grab; touch-action: none; border-radius: 6px; }
.sort-handle svg { width: 16px; height: 16px; }
.sort-handle:hover, .sort-handle:focus-visible { color: var(--text); background: var(--panel-2); }
.sort-handle:active { cursor: grabbing; }
[data-sort-row].dragging { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
p .sort-handle, p svg { vertical-align: middle; }
p > svg { width: 14px; height: 14px; }

.pl-side { border-radius: 10px; margin-top: 2px; }
.pl-side.over { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }
.pl-head { width: 100%; border: 0; background: none; font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.pl-side.active > .pl-head { background: var(--accent-soft); color: var(--text); }
.pl-side.active > .pl-head svg:first-child { color: var(--accent); }
.pl-head .pl-chev { display: inline-flex; transition: transform .15s; transform: rotate(-90deg); }
.pl-head .pl-chev.open { transform: none; }
.pl-head .pl-chev svg { width: 14px; height: 14px; }
.pl-head .pl-count { font-size: 11px; color: var(--faint); font-weight: 600; }
.pl-head .pl-live { display: inline-flex; color: var(--accent); }
.pl-head .pl-live svg { width: 12px; height: 12px; }
.pl-body { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 8px; }
.pl-panel { display: flex; flex-direction: column; gap: 8px; }
.pl-pick { width: 100%; font-size: 13px; padding: 5px 8px; }
.pl-items { display: flex; flex-direction: column; }
.pl-item { display: flex; align-items: center; gap: 6px; padding: 2px 2px 2px 0; border-radius: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.pl-item:hover { background: var(--panel-2); color: var(--text); }
.pl-item.on { color: var(--text); font-weight: 600; }
.pl-item.off > img, .pl-item.off > .ellipsis { opacity: .45; }
.pl-item img, .pl-item .pl-thumb { width: 32px; height: 16px; flex: none; background: #000; border-radius: 3px; object-fit: contain; image-rendering: pixelated; }
.pl-item .pl-x { opacity: 0; width: 24px; height: 24px; flex: none; }
.pl-item:hover .pl-x, .pl-item .pl-x:focus-visible, .pl-panel .pl-x { opacity: 1; }
.pl-drop { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; font-size: 12px; color: var(--faint); text-align: center; line-height: 1.35; }
.pl-drop.more { padding: 5px 10px; }
.pl-side.over .pl-drop { border-color: var(--accent); color: var(--text); }
.pl-panel .pl-drop { border: 0; padding: 0; text-align: left; font-size: 13px; color: var(--muted); }
.pl-panel .pl-item { font-size: 14px; padding: 4px 0; }
.pl-panel .pl-item img { width: 48px; height: 24px; }
.pl-panel .sort-handle { width: 32px; height: 36px; }
.pl-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quick[draggable="true"], .scene-card[draggable="true"] { -webkit-user-drag: element; }
.playlist-page .pl-status { margin: 0 0 14px; }
.playlist-page > .card { margin-top: 16px; }
.playlist-page .list-item { gap: 10px; }
@media (max-width: 820px) {
  .playlist-page .list-item { flex-wrap: nowrap; gap: 6px; }
  .playlist-page .list-item .grow { flex-basis: auto; min-width: 0; }
  .playlist-page .sort-handle { width: 28px; height: 40px; }
}
.pl-side .pl-actions { gap: 4px; flex-wrap: nowrap; }
.pl-side .pl-actions .btn { padding-left: 8px; padding-right: 8px; gap: 5px; }
.playlist-page .field-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 820px) { .playlist-page .dur-input { width: 76px; } }
.pl-side .pl-actions a.btn:not(.icon) svg { display: none; }

/* Settings → Calendars (F-003) */
.cal-list { border: 1px solid var(--border); border-radius: 10px; }
.cal-color { width: 32px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.cal-color::-webkit-color-swatch-wrapper { padding: 6px; }
.cal-color::-webkit-color-swatch { border: 1px solid var(--border-2); border-radius: 50%; }
.cal-color::-moz-color-swatch { border: 1px solid var(--border-2); border-radius: 50%; }
.cal-state { overflow-wrap: anywhere; }
.cal-add .row > input.grow { flex: 1 1 260px; width: auto; min-width: 0; }
.cal-add .row > input.cal-name { flex: 0 0 170px; width: 170px; }
.cal-howto ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.cal-howto p { margin: 8px 0 0; }
@media (max-width: 520px) {
  .cal-item .grow { flex-basis: calc(100% - 48px); }
  .cal-item .switch { margin-left: 40px; margin-right: auto; }
  .cal-add .row > input.grow, .cal-add .row > input.cal-name { flex: 1 1 100%; width: 100%; }
}
