/* "我的胶片" prototype: a full-window editor. The picture takes all the room the panel does not; the
   panel scrolls on its own, so every control is reachable without scrolling the page.
   Tokens come from firmware-store/home.css (dark site theme). */
[hidden] { display: none !important; }
:root {
  --ed-bg: #0b0b0b;
  --ed-chrome: #121212;
  --ed-panel: #151515;
  --ed-raise: #1d1d1c;
  --ed-line: rgba(255, 255, 255, .07);
  --ed-glass: rgba(18, 18, 18, .72);
  --panel-w: 360px;
  --top-h: 56px;
  --strip-h: 92px;
}
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--ed-bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }

.ml-app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: var(--top-h) minmax(0, 1fr) var(--strip-h);
  grid-template-areas: "top top" "stage panel" "strip panel";
}

/* ---------------------------------------------------------------- top bar */
.ml-top { grid-area: top; display: flex; align-items: center; gap: 18px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--ed-line); background: var(--ed-chrome); }
.ml-brand { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.ml-brand span:nth-child(2) { color: var(--ink); font-weight: 600; }
.ml-brand b { font-weight: 400; opacity: .4; }
.ml-mark { width: 18px; height: 18px; border-radius: 5px; background: conic-gradient(from 200deg, #ffb547, #ff6b3d, #ff4f79, #8a7bff, #4fc3ff, #8fd694, #ffb547); box-shadow: inset 0 0 0 4px var(--ed-chrome); }
.ml-tag { padding: 2px 7px; border-radius: 99px; background: rgba(255, 181, 71, .14); color: var(--amber); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.ml-current { display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0 auto; padding: 4px 14px 4px 4px; border-radius: 99px; background: var(--ed-raise); }
.ml-current canvas { width: 32px; height: 32px; border-radius: 99px; background: #1b2325; }
.ml-current div { display: grid; min-width: 0; line-height: 1.25; }
.ml-current strong { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ml-current span { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.ml-top-actions { display: flex; gap: 8px; margin-left: auto; }

.ml-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 16px; border: 0; border-radius: 99px; background: var(--amber); color: var(--ink-on-light); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform var(--t-feedback), opacity var(--t-feedback), background var(--t-feedback); }
.ml-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ml-btn:disabled { opacity: .35; cursor: not-allowed; }
.ml-btn.ghost { background: var(--ed-raise); color: var(--ink); font-weight: 500; }
.ml-btn.ghost:hover { background: #262624; }
.ml-btn svg, .ml-dock-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- stage */
.ml-stage-wrap { grid-area: stage; position: relative; display: grid; place-items: center; min-height: 0; padding: 20px 20px 76px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, #171717 0%, var(--ed-bg) 70%); }
.ml-stage-wrap.over::after { content: ""; position: absolute; inset: 10px; border: 2px dashed var(--amber); border-radius: 16px; background: rgba(255, 181, 71, .05); pointer-events: none; }
.ml-stage { position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px var(--ed-line); background: #000; }
.ml-compare { display: block; width: 100%; height: 100%; --divider-width: 2px; --divider-color: rgba(255, 255, 255, .9); --default-handle-color: #fff; --default-handle-width: 44px; outline: none; }
.ml-compare canvas { display: block; width: 100%; height: 100%; }
.ml-badge { position: absolute; top: 12px; padding: 4px 10px; border-radius: 99px; background: var(--ed-glass); color: #fff; font-size: 12px; letter-spacing: .02em; pointer-events: none; backdrop-filter: blur(10px); }
.ml-badge.left { left: 12px; }
.ml-badge.right { right: 12px; color: var(--amber); }

.ml-empty { position: absolute; inset: 20px 20px 76px; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; border-radius: 16px; text-align: center; cursor: pointer;
  background: rgba(11, 11, 11, .55); backdrop-filter: blur(3px); transition: background var(--t-feedback); }
.ml-empty:hover { background: rgba(11, 11, 11, .4); }
.ml-empty strong { font-size: clamp(20px, 1rem + 1vw, 28px); font-weight: 500; letter-spacing: -.02em; }
.ml-empty-note { max-width: 30em; color: var(--muted); font-size: 13px; line-height: 1.6; }
.ml-empty-ring { width: 64px; height: 64px; margin-bottom: 6px; border-radius: 50%; background: conic-gradient(from 0deg, #ffb547, #ff6b3d, #ff4f79, #8a7bff, #4fc3ff, #8fd694, #ffb547); -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px); mask: radial-gradient(circle, transparent 23px, #000 24px); animation: ml-spin 8s linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }

/* Floating dock under the picture */
.ml-dock { position: absolute; left: 50%; bottom: 16px; display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 99px; transform: translateX(-50%);
  background: var(--ed-glass); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8), inset 0 0 0 1px var(--ed-line); backdrop-filter: blur(14px); white-space: nowrap;
  max-width: calc(100% - 28px); overflow-x: auto; scrollbar-width: none; }
.ml-btn, .ml-top-actions { white-space: nowrap; }
.ml-top-actions { align-items: center; }
.ml-dock-sep { width: 1px; height: 20px; background: var(--ed-line); }
.ml-seg { display: inline-flex; gap: 2px; }
.ml-seg button, .ml-dock-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 99px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: color var(--t-feedback), background var(--t-feedback); }
.ml-seg button:hover:not(:disabled), .ml-dock-btn:hover { color: var(--ink); }
.ml-seg button[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: var(--ink-on-light); }
.ml-seg button:disabled { opacity: .35; cursor: not-allowed; }

/* Processing card, centred over the picture */
.ml-progress { position: absolute; left: 50%; top: 50%; width: min(380px, calc(100% - 48px)); padding: 18px 18px 14px; border-radius: 14px; transform: translate(-50%, -50%);
  background: rgba(24, 20, 12, .88); box-shadow: 0 20px 60px -20px #000, inset 0 0 0 1px rgba(255, 181, 71, .5); backdrop-filter: blur(12px); }
.ml-progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.ml-progress-head strong { color: var(--amber); font-weight: 600; }
.ml-progress-head span { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.ml-progress-track { overflow: hidden; height: 8px; margin: 12px 0 14px; border-radius: 99px; background: rgba(255, 255, 255, .08); }
.ml-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .15s linear;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 10px, #ffd08a 10px 20px); background-size: 28px 28px; animation: ml-stripes .8s linear infinite; }
@keyframes ml-stripes { to { background-position: 28px 0; } }
.ml-progress-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.ml-progress-steps li::before { content: "○"; display: inline-block; width: 1.4em; }
.ml-progress-steps li.done { color: var(--ok); }
.ml-progress-steps li.done::before { content: "✓"; }
.ml-progress-steps li.now { color: var(--amber); font-weight: 600; }
.ml-progress-steps li.now::before { content: "●"; animation: ml-pulse 1s ease-in-out infinite; }
@keyframes ml-pulse { 50% { opacity: .3; } }
.ml-busy .ml-empty { pointer-events: none; }
.ml-busy .ml-empty > * { opacity: 0; }

/* ---------------------------------------------------------------- film strip */
.ml-strip { grid-area: strip; display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: center; gap: 12px; padding: 0 18px; border-top: 1px solid var(--ed-line); background: var(--ed-chrome); }
.ml-strip-head { display: grid; gap: 2px; font-size: 13px; }
.ml-strip-head strong { font-weight: 600; }
.ml-strip-head em { color: var(--muted); font-style: normal; font-family: var(--mono); font-size: 12px; }
.ml-strip-head span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.ml-strip-head .ml-link { justify-self: start; font-size: 12px; text-align: left; }
.ml-reel { display: flex; gap: 8px; margin: 0; padding: 4px 2px; overflow-x: auto; list-style: none; scrollbar-width: thin; }
.ml-reel li { position: relative; flex: 0 0 auto; }
.ml-reel li.empty { color: var(--muted); font-size: 13px; }
.ml-frame { display: flex; align-items: center; gap: 10px; width: 190px; padding: 8px 10px 8px 8px; border: 0; border-radius: 10px; background: var(--ed-raise); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background var(--t-feedback), box-shadow var(--t-feedback); }
.ml-frame:hover { background: #252523; }
.ml-reel li.current .ml-frame { box-shadow: inset 0 0 0 1.5px var(--amber); }
.ml-frame img { width: 40px; height: 40px; border-radius: 6px; background: #1b2325; }
.ml-frame span { display: grid; min-width: 0; line-height: 1.3; }
.ml-frame strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ml-frame small { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.ml-frame-x { position: absolute; top: -6px; right: -6px; display: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: #3a3a38; color: var(--ink); font-size: 13px; line-height: 22px; cursor: pointer; }
.ml-reel li:hover .ml-frame-x, .ml-frame-x:focus-visible { display: block; }

/* ---------------------------------------------------------------- panel */
.ml-panel { grid-area: panel; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; border-left: 1px solid var(--ed-line); background: var(--ed-panel); }
.ml-panel-head { padding: 14px 16px 0; }
.ml-quality { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--ed-raise); font-size: 13px; line-height: 1.45; }
.ml-quality i { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(143, 214, 148, .15); }
.ml-quality.warn i { background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 181, 71, .15); }
.ml-quality div { display: grid; gap: 2px; }
.ml-quality strong { font-weight: 600; }
.ml-quality span { color: var(--muted); font-size: 12px; }
.ml-status { min-height: 0; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ml-status:empty { display: none; }
.ml-status.ok { color: var(--ok); }
.ml-status.bad { color: var(--ember-text); }
.ml-source { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.ml-source .warn { color: var(--amber); }
.ml-chip { display: inline-block; padding: 1px 7px; border-radius: 99px; background: #2f2a46; color: #c9b8ff; font-size: 11px; font-weight: 600; }

.ml-tabs { display: flex; gap: 18px; margin-top: 14px; border-bottom: 1px solid var(--ed-line); }
.ml-tabs button { position: relative; padding: 10px 0 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.ml-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.ml-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--amber); }

.ml-panel-body { overflow-y: auto; padding: 4px 16px 20px; scrollbar-width: thin; }
body:not(.ml-ready) [data-needs-fit] { opacity: .35; pointer-events: none; filter: saturate(.3); }
.ml-group-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 10px; }
.ml-group-head h3 { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.ml-link { padding: 0; border: 0; background: none; color: var(--amber); font: inherit; font-size: 12px; cursor: pointer; }
.ml-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ml-tiny { color: var(--muted); font-size: 11px; line-height: 1.5; }

/* Sliders, after kigen.design/color: a thick inset track that shows what the slider does, a tactile
   pill knob with two dots, a small spaced label and a large value. Native <input type=range> underneath. */
.ml-group { margin-top: 12px; padding: 12px 14px 14px; border: 1px solid var(--ed-line); border-radius: 18px; background: rgba(255, 255, 255, .015); }
.ml-group .ml-group-head { margin: 0 0 12px; }
.ml-group-head h3 { letter-spacing: .22em; }
.ml-sliders { display: grid; gap: 8px; }
.ml-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 10px; }
.ml-slider-head { display: contents; }
.ml-slider-head > span { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .2em; }
.ml-slider output { color: var(--ink); font-size: 18px; font-weight: 500; line-height: 1; letter-spacing: .01em; text-align: right; font-variant-numeric: tabular-nums; transition: color var(--t-feedback); }
.ml-slider output.moved { color: var(--amber); }
.ml-slider input { grid-column: 1 / -1; width: 100%; height: 26px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }

/* Track: 10px, inset; --track paints the whole track, --lo/--hi add a fill from the neutral point. */
.ml-slider input::-webkit-slider-runnable-track { height: 10px; border-radius: 8px;
  background: linear-gradient(90deg, transparent 0 var(--lo, 0%), var(--fill, transparent) var(--lo, 0%) var(--hi, 0%), transparent var(--hi, 0%)), var(--track, #262626);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .05); }
.ml-slider input::-moz-range-track { height: 10px; border-radius: 8px;
  background: linear-gradient(90deg, transparent 0 var(--lo, 0%), var(--fill, transparent) var(--lo, 0%) var(--hi, 0%), transparent var(--hi, 0%)), var(--track, #262626);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .05); }

/* Knob: a 44 x 22 metal pill carrying two 16px dots. */
.ml-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 22px; margin-top: -6px; border-radius: 12px;
  background:
    radial-gradient(circle at 13px 11px, #f6f6f6 0 3px, #d4d4d4 7.5px, transparent 8.5px),
    radial-gradient(circle at 31px 11px, #f6f6f6 0 3px, #d4d4d4 7.5px, transparent 8.5px),
    linear-gradient(#f4f4f4, #dcdcdc);
  box-shadow: inset 3px 3px 6px rgba(255, 255, 255, .55), inset -3px -3px 6px rgba(0, 0, 0, .08),
    0 1px 1.5px -.8px rgba(0, 0, 0, .5), 0 2px 4px -1.6px rgba(0, 0, 0, .5), 0 4px 9px -2.4px rgba(0, 0, 0, .45), 0 8px 20px -3.2px rgba(0, 0, 0, .4);
  transition: transform var(--t-feedback); }
.ml-slider input::-moz-range-thumb { width: 44px; height: 22px; border: 0; border-radius: 12px;
  background:
    radial-gradient(circle at 13px 11px, #f6f6f6 0 3px, #d4d4d4 7.5px, transparent 8.5px),
    radial-gradient(circle at 31px 11px, #f6f6f6 0 3px, #d4d4d4 7.5px, transparent 8.5px),
    linear-gradient(#f4f4f4, #dcdcdc);
  box-shadow: inset 3px 3px 6px rgba(255, 255, 255, .55), inset -3px -3px 6px rgba(0, 0, 0, .08), 0 4px 9px -2.4px rgba(0, 0, 0, .45), 0 8px 20px -3.2px rgba(0, 0, 0, .4); }
.ml-slider input:active::-webkit-slider-thumb { transform: scale(1.06); }
.ml-slider input:focus-visible { outline: none; }
.ml-slider input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 181, 71, .55), 0 8px 20px -3.2px rgba(0, 0, 0, .4); }

/* What each track shows */
.ml-slider[data-key="strength"] input, .ml-slider[data-key="contrast"] input { --fill: #efebe2; }
.ml-slider[data-key="warmth"] input { --track: linear-gradient(90deg, #4f8cff, #3a3a3a 50%, #ffae3d); }
.ml-slider[data-key="tint"] input { --track: linear-gradient(90deg, #3fcf7a, #3a3a3a 50%, #ff5fc8); }
.ml-slider[data-key="saturation"] input { --track: linear-gradient(90deg, #6d6d6d, #8e7766 50%, #ff6a3d 80%, #ff2f6a); }
.ml-slider[data-key="fade"] input { --track: linear-gradient(90deg, #050505, #6a665f); }

/* Hue ring: 12 swatches around the selected sector's name */
.ml-wheel { position: relative; width: 196px; height: 196px; margin: 0 auto 10px; border-radius: 50%; }
.ml-wheel::before { content: ""; position: absolute; inset: 30px; border-radius: 50%; background: var(--ed-raise); }
.ml-wheel-center { position: absolute; inset: 30px; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; font-size: 13px; pointer-events: none; }
.ml-wheel-center i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.ml-wheel-center small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ml-hue { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--c); cursor: pointer;
  transform: rotate(var(--a)) translateY(-82px) rotate(calc(-1 * var(--a))); transition: transform var(--t-feedback), border-color var(--t-feedback); }
.ml-hue:hover { transform: rotate(var(--a)) translateY(-82px) rotate(calc(-1 * var(--a))) scale(1.12); }
.ml-hue[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
.ml-hue.changed::after { content: ""; position: absolute; right: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--ed-panel); }
.ml-hue:disabled { opacity: .3; cursor: not-allowed; }

.ml-curves { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--ed-raise); }

/* Name + icon pane */
.ml-icons { display: flex; align-items: flex-end; gap: 16px; margin: 18px 0 6px; }
.ml-icons > div { display: grid; gap: 8px; }
.ml-icon-big { width: 120px; height: 120px; border-radius: 12px; background: #2a2f31; }
.ml-icon-small { width: 80px; height: 80px; border-radius: 8px; background: #1b2325; image-rendering: pixelated; }
.ml-fields { display: grid; gap: 14px; margin-top: 16px; }
.ml-field { display: grid; gap: 6px; font-size: 13px; }
.ml-field > span { display: flex; justify-content: space-between; color: var(--muted); }
.ml-field em { font-style: normal; font-family: var(--mono); font-size: 11px; }
.ml-field input { min-height: 38px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: var(--ed-raise); color: var(--ink); font: inherit; font-size: 14px; }
.ml-field input[data-camera-name], .ml-field input[data-icon-label] { font-family: var(--mono); letter-spacing: .04em; }
.ml-field input:focus-visible { border-color: var(--amber); outline: none; }
.ml-field input.bad { border-color: var(--ember-text); }
.ml-field small { color: var(--muted); font-size: 11px; }
.ml-palettes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ml-palettes button { display: grid; justify-items: center; gap: 6px; padding: 8px 4px; border: 1px solid transparent; border-radius: 10px; background: var(--ed-raise); color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; }
.ml-palettes button i { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(var(--b) 45%, var(--p) 45%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.ml-palettes button[aria-pressed="true"] { border-color: var(--amber); color: var(--ink); }

.ml-panel-foot { padding: 10px 16px 14px; border-top: 1px solid var(--ed-line); }
.ml-panel-foot .ml-status { margin: 0 0 6px; }
.ml-panel-foot .ml-tiny { margin: 0; }

/* ---------------------------------------------------------------- narrow screens: stack, page scrolls */
@media (max-width: 900px) {
  body { overflow: auto; }
  .ml-app { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; grid-template-areas: "top" "stage" "panel" "strip"; }
  .ml-top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .ml-current { order: 3; margin: 0; width: 100%; }
  .ml-stage-wrap { min-height: 240px; padding: 12px 12px 64px; }
  .ml-empty { inset: 12px 12px 64px; }
  .ml-dock { bottom: 10px; max-width: calc(100% - 20px); overflow-x: auto; }
  .ml-panel { border-left: 0; border-top: 1px solid var(--ed-line); }
  .ml-panel-body { overflow: visible; }
  .ml-strip { grid-template-columns: minmax(0, 1fr); padding: 14px; }
}
/* Colour chart route under the drop target, and its how-to dialog */
.ml-empty-chart { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--ed-line); color: var(--muted); font-size: 13px; }
.ml-empty-chart .ml-btn { min-height: 32px; font-size: 13px; }
.ml-link { padding: 0; border: 0; background: none; color: var(--amber); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ml-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 16px; background: var(--ed-panel); color: var(--ink); box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .9), 0 0 0 1px var(--ed-line); }
.ml-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.ml-dialog form { display: grid; gap: 16px; padding: 24px; }
.ml-dialog h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.ml-dialog p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.ml-dialog-steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.ml-dialog-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 2px 12px; counter-increment: step; }
.ml-dialog-steps li::before { content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--amber); color: var(--ink-on-light); font-weight: 700; font-size: 14px; }
.ml-dialog-steps strong { font-size: 15px; }
.ml-dialog-steps span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.ml-dialog-tips { display: grid; gap: 6px; margin: 0; padding: 12px 14px 12px 30px; border-radius: 10px; background: var(--ed-raise); color: var(--muted); font-size: 13px; line-height: 1.55; }
.ml-dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) { .ml-progress-track i, .ml-progress-steps li.now::before, .ml-empty-ring { animation: none; } }

/* ---------------------------------------------------------------- side by side */
body.ml-mode-grid [data-only="slider"], body:not(.ml-mode-grid) [data-only="grid"] { display: none !important; }
body.ml-mode-grid .ml-stage { display: none; }
.ml-grid-view { position: absolute; inset: 14px 14px 72px; display: grid; grid-template-columns: repeat(var(--panes, 3), minmax(0, 1fr)); gap: 10px; }
.ml-grid-view { align-content: center; justify-content: center; }
.ml-grid-view:not(.stacked) { grid-template-columns: repeat(var(--panes, 3), minmax(0, var(--pane-w, 1fr))); }
.ml-grid-view.stacked { grid-template-columns: minmax(0, var(--pane-w, 1fr)); grid-template-rows: none; }
.ml-pane { display: grid; grid-template-rows: auto var(--pane-h, minmax(0, 1fr)); gap: 8px; min-width: 0; min-height: 0; }
.ml-grid-view.zoomed { align-content: stretch; }
.ml-grid-view.zoomed:not(.stacked) { grid-template-columns: repeat(var(--panes, 3), minmax(0, 1fr)); }
.ml-grid-view.zoomed.stacked { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(var(--panes, 3), minmax(0, 1fr)); }
.ml-grid-view.zoomed .ml-pane { grid-template-rows: auto minmax(0, 1fr); }
.ml-pane-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ml-pane-head b { display: inline-grid; flex: none; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--ed-raise); color: var(--amber); font-size: 12px; }
.ml-pane-head select { min-width: 0; max-width: 100%; min-height: 30px; padding: 0 28px 0 10px; border: 1px solid var(--ed-line); border-radius: 99px; background: var(--ed-raise) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239d9890' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center / 10px; color: var(--ink); font: inherit; font-size: 13px; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; cursor: pointer; }
.ml-pane-view { position: relative; overflow: hidden; border-radius: 8px; background: #050505; box-shadow: inset 0 0 0 1px var(--ed-line); cursor: grab; touch-action: none; }
.ml-pane-view.dragging { cursor: grabbing; }
.ml-pane-view canvas { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; }
.ml-pane-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; color: var(--muted); font-size: 13px; text-align: center; }

/* In side-by-side mode the dock becomes a full-width bar under the panes */
body.ml-mode-grid .ml-dock { left: 14px; right: 14px; transform: none; flex-wrap: wrap; border-radius: 14px; }
.ml-dock-end { margin-left: auto; }
body:not(.ml-mode-grid) .ml-dock-end { margin-left: 0; }
.ml-mode button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.ml-zoom { display: inline-flex; align-items: center; gap: 3px; }
.ml-zoom button { min-width: 34px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .06); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; transition: background var(--t-feedback); }
.ml-zoom button:hover { background: rgba(255, 255, 255, .12); }
.ml-zoom output { min-width: 50px; color: var(--amber); font-family: var(--mono); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.ml-sync { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--ink); font-size: 13px; cursor: pointer; user-select: none; }
.ml-sync input { position: absolute; opacity: 0; pointer-events: none; }
.ml-sync i { position: relative; width: 30px; height: 18px; border-radius: 99px; background: #333; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); transition: background var(--t-feedback); }
.ml-sync i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(#f4f4f4, #d6d6d6); box-shadow: 0 1px 3px rgba(0, 0, 0, .5); transition: transform var(--t-feedback); }
.ml-sync input:checked + i { background: var(--ember); }
.ml-sync input:checked + i::after { transform: translateX(12px); }
.ml-sync input:focus-visible + i { box-shadow: 0 0 0 3px rgba(255, 181, 71, .5); }
.ml-photo-pick { display: inline-flex; align-items: center; gap: 6px; padding-left: 10px; color: var(--muted); }
.ml-photo-pick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ml-photo-pick select { min-height: 32px; padding: 0 24px 0 4px; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239d9890' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 6px center / 10px; color: var(--ink); font: inherit; font-size: 13px; -webkit-appearance: none; appearance: none; cursor: pointer; }
.ml-photo-pick select option, .ml-pane-head select option { background: #1d1d1c; color: var(--ink); }

/* Full screen: the comparison area alone */
.ml-stage-wrap:fullscreen { background: #000; }
@media (max-width: 900px) {
  body.ml-mode-grid .ml-stage-wrap { display: block; padding-bottom: 120px; }
  .ml-grid-view { position: relative; inset: auto; height: 72vh; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); }
}

/* GR IV styles read from the user's firmware: the open one is plain text */
.ml-source [data-gr4-look][aria-pressed="true"] { color: inherit; font-weight: 600; text-decoration: none; cursor: default; }
