/* =====================================================
   MiloCam - Professional screen (tickets 04-07)
   Follows the "Sessie · professional" board of the design canvas,
   hybrid layout. Positions come from js/pro-layout.js.
   ===================================================== */

.ps {
  --ps-bg: #0d0a12;
  --ps-panel: #15111d;
  --ps-card: #1c1626;
  --ps-btn: #2a2038;
  --ps-btn-hover: #3a2d4d;
  --ps-text: #f5f0ff;
  --ps-text-2: rgba(245, 240, 255, 0.75);
  --ps-muted: #a597b5;
  --ps-line: rgba(150, 100, 180, 0.24); /* dividers and buttons inside a block */
  --ps-edge: var(--edge-block, #806f96); /* the edge of a block: rails, bar, panel, cards, popovers */
  --ps-control-edge: #806f96; /* slider tracks and the speed list: at least 3.5:1 */
  --ps-brand: linear-gradient(135deg, #c8005f 0%, #d60067 100%);
  --ps-magenta: #e8006f;
  --ps-yellow: #ffd600;
  --ps-danger: var(--red, #ff4757);
  --ps-danger-soft: var(--red-soft, #ff8a95); /* red text and icons on the dark surface */
  --ps-record: #d9263a; /* the record button: white text on it reaches 4.5:1 */
  --ps-bar-bg: rgba(21, 17, 29, 0.88);
  --ps-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  font-family: Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.4;
  color: var(--ps-text);
  display: none;
}

body.role-client .ps { display: block; }

/* The old toolbar and status UI never show on the professional screen. */
body.role-client .app > .controls,
body.role-client #sessionInfo { display: none !important; }

/* Backdrop behind the frame: the same as the lobby and the setup (--backdrop in styles.css) */
body.role-client .app {
  background: var(--backdrop);
  display: block;
}

/* The stage becomes the frame: the child screen 1:1 */
body.role-client #stage {
  position: fixed;
  z-index: 1;
  background: #000;
  outline: 2px solid var(--edge-active, #a552bf);
  box-shadow: 0 0 32px rgba(122, 29, 145, 0.32);
  cursor: crosshair;
}
body.role-client #stage.ps-tool-pan { cursor: grab; }
body.role-client #stage.ps-panning { cursor: grabbing; }
body.role-client #stage.ps-recording { outline-color: var(--ps-danger, #ff4757); box-shadow: 0 0 0 6px rgba(255, 71, 87, 0.24); }
body.role-client #remoteVideo { object-fit: fill; }

.ps-logo {
  position: fixed;
  left: 22px;
  top: 34px;
  z-index: 2;
  pointer-events: none;
  font-size: 24px;
  line-height: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.ps-logo .milo, .ps-logo .cam { -webkit-background-clip: text; background-clip: text; color: transparent; }
.ps-logo .milo { background-image: linear-gradient(135deg, #ffffff 0%, #7a1d91 100%); }
.ps-logo .cam { background-image: linear-gradient(135deg, #e8006f 0%, #ffd600 100%); }

/* ---------- Generic pieces ---------- */

.ps .icon { display: block; width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ps-btn .icon { width: 20px; height: 20px; }

.ps-bar-surface {
  position: fixed;
  z-index: 5;
  box-sizing: border-box;
  background: var(--ps-bar-bg);
  border: 1px solid var(--ps-edge);
  border-radius: 16px;
  box-shadow: var(--ps-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ps-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--ps-line);
  background: var(--ps-btn);
  color: var(--ps-text);
  font: 600 14px/20px Figtree, system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ps-btn.icon-only { width: 44px; padding: 0; }
/* The canvas has no hover colours: a hover only brightens, so active, party and record keep
   their colour, and on a tablet nothing sticks after a tap */
@media (hover: hover) { .ps-btn:hover:not(:disabled) { filter: brightness(1.15); } }
.ps-btn:focus-visible { outline: 2px solid var(--ps-yellow); outline-offset: 2px; }
.ps-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ps-btn.ghost { background: transparent; border-color: transparent; color: var(--ps-text-2); }
.ps-btn.secondary { background: rgba(42, 32, 56, 0.8); }
.ps-btn.danger { background: rgba(255, 71, 87, 0.12); color: var(--ps-danger-soft); border-color: rgba(255, 71, 87, 0.36); }
.ps-btn.full { width: 100%; }
.ps-btn[aria-pressed="true"], .ps-btn.active {
  background: var(--ps-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 16px rgba(232, 0, 111, 0.32);
}
.ps-btn.party {
  width: 56px; height: 56px; border-radius: 999px;
  background: linear-gradient(135deg, #ffd600 0%, #ff2d8a 100%);
  color: #0d0a12; border-color: transparent;
  box-shadow: 0 4px 20px rgba(255, 45, 138, 0.4);
}
.ps-btn.record { background: var(--ps-record); color: #fff; border-color: transparent; box-shadow: 0 0 16px rgba(255, 71, 87, 0.5); }
.ps-btn.sm { height: 32px; min-width: 32px; border-radius: 8px; font-size: 13px; line-height: 16px; padding: 0 12px; }
.ps-btn.sm .icon { width: 16px; height: 16px; }

.ps-divider-v { width: 1px; height: 28px; background: var(--ps-line); flex-shrink: 0; }
.ps-divider-h { width: 32px; height: 24px; flex-shrink: 0; background: linear-gradient(var(--ps-line), var(--ps-line)) center / 100% 1px no-repeat; }
.ps-group { display: flex; align-items: center; gap: 4px; }
.ps-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ps-label {
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ps-muted);
}

/* ---------- Top rail and session rail ---------- */

.ps-top-wrap { position: fixed; z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.ps-top-rail, .ps-session-rail {
  pointer-events: auto;
  height: 68px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ps-top-rail { position: relative; }
.ps-top-rail, .ps-session-rail { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32); }
.ps-session-rail { gap: 4px; }
.ps-zoom-text {
  box-sizing: border-box; width: 64px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- Left rail ---------- */

.ps-rail {
  width: 68px;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ps-rail .ps-spacer { flex: 1; min-height: 8px; }
/* On a short screen the dividers give up their space first (RAIL_MIN_H in pro-layout.js) */
.ps-rail .ps-divider-h { flex-shrink: 1; min-height: 8px; }
.ps-swatch {
  box-sizing: border-box; width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--ps-line); background: var(--ps-card); cursor: pointer;
}
.ps-swatch[aria-pressed="true"] { border: 2px solid var(--ps-text); }
.ps-swatch .dot { width: 24px; height: 24px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24); }

/* ---------- Popovers ---------- */

.ps-pop {
  position: fixed;
  z-index: 20;
  box-sizing: border-box;
  width: 272px;
  padding: 16px;
  border-radius: 16px;
  background: var(--ps-card);
  border: 1px solid var(--ps-edge);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ps-pop[hidden] { display: none; }
.ps-pop section { display: flex; flex-direction: column; gap: 8px; }
.ps-seg { display: flex; gap: 4px; width: 100%; }
.ps-seg .ps-btn { flex: 1 1 0; padding: 0 8px; }
.ps-seg .line { display: block; width: 24px; border-radius: 999px; background: currentColor; }
.ps-swatches { display: flex; gap: 4px; }

/* ---------- Video bar ---------- */

.ps-tab {
  position: fixed;
  z-index: 4;
  box-sizing: border-box;
  height: 32px;
  padding: 0 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(28, 22, 38, 0.96);
  border: 1px solid var(--ps-edge);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}
.ps-tab.has-video { color: var(--ps-text); }
.ps-tab .icon { width: 16px; height: 16px; }
.ps-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ps-bar {
  height: 68px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ps-time {
  width: 40px; flex-shrink: 0;
  font: 600 12px/16px Consolas, 'SF Mono', monospace; font-variant-numeric: tabular-nums;
  color: var(--ps-muted);
}
.ps-bar.has-video .ps-time { color: var(--ps-text); }
.ps-time.cur { text-align: right; }
.ps-timeline-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 44px; }

/* Sliders: a thin visible track with a 44 px hit area */
.ps-slider { --knob: 20px; position: relative; height: 44px; flex: 1; min-width: 0; display: flex; align-items: center; }
.ps-slider .track { position: absolute; left: 0; right: 0; height: 8px; border-radius: 999px; background: var(--ps-control-edge); }
/* Only the (invisible) range input takes the pointer; the drawn track, fill and knob let it through */
.ps-slider .track, .ps-slider .fill, .ps-slider .thumb { pointer-events: none; }
.ps-slider .fill { position: absolute; left: 0; height: 8px; border-radius: 999px; background: var(--ps-yellow); }
.ps-slider .thumb {
  position: absolute; width: var(--knob); height: var(--knob); border-radius: 999px; background: var(--ps-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(232, 0, 111, 0.32);
}
.ps-slider.vol { flex: 0 0 64px; }
.ps-slider.vol .track, .ps-slider.vol .fill { height: 4px; }
.ps-slider.vol .fill { background: var(--ps-magenta); }
.ps-slider.vol { --knob: 16px; }
.ps-slider input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 44px; margin: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}
/* The (invisible) native knob is as wide as the drawn one, so a drag starts exactly on it */
.ps-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--knob); height: 44px; }
.ps-slider input[type="range"]::-moz-range-thumb { width: var(--knob); height: 44px; border: 0; }
.ps-slider input:disabled { cursor: not-allowed; }
.ps-slider.disabled { opacity: 0.4; }
.ps-slider input:focus-visible + .thumb { outline: 2px solid var(--ps-yellow); outline-offset: 2px; }

.ps-speed { position: relative; display: flex; margin-right: 8px; }
.ps-speed select {
  box-sizing: border-box; width: 88px; height: 44px; padding: 0 32px 0 16px;
  border-radius: 12px; border: 1px solid var(--ps-control-edge); background: var(--ps-card); color: var(--ps-text);
  font: 600 14px/20px Figtree, system-ui, sans-serif; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.ps-speed select:disabled { opacity: 0.4; cursor: not-allowed; }
.ps-speed .icon { position: absolute; right: 12px; top: 14px; width: 16px; height: 16px; pointer-events: none; }
.ps-vol-inline { padding: 0 8px; display: flex; }
.ps-vol-pop {
  position: fixed; z-index: 20; box-sizing: border-box; width: 72px; height: 200px; padding: 12px 0;
  border-radius: 16px; background: var(--ps-card); border: 1px solid var(--ps-edge);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5); display: flex; justify-content: center;
}
.ps-vol-pop[hidden] { display: none; }
.ps-vol-pop .ps-slider.vol { flex: none; width: 160px; transform: rotate(-90deg); transform-origin: center; position: absolute; top: 78px; left: -44px; }

/* ---------- Presets, Alle video's, Opnames: three separate panels in one column ---------- */

.ps-panel {
  position: fixed;
  z-index: 6;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ps-panel[hidden], .ps-strip[hidden], .ps-handle[hidden] { display: none; }

/* Each panel folds open or closed on its own. A folded panel is just its header; open
   Presets and Alle video's share the height that is left. */
.ps-sec {
  box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; flex: none; min-height: 0;
  padding: 4px 8px; background: var(--ps-panel); border: 1px solid var(--ps-edge); border-radius: 16px; box-shadow: var(--ps-shadow);
}
.ps-sec.open { padding-bottom: 8px; }
.ps-sec:not(.open) > .ps-sec-body { display: none; }
.ps-sec.ps-sec-grow.open { flex: 1 1 0; min-height: 140px; }
.ps-sec-body { min-height: 0; }
.ps-sec-grow > .ps-sec-body { flex: 1; overflow-y: auto; }
.ps-sec-head { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ps .ps-sec-toggle {
  box-sizing: border-box; flex: 1; min-width: 0; height: 44px; padding: 0 4px; display: flex; align-items: center; gap: 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ps-text); font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .ps .ps-sec-toggle:hover { background: rgba(150, 100, 180, 0.12); } }
.ps-sec-toggle:focus-visible { outline: 2px solid var(--ps-yellow); outline-offset: -2px; }
.ps-sec-toggle .chev { display: flex; color: var(--ps-muted); }
.ps-sec-toggle .chev .icon, .ps-sec-toggle .sec-icon .icon { width: 16px; height: 16px; }
.ps-sec-toggle .sec-icon { display: flex; color: var(--ps-muted); }
.ps-sec-toggle .sec-icon.bm { color: var(--ps-yellow); }
.ps-sec-toggle .sec-icon.rec { color: var(--ps-danger-soft); }
.ps-sec-toggle .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 20px; font-weight: 700; }
.ps-presets-area { display: flex; flex-direction: column; gap: 8px; }
.ps-library-list { display: flex; flex-direction: column; gap: 4px; }
.ps-hr { height: 1px; background: var(--ps-line); flex-shrink: 0; }
.ps-empty { margin: 0; padding: 4px; font-size: 12px; line-height: 16px; color: var(--ps-muted); }

.ps-item {
  box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px;
  padding: 8px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--ps-text); font: inherit; text-align: left; cursor: pointer;
}
.ps-item:hover { background: rgba(150, 100, 180, 0.12); }
.ps-item:focus-visible { outline: 2px solid var(--ps-yellow); outline-offset: -2px; }
.ps-item[aria-pressed="true"] { background: rgba(232, 0, 111, 0.16); border-color: rgba(232, 0, 111, 0.56); }
.ps-item .thumb {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 28px; flex-shrink: 0;
  border-radius: 4px; background: rgba(150, 100, 180, 0.2); color: #c9bdd8;
}
.ps-item .thumb .icon { width: 16px; height: 16px; }
/* The video's thumbnail (videos/thumbs) covers the film icon once it has loaded */
.ps-item .thumb { position: relative; overflow: hidden; }
.ps-item .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ps-item .name {
  flex: 1; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; font-size: 12px; line-height: 16px; font-weight: 600;
}

/* All three folded: three separate small strips at the top; the Opnames strip turns red while recording */
.ps-strip {
  position: fixed; z-index: 6; box-sizing: border-box; width: 52px;
  display: flex; flex-direction: column; align-items: stretch; gap: 12px; pointer-events: none;
}
.ps-strip-card {
  pointer-events: auto; box-sizing: border-box; width: 52px; padding: 3px;
  background: var(--ps-panel); border: 1px solid var(--ps-edge); border-radius: 16px; box-shadow: var(--ps-shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
/* An opener is a button as a whole: the arrow points to where the panel opens */
.ps .ps-strip-open {
  height: 52px; flex-direction: row; justify-content: center; gap: 2px; padding: 0;
  color: var(--ps-text-2); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .ps .ps-strip-open:hover { filter: brightness(1.2); } }
.ps-strip-open:focus-visible { outline: 2px solid var(--ps-yellow); outline-offset: 2px; }
.ps-strip-open .arrow { display: flex; color: var(--ps-muted); }
.ps-strip-open .arrow .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.ps-strip-open.bm { color: var(--ps-yellow); }
.ps-strip-open.rec { color: var(--ps-danger-soft); border-color: var(--edge-error, #d63d4b); background: linear-gradient(rgba(255, 71, 87, 0.04), rgba(255, 71, 87, 0.04)), var(--ps-panel); }
.ps-strip-open.rec.recording { border-color: var(--ps-danger); background: linear-gradient(rgba(255, 71, 87, 0.16), rgba(255, 71, 87, 0.16)), var(--ps-panel); box-shadow: 0 0 16px rgba(255, 71, 87, 0.4); }

.ps-handle {
  position: fixed; z-index: 7; width: 24px; cursor: col-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.ps-handle span { width: 4px; height: 32px; border-radius: 999px; background: rgba(150, 100, 180, 0.48); }
.ps-handle:hover span, .ps-handle:focus-visible span { background: var(--ps-magenta); }
.ps-handle:focus-visible { outline: none; }

/* ---------- Messages, dialog, portrait ---------- */

.ps-banner {
  position: fixed; z-index: 8; display: flex; justify-content: center; pointer-events: none;
}
.ps-banner[hidden] { display: none; }
.ps-banner div {
  display: flex; align-items: center; gap: 12px; min-height: 48px; max-width: 100%; padding: 10px 20px 10px 12px;
  border-radius: 999px; background: var(--ps-card); border: 1px solid var(--edge-warning, #8b7409); color: var(--ps-text);
  font-size: 14px; line-height: 20px; font-weight: 500; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.ps-banner .tone {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 999px; background: rgba(255, 214, 0, 0.14); color: var(--ps-yellow);
}
.ps-banner .tone .icon { width: 16px; height: 16px; stroke-width: 2.5; }

.ps-dialog-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(13, 10, 18, 0.64);
  display: flex; align-items: center; justify-content: center;
}
.ps-dialog-backdrop[hidden] { display: none; }
.ps-dialog {
  box-sizing: border-box; width: min(400px, calc(100vw - 32px)); padding: 24px; border-radius: 16px;
  background: var(--ps-card); border: 1px solid var(--ps-edge); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; gap: 16px;
}
.ps-dialog h2 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 700; }
.ps-dialog p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ps-text-2); }
.ps-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

.ps-portrait {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: var(--ps-bg); color: var(--ps-text);
  flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px; text-align: center;
}
.ps-portrait .icon { width: 64px; height: 64px; color: var(--ps-yellow); }
.ps-portrait p { margin: 0; font-size: 20px; line-height: 28px; font-weight: 700; }
@media (orientation: portrait) {
  body.role-client .ps-portrait { display: flex; }
}

/* Toast on the professional screen sits above the video bar, centred on the frame */
body.role-client .toast { right: auto; left: var(--ps-toast-x, 50%); bottom: var(--ps-toast-bottom, 128px); transform: translate(-50%, 16px) scale(0.9); z-index: 30; }
body.role-client .toast.show { transform: translate(-50%, 0) scale(1); }

.ps-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Base for the screen's own controls. styles.css styles no bare elements, so these are
   the defaults; :where() keeps them weaker than every .ps-* rule above. */
:where(.ps) button,
:where(.ps) select {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ps-text);
  font-size: 13px;
  font-weight: 500;
}
:where(.ps) button { overflow: hidden; line-height: normal; }
:where(.ps) select option { background: var(--ps-card); color: var(--ps-text); }
:where(.ps) [hidden] { display: none !important; }
.ps .ps-swatch[aria-pressed="true"]:hover { border-color: var(--ps-text); }
.ps .ps-item { height: auto; overflow: visible; white-space: normal; transition: background 0.15s; }
.ps .ps-item:hover:not([aria-pressed="true"]) { background: rgba(150, 100, 180, 0.12); border-color: transparent; }
.ps .ps-item[aria-pressed="true"]:hover { background: rgba(232, 0, 111, 0.22); }
.ps .ps-item .name { white-space: normal; }

/* ---------- Presets (tickets 11 and 12) ---------- */
.ps-presets-area { padding-right: 2px; }
.ps-presets-area.disabled { opacity: 0.4; }
.ps-preset {
  box-sizing: border-box; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--ps-edge);
  background: var(--ps-card); padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 4px;
}
.ps-preset.over { border: 1px dashed var(--ps-magenta); background: rgba(232, 0, 111, 0.08); }
.ps-preset-head { display: flex; align-items: center; gap: 4px; }
.ps .ps-preset-toggle {
  box-sizing: border-box; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ps-text); font: inherit; text-align: left; cursor: pointer;
}
.ps .ps-preset-toggle:hover { background: rgba(150, 100, 180, 0.12); border-color: transparent; }
.ps-preset-toggle .icon { width: 16px; height: 16px; color: var(--ps-muted); }
.ps-preset-toggle .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 20px; font-weight: 700; }
.ps-preset-toggle .ct { font-size: 12px; line-height: 16px; color: var(--ps-muted); }
.ps-rename {
  box-sizing: border-box; flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--ps-magenta); background: var(--ps-bg); color: var(--ps-text);
  font: 700 13px/20px Figtree, system-ui, sans-serif;
}
.ps-preset-menu { display: flex; flex-direction: column; gap: 4px; }
.ps-preset-items { display: flex; flex-direction: column; gap: 4px; }
.ps-preset-row { display: flex; align-items: center; gap: 4px; }
.ps-preset-row.drop-before, .ps-drop-end.drop-before { box-shadow: inset 0 2px 0 var(--ps-magenta); }
.ps-grip {
  width: 44px; height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ps-muted); cursor: grab; touch-action: none;
}
.ps-grip .icon { width: 16px; height: 16px; }
.reordering .ps-grip { cursor: grabbing; }
.ps-drop-end {
  box-sizing: border-box; min-height: 32px; padding: 4px 8px; border-radius: 8px; border: 1px dashed rgba(150, 100, 180, 0.32);
  display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; line-height: 16px; color: var(--ps-muted);
}
.ps-item .txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ps-item .meta { font-size: 12px; line-height: 16px; color: var(--ps-danger-soft); }
.ps .ps-item.missing { opacity: 0.56; cursor: not-allowed; }
.ps-item.missing .thumb { background: rgba(255, 71, 87, 0.12); color: var(--ps-danger-soft); }
.ps-lib-row { display: flex; flex-direction: column; gap: 4px; }
.ps-lib-line { display: flex; align-items: center; gap: 4px; }
.ps-lib-line .ps-item { flex: 1; min-width: 0; cursor: grab; }
.ps-add-to {
  display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 12px;
  background: var(--ps-card); border: 1px solid var(--ps-edge);
}
.ps-add-to .ps-btn span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Recordings (tickets 14 and 15) ---------- */
/* Opnames: its own panel with a red edge, at the bottom. Its header holds the record button;
   when it is the only open panel it takes the whole height (.fill). */
.ps-rec {
  container-type: inline-size; flex-shrink: 0; margin-top: auto; border-color: var(--edge-error, #d63d4b);
  background: linear-gradient(rgba(255, 71, 87, 0.04), rgba(255, 71, 87, 0.04)), var(--ps-panel);
}
.ps-rec.fill { flex: 1 1 0; }
.ps-rec.fill > .ps-sec-body { flex: 1; min-height: 0; }
.ps-rec.fill .ps-rec-list { flex: 1; max-height: none; }
.ps-rec .rec-head-btn { flex-shrink: 0; padding: 0 10px; font-variant-numeric: tabular-nums; }
/* A narrow panel keeps the title readable: the button shows only its icon. While recording
   it keeps the time; the title gives way ("Opn…") */
@container (max-width: 233px) { .ps-rec:not(.recording) .rec-head-btn span { display: none; } .ps-rec:not(.recording) .rec-head-btn { width: 32px; padding: 0; } }
.ps-rec.recording { border-color: var(--ps-danger); background: linear-gradient(rgba(255, 71, 87, 0.08), rgba(255, 71, 87, 0.08)), var(--ps-panel); }
.ps-rec > .ps-sec-body { display: flex; flex-direction: column; gap: 4px; }
.ps-rec-list { max-height: 100px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.ps-rec-list[hidden], .ps-rec .ps-empty[hidden] { display: none; }
.ps-rec-row { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.ps-rec-row .ps-item { flex: 1; min-width: 0; }
.ps-item.rec .thumb { background: rgba(255, 71, 87, 0.16); color: var(--ps-danger-soft); }
.ps-item .meta.muted { color: var(--ps-muted); }
.ps-item .flag { display: flex; flex-shrink: 0; color: var(--ps-muted); }
.ps-item .flag .icon { width: 16px; height: 16px; }
.ps .ps-btn.record[aria-pressed="true"] { background: var(--ps-record); color: #fff; box-shadow: 0 0 16px rgba(255, 71, 87, 0.5); }

/* A new recording glows for a moment (js/pro-screen.js, FRESH_MS), and so do the Opnames panel and
   its strip, so you see it arrive even with the panel folded */
@keyframes ps-fresh-row {
  0%, 55% { background-color: rgba(255, 71, 87, 0.18); box-shadow: 0 0 0 2px var(--ps-danger-soft), 0 0 16px rgba(255, 71, 87, 0.45); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
}
@keyframes ps-fresh-block {
  0%, 55% { box-shadow: 0 0 0 2px var(--ps-danger-soft), 0 0 24px rgba(255, 71, 87, 0.5); }
  100% { box-shadow: var(--ps-shadow); }
}
.ps-rec-row.fresh { border-radius: 8px; animation: ps-fresh-row 2.4s ease-out; }
.ps-rec.fresh, .ps-strip-open.rec.fresh { animation: ps-fresh-block 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .ps-rec-row.fresh, .ps-rec.fresh, .ps-strip-open.rec.fresh { animation: none; outline: 2px solid var(--ps-danger-soft); outline-offset: -2px; }
}

/* Long names never make a list scroll sideways */
.ps-presets-area { overflow-x: hidden; }
.ps-rec-list, .ps-library-list { overflow-x: hidden; }
.ps-preset-row .ps-item { flex: 1; min-width: 0; }
.ps-item .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-item .txt:has(.meta) .name { -webkit-line-clamp: 1; }

.ps-tab-icon { display: flex; }
