/* Single dark look by choice: this is a piece of video gear. */
  :root {
    color-scheme: dark;
    --chassis: #181619;
    --panel: #1f1b20;
    --raise: #29242b;
    --raise-2: #322c35;
    --well: #0e0d0f;
    --line: #37313a;
    --ink: #e4dae8;
    --dim: #9e8ea5;
    --faint: #706375;
    --loop-a: #8b1ab8;
    --loop-b: #4fd1c5;
    --loop-c: #f0a030;
    --loop-d: #5b8cff;
    --loop-a-ink: #d584f5;   /* the accent, lightened, for text and icons on the dark panels */
    --amber: var(--loop-a);
    --amber-ink: var(--loop-a-ink);
    --amber-glow: rgba(139,26,184,.45);
    --press-1: #431f51;
    --press-2: #31163b;
    --press-ink: #f2d9fc;
    --tally: #ff4b3e;
    --gun-r: #ff4a4a;
    --gun-g: #3ddc84;
    --gun-b: #4f86ff;
    --osd: #e9fbe9;
    --f-display: "Michroma", "Eurostile", "Arial Black", sans-serif;
    --f-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
    --f-osd: "VT323", "Courier New", monospace;
  }
  html, body { height: 100%; }
  body {
    background: var(--chassis);
    color: var(--ink);
    font: 15px/1.45 var(--f-body);
    -webkit-font-smoothing: antialiased;
  }
  button, select { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--amber-ink); outline-offset: 2px; }

  .app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }

  /* ---------- top bar ---------- */
  .top {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(#1e1a1f, var(--chassis));
  }
  .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .guns { position: relative; width: 22px; height: 20px; flex: none; }
  .guns i { position: absolute; width: 9px; height: 9px; border-radius: 50%; }
  .guns i:nth-child(1) { background: var(--gun-r); left: 0; top: 0; box-shadow: 0 0 8px var(--gun-r); }
  .guns i:nth-child(2) { background: var(--gun-g); right: 0; top: 0; box-shadow: 0 0 8px var(--gun-g); }
  .guns i:nth-child(3) { background: var(--gun-b); left: 6.5px; bottom: 0; box-shadow: 0 0 8px var(--gun-b); }
  .wordmark {
    font-family: var(--f-display); font-size: 15px; letter-spacing: .22em; text-transform: uppercase;
    white-space: nowrap;
  }
  .readout {
    font-family: var(--f-osd); font-size: 20px; color: var(--dim); letter-spacing: .04em;
    display: flex; gap: 10px; align-items: baseline; white-space: nowrap;
  }
  .readout .tc-label { color: var(--faint); }
  .readout #tc { color: var(--loop-a-ink); min-width: 11ch; }

  /* ---------- main deck ---------- */
  .deck { display: grid; grid-template-columns: minmax(0, 1fr) 7px var(--side-w, 380px); min-height: 0; }
  /* The bar between the picture and the controls: drag it to change how wide the controls are */
  .deck-split { position: relative; cursor: col-resize; touch-action: none; background: var(--chassis); }
  .deck-split::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: var(--line); transition: background .15s, box-shadow .15s; }
  .deck-split:hover::after, .deck-split:focus-visible::after, .deck-split.dragging::after { background: var(--loop-a-ink); box-shadow: 0 0 6px var(--amber-glow); }
  body.resizing, body.resizing * { user-select: none !important; }
  body.resizing.cols, body.resizing.cols * { cursor: col-resize !important; }

  .monitor { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 14px; min-height: 0; min-width: 0; }
  .stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
  /* A picture sized by hand: the stage hugs it and everything below moves up or down with it */
  .stage.sized { flex: none; height: auto !important; }
  /* With the sequencer open the picture gives up height to it, but never shrinks below a usable preview */
  .monitor:has(> .seq:not([hidden])) .stage { min-height: 220px; }
  .stage:fullscreen { background: #000; padding: 0; }
  .stage:-webkit-full-screen { background: #000; }
  .stage:fullscreen .bezel { padding: 0; border-radius: 0; background: #000; box-shadow: none; }
  .stage:fullscreen .screen { border-radius: 0; }
  .stage:-webkit-full-screen .bezel { padding: 0; border-radius: 0; background: #000; box-shadow: none; }
  .stage:-webkit-full-screen .screen { border-radius: 0; }
  /* Full screen: a big way out, shown when the mouse moves or the picture is tapped, gone again when still */
  .fs-exit {
    position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); z-index: 6;
    display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 20px; border-radius: 999px;
    border: 1px solid var(--loop-a); background: rgba(11,10,12,.82); color: #f2d9fc;
    font: 600 18px/1 var(--f-body); cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: opacity .4s;
  }
  .fs-exit:hover { background: rgba(67,31,81,.92); }
  .fs-exit .x { font-size: 22px; line-height: 1; }
  .fs-exit kbd { font: 16px/1 var(--f-osd); padding: 3px 6px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 4px; color: var(--dim); }
  @media (hover: none) { .fs-exit kbd { display: none; } }
  .fs-exit.away { opacity: 0; pointer-events: none; }
  /* Full screen during a taste session: the timer and the rating buttons come and go together with the mouse */
  .fs-taste {
    position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 6;
    display: flex; align-items: center; gap: 10px; transition: opacity .4s;
  }
  .fs-taste.away { opacity: 0; pointer-events: none; }
  .fs-taste[hidden] { display: none; }
  .fs-rate {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 60px; padding: 8px 16px; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25); background: rgba(11,10,12,.82); color: var(--ink);
    font: 600 17px/1 var(--f-body); cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: opacity .4s;
    white-space: nowrap;
  }
  .fs-rate .thumb { width: 22px; height: 22px; }
  .fs-rate.rate-up { border-color: rgba(61, 220, 132, .6); }
  .fs-rate.rate-down { border-color: rgba(255, 75, 62, .6); }
  .fs-rate:hover { background: rgba(38,32,40,.92); }
  .fs-clock {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
    background: rgba(0, 0, 0, .55); color: rgba(255, 255, 255, .85); font: 600 14px/1 var(--f-body);
    font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .fs-clock .ring {
    width: 12px; height: 12px; border-radius: 50%; flex: none;
    background: conic-gradient(var(--gun-g) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .2) 0);
  }
  .stage.idle canvas { cursor: none; }
  .bezel {
    position: relative;
    padding: 8px;
    border-radius: 14px;
    background: linear-gradient(160deg, #312b34 0%, #201c22 45%, #141215 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -2px 0 rgba(0,0,0,.4), 0 24px 50px rgba(0,0,0,.5);
  }
  .screen {
    position: relative; overflow: hidden; line-height: 0;
    border-radius: 9px / 10px;
    background: #030303;
    box-shadow: 0 0 0 2px #09080a;
  }
  .screen canvas { display: block; touch-action: none; cursor: crosshair; }
  /* Save clip: while a trim handle is dragged, the plain video frame at that handle covers the picture */
  .trim-peek { position: absolute; inset: 0; z-index: 4; background: #000; pointer-events: none; display: flex; align-items: center; justify-content: center; }
  .trim-peek[hidden] { display: none; }
  .trim-peek canvas { width: 100%; height: 100%; object-fit: contain; cursor: default; }
  .trim-peek-t { position: absolute; left: 12px; bottom: 10px; padding: 3px 9px; border-radius: 5px; background: rgba(0,0,0,.72); font: 20px/1.2 var(--f-osd); color: var(--amber-ink); }
  /* Handles on the picture's frame: right edge for width, bottom edge for height, corner for both */
  .rz { position: absolute; z-index: 6; touch-action: none; }
  .rz-r { top: 18px; bottom: 18px; right: -5px; width: 12px; cursor: ew-resize; }
  .rz-b { left: 18px; right: 18px; bottom: -5px; height: 12px; cursor: ns-resize; }
  .rz-c { right: -5px; bottom: -5px; width: 20px; height: 20px; cursor: nwse-resize; }
  .rz-r::after, .rz-b::after { content: ""; position: absolute; border-radius: 2px; background: var(--loop-a-ink); opacity: 0; transition: opacity .15s; }
  .rz-r::after { top: 50%; left: 4px; width: 4px; height: 44px; margin-top: -22px; }
  .rz-b::after { left: 50%; top: 4px; height: 4px; width: 44px; margin-left: -22px; }
  .bezel:hover .rz-r::after, .bezel:hover .rz-b::after, .rz.dragging::after { opacity: .7; }
  .rz-c::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); border-radius: 0 0 3px 0; opacity: .55; }
  .rz-c:hover::after, .rz-c.dragging::after { border-color: var(--loop-a-ink); opacity: 1; }
  body.resizing.rz-r-on, body.resizing.rz-r-on * { cursor: ew-resize !important; }
  body.resizing.rz-b-on, body.resizing.rz-b-on * { cursor: ns-resize !important; }
  body.resizing.rz-rb-on, body.resizing.rz-rb-on * { cursor: nwse-resize !important; }
  .stage:fullscreen .rz, .stage:-webkit-full-screen .rz { display: none; }

  .osd {
    position: absolute; left: 5.5%; top: 6%; pointer-events: none;
    display: grid; line-height: 1; gap: 2px;
    font-family: var(--f-osd); color: var(--osd);
    text-shadow: 0 0 6px rgba(120,255,150,.7), 2px 2px 0 rgba(0,0,0,.85);
    opacity: 0; transition: opacity .5s ease;
  }
  .osd.on { opacity: 1; transition: none; }
  .osd-a { font-size: clamp(28px, 4.4vw, 46px); }
  .osd-b { font-size: clamp(18px, 2.4vw, 26px); letter-spacing: .08em; }

  .rec-ind {
    position: absolute; right: 5.5%; top: 6%; pointer-events: none;
    font-family: var(--f-osd); font-size: clamp(20px, 2.6vw, 28px); line-height: 1; color: var(--tally);
    text-shadow: 0 0 8px rgba(255,75,62,.7), 2px 2px 0 rgba(0,0,0,.85);
  }
  .rec-ind .dot { animation: blink 1s steps(2, start) infinite; }
  @keyframes blink { to { visibility: hidden; } }

  .tip {
    position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
    pointer-events: none; line-height: 1.3; text-align: center;
    max-width: 86%;
    padding: 7px 14px; border-radius: 999px;
    background: rgba(9,8,10,.72); color: var(--ink); font-size: 14px;
    border: 1px solid rgba(255,255,255,.12);
    transition: opacity .6s ease;
  }
  .tip.gone { opacity: 0; }
  .name-box {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
    width: min(440px, 90%); display: flex; flex-direction: column; gap: 9px; padding: 14px 16px;
    border-radius: 10px; background: rgba(31,27,32,.97); border: 1px solid var(--line);
    box-shadow: 0 14px 44px rgba(0,0,0,.65); cursor: auto; text-align: left;
  }
  .name-box[hidden] { display: none; }
  .name-title { font-weight: 600; font-size: 15px; color: var(--ink); }
  .name-ext { align-self: center; color: var(--dim); font-size: 14px; }
  .name-btns { justify-content: flex-end; }
  .name-save { border-color: var(--amber); }

  .drop, .screen-msg {
    position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
    padding: 24px; line-height: 1.4;
    font-family: var(--f-osd); font-size: 26px; color: var(--osd);
    background: rgba(5,5,5,.72);
  }
  .screen-msg { font-family: var(--f-body); font-size: 16px; color: var(--ink); background: #080708; }
  /* Dropping onto the picture: one target per loop that's on (see dropZones in js/app.js) */
  .drop { padding: 0; place-items: stretch; }
  .drop.zones { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
  .drop-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 16px; outline: 2px dashed rgba(255,255,255,.28); outline-offset: -10px; transition: background .12s;
  }
  .drop-zone .tag { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; font: 400 32px/1 var(--f-osd); color: #111; }
  .drop-zone[data-k=A] .tag { background: var(--loop-a); }
  .drop-zone[data-k=B] .tag { background: var(--loop-b); }
  .drop-zone[data-k=C] .tag { background: var(--loop-c); }
  .drop-zone[data-k=D] .tag { background: var(--loop-d); }
  .drop.zones .drop-zone { font-size: 20px; }
  .drop-zone.over { background: rgba(139,26,184,.38); outline-color: rgba(255,255,255,.75); }
  [role=tab].drop-over { outline: 2px dashed var(--accent, #8b1ab8); outline-offset: 2px; }

  .transport { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
  .transport .spacer { width: 12px; }

  .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; min-height: 22px; font-size: 13px; color: var(--faint); }
  .foot kbd {
    font: 12px/1 var(--f-body); color: var(--dim);
    padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line); background: var(--raise);
  }
  .toast { color: var(--loop-a-ink); margin: 0; }
  .keys { margin: 0; }
  @media (hover: none) { .keys { display: none; } }

  /* ---------- buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 38px; padding: 7px 14px;
    border-radius: 6px; border: 1px solid var(--line); border-bottom-color: #0b0a0c;
    background: linear-gradient(var(--raise-2), var(--raise));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.4);
    font-weight: 500; cursor: pointer; white-space: nowrap;
  }
  .btn:hover { background: linear-gradient(#3a323d, #2d272f); }
  .btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,.5); }
  .led {
    width: 8px; height: 8px; border-radius: 50%; flex: none;
    background: #39303c; box-shadow: inset 0 1px 1px rgba(0,0,0,.6);
  }
  .btn[aria-pressed="true"] .led { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow), 0 0 2px var(--amber); }
  .btn.rec[aria-pressed="true"] .led { background: var(--tally); box-shadow: 0 0 8px rgba(255,75,62,.7); }
  .btn.rec[aria-pressed="true"] { color: #ffd9d5; }
  .btn.wide { width: 100%; }
  .btn.small { min-height: 32px; padding: 5px 11px; font-size: 14px; }
  .linkish {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--amber-ink); text-decoration: underline; text-underline-offset: 2px; font-weight: 600;
  }

  /* ---------- control panel ---------- */
  .panel {
    overflow-y: auto; min-height: 0;
    border-left: 1px solid var(--line); background: var(--panel);
    padding: 20px;
  }
  .panel-in { display: flex; flex-direction: column; gap: 26px; }
  @media (max-width: 900px) { #wideBtn { display: none; } }
  /* "Spread out controls": the picture here becomes a small preview on the left and the
     controls flow in columns across the rest of the screen */
  @media (min-width: 901px) {
    body.wide-ctl .deck { grid-template-columns: var(--mon-w, 320px) 7px minmax(0, 1fr); }
    body.wide-ctl .monitor { padding: 14px 14px 12px; gap: 10px; overflow-y: auto; }
    body.wide-ctl .stage { flex: none; height: 200px; }
    body.wide-ctl .transport { gap: 6px; }
    body.wide-ctl .transport .btn { padding-inline: 10px; }
    body.wide-ctl .transport .spacer { display: none; }
    body.wide-ctl .foot .keys { display: none; }
    body.wide-ctl .panel { border-left: 1px solid var(--line); }
    /* Column one: Loops, then React to sound and everything below it. Then a column for each loop (or two loops
       to a column on a narrower screen), with that loop's Inputs and Effects. */
    body.wide-ctl .panel-in { display: block; }
    .wide-cols { display: grid; column-gap: 28px; align-items: start; }
    .wide-col { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
    .wide-col + .wide-col { position: relative; }
    .wide-col + .wide-col::before { content: ""; position: absolute; left: -14px; top: 0; bottom: 0; border-left: 1px solid var(--line); }
    .wide-col.first > .panel-tools { margin-top: -14px; }
    .wide-col.first > input[hidden] { display: none; }
    .wide-col.first > .editor { display: none; }
    .loop-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
    .wide-col.loops .loop-col + .loop-col { padding-top: 26px; border-top: 1px solid var(--line); }
    .loop-col .mirror .tabs { display: none; }
    .loop-col-head {
      display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
      background: var(--well); border: 1px solid var(--line); font-weight: 600; font-size: 16px; color: var(--dim);
    }
    .loop-col.editing .loop-col-head { color: var(--ink); background: linear-gradient(var(--raise-2), var(--raise)); }
    .loop-col-head .tag {
      display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 4px;
      font: 400 19px/1 var(--f-osd); color: #111;
    }
    .loop-col-head .t-a { background: var(--loop-a); }
    .loop-col-head .t-b { background: var(--loop-b); }
    .loop-col-head .t-c { background: var(--loop-c); }
    .loop-col-head .t-d { background: var(--loop-d); }
  }
  .lede { margin: 0; color: var(--dim); max-width: 60ch; }
  .lede b { color: var(--ink); font-weight: 600; }
  .group { display: flex; flex-direction: column; gap: 12px; }
  .group h2 {
    margin: 0; display: flex; align-items: center; gap: 10px;
    font: 11px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; color: var(--dim);
  }
  .group h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  /* folding sections */
  .group h2.fold::after { display: none; }
  .group-toggle {
    flex: 1; display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 0; margin: -4px 0;
    background: none; border: 0; cursor: pointer; text-align: left;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  }
  .group-toggle:hover { color: var(--ink); }
  .group-toggle .rule { flex: 1; height: 1px; background: var(--line); }
  .group-toggle .chev {
    width: 8px; height: 8px; margin-right: 3px; flex: none;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease;
  }
  .group-toggle[aria-expanded="false"] .chev { transform: rotate(-45deg); }
  .group-body { display: flex; flex-direction: column; gap: 12px; }
  .group .subhead { margin: 10px 0 0; font: 10px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); opacity: .8; }
  .panel-tools { display: flex; gap: 14px; margin-top: -14px; font-size: 13px; }
  .panel-tools .linkish { font-weight: 500; }

  /* my presets */
  .presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .pre { position: relative; min-width: 0; }
  .pre-load {
    width: 100%; display: flex; flex-direction: column; gap: 5px; padding: 4px 4px 6px;
    border-radius: 7px; border: 1px solid var(--line); border-bottom-color: #0b0a0c;
    background: linear-gradient(var(--raise-2), var(--raise)); cursor: pointer; text-align: left;
  }
  .pre-load:hover { border-color: #524756; }
  .pre-load .sw { display: block; height: 44px; border-radius: 4px; background: #0a090b center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
  .pre-load .nm { font-size: 13px; line-height: 1.15; padding-inline: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pre-load[aria-pressed="true"] { border-color: var(--loop-a); box-shadow: 0 0 0 1px var(--loop-a); }
  .pre-auto {
    position: absolute; top: 8px; left: 8px; padding: 3px 5px; border-radius: 4px; pointer-events: none;
    border: 1px solid rgba(139,26,184,.55); background: rgba(9,8,10,.82); color: var(--amber-ink);
    font: 600 10px/1 var(--f-body); letter-spacing: .08em;
  }
  #presetApNote { display: none; color: var(--amber-ink); }
  .ap-on #presetApNote { display: block; }
  .pre-del, .pre-ren {
    position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; padding: 0; cursor: pointer;
    border: 1px solid rgba(255,255,255,.2); background: rgba(9,8,10,.8); color: var(--ink); font: 600 14px/1 var(--f-body);
    opacity: 0; transition: opacity .15s;
  }
  .pre-ren { right: 32px; font-size: 12px; }
  .pre:hover .pre-del, .pre-del:focus-visible, .pre:hover .pre-ren, .pre-ren:focus-visible { opacity: 1; }
  @media (hover: none) { .pre-del, .pre-ren { opacity: 1; } }
  .admin { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
  .admin-tag { font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--amber-ink); }
  .admin .linkish { align-self: flex-start; font-size: 13px; font-weight: 500; }
  #adminMsg.warn { color: #ffc98a; }
  .pre-confirm {
    position: absolute; inset: 0; border-radius: 7px; background: rgba(11,10,12,.94); border: 1px solid var(--tally);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px;
  }
  .pre-confirm div { display: flex; gap: 6px; }
  .pre-confirm button { min-height: 28px; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line); background: var(--raise-2); cursor: pointer; font-size: 13px; }
  .pre-confirm .yes { border-color: var(--tally); color: #ffd9d5; }
  .preset-form { display: flex; flex-direction: column; gap: 6px; }
  .preset-row { display: flex; gap: 6px; }
  .preset-row input {
    flex: 1; min-width: 0; min-height: 34px; padding: 5px 10px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 14px;
  }
  .preset-row input:focus-visible { outline: 2px solid var(--loop-a-ink); outline-offset: 1px; }
  .hint { margin: 0; font-size: 13px; color: var(--faint); }
  .feed-note { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 6px;
    border: 1px solid #4e305a; background: rgba(139,26,184,.07); color: var(--amber-ink); }
  .feed-note .linkish { align-self: flex-start; font-size: 13px; }


  .meter { display: flex; align-items: stretch; gap: 8px; height: 58px; padding: 6px 8px 4px; border-radius: 6px; background: #070707; border: 1px solid var(--line); }
  .mbar { flex: 1; display: flex; flex-direction: column; gap: 3px; position: relative; }
  .mbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 16px; border-radius: 2px; background: rgba(255,255,255,.05); }
  .mbar i { position: relative; }
  .mbar i { flex: 1; display: block; border-radius: 2px; transform-origin: bottom; transform: scaleY(0);
    background: linear-gradient(0deg, var(--loop-a), #f4defc); }
  .mbar span { font: 13px/1 var(--f-osd); color: var(--faint); text-align: center; }
  .mbeat { align-self: center; font: 18px/1 var(--f-osd); color: #39303c; padding-inline: 4px; }
  .mbeat.on { color: var(--tally); text-shadow: 0 0 8px rgba(255,75,62,.7); }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
  .chip {
    display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 11px; border-radius: 999px;
    border: 1px solid var(--line); border-bottom-color: #0b0a0c; background: linear-gradient(var(--raise-2), var(--raise));
    font-size: 13.5px; font-weight: 500; cursor: pointer;
  }
  .chip[aria-pressed="true"] { border-color: var(--loop-a); color: var(--press-ink); }
  .chip[aria-pressed="true"] .led { background: var(--loop-a); box-shadow: 0 0 8px var(--amber-glow); }
  .quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .quick-actions .btn { padding-inline: 8px; }
  /* shapes */
  .ctl.shape-color { display: flex; flex-direction: row; align-items: center; justify-content: space-between; }
  .shape-color input[type="color"] { width: 64px; height: 32px; padding: 2px; border-radius: 6px; border: 1px solid var(--line); background: var(--raise); cursor: pointer; }
  #shapeAdd { cursor: grab; touch-action: none; }
  .shape-ghost {
    position: fixed; z-index: 1000; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
    pointer-events: none; border: 2px dashed var(--amber); box-shadow: 0 0 18px var(--amber-glow);
  }
  .seg { display: grid; gap: 6px; }
  .seg-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ctl .seg + .hint, .ctl .ends + .seg { margin-top: 4px; }
  .ctl .seg + .ctl-head, .ctl .ends + .ctl-head { margin-top: 10px; }
  .seg-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .wind-dirs { max-width: 168px; margin-inline: auto; }
  .wind-dirs button { font-size: 17px; line-height: 1; padding: 6px 0; }
  .seg button {
    min-height: 36px; padding: 6px 2px; border-radius: 6px;
    border: 1px solid var(--line); border-bottom-color: #0b0a0c;
    background: linear-gradient(var(--raise-2), var(--raise));
    cursor: pointer; font-size: 13.5px; font-weight: 500; min-width: 0;
  }
  .seg button:hover { border-color: #524756; }
  .seg button:disabled { opacity: .45; cursor: default; }
  .seg button[aria-pressed="true"] {
    background: linear-gradient(var(--press-1), var(--press-2)); border-color: var(--amber); color: var(--press-ink);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
  }

  select {
    width: 100%; min-height: 36px; padding: 6px 10px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--raise); color: var(--ink); font-size: 14px; cursor: pointer;
  }

  /* loop editor: B swaps the accent to teal */
  .editor { display: flex; flex-direction: column; gap: 18px; }
  .editor[data-loop="B"] {
    --amber: var(--loop-b); --amber-ink: var(--loop-b); --amber-glow: rgba(79, 209, 197, .45);
    --press-1: #1d4440; --press-2: #15312e; --press-ink: #cafff8;
  }
  .editor[data-loop="C"] {
    --amber: var(--loop-c); --amber-ink: #ffc46b; --amber-glow: rgba(240, 160, 48, .45);
    --press-1: #4a3315; --press-2: #36250f; --press-ink: #ffe3b8;
  }
  .editor[data-loop="D"] {
    --amber: var(--loop-d); --amber-ink: #9db8ff; --amber-glow: rgba(91, 140, 255, .45);
    --press-1: #1d2b4f; --press-2: #15203b; --press-ink: #d9e4ff;
  }
  /* A pin only shows on settings Autopilot is in charge of; loops (and faders) that are yours have none */
  .pin.not-ap { display: none !important; }
  /* While Autopilot runs, each loop tab says whose it is: AUTO for Autopilot's, YOU for yours */
  .tabs .who { font: 400 14px/1 var(--f-osd); letter-spacing: .04em; padding: 2px 4px; border-radius: 3px; border: 1px solid var(--line); color: var(--dim); }
  .tabs .who.auto { color: var(--amber-ink, #e7b8ff); border-color: var(--loop-a); }
  .ap-loops-ctl { margin-top: 12px; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 9px; background: var(--well); border: 1px solid var(--line); }
  .tabs button {
    display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px;
    border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; font-weight: 600; color: var(--dim);
  }
  .tabs button .tag {
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px;
    font: 400 18px/1 var(--f-osd); color: #111;
  }
  #tabA .tag { background: var(--loop-a); }
  #tabB .tag { background: var(--loop-b); }
  #tabC .tag { background: var(--loop-c); }
  #tabD .tag { background: var(--loop-d); }
  .tabs[data-n="3"] { grid-template-columns: repeat(3, 1fr); }
  .tabs[data-n="4"] { grid-template-columns: repeat(4, 1fr); }
  .tabs[data-n="3"] button, .tabs[data-n="4"] button { gap: 6px; padding-inline: 2px; }
  .tabs[data-n="4"] .tab-name { display: none; }
  @media (min-width: 1500px) { .tabs[data-n="4"] .tab-name { display: inline; } }
  .tabs button[aria-selected="true"] { background: linear-gradient(var(--raise-2), var(--raise)); border-color: var(--line); color: var(--ink); }
  .tabs button { white-space: nowrap; }
  .tabs .vis { width: 8px; height: 8px; border-radius: 50%; background: #39303c; box-shadow: inset 0 1px 1px rgba(0,0,0,.6); }
  .tabs .vis.on { background: var(--tally); box-shadow: 0 0 8px rgba(255,75,62,.7); }

  .dev { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 6px; background: var(--well); border: 1px solid var(--line); }
  .dev-status { font-size: 14px; color: var(--dim); overflow-wrap: anywhere; }
  .dev-status b { color: var(--ink); font-weight: 600; }
  .dev-status.warn, .dev-status.warn b { color: #ffc98a; }
  .dev-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .live { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--tally); box-shadow: 0 0 8px rgba(255,75,62,.7); vertical-align: 1px; }
  .vcr { display: flex; flex-direction: column; gap: 10px; }
  .vcr-time { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
  .vcr-time .tc { font: 19px/1 var(--f-osd); color: var(--amber-ink); font-variant-numeric: tabular-nums; min-width: 4ch; }
  .vcr-keys { display: flex; flex-wrap: wrap; gap: 6px; }
  /* The marked part of the video, as a bar under the position slider */
  .vid-track { position: relative; display: flex; align-items: center; min-width: 0; }
  .vid-track input { width: 100%; }
  .vid-mark { position: absolute; bottom: -5px; height: 4px; border-radius: 2px; background: var(--amber); opacity: .9; pointer-events: none; }
  /* Save clip (under the picture): trim the video playing, then save that part to Phosphor Clips with the look */
  .clip-saver { display: flex; flex-direction: column; gap: 6px; }
  .clip-saver:has(#snipPanel[hidden]):has(.snip-status:empty) { display: none; }
  .snip-form { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); }
  .snip-form[hidden] { display: none; }
  .snip-form select { margin: 0; }
  .snip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .snip-what { font-size: 13px; color: var(--dim); }
  .snip-fields { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
  .snip-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
  .snip-opts .spacer { flex: 1; }
  .snip-sound { display: flex; align-items: center; gap: 6px; font-size: 14px; }
  .snip-status { margin: 0; }
  .snip-status:empty { display: none; }
  /* What Save clip does (see snipStage in js/app.js): choose (a video is in: trim it or record the settings),
     rec / recording / recorded (the settings), trim (the video) */
  .snip-choose, .snip-rec, #snipRedo { display: none; }
  .snip-form[data-stage="choose"] .snip-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .snip-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; text-align: left; white-space: normal; height: auto; }
  .snip-pick small { font-size: 13px; color: var(--dim); font-weight: 400; }
  .snip-form:is([data-stage="rec"], [data-stage="recording"], [data-stage="recorded"]) .snip-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .snip-rec-hint { margin: 0; font-size: 13px; flex-basis: 100%; }
  .snip-size { display: flex; align-items: center; gap: 6px; font-size: 14px; }
  .snip-size select { margin: 0; }
  .snip-form[data-stage="recording"] :is(.snip-size, .snip-recsound) { opacity: .5; pointer-events: none; }
  .snip-form[data-stage="recorded"] .snip-size { display: none; }
  .snip-form[data-stage="recorded"] #snipRedo { display: inline-flex; }
  .snip-form[data-stage="recorded"] #snipRecGo { display: none; }
  .snip-form:not([data-stage="trim"]) :is(.trim, .snip-trimonly) { display: none; }
  .snip-form:is([data-stage="choose"], [data-stage="rec"], [data-stage="recording"]) :is(.snip-fields, #snipSave) { display: none; }
  .session-bar.moves-bar { border-color: rgba(255,75,62,.45); background: rgba(255,75,62,.07); }
  .moves-bar .session-row .live { background: var(--tally); box-shadow: 0 0 8px rgba(255,75,62,.7); }
  @media (max-width: 700px) { .snip-form[data-stage="choose"] .snip-choose { grid-template-columns: minmax(0, 1fr); } }
  .trim { display: flex; flex-direction: column; gap: 8px; }
  .trim-bar { position: relative; height: 34px; border-radius: 6px; background: var(--well); border: 1px solid var(--line); cursor: pointer; touch-action: none; }
  .trim-sel { position: absolute; top: 0; bottom: 0; background: rgba(139,26,184,.28); border-top: 2px solid var(--amber); border-bottom: 2px solid var(--amber); pointer-events: none; }
  .trim-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,.8); pointer-events: none; }
  .trim-h { position: absolute; top: 0; bottom: 0; width: 14px; margin-left: -7px; padding: 0; border: 0; border-radius: 4px; background: var(--amber); cursor: ew-resize; touch-action: none; }
  .trim-h::after { content: ""; position: absolute; left: 6px; top: 30%; bottom: 30%; width: 2px; background: rgba(255,255,255,.7); }
  .trim-h:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
  /* the whole video, above the strip: the trimmed part, and the stretch the strip is zoomed in on */
  .trim-over { position: relative; height: 8px; border-radius: 4px; background: var(--well); border: 1px solid var(--line); cursor: pointer; }
  .trim-over-sel { position: absolute; top: 0; bottom: 0; background: var(--amber); opacity: .75; border-radius: 3px; pointer-events: none; }
  .trim-over-view { position: absolute; top: -3px; bottom: -3px; border: 1.5px solid rgba(255,255,255,.8); border-radius: 4px; pointer-events: none; }
  .trim-over-head { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
  .trim-over[data-whole="1"] .trim-over-view { display: none; }
  .trim-bar { overflow: hidden; }
  .trim-vt { position: absolute; bottom: 2px; font: 12px/1 var(--f-osd); color: var(--faint); pointer-events: none; z-index: 1; }
  .trim-v0 { left: 5px; } .trim-v1 { right: 5px; }
  .trim-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
  .trim-row .tc { font: 17px/1 var(--f-osd); color: var(--amber-ink); font-variant-numeric: tabular-nums; min-width: 6ch; }
  @media (max-width: 700px) { .snip-fields { grid-template-columns: minmax(0, 1fr); } }
  details.adj { border-top: 1px solid var(--line); padding-top: 8px; }
  details.adj summary {
    cursor: pointer; font-weight: 600; font-size: 14px; color: var(--dim); list-style-position: inside;
    padding-block: 4px;
  }
  details.adj summary:hover { color: var(--ink); }
  details.adj[open] summary { color: var(--ink); margin-bottom: 6px; }
  .adj-body { display: flex; flex-direction: column; gap: 8px; }
  .qr-wrap { display: flex; gap: 12px; align-items: center; }
  .qr-wrap canvas { flex: none; width: 128px; height: 128px; border-radius: 6px; background: #fff; image-rendering: pixelated; }
  .qr-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; }
  .qr-url { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; user-select: all; }


  .ctl { display: grid; gap: 2px; }
  .ctl[hidden] { display: none; }
  /* Descriptions shown as hover tooltips instead (see hintsToTips) */
  .hint.as-tip { display: none !important; }
  [data-tip] { cursor: help; }
  button[data-tip] { cursor: pointer; }
  .tip-pop {
    position: fixed; z-index: 1000; max-width: 340px; padding: 8px 10px; border-radius: 6px; pointer-events: none;
    background: #18151a; border: 1px solid var(--line); color: var(--ink); font-size: 13px; line-height: 1.45;
    white-space: pre-line; box-shadow: 0 6px 20px rgba(0,0,0,.55);
  }
  .ctl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .ctl-head label, .ctl-head .lbl { font-weight: 600; font-size: 15px; }
  .mini {
    display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; vertical-align: 1px;
    font: 400 16px/1 var(--f-osd); color: #111;
  }
  .mini.a { background: var(--loop-a); }
  .mini.b { background: var(--loop-b); }
  .mini.c { background: var(--loop-c); }
  .mini.d { background: var(--loop-d); }
  #inputs button[data-src="loop"], [data-mid="inputs"] button[data-src="loop"] { grid-column: 1 / -1; }
  /* Each loop's Show fader lights up in that loop's color */
  input[type="range"].lf-a { --amber: var(--loop-a); }
  input[type="range"].lf-b { --amber: var(--loop-b); }
  input[type="range"].lf-c { --amber: var(--loop-c); }
  input[type="range"].lf-d { --amber: var(--loop-d); }
  .show-ctl { gap: 0; }
  /* Final Pass / Within Loops: a small switch in an effect's title row, between its name and its value */
  .ctl-head:has(.where-mini) { flex-wrap: wrap; row-gap: 4px; align-items: center; }
  .ctl-head .where-mini { display: inline-grid; grid-template-columns: auto auto; gap: 0; margin-right: auto; }
  .ctl-head .where-mini button { min-height: 22px; padding: 2px 7px; font-size: 11.5px; border-radius: 0; }
  .ctl-head .where-mini button:first-child { border-radius: 5px 0 0 5px; }
  .ctl-head .where-mini button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
  /* Posterize › Colors: a swatch per theme */
  .poster-colors { margin-top: 6px; font-size: 11.5px; opacity: .92; }
  .poster-colors b { font-weight: 600; }
  .poster-themes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
  .poster-themes button { height: 18px; min-height: 18px; padding: 0; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; cursor: pointer; }
  .poster-themes button[aria-pressed="true"] { outline: 2px solid var(--amber); outline-offset: 1px; border-color: #fff; }
  /* Chaos game › Colors: a strip per set of colors */
  .chaos-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 4px; width: 100%; }
  .chaos-colors button { height: 22px; min-height: 22px; padding: 0; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; cursor: pointer; }
  .chaos-colors button[aria-pressed="true"] { outline: 2px solid var(--amber); outline-offset: 1px; border-color: #fff; }
  .ctl-head output { font-family: var(--f-osd); font-size: 19px; line-height: 1; color: var(--amber-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); letter-spacing: .02em; }
  .ctl select { margin-top: 4px; }

  /* Autopilot pins: shown beside each setting while Autopilot runs, and whenever one is pinned */
  .pin {
    display: none; place-items: center; flex: none; align-self: center; margin-left: auto;
    width: 30px; height: 24px; padding: 0; border-radius: 5px; cursor: pointer;
    border: 1px solid var(--line); background: var(--well); color: var(--faint);
  }
  .pin svg { width: 14px; height: 14px; display: block; }
  .pin:hover { color: var(--ink); border-color: #524756; }
  .pin[aria-pressed="true"] { color: var(--amber-ink); border-color: var(--amber); background: rgba(139,26,184,.12); }
  .editor[data-loop="B"] .pin[aria-pressed="true"], .show-ctl[data-loop-row="B"] .pin[aria-pressed="true"] { background: rgba(79,209,197,.12); }
  .ap-on .pin, .pin[aria-pressed="true"] { display: inline-grid; }
  /* A pin holding the setting on both loops (right-click) is wider and says AB */
  .pin .pin-ab { display: none; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; line-height: 1; }
  .pin.both { width: auto; padding: 0 7px; grid-auto-flow: column; gap: 4px; }
  .pin.both .pin-ab { display: block; }
  .ctl-head:has(.pin) { align-items: center; }
  .ctl-head:has(.drift-mini) { align-items: center; }
  .ctl-head .drift-mini { min-height: 22px; padding: 2px 8px; font-size: 11.5px; gap: 5px; margin-right: auto; }
  .ctl-head .drift-mini .led { width: 6px; height: 6px; }
  .ap-state { margin: 0; font-size: 14px; color: var(--dim); }
  .ap-state b { color: var(--ink); font-weight: 600; }
  .ap-state .live { background: var(--loop-a); box-shadow: 0 0 8px var(--amber-glow); }
  .ap-reset { align-self: flex-start; font-size: 13px; font-weight: 500; }

  /* Next look: Autopilot's next new look straight away */
  .next-look .skip { width: 15px; height: 11px; flex: none; color: var(--loop-a-ink); }
  /* More like this and Not this, under the picture: just a thumb up and a thumb down (no words), and a quick glow when pressed */
  .rate .thumb { width: 18px; height: 18px; flex: none; }
  /* The small strip under the picture: More like this, Not this, and how long this look has left */
  .taste-strip {
    width: fit-content; max-width: 100%; margin-inline: auto 0; gap: 6px; padding: 5px 6px;
    border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025);
  }
  .taste-strip .btn { min-height: 34px; padding: 5px 12px; }
  .taste-strip .rate { min-width: 46px; justify-content: center; }
  .look-clock {
    display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px 0 8px;
    border-radius: 6px; background: var(--well); color: var(--dim); font-size: 14px; white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .look-clock b { color: var(--ink); font-weight: 600; display: inline-block; min-width: 3.2ch; text-align: right; }
  .look-clock .ring {
    width: 14px; height: 14px; border-radius: 50%; flex: none;
    background: conic-gradient(var(--loop-a) calc(var(--p, 0) * 1turn), rgba(255,255,255,.13) 0);
  }
  .look-clock.off .ring { background: rgba(255,255,255,.13); }
  .look-clock .lc-s { display: none; }
  @media (max-width: 480px) {
    .look-clock .lc-l { display: none; }
    .look-clock .lc-s { display: inline; }
    .taste-strip .btn { padding-inline: 10px; }
    .look-clock { padding-inline: 7px 8px; }
  }
  .look-clock.off { color: var(--faint); }
  .rate-up .thumb { color: var(--gun-g); }
  .rate-down .thumb { color: var(--tally); transform: rotate(180deg); }
  .rate.flash { animation: rate-flash .9s ease-out; }
  .rate-up.flash { --rate-glow: rgba(61, 220, 132, .55); }
  .rate-down.flash { --rate-glow: rgba(255, 75, 62, .55); }
  @keyframes rate-flash {
    from { box-shadow: 0 0 0 2px var(--rate-glow), 0 0 18px var(--rate-glow); }
    to { box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.4); }
  }
  /* Lit for as long as this very look is rated that way, so you can see at a glance that you've already pressed it */
  .rate.rated.rate-up, .rate.rated.rate-up:hover {
    --rate-glow: rgba(61, 220, 132, .6); border-color: rgba(61, 220, 132, .95);
    background: linear-gradient(rgba(61, 220, 132, .38), rgba(61, 220, 132, .24)); color: #eafff1;
  }
  .rate.rated.rate-down, .rate.rated.rate-down:hover {
    --rate-glow: rgba(255, 75, 62, .6); border-color: rgba(255, 75, 62, .95);
    background: linear-gradient(rgba(255, 75, 62, .38), rgba(255, 75, 62, .24)); color: #ffe6e3;
  }
  .rate.rated { box-shadow: 0 0 0 1px var(--rate-glow), 0 0 16px var(--rate-glow); }
  @media (prefers-reduced-motion: reduce) { .rate.flash { animation: none; } }
  .taste-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
  /* Taste profiles: tiles like presets, two to a row so their buttons fit */
  .tp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-load {
    width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px;
    border-radius: 7px; border: 1px solid var(--line); border-bottom-color: #0b0a0c;
    background: linear-gradient(var(--raise-2), var(--raise)); cursor: pointer; text-align: left;
  }
  .tp-load:hover { border-color: #524756; }
  .tp-load[aria-pressed="true"] { border-color: var(--gun-g); box-shadow: 0 0 0 1px var(--gun-g); }
  .tp-load .sw { display: block; height: 44px; border-radius: 4px; background: #0a090b center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
  .tp-load .sw.blank { background: radial-gradient(circle at 30% 40%, rgba(61,220,132,.55) 0 18%, transparent 40%), radial-gradient(circle at 72% 60%, rgba(139,26,184,.5) 0 16%, transparent 38%), #0a090b; }
  .tp-load .nm { font-size: 13px; line-height: 1.15; padding-inline: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tp-load .ct { font-size: 11.5px; line-height: 1.1; padding-inline: 2px; color: var(--faint); }
  .tp-load[aria-pressed="true"] .ct { color: var(--gun-g); }
  .tp-ics { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
  .tp-ic {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer;
    border: 1px solid rgba(255,255,255,.2); background: rgba(9,8,10,.82); color: var(--ink); font: 600 13px/1 var(--f-body);
  }
  .tp-ic:hover { border-color: var(--loop-a); }
  .tp-ic.share { color: var(--loop-a-ink); }
  #tasteAdminNote .admin-tag { margin-right: 4px; }
  /* The taste session bar, under the buttons under the picture */
  .session-bar {
    display: flex; flex-direction: column; gap: 8px; padding: 8px 12px; border-radius: 8px;
    border: 1px solid rgba(61,220,132,.45); background: rgba(61,220,132,.07);
  }
  .session-bar[hidden] { display: none; }
  .session-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
  .session-row .live { background: var(--gun-g); box-shadow: 0 0 8px rgba(61,220,132,.7); }
  .session-row #sessionText { color: var(--ink); }
  .session-form { max-width: 460px; width: 100%; align-self: center; }
  #tasteState .live { background: var(--gun-g); box-shadow: 0 0 8px rgba(61,220,132,.7); }
  .session-btn[aria-pressed="true"] .led { background: var(--gun-g); box-shadow: 0 0 8px rgba(61,220,132,.7); }
  .btn.armed { border-color: var(--tally); color: #ffd9d5; }

  /* Fader limits: the button under Autopilot settings, and the menu it opens over the controls */
  .lim-btn svg { width: 24px; height: 12px; flex: none; color: var(--amber-ink); }
  .lim-btn[aria-expanded="true"] { border-color: var(--amber); color: var(--press-ink); }
  .lim-count {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: var(--amber); color: #fbf5fe; font: 700 12px/1 var(--f-body);
  }
  .lim-count[hidden] { display: none; }
  .lim {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: 420px; max-width: 100vw;
    display: flex; flex-direction: column;
    background: var(--panel); border-left: 1px solid var(--line); box-shadow: -18px 0 40px rgba(0,0,0,.5);
  }
  .lim[hidden] { display: none; }
  .lim-bar { position: static; flex: none; }
  .lim-bar .wordmark { color: var(--loop-a-ink); }
  .lim-inner {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 18px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 24px;
  }
  .lim-lede { margin: 0; color: var(--dim); }
  .lim-lede b { color: var(--ink); font-weight: 600; }
  .lim-list { display: flex; flex-direction: column; gap: 14px; }
  .lim-row .ctl-head output.any { color: var(--faint); }
  .lim-row.set .ctl-head .lbl::after {
    content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; vertical-align: 2px;
    background: var(--amber); box-shadow: 0 0 8px var(--amber-glow);
  }
  /* A fader with two handles: two sliders stacked on one track, each grabbed only by its handle */
  .dual { position: relative; height: 30px; --fa: 0; --fb: 1; touch-action: none; cursor: pointer; }
  .dual-track {
    position: absolute; left: 0; right: 0; top: 11px; height: 8px; border-radius: 4px; pointer-events: none;
    background: linear-gradient(90deg,
      var(--well) 0 calc(8px + (100% - 16px) * var(--fa)),
      var(--amber) calc(8px + (100% - 16px) * var(--fa)) calc(8px + (100% - 16px) * var(--fb)),
      var(--well) calc(8px + (100% - 16px) * var(--fb)) 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.04);
  }
  .dual.bipolar .dual-track::after {
    content: ""; position: absolute; left: calc(50% - 1px); top: -3px; width: 2px; height: 14px; border-radius: 1px; background: var(--dim); opacity: .6;
  }
  .dual input[type="range"] { position: absolute; inset: 0; pointer-events: none; }
  .dual input[type="range"]::-webkit-slider-runnable-track { background: transparent; box-shadow: none; }
  .dual input[type="range"]::-moz-range-track { background: transparent; box-shadow: none; }
  .dual input[type="range"]::-webkit-slider-thumb { pointer-events: auto; cursor: grab; }
  .dual input[type="range"]::-moz-range-thumb { pointer-events: auto; cursor: grab; }
  /* Mirror's five stops, named under the slider, each centred under the spot its handle stops at */
  .lim-ticks { position: relative; height: 16px; margin-top: 2px; font: 12px/16px var(--f-body); color: var(--dim); }
  .lim-ticks span { position: absolute; top: 0; left: calc(8px + (100% - 16px) * var(--p)); transform: translateX(-50%); }
  @media (max-width: 900px) {
    .lim { width: 100vw; border-left: 0; box-shadow: none; }
  }
  @media (max-width: 520px) {
    .lim-inner { padding-inline: 16px; }
    .lim-bar { padding-inline: 16px; }
  }

  /* fader */
  input[type="range"] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0;
    background: transparent; cursor: pointer; --a: 0%; --b: 50%;
  }
  input[type="range"]:focus-visible { outline: none; }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 8px; border-radius: 4px;
    background: linear-gradient(90deg, var(--well) 0 var(--a), var(--amber) var(--a) var(--b), var(--well) var(--b) 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.04);
  }
  input[type="range"]::-moz-range-track {
    height: 8px; border-radius: 4px;
    background: linear-gradient(90deg, var(--well) 0 var(--a), var(--amber) var(--a) var(--b), var(--well) var(--b) 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.7);
  }
  input[type="range"].bipolar::-webkit-slider-runnable-track {
    background:
      linear-gradient(90deg, transparent calc(50% - 1px), var(--dim) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
      linear-gradient(90deg, var(--well) 0 var(--a), var(--amber) var(--a) var(--b), var(--well) var(--b) 100%);
  }
  input[type="range"].bipolar::-moz-range-track {
    background:
      linear-gradient(90deg, transparent calc(50% - 1px), var(--dim) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
      linear-gradient(90deg, var(--well) 0 var(--a), var(--amber) var(--a) var(--b), var(--well) var(--b) 100%);
  }
  /* the A/B view fader: amber on the A side, teal on the B side */
  input[type="range"].ab::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--loop-a), #6f517b 50%, var(--loop-b)); }
  input[type="range"].ab::-moz-range-track { background: linear-gradient(90deg, var(--loop-a), #6f517b 50%, var(--loop-b)); }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 28px; margin-top: -10px; border-radius: 4px;
    border: 1px solid #0a090b;
    background: linear-gradient(90deg, transparent 6.5px, #241f26 6.5px 8.5px, transparent 8.5px), linear-gradient(#eae3ed, #ad9db4);
    box-shadow: 0 2px 5px rgba(0,0,0,.55);
  }
  input[type="range"]::-moz-range-thumb {
    width: 14px; height: 26px; border-radius: 4px;
    border: 1px solid #0a090b;
    background: linear-gradient(90deg, transparent 6px, #241f26 6px 8px, transparent 8px), linear-gradient(#eae3ed, #ad9db4);
    box-shadow: 0 2px 5px rgba(0,0,0,.55);
  }
  input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--amber-ink); outline-offset: 2px; }
  input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--amber-ink); outline-offset: 2px; }

  /* ---------- top bar guide button ---------- */
  .top-right { display: flex; align-items: center; gap: 16px; }
  .guide-btn { min-height: 34px; padding: 5px 14px; gap: 7px; }
  .guide-btn .q {
    display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    background: var(--loop-a); color: #fbf5fe; font: 700 12px/1 var(--f-body);
  }

  /* ---------- guide page ---------- */
  .guide {
    position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain;
    background: var(--chassis); color: var(--ink);
  }
  .guide-bar {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px;
    background: rgba(24,22,25,.94); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
  }
  .guide-bar .wordmark { font-size: 13px; }
  .guide-bar .spacer { flex: 1; }
  .guide-inner { max-width: 880px; margin: 0 auto; padding: 32px 20px calc(56px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 44px; }
  .guide .g-eyebrow { margin: 0 0 12px; font: 20px/1 var(--f-osd); color: var(--loop-a-ink); letter-spacing: .04em; }
  .guide h1 { margin: 0; font: 400 clamp(22px, 3.4vw, 32px)/1.25 var(--f-display); letter-spacing: .06em; text-transform: uppercase; text-wrap: balance; }
  .guide .g-lede { margin: 16px 0 0; font-size: 17px; line-height: 1.55; color: var(--dim); max-width: 62ch; }
  .guide h2 { margin: 0 0 14px; font: 600 22px/1.2 var(--f-body); text-wrap: balance; }
  .guide h2 small { font: 11px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 8px; }
  .guide h3 { margin: 0; font: 600 16px/1.3 var(--f-body); }
  .guide p { margin: 0; line-height: 1.55; }
  .g-flow { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
  .g-node { flex: 1 1 150px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
  .g-node b { display: block; font: 19px/1 var(--f-osd); color: var(--loop-a-ink); letter-spacing: .04em; margin-bottom: 4px; }
  .g-node span { font-size: 14px; color: var(--dim); }
  .g-arrow { align-self: center; font: 24px/1 var(--f-osd); color: var(--faint); }
  .g-return { flex-basis: 100%; font: 18px/1 var(--f-osd); color: var(--faint); text-align: center; padding-top: 2px; }
  .g-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
  .g-steps li { counter-increment: step; padding: 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); line-height: 1.5; }
  .g-steps li::before { content: counter(step); display: block; font: 30px/1 var(--f-osd); color: var(--loop-a-ink); margin-bottom: 6px; }
  .g-steps li b { color: var(--ink); }
  .g-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
  .g-card { padding: 16px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
  .g-card dl, .g-fix { margin: 0; display: grid; gap: 8px; }
  .g-card dt, .g-fix dt { font-weight: 600; }
  .g-card dd, .g-fix dd { margin: -6px 0 0; color: var(--dim); line-height: 1.5; }
  .g-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--dim); line-height: 1.5; max-width: 66ch; }
  .g-list b { color: var(--ink); }
  .g-keys { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 16px; font-size: 14px; color: var(--dim); }
  .g-keys div { display: flex; gap: 10px; align-items: baseline; }
  .g-keys kbd { min-width: 64px; text-align: center; font: 13px/1 var(--f-body); color: var(--ink); padding: 4px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--raise); }
  .g-recipes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
  .g-recipe { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
  .g-recipe .g-swatch { height: 54px; border-radius: 6px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
  .g-recipe p { color: var(--dim); font-size: 14.5px; }
  .g-recipe .g-how { font: 17px/1.25 var(--f-osd); color: var(--loop-a-ink); letter-spacing: .02em; }
  .g-recipe .g-act { margin-top: auto; padding-top: 4px; }
  .g-recipe .g-act .hint { display: block; }
  .g-fix { max-width: 70ch; }

  /* ---------- nature pictures ---------- */
  .pic-credit { font-size: 12.5px; line-height: 1.4; color: var(--faint); overflow-wrap: anywhere; }
  .pic-credit a { color: var(--dim); }
  .nat-step { min-width: 40px; padding-inline: 8px; }
  .nat-count { font: 18px/1 var(--f-osd); color: var(--faint); letter-spacing: .04em; }
  .nat-inner { padding: 14px 16px calc(40px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
  .nat-bar { flex-wrap: wrap; row-gap: 10px; }
  .nat-tabs { margin: 0; flex-basis: 100%; }
  .nat-tabs .chip b { font: 16px/1 var(--f-osd); color: var(--faint); font-weight: 400; }
  .nat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  @media (max-width: 520px) {
    .nat-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
    .nat-count { display: none; }
    .nat-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
    .nat-tabs::-webkit-scrollbar { display: none; }
    .nat-tabs .chip { flex: none; }
  }
  .nat-tile {
    position: relative; display: block; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer;
    border: 1px solid var(--line); background: #0a090b; aspect-ratio: 4 / 3; color: inherit; font: inherit;
  }
  .nat-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease, filter .25s ease; }
  .nat-tile span {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 5px; text-align: left;
    font-size: 12px; line-height: 1.25; color: #fff; text-shadow: 0 1px 2px #000;
    background: linear-gradient(transparent, rgba(0,0,0,.75));
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #genGrid .nat-tile { aspect-ratio: 1; }
  #genGrid .nat-tile > video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform .25s ease, filter .25s ease; }
  .nat-tile:hover img, .nat-tile:focus-visible img, #genGrid .nat-tile:hover > video, #genGrid .nat-tile:focus-visible > video { transform: scale(1.06); filter: brightness(1.12); }
  .nat-tile[aria-current="true"] { border-color: var(--loop-a); box-shadow: 0 0 0 2px var(--loop-a), 0 0 14px var(--amber-glow); }
  .nat-foot { margin-top: 8px; }
  /* ---------- clip library ---------- */
  .clips-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .clips-grid .nat-tile { aspect-ratio: 16 / 9; }
  .nat-tile img.sticker-thumb { height: 200%; object-fit: contain; object-position: center top; }
  /* ---------- the preset library (shares the clip explorer's layout) ---------- */
  .lb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .lb-row[hidden], .lb-more[hidden], .lb-box[hidden] { display: none; }
  .lb-row .seq-in { flex: 1 1 220px; max-width: 420px; min-width: 0; }
  .lb-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
  .lb-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); }
  .lb-pic { object-fit: cover; }
  .lb-pic:not([src]), .lb-pic[src=""] { visibility: hidden; }
  .lib .nat-tile .lb-none { position: absolute; inset: 0; display: grid; place-items: center; padding: 0; background: none; font-size: 12px; color: var(--faint); text-shadow: none; }
  .lib .cx-node .lb-fb { flex: none; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 4px 6px; font-size: 13px; border-radius: 5px; }
  .lib .cx-node .lb-fb:hover { color: var(--ink); background: var(--raise); }
  .lib .cx-node.drop .cx-fold { outline: 2px dashed var(--loop-a); outline-offset: -2px; color: var(--ink); }
  .lib .cx-use .btn.small { flex: 1 1 120px; }
  #libDel.sure { border-color: var(--tally); color: var(--tally); }
  #presetRecent { display: block; margin: 2px 0 -2px; }
  #presetRecent[hidden] { display: none; }
  /* ---------- the clip explorer ---------- */
  .cx-search { flex: 1 1 260px; max-width: 460px; min-width: 0; }
  .nat-bar select { margin: 0; width: auto; flex: none; }
  .cx-tags { margin: 0; flex-basis: 100%; }
  .cx-tags:empty { display: none; }
  .cx-tags .chip { font-size: 13px; }
  .cx-tags .chip b { font: 14px/1 var(--f-osd); color: var(--faint); font-weight: 400; }
  .cx-body { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr); gap: 16px; align-items: start; }
  .cx-body:has(.cx-side:not([hidden])) { grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) minmax(280px, 360px); }
  /* the folder tree: categories, then their subfolders */
  .cx-tree { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 160px); overflow-y: auto; }
  .cx-treelist { display: flex; flex-direction: column; gap: 1px; }
  .cx-node { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--d, 0) * 14px); }
  .cx-node .cx-tw { width: 20px; flex: none; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 4px 0; font-size: 11px; }
  .cx-node .cx-tw:disabled { visibility: hidden; }
  .cx-node .cx-fold { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left; border: 0; border-radius: 5px; background: none; color: var(--dim); cursor: pointer; padding: 5px 8px; font: 14px var(--f-body); }
  .cx-node .cx-fold span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cx-node .cx-fold b { font: 14px/1 var(--f-osd); color: var(--faint); font-weight: 400; }
  .cx-node .cx-fold:hover { background: var(--raise); color: var(--ink); }
  .cx-node .cx-fold[aria-current="true"] { background: var(--press-1); color: var(--press-ink); }
  .cx-tree > .btn { align-self: flex-start; }
  .cx-newform[hidden] { display: none; }
  .cx-newform { display: flex; flex-direction: column; gap: 4px; }
  .cx-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
  .cx-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .cx-more { height: 1px; }
  .cx-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); max-height: calc(100vh - 160px); overflow-y: auto; }
  .cx-video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; object-fit: contain; }
  .cx-one, .cx-many { display: flex; flex-direction: column; gap: 10px; }
  .cx-one[hidden], .cx-many[hidden] { display: none; }
  .cx-side select { margin: 0; }
  .cx-taged { display: flex; flex-direction: column; gap: 6px; }
  .cx-taged .lbl { font-size: 13px; color: var(--dim); }
  .cx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .cx-chips:empty::after { content: "No tags yet"; font-size: 13px; color: var(--faint); }
  .cx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 999px; background: var(--press-1); color: var(--press-ink); font-size: 13px; }
  .cx-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 15px; line-height: 1; opacity: .75; }
  .cx-chip button:hover { opacity: 1; }
  .cx-fx { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
  .cx-fxstate { font-size: 14px; color: var(--dim); }
  .cx-fxstate b { color: var(--amber-ink); font-weight: 600; }
  .cx-use { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
  .cx-use .btn { flex: 1 1 140px; }
  .cx-facts { font-size: 12.5px; }
  .clips-grid .nat-tile[aria-selected="true"] { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
  .nat-tile .cx-fxb { position: absolute; left: 5px; top: 5px; padding: 1px 6px; border-radius: 4px; background: var(--amber); color: #fff; font: 600 11px/1.5 var(--f-body); letter-spacing: .04em; }
  .nat-tile .cx-fxb.mv { background: var(--tally); }
  .nat-tile .cx-tl { position: absolute; left: 0; right: 0; bottom: 21px; padding: 0 7px; font-size: 11px; color: #e7d6f2; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; background: none; }
  @media (max-width: 900px) {
    .cx-body, .cx-body:has(.cx-side:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
    .cx-side { position: static; max-height: none; order: -1; }
    .cx-tree { position: static; max-height: 40vh; }
  }
  .clip-dur { position: absolute; right: 5px; top: 5px; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.7);
    font: 14px/1.2 var(--f-osd); font-style: normal; color: #fff; }
  .clips-ap { display: flex; flex-direction: column; gap: 4px; }
  .clips-ap .lbl { font-size: 13px; color: var(--dim); }
  .clips-msg { max-width: 62ch; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); }
  .clips-msg p { margin: 0 0 10px; line-height: 1.5; color: var(--dim); }
  .clips-msg p b { color: var(--ink); }
  .clips-msg a.btn { text-decoration: none; display: inline-flex; align-items: center; }
  .nat-foot a { color: var(--dim); }
  .g-foot { display: flex; justify-content: center; }

  /* ---------- narrow screens ---------- */
  @media (max-width: 900px) {
    html, body { height: auto; }
    .app { height: auto; display: block; }
    .deck { grid-template-columns: minmax(0, 1fr); }
    .deck-split, .rz { display: none; }
    .monitor { padding: 16px; }
    .stage { flex: none; }
    .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 20px 16px 32px; }
    .top { padding: 10px 16px; }
    .readout .lines { display: none; }
    .top-right { gap: 10px; }
    .bezel { padding: 6px; border-radius: 12px; }
  }
  @media (max-width: 520px) {
    .top .readout { display: none; }
    .g-arrow { display: none; }
    .g-return { text-align: left; }
  }
  @media (max-width: 420px) {
    .wordmark { font-size: 13px; letter-spacing: .16em; }
    .readout { font-size: 18px; }
    .readout .tc-label { display: none; }
    .guide-btn { padding-inline: 10px; }
    .transport .btn { padding-inline: 11px; }
    .seg button { font-size: 12.5px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .osd, .tip { transition: none; }
    .rec-ind .dot { animation: none; }
  }

  /* How often Autopilot uses an input: the pie on each switch, and the menu a right-click opens */
  .pie { width: 15px; height: 15px; flex: none; }
  .pie-r { fill: none; stroke: currentColor; stroke-width: 1.3; opacity: .55; }
  .pie-f { fill: var(--loop-a-ink); }
  .chip .pie { margin-left: 1px; color: var(--dim); }
  .chip[aria-pressed="false"] .pie { opacity: .45; }
  .wpie { display: inline-flex; }
  .wpop {
    position: fixed; z-index: 60; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 12px 14px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
    box-shadow: 0 12px 32px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 8px;
  }
  .wpop[hidden] { display: none; }
  .wpop-head { display: flex; align-items: center; gap: 8px; }
  .wpop-title { flex: 1; font-family: var(--f-display); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--loop-a-ink); }
  .wpop-x { min-width: 32px; min-height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--raise); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
  .wpop-back { align-self: flex-start; font-size: 13px; }
  .wpop-q { margin: 0; font-size: 13px; color: var(--dim); }
  .wpop-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .wlv {
    display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 52px; padding: 7px 4px 6px; border-radius: 7px;
    border: 1px solid var(--line); border-bottom-color: #0b0a0c; background: linear-gradient(var(--raise-2), var(--raise));
    color: var(--ink); font: 500 13px/1.1 var(--f-body); cursor: pointer;
  }
  .wlv .pie { width: 20px; height: 20px; color: var(--dim); }
  .wlv[aria-pressed="true"] { border-color: var(--amber); background: linear-gradient(var(--press-1), var(--press-2)); color: var(--press-ink); }
  .wlv[aria-pressed="true"] .pie { color: var(--press-ink); }
  .wpop-share { margin: 0; font-size: 13px; color: var(--ink); min-height: 1.45em; }
  .wpop-sub { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
  .wpop-sub[hidden] { display: none; }
  .wpop-sub .hint { font-size: 12px; }
  @media (max-width: 600px) {
    .wpop { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); top: auto; width: auto; max-height: 70vh; }
  }

.spotify-connect { padding: 10px; margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; }
#spotifyClientId { width: 100%; min-width: 0; margin-top: 6px; }
#spotifySetup { overflow-wrap: anywhere; }
#spotifyNow, #spotifyNext { overflow-wrap: anywhere; }
#spotifyQueue { padding-left: 20px; font-size: 12px; }
#sequenceGroup .dev-actions { flex-wrap: wrap; }

/* ---------- sequencer under the picture: four tracks (loops A to D) of looks placed by time ---------- */
.seq { --seq-head: 190px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.seq[hidden] { display: none; }
.seq-head, .seq-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.seq .btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.seq-head h2 { margin: 0; font: 12px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.seq-grp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seq-song { flex: 1 1 180px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.seq-song span { color: var(--dim); }
.seq-clock { font: 20px/1 var(--f-osd); color: var(--osd); font-variant-numeric: tabular-nums; }
.seq-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.seq-in { background: var(--well); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; font: 14px var(--f-body); color: var(--ink); }
.seq-vsep { width: 1px; height: 24px; background: var(--line); }
.seq-tools { font-size: 14px; color: var(--dim); }
.seq-tools b { color: var(--ink); font-weight: 600; }
.seq-note { margin: 0; flex: 1 1 200px; min-width: 0; color: var(--loop-a-ink); font-size: 13px; line-height: 1.3; }
.seq-save { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seq-save[hidden] { display: none; }
.seq-save input { width: min(260px, 60vw); }
.btn.seq-handbtn[aria-pressed="true"] .led { background: #3ddc84; box-shadow: 0 0 8px rgba(61,220,132,.7); }
.btn#seqLetGo.live { border-color: #3ddc84; color: var(--ink); box-shadow: 0 0 8px rgba(61,220,132,.45); }
.seq-hand .seq-field select:disabled { opacity: .45; }
.tabs .hand-live { font: 400 13px/1 var(--f-osd); letter-spacing: .04em; padding: 2px 4px; border-radius: 3px; border: 1px solid #3ddc84; color: #3ddc84; margin-left: 4px; }
.tabs .hand-live[hidden] { display: none; }
.btn.seq-recbtn[aria-pressed="true"] .led { background: var(--tally); box-shadow: 0 0 8px rgba(255,75,62,.7); }
.seq .btn:disabled { opacity: .45; cursor: default; }

.seq-menuwrap { position: relative; }
.seq-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; border-radius: 6px; background: var(--raise); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 2px; }
.seq-menu[hidden] { display: none; }
.seq-menu.fixed { position: fixed; top: auto; left: auto; }
.seq-ask { display: flex; flex-direction: column; gap: 6px; padding: 2px; min-width: 220px; }
.seq-ask .mh { padding: 2px 2px 0; }
.seq-menu .mh { font-size: 12px; color: var(--dim); padding: 2px 8px 4px; }
.seq-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.seq-menu > button { text-align: left; padding: 7px 8px; border: 0; border-radius: 4px; background: none; cursor: pointer; font: 14px var(--f-body); color: var(--ink); display: flex; justify-content: space-between; gap: 16px; }
.seq-menu > button kbd { font: 12px var(--f-body); color: var(--dim); }
.seq-menu > button:hover:not(:disabled), .seq-menu > button:focus-visible { background: var(--press-1); color: var(--press-ink); }
.seq-menu > button:disabled { opacity: .45; cursor: default; }
.seq-menu > button[aria-checked="true"]::after { content: "\2713"; color: var(--loop-a-ink); }

.seq-tl { display: flex; gap: 8px; min-width: 0; }
.seq-heads .seq-card { gap: 8px; padding: 0 8px; font-size: 13px; }
.seq-heads, .seq-view-col { display: flex; flex-direction: column; gap: 4px; }
.seq-heads { flex: none; width: var(--seq-head); }
.seq-view-col { flex: 1 1 auto; min-width: 0; }
.seq-h-ruler { height: 18px; } .seq-h-marks { height: 18px; } .seq-h-spec { height: 48px; } .seq-h-lane { height: 40px; } .seq-h-ov { height: 10px; }
/* The selected block's track, taller while it has change lines (see seqDrawStatic) */
.seq-h-lane.tall { height: 128px; transition: height .15s; }
.seq-h-lane { transition: height .15s; }
#seqInsp .seq-lines, #seqInsp .seq-mfx { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
#seqInsp .seq-lines .led { box-shadow: none; }
.seq-blk .atag b { font-weight: 600; }
.seq-card { display: flex; align-items: center; gap: 10px; box-sizing: border-box; padding: 0 10px; border-radius: 5px; border: 1px solid var(--line); background: var(--raise); text-align: left; font: 14px/1.2 var(--f-body); color: var(--ink); min-width: 0; }
.seq-card b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seq-card small { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.seq-txt { min-width: 0; }
.seq-song-card { background: var(--panel); color: var(--loop-a-ink); }
.seq-song-card b { color: var(--ink); }
button.seq-card { cursor: pointer; }
.seq-card[aria-pressed="true"] { border-color: var(--loop-a-ink); background: var(--press-1); }
.seq-card.off { opacity: .55; }
.seq-num { flex: none; width: 22px; height: 22px; border-radius: 4px; font: 600 13px/22px var(--f-body); text-align: center; color: var(--well); }
.seq-mini { font-size: 12px; color: var(--dim); display: flex; align-items: center; padding-left: 10px; }

.seq-view { position: relative; display: flex; flex-direction: column; gap: 4px; overflow: hidden; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.seq-view.dragging { cursor: grabbing; }
.seq-lanes { display: flex; flex-direction: column; gap: 4px; }
.seq-ruler { position: relative; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.seq-ruler .tk { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--line); }
.seq-ruler .tk.major { height: 9px; background: var(--dim); }
.seq-ruler .lb { position: absolute; top: 0; transform: translateX(3px); white-space: nowrap; }
.seq-marks { position: relative; }
.seq-mk { position: absolute; top: 0; height: 18px; box-sizing: border-box; padding: 0 7px 0 6px; border-left: 2px solid var(--loop-a-ink); border-radius: 0 4px 4px 0; background: var(--press-1); color: var(--press-ink); font-size: 12px; line-height: 18px; white-space: nowrap; cursor: ew-resize; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.seq-mk input { width: 110px; height: 16px; font: 12px var(--f-body); padding: 0 4px; border: 1px solid var(--loop-a-ink); border-radius: 3px; background: var(--well); color: var(--ink); }
.seq-spec-wrap { position: relative; }
.seq-spec { display: block; width: 100%; border-radius: 5px; background: var(--well); }
.seq-unheard { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--dim); white-space: nowrap; pointer-events: none; padding-left: 10px; }
.seq-unheard[hidden] { display: none; }
.seq-lane { position: relative; border-radius: 5px; background: var(--well); }
.seq-lane.off { background: repeating-linear-gradient(135deg, var(--well) 0 6px, #141216 6px 12px); }
.seq-grid { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.seq-grid i { position: absolute; top: 40px; bottom: 0; width: 1px; background: rgba(228,218,232,.06); }
.seq-grid i.m { top: 22px; background: rgba(213,132,245,.35); }

.seq-blk { position: absolute; top: 3px; bottom: 3px; box-sizing: border-box; border-radius: 4px; font-size: 13px; line-height: 1.2; border: 1px solid; font-variant-numeric: tabular-nums; cursor: move; color: var(--ink); }
.seq-blk.sel { box-shadow: 0 0 0 2px var(--press-ink); z-index: 2; }
.seq-blk.rec { border-style: dashed; border-color: var(--tally) !important; }
.seq-blk .t { position: absolute; left: 7px; right: 7px; top: 3px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.seq-blk .t small { display: block; color: var(--dim); font-size: 11px; }
.seq-blk .fi, .seq-blk .fo { position: absolute; top: 0; bottom: 0; background: rgba(14,13,15,.6); pointer-events: none; }
.seq-blk .fi { left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); }
.seq-blk .fo { right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.seq-blk .eg { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.seq-blk .eg.l { left: -2px; } .seq-blk .eg.r { right: -2px; }
.seq-blk .fh { display: none; position: absolute; top: -6px; width: 11px; height: 11px; margin-left: -6px; border-radius: 50%; background: var(--press-ink); border: 2px solid var(--well); box-sizing: border-box; cursor: ew-resize; z-index: 2; }
.seq-blk:hover .fh, .seq-blk.sel .fh { display: block; }
.seq-blk .lines { position: absolute; inset: 8px 11px; pointer-events: none; z-index: 3; }
.seq-blk.sel .lines { top: 22px; bottom: 16px; }
.seq-blk svg.auto { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.seq-blk svg.auto .hit { pointer-events: stroke; cursor: pointer; }
.seq-blk .dot { pointer-events: auto; }
.seq-blk .dot::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; }
.seq-blk .dot { position: absolute; width: 11px; height: 11px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--well); box-sizing: border-box; cursor: grab; z-index: 1; }
.seq-blk .dot.sel { width: 13px; height: 13px; margin: -7px 0 0 -7px; border-color: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.6); z-index: 2; }
.seq-blk .atag { position: absolute; right: 6px; bottom: 2px; font-size: 11px; color: var(--osd); pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 90%; }
.seq-xf { position: absolute; top: 3px; bottom: 3px; z-index: 3; pointer-events: none; border-radius: 3px; background: repeating-linear-gradient(135deg, rgba(242,217,252,.28) 0 4px, transparent 4px 8px); border: 1px dashed var(--press-ink); box-sizing: border-box; display: flex; align-items: flex-end; justify-content: flex-end; font-size: 11px; color: var(--press-ink); overflow: hidden; white-space: nowrap; padding-right: 2px; }
.seq-xf span { margin-bottom: 2px; padding: 0 4px; border-radius: 3px; background: var(--well); }
.seq-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--press-ink); box-shadow: 0 0 6px rgba(242,217,252,.6); pointer-events: none; z-index: 4; }
.seq-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--press-ink); }
.seq-snapline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed #ffd84a; margin-left: -1px; pointer-events: none; z-index: 5; filter: drop-shadow(0 0 3px rgba(255,216,74,.7)); }
.seq-snapline[hidden] { display: none; }
.seq-ov { position: relative; border-radius: 7px; background: var(--well); border: 1px solid var(--line); cursor: pointer; touch-action: none; }
.seq-thumb { position: absolute; top: 1px; bottom: 1px; border-radius: 6px; background: var(--raise-2); border: 1px solid var(--dim); box-sizing: border-box; cursor: grab; min-width: 12px; }
.seq-ovmark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--press-ink); pointer-events: none; }
.seq-insp { font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center; min-height: 16px; }
.seq-insp b { color: var(--ink); font-weight: 600; }
.seq-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--dim); }
.seq-foot kbd { font: 12px/1 var(--f-body); color: var(--ink); padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line); background: var(--raise); }
.seq-zoomread { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .seq { --seq-head: 44px; }
  .seq-card { padding: 0; justify-content: center; }
  .seq-card .seq-txt, .seq-song-card svg, .seq-mini { display: none; }
  .seq-song-card::after { content: "\266A"; }
}

/* Video controls: whose video it is, when other loops have their own */
.vid-whose { opacity: 0.7; font-weight: 400; }

/* Export video (sequencer) */
.seq-export { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--well); }
.seq-export[hidden] { display: none; }
.seq-ex-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.seq-ex-row b { color: var(--ink); }
.seq-ex-size { display: inline-flex; }
.seq-ex-how { margin: 0; padding-left: 20px; color: var(--dim); font-size: 13px; line-height: 1.45; }
.seq-ex-say { color: var(--loop-a-ink); font-size: 13px; flex: 1 1 220px; }

/* Edit this look (sequencer): the bar while a block's look is being changed */
.session-bar.edit-bar { border-color: rgba(176,108,255,.5); background: rgba(176,108,255,.08); }
.edit-bar .session-row .live { background: var(--loop-a); box-shadow: 0 0 8px rgba(176,108,255,.7); }

/* Cue mode's previews: the ready looks under the picture */
.cue-strip { counter-reset: cue; display: flex; gap: 6px; align-items: stretch; flex-wrap: nowrap; overflow: hidden; }
.cue-strip[hidden] { display: none; }
.cue-slot { flex: 1 1 0; min-width: 0; position: relative; display: flex; }
.cue-pic { flex: 1 1 0; width: 100%; min-width: 0; position: relative; padding: 0; border: 2px solid var(--line, #333); border-radius: 6px; background: #000; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.cue-pic canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.cue-pic .cue-name { font-size: 11px; line-height: 1.3; padding: 2px 4px; color: var(--muted, #aaa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; background: rgba(0,0,0,.6); }
.cue-pic { counter-increment: cue; }
.cue-pic::before { content: counter(cue); position: absolute; top: 3px; left: 3px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; font: 600 11px/16px system-ui, sans-serif; text-align: center; z-index: 1; }
.cue-pic:disabled { cursor: default; opacity: .45; }
.cue-pic.next { border-color: #8b1ab8; box-shadow: 0 0 0 1px #8b1ab8, 0 0 10px rgba(139,26,184,.6); }
.cue-pic.next .cue-name { color: #fff; }
.cue-pic.picked::after { content: '★'; position: absolute; top: 2px; left: 24px; color: #fff; font-size: 13px; text-shadow: 0 0 3px #000; }
.cue-go { flex: 0 0 auto; align-self: center; }
.cue-go kbd { font: inherit; opacity: .7; margin-left: 4px; }

/* Fix projector shape (keystone): the corner map under the picture */
.ks-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise, var(--panel)); }
.ks-panel[hidden] { display: none; }
.ks-head { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.4; color: var(--muted, #aaa); }
.ks-head b { color: var(--ink); font-size: 14px; }
.ks-body { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ks-map { width: min(360px, 100%); height: auto; background: #000; border: 1px solid var(--line); border-radius: 6px; touch-action: none; overflow: visible; }
.ks-map .ks-frame { fill: none; stroke: #555; stroke-dasharray: 3 3; stroke-width: .6; }
.ks-map .ks-quad { fill: rgba(139,26,184,.18); stroke: #b06cff; stroke-width: .8; }
.ks-map .ks-line { stroke: rgba(255,255,255,.35); stroke-width: .4; fill: none; }
.ks-map .ks-dot { fill: #8b1ab8; stroke: #fff; stroke-width: .8; cursor: grab; outline: none; }
.ks-map .ks-dot:focus, .ks-map .ks-dot.on { fill: #d39bff; }
.ks-btns { display: flex; gap: 8px; flex-wrap: wrap; }
#ksBtn[aria-pressed="true"] .led { background: #b06cff; box-shadow: 0 0 8px rgba(176,108,255,.7); }

/* Map my boxes: the faces traced onto a stack of boxes */
.bm-side { display: flex; flex-direction: column; gap: 8px; }
.bm-lbl { align-self: center; font-size: 13px; color: var(--muted, #aaa); }
.bm-kind .btn[aria-pressed="true"] { border-color: #b06cff; color: var(--ink); box-shadow: 0 0 0 1px #b06cff inset; }
.bm-kind .btn:disabled { opacity: .45; }
.bm-count { font-size: 12px; color: var(--muted, #aaa); }
.ks-map .bm-face { fill: rgba(255,255,255,.18); stroke: rgba(255,255,255,.7); stroke-width: .6; cursor: move; }
.ks-map .bm-face.on { fill: rgba(176,108,255,.35); stroke: #d39bff; stroke-width: .9; }
#bmBtn[aria-pressed="true"] .led, #bmShade[aria-pressed="true"] .led, #bmOn[aria-pressed="true"] .led { background: #b06cff; box-shadow: 0 0 8px rgba(176,108,255,.7); }

/* Cue mode: the small ✕ that clears one ready look */
.cue-x { position: absolute; top: 3px; right: 3px; z-index: 2; width: 20px; height: 20px; padding: 0; border: 1px solid rgba(255,255,255,.35); border-radius: 4px;
  background: rgba(0,0,0,.7); color: #fff; font: 600 11px/18px system-ui, sans-serif; text-align: center; cursor: pointer; opacity: .7; }
.cue-x:hover, .cue-x:focus-visible { opacity: 1; background: #a32d2d; border-color: #f09595; }
.cue-x[hidden] { display: none; }
.cue-fade { flex: 0 0 auto; align-self: center; }
#cueFadeBar[aria-pressed="true"] .led { background: #b06cff; box-shadow: 0 0 8px rgba(176,108,255,.7); }
/* Soft trails, under the Trails fader (only for the inputs it works on) */
#softCtl:not([hidden]) { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }

/* ---------- Patch: the layer stack (Inputs › Patch) ---------- */
.pl-top { display: flex; gap: 6px; align-items: center; }
.pl-top input { flex: 1; min-width: 0; }
#row-patch > .ctl { display: grid; gap: 6px; }
.pl-stack { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.pl-layer { border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 6px; background: var(--well); }
.pl-layer.pl-effect { border-left-color: var(--loop-b); }
.pl-layer.pl-color { border-left-color: var(--loop-c); }
.pl-layer.off { opacity: .5; }
.pl-head { display: flex; align-items: center; gap: 4px; padding: 3px 4px; }
.pl-head .pl-on { min-height: 28px; padding: 4px 8px; }
.pl-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 4px; text-align: left; cursor: pointer; font-weight: 500; }
.pl-g { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pl-caret { margin-left: auto; color: var(--dim); }
.pl-ic { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 5px; background: var(--raise); cursor: pointer; padding: 0; font-size: 13px; }
.pl-ic[aria-disabled="true"] { opacity: .35; }
.pl-ic:hover { background: var(--raise-2); }
.pl-body { display: grid; gap: 4px; padding: 2px 10px 8px; }
.pl-c, .pl-fh { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--dim); }
.pl-c select { width: auto; min-height: 28px; padding: 3px 8px; font-size: 13px; }
.pl-fh select.pl-mv { width: auto; min-height: 24px; padding: 1px 6px; font-size: 12px; background: transparent; }
.pl-f.moving .pl-mv { color: var(--amber-ink); border-color: var(--amber); }
.pl-f input[type="range"] { height: 24px; }
.pl-amt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); padding-left: 12px; }
.pl-amt input[type="range"] { flex: 1; height: 20px; }
.pl-empty { margin: 0; padding: 10px; font-size: 13px; color: var(--dim); border: 1px dashed var(--line); border-radius: 6px; }

/* ===== Effect stack (see "effect stack" in js/app.js) ===== */
body:not(.stk) .stk-only, body.stk .classic-only { display: none !important; }
body.stk .where-mini, body.stk #gradeWhere, body.stk #typeWhere, body.stk .stk-classic-hint { display: none !important; }
body.stk #sndMap .chip[data-map="flash"] { display: none; }
.stk-top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 2px 0 6px; }
.stk-top .hint { flex: 1; }
.stk-fixed { margin-bottom: 6px; }
.stk-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.stk-zone { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.stk-zone::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.stk-zone small { text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--faint); opacity: .8; }
.stk-zone.drop { color: var(--amber-ink); }
.stk-zone.drop::after { border-top-color: var(--amber); border-top-style: solid; }
.stk-empty { margin: 0; padding: 7px 10px; font-size: 12px; color: var(--faint); border: 1px dashed var(--line); border-radius: 6px; }
.stk-item { border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 6px; background: var(--well); position: relative; }
.stk-item.z-out { border-left-color: var(--loop-b); }
.stk-item.z-all { border-left-color: var(--loop-c); }
.stk-item.off { opacity: .5; }
.stk-item.drop::before { content: ""; position: absolute; left: -3px; right: 0; top: -5px; border-top: 2px solid var(--amber); }
.stk-item.drop-after::before { top: auto; bottom: -5px; }
.stk-item.dragging { opacity: .4; }
.stk-head { display: flex; align-items: center; gap: 4px; padding: 3px 4px; }
.stk-grip { width: 22px; height: 28px; border: 0; background: none; color: var(--faint); cursor: grab; padding: 0; font-size: 14px; letter-spacing: -2px; touch-action: none; }
.stk-grip:active { cursor: grabbing; }
.stk-head .pl-on { min-height: 28px; padding: 4px 8px; }
.stk-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 4px; text-align: left; cursor: pointer; font-weight: 500; color: inherit; font: inherit; }
.stk-name .stk-mv { color: var(--amber-ink); font-size: 12px; }
.stk-name .stk-val { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 400; }
.stk-name .pl-caret { margin-left: 6px; color: var(--dim); }
.stk-body { display: grid; gap: 6px; padding: 2px 10px 8px; }
.stk-body > .ctl { margin: 0; }
.stk-mvrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); }
.stk-mvrow select { width: auto; min-height: 24px; padding: 1px 6px; font-size: 12px; background: transparent; }
.stk-mvrow.moving select { color: var(--amber-ink); border-color: var(--amber); }
.stk-mvrow input[type="range"] { flex: 1; height: 20px; }
.stk-add { width: 100%; }
  /* the Model input's list of your models */
  #modelList .chip { max-width: 100%; }
  .model-x { margin-left: 2px; padding: 0 2px; opacity: .55; font-size: 12px; }
  .model-x:hover { opacity: 1; color: var(--tally); }
  #modelBusy { align-self: center; }
