/* ============================================================================
   KindaFilm — UI Refinement V2 (Photographic Experience)
   Quiet. Precise. Photographic.
   Design tokens and consolidated darkroom surfaces, controls, and layouts.
   ============================================================================ */

:root {
  --bg-canvas: #000000;
  --bg-stage: #060608;
  --bg-panel: #0d0d0f;
  --bg-card: #121215;
  --bg-elevated: #1d1d22;
  --bg-input: #101013;

  --border-subtle: rgba(255, 255, 255, 0.065);
  --border-default: rgba(255, 255, 255, 0.13);
  --border-strong: rgba(255, 255, 255, 0.26);

  --text-primary: #f2f2f3;
  --text-secondary: #b6b6be;
  --text-muted: #94949c;

  --accent-warm: #e8c17a;
  --accent-warm-soft: rgba(232, 193, 122, 0.16);
  --accent-warm-border: rgba(232, 193, 122, 0.48);
  --focus-ring: 0 0 0 2px rgba(232, 193, 122, 0.85);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 15px;
  --radius-pill: 999px;

  --ctrl-height-sm: 28px;
  --ctrl-height-md: 34px;
  --ctrl-height-lg: 38px;

  --t-fast: 140ms cubic-bezier(0.22, 1, 0.36, 1);
  --t-ui: 180ms cubic-bezier(0.22, 1, 0.36, 1);

  --shadow: 0 18px 54px rgba(0, 0, 0, 0.48);

  color-scheme: dark;
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--text-primary);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
}

body.intro-active {
  overflow: hidden;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(232, 193, 122, 0.88);
  outline-offset: 2px;
}

svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
}

[hidden] {
  display: none !important;
}

/* ============================================================================
   App Shell & Topbar
   ============================================================================ */

.app-shell {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  overflow: hidden;
  overscroll-behavior: none;
}

.topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  position: relative;
  z-index: 5;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 200px;
  border: 0;
  background: none;
  color: #ffffff;
  text-align: left;
  padding: 0;
}

.brand-mark {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

.brand-name {
  font-size: 18px;
  font-weight: 640;
  letter-spacing: -0.035em;
  color: #ffffff;
}

.brand-divider {
  height: 16px;
  width: 1px;
  background: var(--border-default);
  margin: 0 4px;
}

.brand-subtitle {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 680;
  letter-spacing: 0.2em;
}

.header-center {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34vw;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button {
  border: 0;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: background-color var(--t-fast), color var(--t-fast);
}

.icon-button:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.top-actions .desktop-studio-action {
  flex: none;
  width: 31px;
}

.guide-button {
  flex: none;
}

.action-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.text-button,
.primary-button {
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 33px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  padding: 0 13px;
  white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.text-button {
  background: var(--bg-card);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.text-button:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.primary-button {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  background: #e8e8ea;
  border-color: #e8e8ea;
}

.text-button svg,
.primary-button svg {
  width: 15px;
  height: 15px;
}

/* ============================================================================
   Workspace & Photo Stage
   ============================================================================ */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
}

.main-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.photo-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-canvas);
  border-right: 1px solid var(--border-subtle);
  overscroll-behavior: none;
}

.workspace-topline,
.workspace-bottomline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  min-height: 34px;
  gap: 10px;
  background: var(--bg-canvas);
  transition: opacity var(--t-ui);
}

.workspace-topline {
  justify-content: flex-end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.workspace-topline:has(.workspace-resolution:empty) {
  display: none;
}

.workspace-topline:has(.hdr-view:not([hidden])) {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
}

.workspace-bottomline {
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

body.has-photo .workspace-topline,
body.has-photo .workspace-bottomline {
  opacity: 0.84;
}

body.has-photo .workspace-topline:hover,
body.has-photo .workspace-topline:focus-within,
body.has-photo .workspace-bottomline:hover,
body.has-photo .workspace-bottomline:focus-within {
  opacity: 1;
}

/* The editor controls output resolution without resizing the working preview. */
.upscale-editor { display:inline-flex; align-items:center; gap:4px; min-width:0; margin-left:auto; }
.upscale-editor-label { font-size:9px; font-weight:750; letter-spacing:.1em; color:var(--text-muted); margin-right:5px; }
.upscale-editor button, .upscale-mode-controls button {
  min-width:32px; min-height:26px; border:1px solid var(--border-default);
  border-radius:7px; background:var(--bg-card); color:var(--text-secondary);
  font-size:11px; font-weight:650; padding:4px 7px; cursor:pointer;
  transition:background var(--t-fast),border-color var(--t-fast);
}
.upscale-editor button[aria-pressed="true"], .upscale-mode-controls button[aria-pressed="true"] {
  color:var(--text-primary); border-color:rgba(241,169,111,.75); background:rgba(241,169,111,.14);
}
.upscale-editor button:focus-visible, .upscale-mode-controls button:focus-visible { outline:2px solid var(--text-primary); outline-offset:2px; }
.upscale-editor button:disabled, .upscale-mode-controls button:disabled { opacity:.38; cursor:not-allowed; }
.upscale-editor-status { display:block; max-width:144px; padding-left:6px; overflow:hidden;
  white-space:nowrap; text-overflow:ellipsis; color:var(--text-muted);
  font-size:10px; font-variant-numeric:tabular-nums; }
.upscale-mode-controls { display:flex; align-items:center; gap:7px; margin:10px 0; flex-wrap:wrap; }
.upscale-mode-controls button { flex:1; min-height:34px; }
.upscale-detail-note { color:var(--text-secondary); font-size:11.5px; line-height:1.5; margin:6px 0 0; }
.upscale-detail-note[data-warning="true"] { color:#f2c19a; }
@media (max-width:740px) {
  .upscale-editor { gap:3px; margin-left:0; }
  .upscale-editor-label, .upscale-editor-status { display:none; }
  .upscale-editor button { min-width:28px; min-height:25px; padding:4px 5px; font-size:10px; }
}
@media (prefers-reduced-motion:reduce) { .upscale-editor button, .upscale-mode-controls button { transition:none; } }

.workspace-resolution {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.workspace-topline:has(.hdr-view:not([hidden])) .workspace-resolution {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-compare-hold {
  display: none;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 560;
  white-space: nowrap;
  -webkit-touch-callout: none;
  user-select: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.mobile-compare-hold svg {
  width: 12px;
  height: 12px;
}

.mobile-compare-hold.pressed {
  background: var(--accent-warm-soft);
  border-color: var(--accent-warm-border);
  color: var(--accent-warm);
}

.hdr-view {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
}

.hdr-view button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 11px;
  font-weight: 620;
}

.hdr-view button[aria-pressed="true"] {
  color: #0b0b0d;
  background: #ffffff;
}

.hdr-view-label {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.photo-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: none;
  background: radial-gradient(ellipse at 50% 48%, #0d0d10 0%, #040406 68%, #000000 100%);
}

.empty-state {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  max-width: 480px;
}

.empty-contact {
  width: 72px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

.empty-contact svg {
  width: 56px;
  height: 46px;
  stroke: var(--text-secondary);
  stroke-width: 1.2;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.empty-state h1 {
  font-weight: 580;
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-size: clamp(28px, 3vw, 40px);
  color: var(--text-primary);
  margin: 10px 0;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 20px;
}

.empty-cta {
  background: #f2f2f3;
  color: #0a0a0c;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 620;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  transition: background-color var(--t-fast);
}

.empty-cta:hover {
  background: #ffffff;
}

.empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
}

.sample-photos {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.sample-strip {
  display: flex;
  gap: 7px;
}

.sample-strip button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--bg-card);
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.sample-strip button:hover:not(:disabled),
.sample-strip button:focus-visible {
  border-color: #ffffff;
  transform: translateY(-1px);
}

.sample-strip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draft-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.draft-actions button {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 7px 11px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
}

.draft-actions button:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.image-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(10px, 1.6dvh, 22px) clamp(14px, 2vw, 32px);
  overflow: auto;
  overscroll-behavior: contain;
  transition: padding var(--t-ui);
}

.image-frame:not(.zoom-actual) {
  overflow: hidden;
}

.image-frame canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  -webkit-touch-callout: none;
  user-select: none;
}

.image-frame canvas#previewCanvas {
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.84);
  background: #101013;
}

#previewCanvas.composited {
  opacity: 0;
}

#previewCanvas.wb-picking,
#overlayCanvas.wb-picking {
  cursor: crosshair !important;
}

#previewCanvas.mask-painting {
  touch-action: none;
  cursor: crosshair;
}

.image-frame > .overlay-canvas {
  position: absolute;
  inset: auto;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  margin: 0;
  box-shadow: none;
  background: transparent;
  object-fit: fill;
  pointer-events: none;
  z-index: 1;
}

.image-frame > .overlay-canvas.composited {
  pointer-events: auto;
}

.image-frame.zoom-actual {
  display: block;
  text-align: center;
}

.image-frame.zoom-actual canvas {
  max-width: none;
  max-height: none;
  width: var(--actual-width);
  height: var(--actual-height);
  margin: auto;
}

.image-frame.zoom-actual > .overlay-canvas {
  max-width: none;
  max-height: none;
  margin: 0;
  width: auto;
  height: auto;
}

.overlay-canvas.text-editable {
  pointer-events: auto !important;
  touch-action: none;
  cursor: grab;
  outline: none;
}

.overlay-canvas.text-editable[data-dragging="true"] {
  cursor: grabbing;
}

.overlay-canvas.interactive-guide {
  pointer-events: auto !important;
  touch-action: none;
  cursor: default;
}

.overlay-canvas.interactive-guide[data-hover="move"] { cursor: grab; }
.overlay-canvas.interactive-guide[data-hover="resize"] { cursor: ew-resize; }
.overlay-canvas.interactive-guide[data-hover="rotate"] { cursor: crosshair; }
.overlay-canvas.interactive-guide[data-dragging="true"] { cursor: grabbing !important; }

.compare-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(12, 12, 14, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 640;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hdr-original-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  dynamic-range-limit: no-limit;
}

.hdr-view[hidden],
.hdr-original-preview[hidden],
.image-frame.hdr-preview canvas {
  display: none;
}

.image-loading {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  z-index: 6;
  animation: fade-in var(--t-fast) both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.spinner {
  height: 26px;
  width: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-warm);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.drop-overlay {
  position: absolute;
  inset: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(14, 14, 17, 0.92);
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.drop-symbol {
  font-size: 40px;
  font-weight: 250;
}

.drop-overlay strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.drop-overlay span {
  font-size: 12px;
  color: var(--text-secondary);
}

.split-divider {
  position: absolute;
  z-index: 3;
  width: 28px;
  margin-left: -14px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.split-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.split-handle {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(20, 20, 23, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.split-handle svg {
  width: 14px;
  height: 14px;
}

.split-divider:focus-visible .split-handle {
  outline: 2px solid var(--accent-warm);
  outline-offset: 2px;
}

.brush-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.68), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
}

.brush-cursor[data-mode="add"] {
  border-color: #35e0b8;
  background: rgba(53, 224, 184, 0.12);
}

.brush-cursor[data-mode="remove"] {
  border-color: #ff7b7b;
  background: rgba(255, 123, 123, 0.12);
}

.photo-meta,
.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.meta-chip svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}

.compare-button,
.zoom-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 560;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  transition: background-color var(--t-fast), color var(--t-fast);
}

.compare-button:hover:not(:disabled),
.zoom-button:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.compare-button[aria-pressed="true"],
.compare-button.pressed {
  background: var(--bg-elevated);
  color: #ffffff;
}

.zoom-button[aria-pressed="true"],
.zoom-button.pressed {
  background: var(--bg-elevated);
  color: var(--accent-warm);
}

.compare-button svg {
  width: 14px;
  height: 14px;
}

.bottom-divider {
  width: 1px;
  height: 14px;
  background: var(--border-subtle);
}

.desktop-panel-toggle,
.desktop-panel-divider {
  display: none;
}

/* ============================================================================
   Film Library & Curated Looks / Atmospheres Gallery
   ============================================================================ */

.film-library {
  background: var(--bg-canvas);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.library-eyebrow {
  font-size: 10px;
  color: var(--text-muted);
}

.library-heading h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin: 0;
}

.library-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.library-info {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 4px;
  display: grid;
  place-items: center;
}

.library-info svg,
.split-handle svg {
  width: 15px;
  height: 15px;
}

.atmosphere-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.atmosphere-switch:hover,
.atmosphere-switch:focus-visible {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.atmo-switch-icon,
.atmo-tune-icon {
  width: 13px;
  height: 13px;
  flex: none;
  stroke: currentColor;
}

.category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  white-space: nowrap;
  scroll-snap-type: x proximity;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.category-tab:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.category-tab.selected {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.look-workbench-actions,
.look-compare-slots,
.look-compare-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.look-workbench button,
.recipe-list button {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 4px 9px;
  min-height: var(--ctrl-height-sm);
  font-size: 11px;
  font-weight: 600;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.look-workbench button:not([aria-pressed="true"]):hover:not(:disabled),
.recipe-list button:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.look-workbench button[aria-pressed="true"],
#applyLookCompare:not(:disabled) {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

#lookGridBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#lookGridBtn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
}

.look-search {
  display: inline-flex;
  align-items: center;
}

.look-search input {
  width: 154px;
  height: var(--ctrl-height-sm);
  padding: 0 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  outline: none;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}

.look-search input::placeholder {
  color: var(--text-muted);
}

.look-search input:focus {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.look-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  margin-top: 8px;
}

.look-compare-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.look-compare-slots button {
  text-align: left;
  overflow-wrap: anywhere;
}

.look-compare-slots button[aria-pressed="true"] {
  font-weight: 700;
}

#lookCompareHint {
  grid-column: 1;
  grid-row: 2;
  color: var(--text-secondary);
  font-size: 11px;
  margin: 0;
}

.look-compare-actions {
  grid-column: 2;
  grid-row: 1 / 3;
}

.look-strength-card {
  padding: 8px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.look-strength-card label {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 560;
}

.look-strength-card label span {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 38px;
  text-align: right;
  white-space: nowrap;
}

.look-strength-card[data-modified="true"] label span {
  color: var(--accent-warm);
}

.look-toolbar-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.look-toolbar-note strong {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

.look-toolbar-note span {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.look-tools-btn {
  display: none;
}

.smart-caption {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.preset-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.preset-strip.is-grid {
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.preset-tile {
  position: relative;
  flex: 0 0 auto;
  min-width: 96px;
  width: 96px;
}

.preset-card {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 5px;
  color: var(--text-primary);
}

.preset-visual {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
  background: linear-gradient(145deg, #24242a, #131317);
  background-size: cover;
  background-position: center;
  border: 1.5px solid var(--border-subtle);
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.preset-visual.is-loaded {
  animation: thumb-reveal var(--t-ui) both;
}

@keyframes thumb-reveal {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

.preset-card:hover .preset-visual {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.preset-card.selected .preset-visual {
  border-color: #f2f2f3;
  box-shadow: 0 0 0 1px rgba(242, 242, 243, 0.32), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.preset-card.is-candidate .preset-visual {
  outline: 1.5px dashed #e0e0e0;
  outline-offset: -3px;
}

/* Curated gallery code pill with subtle color swatch dot */
.preset-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  align-self: flex-start;
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.preset-code::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--look-color, var(--text-secondary));
  flex: none;
}

.preset-card.selected .preset-code {
  border-color: rgba(232, 193, 122, 0.45);
  color: var(--text-primary);
}

.preset-name {
  font-size: 11.5px;
  font-weight: 560;
  color: var(--text-secondary);
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.preset-card.selected .preset-name {
  color: #ffffff;
  font-weight: 640;
}

/* Editorial Film Atmospheres Presentation */
.preset-tile.is-editorial .preset-card {
  gap: 7px;
}

.preset-tile.is-editorial .preset-visual {
  aspect-ratio: 3 / 2;
  border-radius: var(--radius-sm);
}

.preset-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.preset-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.preset-meta-top .preset-code {
  flex: none;
  align-self: center;
}

.preset-meta-top .preset-name {
  flex: 1 1 auto;
  min-width: 0;
}

.preset-character {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.38;
  color: var(--text-muted);
}

.preset-card.selected .preset-character {
  color: var(--text-secondary);
}

.preset-reason {
  display: block;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--text-secondary);
  white-space: normal;
}

.preset-strip:not(.is-grid):not(.is-recommended) .preset-reason {
  display: none;
}

.preset-favorite {
  position: absolute;
  right: 5px;
  top: 5px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  width: 22px;
  height: 22px;
  background: rgba(12, 12, 15, 0.72);
  color: #ffffff;
  backdrop-filter: blur(8px);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: background-color var(--t-fast), transform var(--t-fast);
}

.preset-favorite:hover,
.preset-favorite:focus-visible {
  background: rgba(36, 36, 42, 0.92);
  transform: scale(1.06);
}

.preset-favorite.is-favorite {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.preset-empty {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 4px;
}

.preset-strip.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  align-content: start;
  gap: 12px 9px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ============================================================================
   Film Atmospheres Drawer & Fine-Tune Controls
   ============================================================================ */

.atmosphere-bar {
  display: contents;
}

.atmosphere-intro,
.atmosphere-tune,
.atmosphere-controls,
.atmosphere-fallback,
.atmosphere-help-panel {
  min-width: 0;
}

.atmosphere-intro {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.05em;
}

.atmosphere-intro small {
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.atmosphere-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  flex: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.atmosphere-help-btn:hover,
.atmosphere-help-btn[aria-expanded="true"] {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.atmosphere-help-panel {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.atmosphere-help-details {
  margin-top: 2px;
}

.atmosphere-help-details p {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.atmo-tune-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.atmo-back-label {
  display: none;
}

.atmosphere-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0;
}

.atmosphere-status:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.atmosphere-status:disabled {
  opacity: 0.65;
  cursor: default;
}

.atmosphere-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}

.atmosphere-status[data-state="ready"] i {
  background: #3fd0b0;
  box-shadow: 0 0 0 2px rgba(63, 208, 176, 0.22);
}

.atmosphere-status[data-state="manual"] i {
  background: #d4b16a;
}

.atmosphere-status[data-state="warn"] i {
  background: #d98b5f;
}

.atmosphere-status[data-quality="partial"] {
  border-color: rgba(232, 193, 122, 0.36);
}

.atmosphere-status[data-state="busy"] i {
  background: #d6d6d6;
  animation: atmosphere-pulse 1.05s ease-in-out infinite;
}

@keyframes atmosphere-pulse {
  50% { opacity: 0.28; }
}

.atmosphere-tune {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 6px 11px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 560;
  text-align: left;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.atmosphere-tune:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.atmosphere-tune > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.atmosphere-tune-count {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-warm-soft);
  border: 1px solid var(--accent-warm-border);
  color: var(--accent-warm);
  font-size: 10.5px;
  font-weight: 600;
}

.atmosphere-tune-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-ui);
}

.atmosphere-tune-chevron svg {
  width: 13px;
  height: 13px;
}

.atmosphere-tune[aria-expanded="true"] {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.atmosphere-tune[aria-expanded="true"] .atmosphere-tune-chevron {
  transform: rotate(180deg);
}

.atmosphere-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px 13px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: inherit;
  font-size: 11.5px;
  max-height: 260px;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.atmosphere-control-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.atmosphere-control-heading > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.atmosphere-reset {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 560;
  padding: 4px 10px;
}

.atmosphere-reset:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.atmosphere-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.atmosphere-section > h3 {
  grid-column: 1 / -1;
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.atmosphere-section > h3 small {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.atmosphere-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 8px;
  color: var(--text-primary);
  font-size: 11.5px;
  min-width: 0;
}

.atmosphere-controls label.atmosphere-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.atmosphere-controls label.atmosphere-toggle input {
  width: auto;
  margin: 0;
}

.atmosphere-controls input[type="range"],
.atmosphere-controls select {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
}

.atmosphere-controls output {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 44px;
  text-align: right;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.atmosphere-controls label[data-modified="true"] output {
  color: var(--accent-warm);
}

.atmosphere-controls label[data-modified="true"] output::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-warm);
  flex: none;
}

.atmosphere-controls label:has(:disabled) {
  opacity: 0.42;
}

.atmosphere-controls p {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.spotlight-position {
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.spotlight-note {
  grid-column: 1 / -1;
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.rim-direction-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.rim-direction-label {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.rim-direction-pills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.rim-direction-pills button {
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.rim-direction-pills button:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.rim-direction-pills button[aria-pressed="true"] {
  background: #ededef;
  border-color: #ededef;
  color: #0b0b0d;
}

.atmosphere-regions select,
.atmosphere-mask-tools button,
.atmosphere-brush button,
.atmosphere-ml button {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 560;
  padding: 6px 11px;
  min-height: 32px;
}

.atmosphere-mask-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.atmosphere-mask-tools button[data-attention="true"] {
  border-color: var(--accent-warm-border);
  color: var(--accent-warm);
  background: var(--accent-warm-soft);
}

.atmosphere-mask-tools button[aria-pressed="true"],
.atmosphere-brush button[aria-pressed="true"] {
  background: #ededef;
  border-color: #ededef;
  color: #0b0b0d;
}

.atmosphere-mask-tools small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.atmosphere-mask-tools .swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.atmosphere-mask-tools .swatch-subject { background: #12d9ad; }
.atmosphere-mask-tools .swatch-face { background: #ff6699; margin-left: 4px; }

.atmosphere-ml {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.atmosphere-ml small {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1 1 180px;
}

.atmosphere-brush {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.atmosphere-brush > div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.atmosphere-brush button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.atmosphere-brush button svg,
.geometry-actions button svg,
.wb-picker-btn svg {
  width: 13px;
  height: 13px;
  flex: none;
  stroke: currentColor;
}

.atmosphere-brush small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.atmosphere-guide {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.atmosphere-guide summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 560;
  padding: 2px 0;
  user-select: none;
}

.atmosphere-guide summary small {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.atmosphere-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding-top: 8px;
}

.atmosphere-fallback {
  margin: 4px 12px;
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

/* ============================================================================
   Inspector — 5-Workspace Hierarchy & Unified Controls
   ============================================================================ */

.inspector {
  background: var(--bg-canvas);
  border-left: 1px solid var(--border-subtle);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.inspector-heading {
  height: 50px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-heading .eyebrow {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.inspector-heading h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 1px 0 0;
}

.reset-button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 560;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  transition: background-color var(--t-fast), color var(--t-fast);
}

.reset-button svg {
  width: 13px;
  height: 13px;
}

.reset-button:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Level 1 Workspace Switcher */
.inspector-primary-nav {
  margin: 10px 12px 0;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex: none;
}

.inspector-group-btn {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  min-height: 30px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.inspector-group-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.inspector-group-btn.active {
  background: #f2f2f3;
  color: #0b0b0d;
  border-color: #f2f2f3;
}

/* Level 2 Context Sub-Tabs */
.inspector-tabs {
  margin: 6px 12px 0;
  padding: 3px;
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 0;
  border-radius: var(--radius-sm);
  flex: none;
}

.inspector-tab {
  position: relative;
  flex: 1 1 0%;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 560;
  min-height: 28px;
  padding: 0 4px;
  white-space: nowrap;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.inspector-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.inspector-tab.active {
  background: var(--bg-elevated);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
}

/* Edit Indicator Dots across Workspace Groups, Sub-Tabs & Dock */
.inspector-group-btn.has-edits::after,
.inspector-tab.has-edits::after,
.mobile-category.has-edits::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-warm);
  box-shadow: 0 0 6px rgba(232, 193, 122, 0.55);
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.inspector-group-btn.active.has-edits::after,
.mobile-category.selected.has-edits::after {
  background: #b57b20;
  box-shadow: none;
}

.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 10px 14px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.inspector-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 0;
  margin-bottom: 8px;
}

.inspector-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

/* Shared Darkroom Cards & Segmented Controls */
.kf-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: var(--radius-md);
  padding: 11px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.kf-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kf-card-head > span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.kf-card-head > small {
  font-size: 11px;
  color: var(--text-muted);
}

.inline-inspect-btn {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 9px;
  min-height: 22px;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.inline-inspect-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.inline-inspect-btn[aria-pressed="true"] {
  background: var(--accent-warm-soft);
  border-color: var(--accent-warm-border);
  color: var(--accent-warm);
}

.kf-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.kf-segmented button {
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.kf-segmented button:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.kf-segmented button[aria-pressed="true"] {
  background: var(--bg-elevated);
  border-color: rgba(232, 193, 122, 0.56);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Progressive Disclosure Accordions */
.kf-disclosure,
.creative-stack {
  border-top: 1px solid var(--border-subtle);
  padding-top: 4px;
}

.kf-disclosure > summary,
.creative-stack > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 2px;
  transition: color var(--t-fast);
}

.kf-disclosure > summary:hover,
.creative-stack > summary:hover {
  color: var(--text-primary);
}

.kf-disclosure > summary::-webkit-details-marker,
.creative-stack > summary::-webkit-details-marker {
  display: none;
}

.kf-disclosure > summary::after,
.creative-stack > summary::after {
  content: "+";
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
}

.kf-disclosure[open] > summary::after,
.creative-stack[open] > summary::after {
  content: "−";
}

.kf-disclosure-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
}

/* Unified Slider Rows & Modified Indicators */
.control {
  margin: 0;
  padding: 2px 0;
}

.kf-card > .control + .control {
  margin-top: 2px;
}

.control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1px;
}

.control-header label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 540;
  color: var(--text-secondary);
  transition: color var(--t-fast);
}

.control:hover .control-header label,
.control:focus-within .control-header label,
.control[data-modified="true"] .control-header label {
  color: var(--text-primary);
}

.control-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: right;
  white-space: nowrap;
}

.control[data-modified="true"] .control-header label::after,
.studio-control[data-modified="true"] .control-header label::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-warm);
  flex: none;
}

.control[data-modified="true"] .control-value,
.studio-control[data-modified="true"] output {
  color: var(--accent-warm);
}

input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 22px;
  border-radius: 4px;
  background-color: transparent;
  background-image: linear-gradient(#2b2b30, #2b2b30);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 3px;
  outline: none;
  margin: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

input[type="range"][data-bipolar] {
  --fill-start: 0%;
  --fill-end: 0%;
  --zero-pct: 50%;
  --track-fill: rgba(255, 255, 255, 0.34);
  background-image:
    linear-gradient(
      90deg,
      transparent 0%,
      transparent var(--fill-start),
      var(--track-fill) var(--fill-start),
      var(--track-fill) var(--fill-end),
      transparent var(--fill-end),
      transparent 100%
    ),
    linear-gradient(#28282d, #28282d);
}

input[type="range"][data-bipolar="true"] {
  background-image:
    linear-gradient(
      90deg,
      transparent calc(var(--zero-pct) - 0.75px),
      rgba(255, 255, 255, 0.42) calc(var(--zero-pct) - 0.75px),
      rgba(255, 255, 255, 0.42) calc(var(--zero-pct) + 0.75px),
      transparent calc(var(--zero-pct) + 0.75px)
    ),
    linear-gradient(
      90deg,
      transparent 0%,
      transparent var(--fill-start),
      var(--track-fill) var(--fill-start),
      var(--track-fill) var(--fill-end),
      transparent var(--fill-end),
      transparent 100%
    ),
    linear-gradient(#28282d, #28282d);
}

input[type="range"][data-active="true"] {
  --track-fill: rgba(232, 193, 122, 0.85);
}

#control-adjustments-temp,
#mobileFocusSlider[data-color-control="temp"] {
  background-image: linear-gradient(90deg, #5595ff, #a1a1a1 50%, #efa04c);
  background-size: 100% 4px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid #0d0d0f;
  border-radius: 50%;
  background: #f2f2f3;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  transition: transform var(--t-fast), background-color var(--t-fast), box-shadow var(--t-fast);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.1);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.18);
  background: var(--accent-warm);
  box-shadow: 0 0 0 4px rgba(232, 193, 122, 0.24), 0 2px 8px rgba(0, 0, 0, 0.75);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #0d0d0f;
  border-radius: 50%;
  background: #f2f2f3;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

@media (max-width: 740px), (pointer: coarse) {
  input[type="range"] {
    height: 36px;
    margin: 0;
    background-size: 100% 4px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border-width: 2px;
  }

  input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(232, 193, 122, 0.26), 0 2px 8px rgba(0, 0, 0, 0.75);
  }

  input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
}

.hsl-note,
.creative-note {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.5;
  margin: 2px 0 0;
}

/* ============================================================================
   Tool-Specific Panels (HSL, Curves, Grain, Blur, Light Studio, Crop, Type, Masks)
   ============================================================================ */

/* HSL */
.hsl-panel {
  gap: 10px;
}

.hsl-swatches {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
}

.hsl-swatch {
  display: grid;
  place-items: center;
  width: 100%;
  height: 34px;
  border-radius: var(--radius-xs);
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
}

.hsl-swatch span {
  display: block;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--swatch);
}

.hsl-swatch[aria-pressed="true"] {
  border-color: rgba(232, 193, 122, 0.75);
  background: var(--bg-elevated);
}

.hsl-band-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  color: var(--text-primary);
  font-size: 12.5px;
}

.inline-reset {
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 4px 9px;
  font-size: 11px;
}

.inline-reset:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.hsl-panel #control-hsl-hue {
  background-image: linear-gradient(90deg, #f66, #ffdf63, #80d75f, #67dce7, #7483ff, #e673e6, #f66);
  background-size: 100% 4px;
  background-position: center;
  background-repeat: no-repeat;
}

.hsl-panel #control-hsl-sat {
  background-image: linear-gradient(90deg, #626262, var(--band-color));
  background-size: 100% 4px;
  background-position: center;
  background-repeat: no-repeat;
}

.hsl-panel #control-hsl-lum {
  background-image: linear-gradient(90deg, #222, var(--band-color), #fff);
  background-size: 100% 4px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Curves */
.curve-workspace,
.geometry-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.curve-channel-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.curve-channel-tabs button {
  min-height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}

.curve-channel-tabs button[aria-pressed="true"] {
  background: var(--bg-elevated);
  border-color: rgba(232, 193, 122, 0.56);
  color: #ffffff;
}

.curve-graph {
  display: block;
  width: 100%;
  max-width: 230px;
  aspect-ratio: 1;
  margin: 4px auto 8px;
  background: linear-gradient(145deg, #1b1b20, #121216);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  touch-action: none;
  cursor: crosshair;
}

.curve-node {
  stroke: #0d0d0f;
  stroke-width: 1.8px;
  cursor: ns-resize;
  transition: r 120ms ease;
}

.curve-node:hover {
  r: 7px;
}

.curve-reset,
.geometry-actions button {
  padding: 8px 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 560;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

.curve-reset:hover:not(:disabled),
.geometry-actions button:hover:not(:disabled),
.geometry-actions button[aria-pressed="true"] {
  background: #28282f;
  color: #ffffff;
  border-color: rgba(232, 193, 122, 0.56);
}

.wb-picker-btn {
  width: 100%;
  justify-content: center;
}

.wb-picker-btn[aria-pressed="true"] {
  background: var(--accent-warm);
  color: #0b0b0d;
  border-color: var(--accent-warm);
}

/* Grain & Blur */
.grain-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-grain-presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.grain-presets button {
  flex: 1 1 28%;
}

.mobile-grain-presets button {
  flex: 0 0 auto;
  padding: 5px 10px;
}

.grain-presets button,
.mobile-grain-presets button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  min-height: 32px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 560;
  white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.grain-presets button:hover:not(:disabled),
.mobile-grain-presets button:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.grain-presets button[aria-pressed="true"],
.mobile-grain-presets button[aria-pressed="true"] {
  background: var(--bg-elevated);
  color: #ffffff;
  border-color: rgba(232, 193, 122, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.blur-studio-panel,
.light-studio-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-blur-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.mobile-blur-modes button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.mobile-blur-modes button[aria-pressed="true"] {
  background: var(--bg-elevated);
  color: #ffffff;
  border-color: rgba(232, 193, 122, 0.58);
}

/* Light Studio */
.studio-slot-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  vertical-align: 1px;
  margin-right: 4px;
}

.studio-slot-dot.is-on {
  background: var(--accent-warm);
}

.studio-light-slots button[aria-pressed="true"] .studio-slot-dot.is-on {
  background: #a56516;
}

.studio-light-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.studio-light-toggle,
.studio-subject-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
}

.studio-light-toggle input,
.studio-subject-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #f2f2f3;
  margin: 0;
}

.studio-light-head button {
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  border-radius: var(--radius-xs);
  padding: 4px 9px;
}

.studio-light-head button:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.studio-control {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.studio-control .control-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.studio-control output {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 12px;
  min-width: 42px;
  text-align: right;
  white-space: nowrap;
}

.studio-status,
.studio-hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.studio-hint {
  color: var(--text-muted);
}

.light-studio-handles {
  position: absolute;
  inset: 0;
  z-index: 13;
  pointer-events: none;
}

.light-studio-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1.5px solid #f1ece2;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(11, 11, 13, 0.65);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.light-studio-handle[aria-pressed="true"] {
  outline: 2px solid var(--accent-warm);
  outline-offset: 3px;
}

.fx-process-styles { display: flex; gap: 5px; flex-wrap: wrap; margin: 7px 0 10px; }
.fx-process-styles button {
  flex: 1 1 auto; min-height: 32px; border: 1px solid var(--border-default);
  background: var(--bg-input); color: var(--text-secondary);
  font-size: 10px; border-radius: 8px; padding: 6px 7px; cursor: pointer;
  touch-action: manipulation;
}
.fx-process-styles button[aria-pressed="true"] {
  background: var(--bg-elevated); color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Film Lab V2.2–2.4: clean darkroom suggestions and precision tuning. */
.fx-ideas .kf-card-head small { color: var(--text-muted); font-weight: 400; }
.fx-ideas-list { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 10px; }
.fx-idea {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  width: 100%; min-width: 0; min-height: 62px; text-align: left;
  border: 1px solid var(--border-default); background: var(--bg-input);
  color: var(--text-primary); border-radius: 10px; padding: 11px 12px;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
  touch-action: manipulation;
}
.fx-idea:hover, .fx-idea:focus-visible { border-color: var(--border-strong); background: var(--bg-elevated); }
.fx-idea strong { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.fx-idea small { font-size: 10px; line-height: 1.4; color: var(--text-secondary); }
.fx-idea > span { color: var(--text-muted); font-size: 10px; }
.fx-precision { margin: 8px 0 1px; padding: 1px 0; }
.fx-precision > summary { cursor: pointer; font-size: 11px; color: var(--text-secondary); padding: 6px 0; }
.fx-precision-body { display: flex; flex-direction: column; gap: 9px; padding: 5px 0 7px; }
.fx-feather-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); }
.fx-feather-steps, .fx-precision-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-feather-steps button, .fx-precision-actions button {
  flex: 1 1 auto; border: 1px solid var(--border-default); border-radius: 7px;
  background: var(--bg-input); color: var(--text-secondary);
  padding: 7px 9px; font-size: 10px; min-height: 32px; cursor: pointer;
  touch-action: manipulation;
}
.fx-feather-steps button[aria-pressed="true"], .fx-precision-actions button[aria-pressed="true"] {
  border-color: var(--border-strong); color: var(--text-primary);
  background: var(--bg-elevated);
}
.fx-material > summary { min-height: 34px; }
body[data-mobile-tab="effects"] .mobile-tool-categories .mobile-category { font-size: 10px; padding-inline: 2px; }
body[data-mobile-tab="effects"] .mobile-tool-strip { touch-action: pan-x; }
body[data-mobile-tab="effects"] .mobile-focus-control input[type="range"] { touch-action: none; }
body[data-mobile-tab="effects"] .mobile-tool-strip .fx-idea-mobile {
  flex: 0 0 min(230px, 66vw); max-width: min(230px, 66vw);
  min-height: 90px; padding: 10px; white-space: normal;
}
@media(max-width:740px) {
  .mobile-fx-target .fx-precision-body { max-height: 160px; overflow-y: auto; overscroll-behavior: contain; }
  .mobile-fx-target .fx-precision > summary { min-height: 32px; }
}

/* Film FX V2.1: quiet contrast, compact tactile controls and optional mask targeting. */
.fx-quality .fx-note {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.fx-intensity-presets, .fx-target-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.fx-intensity-presets button, .fx-target-options button {
  flex: 1 1 auto;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  background: var(--bg-input);
  font-size: 11px;
  cursor: pointer;
}
.fx-intensity-presets button[aria-pressed="true"], .fx-target-options button[aria-pressed="true"] {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.fx-target {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 9px;
}
.fx-target-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  font-weight: 600;
}
.fx-target-pending {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}
.mobile-fx-target[hidden] { display: none !important; }
.mobile-fx-target .fx-target { border-top: 0; padding: 5px 0 1px; }
.fx-more-choice { border: 1px dashed var(--border-strong) !important; }
.fx-more-choice .mobile-tool-icon { font-size: 23px; line-height: 1; }
@media (max-width: 740px) {
  .mobile-fx-target .fx-target-options button { min-height: 30px; }
  .mobile-fx-target .fx-target-label { font-size: 10px; }
}

/* Film FX Collection V2: low-density hierarchy, consistent touch targets. */
.fx-subhead {
  margin: 12px 0 6px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: .11em;
  font-weight: 700;
}
body[data-mobile-tab="effects"] .mobile-tool-categories {
  gap: 5px;
  width: 100%;
}
body[data-mobile-tab="effects"] .mobile-tool-categories .mobile-category {
  flex: 1 1 0;
  min-width: 0;
  min-height: 30px;
  padding: 6px 4px;
  text-align: center;
  white-space: nowrap;
}
body[data-mobile-tab="effects"] .mobile-tool-strip {
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
}

/* FX Layers & Geometry */
.film-layer-row {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.film-layer-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.film-layer-row.is-enabled .film-layer-toggle {
  color: #ffffff;
}

.film-layer-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.film-layer-toggle input {
  accent-color: #f2f2f3;
}

.film-layer-control {
  margin-top: 8px;
}

.geometry-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.geometry-controls select,
.creative-card select,
.creative-card textarea,
.frame-options > select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12px;
  outline: none;
}

.geometry-angle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.geometry-angle > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.geometry-angle input {
  width: 8ch;
  padding: 6px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Creative Cards (Type, Frames, Masks) */
.creative-card {
  padding: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 10px;
}

.creative-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stack-field,
.select-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#creativeText {
  min-height: 60px;
  max-height: 150px;
  line-height: 1.4;
  resize: vertical;
}

.type-options,
.overlay-palette {
  margin-top: 12px;
}

.overlay-palette-head,
.overlay-swatches,
.overlay-picker {
  display: flex;
  gap: 7px;
  align-items: center;
}

.overlay-palette-head {
  justify-content: space-between;
  margin-bottom: 7px;
}

.overlay-picker {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.overlay-picker input {
  width: 32px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  cursor: pointer;
}

.overlay-swatches {
  flex-wrap: wrap;
}

.overlay-swatches button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11.5px;
}

.overlay-swatches .overlay-swatch {
  width: 28px;
  padding: 0;
  background: var(--swatch);
}

.overlay-swatches button[aria-pressed="true"] {
  outline: 1.5px solid #ffffff;
  outline-offset: 2px;
}

/* Frames */
.frame-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.frame-picker button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 66px;
  padding: 6px 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}

.frame-picker button[aria-pressed="true"] {
  border-color: #ffffff;
  background: var(--bg-elevated);
  color: #ffffff;
}

.frame-sample {
  display: block;
  width: 34px;
  height: 24px;
  background: #5a5a5e;
  border: 2px solid #e0e0e4;
  border-radius: 2px;
}

[data-frame-style="none"] .frame-sample { border: 1px dashed #d8d8dc; background: transparent; }
[data-frame-style="black"] .frame-sample { border-color: #050505; }
[data-frame-style="polaroid"] .frame-sample { border-width: 3px 3px 7px; }
[data-frame-style="gallery"] .frame-sample { border-width: 5px; }
[data-frame-style="letterbox"] .frame-sample { border-width: 5px 0; border-color: #050505; }
[data-frame-style="sidebars"] .frame-sample { border-width: 0 5px; }
[data-frame-style^="roll"] .frame-sample { border: 4px solid #101010; border-inline-style: dotted; outline: 1px solid #777; }
[data-frame-style="roll16"] .frame-sample { border-right-style: solid; }
[data-frame-style="roll120"] .frame-sample { border-inline-style: solid; border-block-style: dotted; }

.frame-options {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
}

.frame-options legend {
  padding-right: 7px;
  color: var(--text-secondary);
}

.frame-options > .stack-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
}

.frame-options .control {
  margin: 12px 0 2px;
}

/* Local Masks (preserving required class names) */
.mask-card .mask-kind-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.mask-card .mask-kind-tabs button {
  padding: 0 6px;
  min-height: 28px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
}

.mask-card .mask-kind-tabs button[aria-pressed="true"] {
  background: #ededef;
  color: #0b0b0d;
  border-color: #ededef;
  outline: none;
}

.mask-starters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 10px 0 6px;
}

.mask-starters button {
  padding: 0 4px;
  min-height: 30px;
  font-size: 11px;
}

.mask-target-group {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.mask-target-pills {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 1.35fr);
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.mask-target-pills button {
  min-height: 28px;
  min-width: 0;
  padding: 3px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.mask-target-pills button[aria-pressed="true"] {
  background: #ededef;
  border-color: #ededef;
  color: #0b0b0d;
  outline: none;
}

.mask-subject-bar {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}

.mask-subject-status {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.mask-subject-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mask-subject-actions button {
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
}

.mask-subject-actions button[aria-pressed="true"] {
  background: #ededef;
  border-color: #ededef;
  color: #0b0b0d;
}

.mask-card .film-layer-toggle {
  margin-top: 10px;
}

.mask-card .mask-invert-toggle {
  margin-top: 6px;
  margin-bottom: 6px;
}

.mask-card .mask-tip {
  margin: 10px 0 2px;
  font-size: 11px;
}

/* Histogram */
.histogram-panel {
  border-top: 1px solid var(--border-subtle);
  margin-top: 14px;
  padding-top: 12px;
}

.histogram-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11.5px;
  margin-bottom: 8px;
}

.histogram-heading span:last-child {
  color: var(--text-muted);
  font-size: 11px;
}

.histogram-panel canvas {
  display: block;
  max-width: 100%;
  width: 100%;
  height: 76px;
  background: linear-gradient(180deg, #161619, #0e0e11);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.histogram-warning {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ============================================================================
   Modals, Dialogs, Intro Cover & Toasts
   ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 6, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.modal {
  width: min(100%, 510px);
  background: var(--bg-panel);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.78);
  max-height: 90dvh;
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.modal-head h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 6px 0 0;
}

.modal-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.format-choice {
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 68px;
}

.format-choice strong {
  font-size: 13px;
}

.format-choice span {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.format-choice.selected {
  border-color: #ffffff;
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px #ffffff inset;
}

.export-format-help {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.export-setting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0 0;
}

.export-setting label {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.export-setting label span {
  color: var(--text-secondary);
}

.export-setting select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
}

.upscale-extended-toggle {
  display:flex; align-items:flex-start; gap:10px; margin-top:10px;
  padding:11px 12px; border:1px solid var(--border-subtle);
  background:var(--bg-card); border-radius:var(--radius-sm);
  color:var(--text-primary); cursor:pointer; font-size:12px;
}
.upscale-extended-toggle input { flex:none; margin:3px 0 0; accent-color:#e5aa78; }
.upscale-extended-toggle span { display:flex; flex-direction:column; gap:3px; line-height:1.35; min-width:0; }
.upscale-extended-toggle small { color:var(--text-secondary); font-size:11px; line-height:1.45; font-weight:400; }
.upscale-extended-toggle:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.upscale-extended-toggle:focus-within { outline:1px solid var(--text-secondary); outline-offset:2px; }
.upscale-extended-toggle.compact { padding:9px 10px; margin:8px 0; }
/* Neural Detail model tiers: visible only when AI is enabled.
 * Compact, accessible and independent of the processing-strength slider. */
.neural-model-wrap { margin:10px 0 11px; }
.neural-model-wrap[hidden] { display:none !important; }
.neural-model-heading { display:block; font-size:10px; font-weight:650; letter-spacing:.09em;
  color:var(--text-secondary); margin-bottom:6px; }
.neural-model-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
.neural-model-controls button { display:flex; align-items:center; justify-content:center; gap:6px;
  flex-wrap:wrap; min-width:0; min-height:42px; padding:7px 6px; border:1px solid var(--border-default);
  border-radius:7px; background:var(--bg-card); color:var(--text-secondary);
  font-size:11px; font-weight:600; line-height:1.2; font-family:inherit; cursor:pointer; }
.neural-model-controls button small { font-size:9px; font-weight:500; opacity:.78; }
.neural-model-controls button[aria-pressed="true"] { border-color:rgba(241,169,111,.78);
  color:var(--text-primary); background:rgba(241,169,111,.12); }
.neural-model-controls button:disabled { opacity:.4; cursor:not-allowed; }
.neural-model-controls button:focus-visible { outline:2px solid var(--text-primary); outline-offset:2px; }

.upscale-extended-toggle[data-extended="true"] {
  border-color:rgba(229,170,120,.36);
  background:rgba(229,170,120,.055);
}

/* Precision Upscale is a separate, non-destructive export enhancement.
 * Small segmented controls remain scroll-free at narrow mobile widths. */
.precision-export-controls {
  margin-top:14px;
  padding:12px;
  border:1px solid var(--border-subtle);
  border-radius:var(--radius-sm);
  background:var(--bg-card);
}
.precision-export-controls.compact { margin:12px 0 0; padding:0; border:0; background:transparent; }
.precision-heading { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.precision-heading strong { color:var(--text-primary); font-size:11px; letter-spacing:.06em; text-transform:uppercase; }
.precision-heading small { color:var(--text-muted); font-size:10px; text-align:right; }
.precision-mode-controls { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; margin:11px 0; }
.precision-mode-controls button {
  min-height:32px; min-width:0; border:1px solid var(--border-default); border-radius:7px;
  background:var(--bg-card); color:var(--text-secondary); font-size:11px;
  font-weight:600; cursor:pointer; padding:5px 3px; line-height:1.3;
}
.precision-mode-controls button[aria-pressed="true"] {
  border-color:rgba(241,169,111,.78); color:var(--text-primary); background:rgba(241,169,111,.14);
}
.precision-mode-controls button:disabled { opacity:.38; cursor:not-allowed; }
.precision-mode-controls button:focus-visible, .precision-strength-label input:focus-visible {
  outline:2px solid var(--text-primary); outline-offset:2px;
}
.precision-strength-label {
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap;
  column-gap:8px; color:var(--text-secondary); font-size:11px; line-height:1.5;
}
.precision-strength-label output { font-variant-numeric:tabular-nums; color:var(--text-primary); font-weight:650; }
.precision-strength-label input { flex:0 0 100%; margin:7px 0 2px; accent-color:#e5aa78; }
.precision-strength-label input:disabled { opacity:.4; }
.precision-note { color:var(--text-secondary); font-size:11px; line-height:1.5; margin:8px 0 0; }
.precision-note[data-warning="true"] { color:#f2c19a; }
@media (max-width:740px) {
  .precision-export-controls { padding:10px; }
  .precision-mode-controls { gap:3px; }
  .precision-mode-controls button { font-size:10px; min-height:32px; }
}

.export-upscale-note {
  margin: 1px 0 0;
  padding: 9px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-card);
  font-size: 11.5px;
  line-height: 1.5;
}
.export-upscale-note[hidden] { display: none; }
.export-upscale-note[data-warning="true"] {
  color: #f2c19a;
  border-color: rgba(242, 193, 154, .30);
}

.export-note {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.export-note svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.export-error {
  margin: 12px 0 0;
  color: #f3a1a1;
  font-size: 12px;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.modal-footer > span {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.modal-footer .primary-button {
  height: 40px;
}

#heicDownload {
  text-decoration: none;
}

/* Dialogs (Recipes, Edit History, Magic Edit, Guide) */
.recipes-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: min(680px, calc(100dvh - 34px));
  padding: 20px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  color: var(--text-primary);
}

.recipes-dialog::backdrop {
  background: rgba(4, 4, 6, 0.72);
}

.recipe-copy,
.recipe-status {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.recipe-form label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.recipe-form > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.recipe-form input {
  min-width: 0;
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 9px 10px;
}

.recipe-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.recipe-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--border-subtle);
}

.recipe-list li small {
  color: var(--text-secondary);
  margin-top: 2px;
}

.recipe-portability {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px;
}

.recipe-import-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.recipe-import-box textarea {
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 11px;
  font-family: Menlo, Consolas, monospace;
  resize: vertical;
}

.recipe-import-box button {
  align-self: flex-end;
}

.history-summary {
  margin: 0;
  padding-bottom: 8px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

#editHistoryList {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

#editHistoryList li {
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto 46px;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

#editHistoryList li[aria-current="step"] {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

#editHistoryList .history-number {
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.history-info {
  display: grid;
  gap: 3px;
  font-size: 12px;
}

.history-info small {
  font-size: 11px;
  color: var(--text-secondary);
}

.history-info small:empty {
  display: none;
}

.magic-dialog {
  width: min(1040px, calc(100vw - 40px));
  max-width: none;
  max-height: min(780px, calc(100dvh - 36px));
  padding: 0;
  overflow: hidden;
}

.magic-studio-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  max-height: inherit;
}

.magic-header {
  padding: 14px 20px 12px;
  margin: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.magic-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.magic-scene-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.magic-studio-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
  gap: 18px;
  padding: 16px 20px;
  min-height: 0;
  overflow: hidden;
}

.magic-stage-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.magic-photo {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 240px;
  background: #050507;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: zoom-in;
}

.magic-photo.is-zoomed {
  overflow: auto;
  place-items: start;
  touch-action: pan-x pan-y;
  cursor: zoom-out;
}

.magic-photo-canvas {
  display: grid;
  place-items: center;
}

.magic-photo-canvas canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(56dvh, 520px);
  object-fit: contain;
}

.magic-photo.is-zoomed .magic-photo-canvas canvas {
  max-width: none;
  max-height: none;
}

.magic-compare-badge {
  z-index: 2;
}

.magic-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.magic-stage-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.magic-stage-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.magic-controls-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.magic-style-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.magic-style-pill {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.magic-style-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.magic-style-pill[aria-selected="true"] {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #09090b;
  font-weight: 600;
}

.magic-description {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-block: 4px;
}

.magic-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.magic-style-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.magic-variations {
  min-width: 204px;
}

.magic-description p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}

.magic-intensity-card,
.magic-apply-mode {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.magic-intensity-card label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.magic-intensity-card label span {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.magic-field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.magic-conflict-note {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.4;
}

.magic-safeguards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.magic-safeguard-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
}

#magicLayers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  list-style-position: inside;
  padding: 0;
  margin: 0;
  color: var(--text-primary);
  font-size: 11.5px;
}

#magicLayers li {
  padding: 4px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
}

.magic-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.magic-actions .primary-button {
  margin-inline-start: auto;
}

.magic-preview-note {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.magic-adjustments {
  color: var(--text-primary);
  font-size: 11.5px;
}

.magic-adjustments p {
  padding: 8px 10px;
  font-size: 11.5px;
}

@media (max-width: 767px) {
  .magic-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .magic-header {
    padding: 10px 14px;
  }

  .magic-studio-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(210px, 44dvh) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 14px;
  }

  .magic-photo {
    min-height: 180px;
  }

  .magic-photo-canvas canvas {
    max-height: min(38dvh, 340px);
  }

  .magic-style-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .magic-style-strip::-webkit-scrollbar {
    display: none;
  }

  .magic-actions {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
}

.studio-guide {
  padding: 0;
  max-height: min(640px, calc(100dvh - 28px));
  overflow: auto;
}

.studio-guide .modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}

.studio-guide-body {
  padding: 12px 16px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.guide-icons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.guide-icons li {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 7px 6px;
  color: var(--text-primary);
  font-size: 11px;
}

.guide-icons svg {
  width: 15px;
  height: 15px;
}

.studio-guide details {
  border-top: 1px solid var(--border-subtle);
  padding: 9px 0;
}

.studio-guide summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  padding: 4px 0;
}

.studio-guide dt {
  font-weight: 600;
  color: var(--text-primary);
}

.studio-guide dd {
  margin: 0 0 6px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  z-index: 50;
  transition: opacity var(--t-ui), transform var(--t-ui);
  max-width: min(460px, 90vw);
  text-align: center;
  line-height: 1.45;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Intro Cover */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  isolation: isolate;
  display: grid;
  overflow: auto;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: max(16px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  background: #000;
  color: #fff;
  text-align: center;
}

.intro-image,
.intro-overlay::before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.intro-image {
  z-index: -2;
  object-fit: cover;
  object-position: center 48%;
}

.intro-overlay::before {
  content: "";
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.44) 48%, rgba(0, 0, 0, 0.84) 100%);
}

/* Desktop cover uses the newly supplied 4:3 photograph; mobile is unchanged. */
@media (min-width: 741px) {
  .intro-image { object-position: center 39%; }
  .intro-overlay::before {
    background: linear-gradient(180deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.26) 38%, rgba(0,0,0,.56) 65%, rgba(0,0,0,.86) 100%);
  }
}


.intro-title {
  grid-row: 2;
  margin: 0;
  justify-self: center;
  color: #fff;
}

.intro-logo {
  display: block;
  width: clamp(210px, 34vw, 384px);
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.9));
}

.intro-k { stroke-width: 2.7; }
.intro-film { stroke-width: 2.1; }

[data-intro-letter] {
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
}

[data-intro-letter] > g {
  transform-box: fill-box;
  transform-origin: center 85%;
  pointer-events: none;
}

.intro-letter-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1;
  pointer-events: all;
}

[data-intro-letter]:focus-visible .intro-letter-hit {
  stroke: #fff;
}

.intro-content {
  grid-row: 3;
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 13px;
}

#introEnterBtn {
  min-width: 164px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-xs);
  background: rgba(10, 10, 12, 0.56);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

#introEnterBtn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-1px);
}

.intro-footer {
  color: rgba(255, 255, 255, 0.84);
  font-size: 11.5px;
  text-shadow: 0 1px 8px #000;
}

/* A cinematic cover with one invitation; studio choices live at /studio/. */
.intro-content {
  width: min(380px, 100%);
  justify-self: center;
  padding-top: 16px;
  gap: 18px;
}
.intro-choose-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: .2em;
  font-weight: 650;
  color: rgba(255,255,255,.9);
  text-shadow: 0 2px 10px rgba(0,0,0,.8);
}
#introEnterBtn {
  display: inline-flex;
  width: min(270px, 100%);
  min-height: 53px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 10px;
  padding: 0 20px;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.26);
}
#introEnterBtn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#introEnterBtn:focus-visible {outline: 2px solid #f4d0b1;outline-offset: 4px}
.intro-footer { margin-top: 1px; }
@media (max-width: 620px) {
  .intro-content { width: min(340px,100%); gap: 14px; }
  .intro-choose-label { font-size: 9px; letter-spacing: .18em; }
  #introEnterBtn { min-height: 52px; }
}
@media (max-height: 560px) {
  .intro-overlay { grid-template-rows: minmax(0,1fr) auto auto; }
  .intro-content { align-self: end; gap: 10px; margin-top: 12px; }
  #introEnterBtn { min-height: 43px; }
}

@media (prefers-reduced-motion: no-preference) {
  .intro-image { animation: cover-reveal 0.45s ease-out both; }
  .intro-k path { stroke-dasharray: 1; animation: ink-stroke 0.45s ease-out both; }
  .intro-k path:nth-child(2) { animation-delay: 0.36s; }
  .intro-k path:nth-child(3) { animation-delay: 0.68s; }
  .intro-film path {
    --film-tilt: -9deg;
    --film-delay: 0.95s;
    transform-box: fill-box;
    transform-origin: center 85%;
    animation: film-settle 1.05s ease-out var(--film-delay) both;
  }
  .intro-film > g:nth-child(2) path { --film-delay: 1.06s; --film-tilt: 10deg; }
  .intro-film > g:nth-child(3) path { --film-delay: 1.17s; --film-tilt: -8deg; }
  .intro-film > g:nth-child(4) path { --film-delay: 1.28s; --film-tilt: 9deg; }
}

@keyframes cover-reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes ink-stroke { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes film-settle {
  0% { opacity: 0; transform: translateY(8px) rotate(var(--film-tilt)); }
  42% { opacity: 1; transform: translateY(-4px) rotate(calc(var(--film-tilt) * -0.55)); }
  64% { transform: translateY(2px) rotate(calc(var(--film-tilt) * 0.32)); }
  83% { transform: translateY(-1px) rotate(calc(var(--film-tilt) * -0.14)); }
  100% { opacity: 1; transform: none; }
}

/* ============================================================================
   Desktop & Tablet (>= 741px)
   ============================================================================ */

.mobile-dock,
.mobile-more-menu,
.mobile-sheet-actions,
.sheet-close,
.mobile-tool-browser,
.mobile-focus-control {
  display: none;
}

@media (min-width: 741px) and (max-width: 1023px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 292px;
  }
  .film-library {
    --tray-gutter: 16px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
    padding: 8px 0 8px;
    max-height: 300px;
  }
  .library-heading { grid-column: 1; grid-row: 1; padding-left: var(--tray-gutter); }
  .look-toolbar { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 10px; }
  .look-strength-card { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; }
  .look-strength-card input[type="range"] { width: 80px; }
  .look-workbench { grid-column: 3; grid-row: 1; padding-right: var(--tray-gutter); }
  .category-tabs { grid-column: 1 / -1; padding: 0 var(--tray-gutter); }
  .preset-strip { grid-column: 1 / -1; padding: 2px var(--tray-gutter) 4px; }
  .preset-tile { width: 88px; min-width: 88px; }
  .atmosphere-intro, .atmosphere-tune, .atmosphere-controls, .atmosphere-fallback, .atmosphere-help-panel {
    grid-column: 1 / -1;
    margin-inline: var(--tray-gutter);
  }
  .atmosphere-intro { margin-inline: 0; padding-inline: var(--tray-gutter); }
  .atmosphere-tune { width: calc(100% - (var(--tray-gutter) * 2)); }
}

@media (min-width: 1024px) {
  .topbar {
    height: 48px;
    padding: 0 18px;
  }

  .desktop-panel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
  }

  .desktop-panel-toggle[aria-pressed="true"] {
    color: var(--text-primary);
    background: var(--bg-card);
  }

  .desktop-panel-divider {
    display: inline-block;
  }

  .workspace {
    --left-rail: clamp(256px, 20vw, 296px);
    --right-rail: clamp(280px, 21.5vw, 320px);
    grid-template-columns: var(--left-rail) minmax(0, 1fr) var(--right-rail);
    grid-template-rows: minmax(0, 1fr);
  }

  .main-column {
    display: contents;
  }

  .photo-workspace {
    grid-column: 2;
    grid-row: 1;
    border-right: 0;
  }

  .image-frame {
    padding: clamp(8px, 1.3dvh, 18px) clamp(12px, 1.6vw, 24px);
  }

  .workspace-bottomline {
    min-height: 32px;
    padding: 0 14px;
    gap: 8px;
  }

  .photo-meta {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .photo-meta .meta-chip,
  #fileMeta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .view-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  /* Left Looks & Atmospheres Rail */
  .film-library {
    --tray-gutter: 12px;
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 11px 0 8px;
    background: var(--bg-canvas);
    border-top: 0;
    border-right: 1px solid var(--border-subtle);
  }

  .library-heading {
    flex: none;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 0 var(--tray-gutter);
  }

  .library-heading > div:first-child {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }

  .library-eyebrow {
    display: none;
  }

  .library-heading h2 {
    font-size: 15px;
  }

  .category-tabs {
    flex: none;
    padding: 0 var(--tray-gutter) 2px;
    gap: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
  }

  .look-workbench {
    flex: none;
    padding: 0 var(--tray-gutter);
  }

  .look-workbench-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
  }

  .look-search {
    grid-column: 1 / -1;
    width: 100%;
  }

  .look-search input {
    width: 100%;
    height: 29px;
  }

  .look-workbench-actions > button {
    width: 100%;
    justify-content: center;
    padding: 4px 6px;
    font-size: 11px;
  }

  .look-compare {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  #lookCompareHint,
  .look-compare-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .look-compare-actions {
    justify-content: flex-end;
  }

  .look-toolbar {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 0 var(--tray-gutter);
  }

  .look-strength-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
  }

  .look-strength-card label {
    flex: 0 0 auto;
    margin: 0;
  }

  .look-strength-card input[type="range"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin: 0;
  }

  .look-toolbar-note {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px;
  }

  .look-toolbar-note span {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .smart-caption {
    flex: none;
    margin: 0 var(--tray-gutter);
  }

  .film-library.is-atmosphere .atmosphere-fallback {
    display: none;
  }

  .atmosphere-intro {
    flex: none;
    flex-wrap: nowrap;
    padding: 0 var(--tray-gutter);
    gap: 6px;
  }

  .atmosphere-intro > span:first-child,
  .atmosphere-intro small {
    display: none;
  }

  .atmosphere-status {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .atmosphere-status span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .atmosphere-tune {
    flex: none;
    width: calc(100% - (var(--tray-gutter) * 2));
    margin: 0 var(--tray-gutter);
  }

  .atmosphere-controls,
  .atmosphere-help-panel {
    flex: 0 0 auto;
    margin: 0 var(--tray-gutter);
  }

  .atmosphere-controls {
    max-height: min(36dvh, 280px);
  }

  .preset-strip,
  .film-library.is-atmosphere .preset-strip {
    order: 1;
    flex: 1 1 0%;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 11px 9px;
    padding: 2px var(--tray-gutter) 10px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .film-library.is-atmosphere .preset-strip:not(.is-grid) {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .film-library.is-atmosphere .preset-strip.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
  }

  .preset-tile,
  .preset-card,
  .preset-visual {
    width: 100%;
    min-width: 0;
  }

  .preset-strip.is-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px 7px;
  }

  .preset-strip.is-grid .preset-favorite {
    width: 19px;
    height: 19px;
    font-size: 12px;
    top: 3px;
    right: 3px;
  }

  .preset-strip.is-recommended:not(.is-grid) {
    grid-template-columns: 1fr;
  }

  .preset-empty {
    grid-column: 1 / -1;
  }

  /* Right Darkroom Inspector */
  .inspector {
    grid-column: 3;
    grid-row: 1;
  }

  /* Collapsible Rails & Focus Mode */
  body.collapse-left-panel .workspace {
    grid-template-columns: minmax(0, 1fr) var(--right-rail);
  }
  body.collapse-left-panel .film-library {
    display: none;
  }
  body.collapse-left-panel .photo-workspace { grid-column: 1; }
  body.collapse-left-panel .inspector { grid-column: 2; }

  body.collapse-right-panel .workspace {
    grid-template-columns: var(--left-rail) minmax(0, 1fr);
  }
  body.collapse-right-panel .inspector {
    display: none;
  }

  body.collapse-left-panel.collapse-right-panel .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  body.collapse-left-panel.collapse-right-panel .photo-workspace {
    grid-column: 1;
  }

  body.is-focus-mode.has-photo .image-frame {
    padding: clamp(14px, 2.4dvh, 30px) clamp(20px, 3vw, 44px);
  }

  body.is-focus-mode.has-photo .workspace-topline,
  body.is-focus-mode.has-photo .workspace-bottomline {
    opacity: 0.45;
    transition: opacity var(--t-ui);
  }

  body.is-focus-mode.has-photo .workspace-topline:hover,
  body.is-focus-mode.has-photo .workspace-topline:focus-within,
  body.is-focus-mode.has-photo .workspace-bottomline:hover,
  body.is-focus-mode.has-photo .workspace-bottomline:focus-within {
    opacity: 1;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .workspace {
    --left-rail: clamp(228px, 21vw, 256px);
    --right-rail: clamp(266px, 23vw, 288px);
  }
  body:not(.collapse-left-panel):not(.collapse-right-panel) #colorBadge {
    display: none;
  }
}

@media (min-width: 1560px) {
  .workspace {
    --left-rail: clamp(276px, 19vw, 316px);
    --right-rail: clamp(296px, 20vw, 336px);
  }
}

/* ============================================================================
   Mobile Editing Studio (<= 740px) — 6-Button Fixed Dock + Expandable More Menu
   ============================================================================ */

@media (max-width: 740px) {
  body {
    --mobile-header: 50px;
    --mobile-dock-height: calc(58px + env(safe-area-inset-bottom, 0px));
    --mobile-sheet-max: max(180px, calc(100dvh - var(--mobile-header) - var(--mobile-dock-height) - 180px));
    --mobile-sheet-height: 0px;
  }

  body[data-mobile-panel="looks"] { --mobile-sheet-height: min(clamp(186px, 32dvh, 194px), var(--mobile-sheet-max)); }
  body[data-mobile-panel="looks"]:has(.film-library.is-look-tools-open) { --mobile-sheet-height: min(44dvh, 282px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="looks"]:has(.preset-strip.is-grid) { --mobile-sheet-height: min(46dvh, 360px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="looks"]:has(#lookCompare:not([hidden])) { --mobile-sheet-height: min(48dvh, 376px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="looks"]:has(.preset-strip.is-grid):has(.film-library.is-look-tools-open),
  body[data-mobile-panel="looks"]:has(.preset-strip.is-grid):has(#lookCompare:not([hidden])) { --mobile-sheet-height: min(48dvh, 380px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="atmospheres"] { --mobile-sheet-height: min(31dvh, 186px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="atmospheres"]:has(#atmosphereHelp:not([hidden])) { --mobile-sheet-height: min(40dvh, 256px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) { --mobile-sheet-height: min(48dvh, 360px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="tools"] { --mobile-sheet-height: min(clamp(232px, 37dvh, 254px), var(--mobile-sheet-max)); }
  body[data-mobile-panel="tools"]:is([data-mobile-tab="creative"],[data-mobile-tab="frames"],[data-mobile-tab="masks"],[data-mobile-tab="studio"]) { --mobile-sheet-height: min(39dvh, 295px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="tools"]:is([data-mobile-tab="geometry"],[data-mobile-tab="curves"],[data-mobile-tab="hsl"]) { --mobile-sheet-height: min(46dvh, 320px, var(--mobile-sheet-max)); }
  body[data-mobile-panel="tools"].mobile-sheet-expanded { --mobile-sheet-height: min(48dvh, 360px, var(--mobile-sheet-max)); }

  .topbar {
    height: var(--mobile-header);
    padding: 0 10px;
    gap: 8px;
  }

  .brand {
    min-width: 0;
    gap: 6px;
  }

  .brand-divider,
  .brand-subtitle,
  .header-center,
  .compact-hide,
  .top-actions .desktop-studio-action {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .top-actions .icon-button {
    width: 30px;
    height: 30px;
  }

  .top-actions .text-button,
  .top-actions .primary-button {
    height: 34px;
    min-width: 34px;
    padding: 0 9px;
  }

  .top-actions .text-button span,
  .top-actions .primary-button span {
    display: none;
  }

  body:not(.has-photo) .top-actions .history-button {
    display: none;
  }

  .workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
  }

  .main-column {
    display: block;
    flex: 1;
    min-height: 0;
    position: relative;
  }

  .photo-workspace {
    height: max(160px, calc(100dvh - var(--mobile-header) - var(--mobile-dock-height) - var(--mobile-sheet-height)));
    border-right: 0;
    transition: height 200ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.has-photo .workspace-bottomline {
    display: none;
  }

  body.has-photo .mobile-compare-hold {
    display: inline-flex;
    margin-left: auto;
  }

  .workspace-topline,
  .workspace-bottomline {
    min-height: 32px;
    padding: 0 10px;
    gap: 6px;
  }

  .view-actions {
    gap: 4px;
  }

  .compare-button span {
    display: none;
  }

  .workspace-resolution,
  .photo-meta #colorBadge,
  .workspace-bottomline .bottom-divider,
  .workspace-bottomline #actualBtn {
    display: none;
  }

  .image-frame {
    padding: 6px 8px;
  }

  .image-frame:not(.zoom-actual) {
    touch-action: manipulation;
  }

  .image-frame canvas#previewCanvas {
    box-shadow: none;
  }

  .film-library,
  .inspector {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--mobile-dock-height);
    z-index: 18;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -14px 48px rgba(0, 0, 0, 0.72);
    min-width: 0;
    overscroll-behavior: contain;
    transition: height 200ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .film-library.sheet-open,
  .inspector.sheet-open {
    display: flex;
    flex-direction: column;
    height: var(--mobile-sheet-height);
  }

  .film-library.sheet-open {
    padding: 6px 0 6px;
    gap: 4px;
    overflow-y: hidden;
    overscroll-behavior: contain;
  }

  .film-library.sheet-open:not(.is-atmosphere).is-look-tools-open:not(:has(.preset-strip.is-grid)),
  .film-library.sheet-open:not(.is-atmosphere):has(#lookCompare:not([hidden])):not(:has(.preset-strip.is-grid)) {
    overflow-y: auto;
  }

  .film-library .library-heading {
    display: none;
  }

  .film-library:not(.is-atmosphere) .category-tabs {
    order: 0;
    flex: 0 0 auto;
    padding: 0 12px 2px;
    gap: 4px;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
  }

  .film-library:not(.is-atmosphere) .category-tab {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 11px;
  }

  .film-library:not(.is-atmosphere) .look-workbench {
    order: 2;
    flex: 0 0 auto;
    display: none;
    padding: 5px 12px 3px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .film-library:not(.is-atmosphere).is-look-tools-open .look-workbench,
  .film-library:not(.is-atmosphere):has(#lookCompare:not([hidden])) .look-workbench {
    display: block;
  }

  .film-library:not(.is-atmosphere) .look-workbench-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .film-library:not(.is-atmosphere) .look-search {
    grid-column: 1 / -1;
    width: 100%;
  }

  .film-library:not(.is-atmosphere) .look-search input {
    width: 100%;
    height: 34px;
    font-size: 16px;
  }

  .film-library:not(.is-atmosphere) .look-workbench-actions > button {
    width: 100%;
    justify-content: center;
    min-height: 32px;
    font-size: 11px;
  }

  .look-toolbar {
    order: 3;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 2px 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .look-toolbar-note {
    order: 0;
    flex: 0 1 32%;
    min-width: 0;
  }

  #selectedLookName {
    display: block;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #selectedLookDescription,
  .film-library:not(.is-atmosphere) .smart-caption,
  .film-library:not(.is-atmosphere) .preset-strip:not(.is-grid) .preset-reason {
    display: none;
  }

  .look-strength-card {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 0;
    padding: 0;
  }

  .look-strength-card label {
    order: 2;
    flex: 0 0 auto;
    margin: 0;
    font-size: 11px;
  }

  .look-strength-label {
    display: none;
  }

  .look-strength-card label span {
    min-width: 34px;
  }

  .look-strength-card input[type="range"] {
    order: 1;
    flex: 1 1 auto;
    width: auto;
    min-width: 64px;
    height: 36px;
    margin: 0;
  }

  .look-tools-btn {
    order: 2;
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--t-fast), border-color var(--t-fast);
  }

  .look-tools-btn svg {
    width: 13px;
    height: 13px;
    flex: none;
    stroke: currentColor;
  }

  .look-tools-btn[aria-expanded="true"] {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
  }

  .look-tools-btn[data-has-active="true"]::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-warm);
  }

  .film-library:not(.is-atmosphere) .preset-strip {
    order: 1;
    flex: 1 1 0%;
    min-height: 0;
    align-items: flex-start;
    gap: 9px;
    padding: 2px 12px 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
  }

  .film-library:not(.is-atmosphere) .preset-strip::-webkit-scrollbar {
    display: none;
  }

  .film-library:not(.is-atmosphere) .preset-tile {
    width: 78px;
    min-width: 78px;
    scroll-snap-align: start;
  }

  .film-library:not(.is-atmosphere) .preset-card {
    gap: 3px;
  }

  .film-library:not(.is-atmosphere) .preset-visual {
    border-radius: 7px;
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .film-library:not(.is-atmosphere) .preset-card.selected .preset-visual {
    border-width: 1.5px;
    border-color: #f4f4f6;
    box-shadow: 0 0 0 1px rgba(244, 244, 246, 0.25), 0 6px 14px rgba(0, 0, 0, 0.48);
  }

  .film-library:not(.is-atmosphere) .preset-code {
    padding: 1px 4px;
    font-size: 9.5px;
    gap: 4px;
  }

  .film-library:not(.is-atmosphere) .preset-code::before {
    width: 5px;
    height: 5px;
  }

  .film-library:not(.is-atmosphere) .preset-strip:not(.is-grid) .preset-name {
    font-size: 10.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .film-library:not(.is-atmosphere) .preset-favorite {
    width: 20px;
    height: 20px;
    top: 4px;
    right: 4px;
    font-size: 11px;
  }

  .film-library:not(.is-atmosphere) .preset-strip.is-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 10px 8px;
    padding: 2px 12px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .film-library:not(.is-atmosphere) .preset-strip.is-grid .preset-tile {
    width: 100%;
    min-width: 0;
  }

  .film-library.is-atmosphere.sheet-open {
    padding-top: 6px;
    overflow-y: hidden;
  }

  .film-library.is-atmosphere .look-workbench,
  .film-library.is-atmosphere .look-toolbar,
  .film-library.is-atmosphere .look-tools-btn {
    display: none;
  }

  .film-library.is-atmosphere .preset-strip,
  .film-library.is-atmosphere .preset-strip.is-grid {
    order: 0;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 12px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
  }

  .film-library.is-atmosphere .preset-strip::-webkit-scrollbar {
    display: none;
  }

  .film-library.is-atmosphere .preset-strip:not(.is-grid) .preset-tile.is-editorial,
  .film-library.is-atmosphere .preset-strip.is-grid .preset-tile.is-editorial {
    width: 108px;
    min-width: 108px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .film-library.is-atmosphere .preset-tile.is-editorial .preset-card {
    gap: 5px;
  }

  .film-library.is-atmosphere .preset-character {
    display: none;
  }

  .film-library.is-atmosphere .preset-meta-top {
    gap: 4px;
  }

  .film-library.is-atmosphere .preset-meta-top .preset-code {
    padding: 1px 4px;
    font-size: 9.5px;
  }

  .film-library.is-atmosphere .preset-meta-top .preset-code::before {
    display: none;
  }

  .film-library.is-atmosphere .preset-meta-top .preset-name {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .film-library.is-atmosphere .atmosphere-bar {
    order: 1;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 2px 12px 6px;
    min-width: 0;
  }

  .film-library.is-atmosphere .atmosphere-intro {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0;
  }

  .film-library.is-atmosphere .atmosphere-intro > span:first-child,
  .film-library.is-atmosphere .atmosphere-intro small {
    display: none;
  }

  .film-library.is-atmosphere .atmosphere-status {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    min-height: 28px;
    padding: 4px 9px;
    font-size: 10.5px;
  }

  .film-library.is-atmosphere .atmosphere-status[data-state="idle"],
  .film-library.is-atmosphere .atmosphere-status[data-state="ready"]:not([data-quality="partial"]):not([data-quality="soft"]) {
    width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
  }

  .film-library.is-atmosphere .atmosphere-status[data-state="idle"] span,
  .film-library.is-atmosphere .atmosphere-status[data-state="ready"]:not([data-quality="partial"]):not([data-quality="soft"]) span {
    display: none;
  }

  .film-library.is-atmosphere .atmosphere-status span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .film-library.is-atmosphere .atmosphere-help-btn {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .film-library.is-atmosphere .atmosphere-tune {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    min-height: 30px;
    padding: 4px 11px;
    gap: 6px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
  }

  .film-library.is-atmosphere .atmosphere-help-panel {
    order: 2;
    flex: 0 0 auto;
    margin: 0 12px 8px;
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) .preset-strip {
    display: none;
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) .atmosphere-bar {
    order: 0;
    padding: 2px 12px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) #atmosphereTune {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) #atmosphereTune .atmo-tune-label {
    display: none;
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) #atmosphereTune .atmo-back-label {
    display: inline;
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) #atmosphereTune .atmosphere-tune-chevron {
    transform: rotate(90deg);
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) .look-toolbar {
    display: flex;
    order: 1;
    padding: 4px 12px 2px;
    border-top: 0;
  }

  body[data-mobile-panel="atmospheres"]:has(#atmosphereControls:not([hidden])) .atmosphere-controls {
    order: 2;
    flex: 1 1 0%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    margin: 2px 12px 10px;
    gap: 10px;
    padding: 10px 12px 14px;
  }

  .atmosphere-section,
  .atmosphere-guide-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .atmosphere-section > h3 small,
  .spotlight-note {
    display: none;
  }

  .atmosphere-controls label {
    font-size: 12px;
    gap: 2px 8px;
  }

  .inspector-heading {
    height: 34px;
    padding: 3px 12px;
    gap: 8px;
  }

  .inspector-heading .eyebrow,
  .inspector-heading .reset-button,
  .inspector-primary-nav,
  .inspector-tabs,
  .inspector-intro {
    display: none;
  }

  .inspector-heading h2 {
    font-size: 13.5px;
    margin: 0;
  }

  .mobile-sheet-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  .mobile-sheet-expand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 9px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 580;
    transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  }

  .mobile-sheet-expand svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--t-fast);
  }

  .mobile-sheet-expand[aria-expanded="true"],
  .mobile-zoom-btn[aria-pressed="true"] {
    background: rgba(232, 193, 122, 0.14);
    border-color: rgba(232, 193, 122, 0.42);
    color: var(--accent-warm);
  }

  .mobile-sheet-expand[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  .sheet-close {
    display: grid;
    place-items: center;
    height: 26px;
    width: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-primary);
    margin-left: 0;
    font-size: 11.5px;
  }

  .inspector-scroll {
    padding: 2px 12px 8px;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .hsl-panel {
    padding: 6px 10px;
    gap: 2px;
    margin-bottom: 0;
  }

  .hsl-swatch {
    height: 24px;
  }

  .hsl-band-header {
    min-height: 20px;
  }

  .hsl-panel .wb-picker-btn {
    padding: 4px 8px;
    min-height: 24px;
    font-size: 11px;
  }

  .hsl-panel .control {
    padding: 0;
    gap: 0;
  }

  .hsl-panel .control-header {
    margin-bottom: 0;
  }

  .hsl-panel input[type="range"] {
    height: 28px;
    margin: 0;
  }

  .mobile-tool-browser,
  .mobile-focus-control {
    display: block;
  }

  body[data-mobile-panel="tools"]:not([data-mobile-tab="creative"],[data-mobile-tab="frames"],[data-mobile-tab="geometry"],[data-mobile-tab="curves"],[data-mobile-tab="masks"],[data-mobile-tab="hsl"],[data-mobile-tab="studio"]) #controlsContainer {
    display: none;
  }

  body[data-mobile-panel="tools"].mobile-sheet-expanded #controlsContainer {
    display: block;
  }

  body[data-mobile-panel="tools"].mobile-sheet-expanded #mobileFocusControl,
  body[data-mobile-panel="tools"].mobile-sheet-expanded #mobileToolStrip,
  body[data-mobile-panel="tools"].mobile-sheet-expanded #mobileToolCategories:has(.mobile-grain-presets, .mobile-blur-modes) {
    display: none;
  }

  body:is([data-mobile-tab="creative"],[data-mobile-tab="frames"],[data-mobile-tab="geometry"],[data-mobile-tab="curves"],[data-mobile-tab="masks"],[data-mobile-tab="hsl"],[data-mobile-tab="studio"]) #mobileToolStrip {
    display: none;
  }

  body[data-mobile-tool="focus"] #mobileFocusControl {
    display: block;
  }

  .mobile-tool-categories {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    padding: 0 0 5px;
    scrollbar-width: none;
  }

  .mobile-tool-categories:empty {
    display: none;
  }

  .mobile-grain-presets {
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
  }

  .mobile-category {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: var(--radius-xs);
    border: 1px solid transparent;
    background: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 560;
  }

  .mobile-category.selected {
    background: #ededef;
    color: #0b0b0d;
    font-weight: 640;
  }

  .mobile-tool-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    padding: 1px 1px 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .mobile-tool-choice {
    flex: 0 0 auto;
    width: 72px;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-secondary);
    font-size: 10.5px;
    text-align: center;
    min-height: 48px;
    padding: 4px 6px;
    scroll-snap-align: start;
    transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  }

  .mobile-tool-choice[data-modified="true"] {
    border-color: rgba(232, 193, 122, 0.28);
  }

  .mobile-tool-choice.is-active {
    background: var(--bg-elevated);
    border-color: rgba(232, 193, 122, 0.55);
    color: var(--text-primary);
  }

  .mobile-tool-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 560;
    white-space: nowrap;
  }

  .mobile-tool-icon {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-xs);
    background: transparent;
    border: 0;
    color: currentColor;
  }

  .mobile-tool-icon svg {
    width: 15px;
    height: 15px;
  }

  .dock-icon svg {
    width: 17px;
    height: 17px;
  }

  .mobile-tool-choice small {
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .mobile-tool-choice[data-modified="true"] small {
    color: var(--accent-warm);
  }

  .mobile-focus-control {
    padding: 2px 4px 0;
  }

  .mobile-focus-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 22px;
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 1px;
  }

  #mobileFocusTitle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 580;
  }

  .mobile-focus-head .film-layer-toggle {
    flex: none;
    gap: 5px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-primary);
    white-space: nowrap;
  }

  .mobile-focus-head strong {
    margin-left: auto;
    min-width: 46px;
    text-align: right;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 580;
    font-variant-numeric: tabular-nums;
  }

  #mobileFocusSlider {
    height: 38px;
    margin: 0;
  }

  .mobile-focus-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 3px;
  }

  .mobile-focus-footer button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    font-size: 11.5px;
    padding: 0 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--text-primary);
  }

  #mobileFocusDone {
    background: #ededef;
    color: #0b0b0d;
    font-weight: 640;
    border-color: #ededef;
  }

  /* 6-Button Fixed Primary Mobile Dock (Zero Horizontal Scroll) */
  .mobile-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-dock-height);
    z-index: 24;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: center;
    padding: 4px 6px env(safe-area-inset-bottom, 0px);
    background: rgba(8, 8, 10, 0.96);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: visible;
  }

  .mobile-dock button {
    position: relative;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-direction: column;
    border: 1px solid transparent;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 560;
    padding: 4px 2px;
    transition: background-color var(--t-fast), color var(--t-fast);
  }

  .mobile-dock button.active,
  .mobile-dock button.is-open {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: #ffffff;
  }

  .mobile-dock button.has-edits::after {
    content: "";
    position: absolute;
    top: 6px;
    right: calc(50% - 14px);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-warm);
  }

  .dock-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
  }

  /* Mobile Expandable "More" Popover Drawer */
  .mobile-more-menu {
    position: fixed;
    right: 10px;
    bottom: calc(var(--mobile-dock-height) + 8px);
    width: min(320px, calc(100vw - 20px));
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 13px;
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.84);
    animation: more-menu-in 150ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes more-menu-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }

  .mobile-more-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }

  .mobile-more-actions {
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
  }

  .mobile-more-heading {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .mobile-more-menu button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 54px;
    padding: 6px 4px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 560;
  }

  .mobile-more-menu button.active {
    background: #ededef;
    color: #0b0b0d;
    border-color: #ededef;
  }

  .mobile-more-menu button.has-edits::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-warm);
  }

  .mobile-more-menu button.active.has-edits::after {
    background: #a56516;
  }

  .creative-card textarea,
  .creative-card select,
  .geometry-angle input,
  .geometry-controls select,
  .atmosphere-regions select,
  #recipeName {
    font-size: 16px;
  }

  body[data-mobile-panel="tools"][data-mobile-tab="creative"].type-keyboard {
    --mobile-sheet-height: clamp(116px, calc(100dvh - var(--type-keyboard-inset) - 170px), 180px);
  }

  body.type-keyboard[data-mobile-tab="creative"] .inspector.sheet-open {
    bottom: var(--type-keyboard-inset);
  }

  body.type-keyboard[data-mobile-tab="creative"] .photo-workspace {
    height: max(100px, calc(100dvh - var(--mobile-header) - var(--mobile-sheet-height) - var(--type-keyboard-inset)));
  }

  .toast {
    bottom: calc(var(--mobile-dock-height) + var(--mobile-sheet-height) + 10px);
    max-width: calc(100% - 28px);
    width: max-content;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding: 0 8px;
    gap: 6px;
  }

  .mobile-dock {
    padding: 4px 3px env(safe-area-inset-bottom, 0px);
  }

  .mobile-dock button {
    font-size: 9.5px;
  }

  .mobile-tool-choice {
    width: 66px;
    min-width: 66px;
  }

  .mobile-focus-head .film-layer-toggle {
    padding: 2px 6px;
    font-size: 10.5px;
  }

  .look-tools-btn {
    padding: 4px 8px;
  }

  .film-library:not(.is-atmosphere) .preset-tile {
    width: 74px;
    min-width: 74px;
  }
}

@media (max-width: 740px) and (max-height: 500px) {
  body {
    --mobile-header: 42px;
    --mobile-dock-height: calc(46px + env(safe-area-inset-bottom, 0px));
  }

  .photo-workspace {
    height: calc(100dvh - var(--mobile-header) - var(--mobile-dock-height));
  }

  body[data-mobile-panel]:not([data-mobile-panel=""]) .photo-workspace {
    padding-right: min(330px, 50vw);
  }

  .film-library.sheet-open,
  .inspector.sheet-open {
    left: auto;
    width: min(330px, 50vw);
    top: var(--mobile-header);
    bottom: var(--mobile-dock-height);
    height: auto;
    border-radius: 14px 0 0 0;
  }

  .film-library.sheet-open:not(.is-atmosphere).is-look-tools-open,
  .film-library.sheet-open:not(.is-atmosphere):has(#lookCompare:not([hidden])) {
    overflow-y: auto;
  }

  .mobile-dock button {
    min-height: 40px;
    flex-direction: row;
    gap: 5px;
  }
}

@media (min-width: 741px) and (max-width: 1023px) and (max-height: 520px) {
  .topbar {
    height: 42px;
    padding: 0 12px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 268px;
  }

  .workspace-bottomline {
    min-height: 28px;
  }

  .film-library {
    max-height: 150px;
    padding: 4px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .preset-tile {
    width: 68px;
    min-width: 68px;
  }

  .preset-visual {
    border-radius: 7px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes kf-reveal {
    from { opacity: 0.01; }
    to { opacity: 1; }
  }

  #controlsContainer > *,
  .mobile-focus-control:not([hidden]),
  .atmosphere-controls:not([hidden]),
  .atmosphere-help-panel:not([hidden]),
  .film-library.is-look-tools-open .look-workbench,
  .film-library.is-atmosphere .preset-strip {
    animation: kf-reveal 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .compare-badge:not([hidden]) {
    animation: fade-in 120ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .preset-card:active .preset-visual,
  .mobile-tool-choice:active,
  .zoom-button:active,
  .compare-button:active,
  .mobile-compare-hold:active {
    transform: scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* V3 mobile header: promote creative actions without increasing header height. */
.top-actions .mobile-header-action { display:none; }
@media(max-width:740px) {
  .topbar { flex-wrap:nowrap; gap:3px; }
  .brand { flex: 0 0 auto; min-width: 28px; }
  .brand .brand-name, .brand .brand-divider, .brand .brand-subtitle { display:none; }
  .brand .brand-mark { width:25px; height:25px; }
  .top-actions { margin-left:auto; flex:0 0 auto; gap:2px; }
  .top-actions .mobile-header-action { display:inline-flex; flex:0 0 34px; width:34px; height:38px; }
  .top-actions .desktop-studio-action { display:none; }
  .top-actions .guide-button { display:inline-flex; flex:0 0 30px; width:30px; height:38px; }
  .top-actions .icon-button.history-button { flex:0 0 32px; width:32px; height:38px; }
  .top-actions #openBtn, .top-actions #exportBtn { flex:0 0 34px; width:34px; height:38px; min-width:34px; padding:0; }
  .top-actions .mobile-header-action svg { width:17px; height:17px; }
  .top-actions .mobile-header-action:focus-visible { outline:2px solid var(--text-secondary); outline-offset:-3px; }
}
@media(max-width:359px) {
  .topbar { padding-inline:5px; }
  .top-actions { gap:0; }
  .top-actions .mobile-header-action { flex-basis:31px; width:31px; }
  .top-actions .icon-button.history-button { flex-basis:29px; width:29px; }
}


/* Magic Edit V3: calm, progressive creative controls in a true darkroom. */
.magic-v3 { display:flex; flex-direction:column; gap:10px; padding:7px 0 3px; }
.magic-v3-heading { display:flex; align-items:baseline; justify-content:space-between; gap:9px; flex-wrap:wrap; }
.magic-v3-heading span { font-size:10px; letter-spacing:.11em; font-weight:650; color:var(--text-secondary); }
.magic-v3-heading small { font-size:10px; color:var(--text-muted); }
.magic-refinements { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.magic-refinements button {
  background:var(--bg-input); color:var(--text-secondary); border:1px solid var(--border-default);
  border-radius:9px; padding:9px 8px; min-height:38px; font-size:11px; font-weight:500;
  cursor:pointer; touch-action:manipulation; transition:border-color .16s,color .16s,background .16s;
}
.magic-refinements button[aria-pressed="true"] {
  color:var(--text-primary); background:var(--bg-elevated); border-color:var(--border-strong);
}
.magic-refinements button:focus-visible,.magic-module-controls input:focus-visible {
  outline:2px solid var(--text-secondary); outline-offset:2px;
}
.magic-fine-tune,.magic-direction-why {
  border:1px solid var(--border-subtle); border-radius:10px; overflow:hidden;
  background:var(--bg-card);
}
.magic-fine-tune summary,.magic-direction-why summary {
  padding:11px 12px; cursor:pointer; color:var(--text-primary);
  font-size:11.5px; min-height:36px; font-weight:550;
}
.magic-fine-tune summary span { color:var(--text-muted); font-size:10px; font-weight:400; margin-left:4px; }
.magic-module-controls { display:grid; grid-template-columns:1fr 1fr; gap:11px 14px; padding:11px 13px 15px; }
.magic-module-controls label {
  min-width:0; display:grid; grid-template-columns:1fr auto; align-items:center; gap:8px;
  color:var(--text-secondary); font-size:11px; font-weight:550;
}
.magic-module-controls output { font-size:10px; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.magic-module-controls input { width:100%; grid-column:1/-1; accent-color:var(--text-primary); touch-action:none; }
.magic-direction-why ul { margin:0; padding:3px 14px 14px 26px; display:grid; gap:6px; }
.magic-direction-why li { font-size:11px; line-height:1.42; color:var(--text-secondary); }
@media(max-width:767px) {
  .magic-v3 { padding-top:4px; gap:8px; }
  .magic-refinements button { min-height:36px; padding:8px 6px; font-size:10.5px; }
  .magic-module-controls { gap:10px 12px; padding:8px 12px 13px; }
  .magic-fine-tune,.magic-direction-why { overscroll-behavior:contain; }
}

.magic-detect-subject {
  width:100%;border:1px dashed var(--border-strong);background:transparent;
  color:var(--text-secondary);font-size:11px;border-radius:9px;
  padding:9px 12px;min-height:37px;text-align:left;cursor:pointer;
}
.magic-detect-subject:disabled {opacity:.55;cursor:wait;}
.magic-detect-status {font-size:10px;line-height:1.5;color:var(--text-muted);}


/* V4 mobile: no accidental page gestures while adjusting, with reversible reset. */
.person-instance-field {
  display:grid;gap:6px;margin:8px 0;padding:9px 10px;
  border:1px solid var(--border-subtle);border-radius:10px;
  color:var(--text-secondary);font-size:11px;font-weight:560;background:var(--bg-card);
}
.person-instance-field[hidden] { display:none; }
.person-instance-field select {
  appearance:none;width:100%;min-width:0;min-height:37px;
  background:var(--bg-elevated);color:var(--text-primary);
  border:1px solid var(--border-default);border-radius:8px;padding:8px 10px;
  font:inherit;font-size:12px;cursor:pointer;
}
.person-instance-field small {font-size:10px;line-height:1.45;font-weight:400;color:var(--text-muted);}
.magic-direction-more {border:1px solid var(--border-subtle);border-radius:10px;background:var(--bg-card);}
.magic-direction-more summary {font-size:11px;font-weight:520;color:var(--text-secondary);cursor:pointer;min-height:34px;padding:10px 12px;}
.magic-direction-more .magic-refinements {padding:0 10px 10px;}
.magic-quality-status {font-size:10px;color:var(--text-secondary);line-height:1.5;}
.reset-confirm-dialog {max-width:min(380px,calc(100vw - 32px));padding:20px;}
.reset-confirm-dialog p {font-size:13px;line-height:1.5;color:var(--text-secondary);margin:12px 0 20px;}
.reset-confirm-actions {display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;}
.reset-confirm-actions form {display:contents;}
@media(max-width:740px) {
  .top-actions .mobile-header-action,.top-actions .guide-button,
  .top-actions .history-button,.top-actions #openBtn,.top-actions #exportBtn { min-height:42px; }
  .magic-dialog input[type=range] { touch-action:none; overscroll-behavior:contain; }
  .magic-controls-column { overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .magic-direction-more .magic-refinements button { min-height:40px; }
}

/* Film Library V5: opt-in editorial discovery surface. Does not alter existing Looks. */
.film-library-v5-entry{border:1px solid currentColor;border-radius:999px;background:transparent;color:inherit;padding:6px 10px;font:inherit;font-size:11px;white-space:nowrap;cursor:pointer;opacity:.85}
.film-library-v5-entry:hover,.film-library-v5-entry:focus-visible{opacity:1}
.film-library-v5-dialog{border:1px solid #393939;border-radius:20px;background:#121212;color:#f5f5f3;padding:0;width:min(740px,calc(100vw - 24px));max-height:min(88dvh,850px);overflow:auto;box-shadow:0 24px 90px #0009}
.film-library-v5-dialog::backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(5px)}
.film-v5-shell{padding:clamp(18px,4vw,32px)}
.film-v5-header{display:flex;justify-content:space-between;align-items:flex-start;gap:14px}
.film-v5-eyebrow{font-size:10px;letter-spacing:.17em;color:#a8a8a5;margin:0 0 12px}
.film-v5-header h2{font-size:clamp(25px,5vw,38px);font-weight:500;letter-spacing:-.045em;line-height:1.1;margin:0 0 10px}
.film-v5-header p:not(.film-v5-eyebrow){font-size:13px;color:#b8b8b6;line-height:1.5;margin:0;max-width:460px}
.film-v5-close{flex:none;border:1px solid #4a4a4a;background:transparent;color:inherit;border-radius:50%;width:32px;height:32px;cursor:pointer}
.film-v5-categories{display:flex;gap:7px;overflow-x:auto;scrollbar-width:none;padding:23px 0 14px;overscroll-behavior-x:contain}
.film-v5-categories::-webkit-scrollbar{display:none}
.film-v5-categories button{flex:none;border:1px solid #484848;border-radius:999px;padding:8px 12px;background:transparent;color:#c4c4c4;font:inherit;font-size:12px;cursor:pointer}
.film-v5-categories button[aria-pressed="true"]{background:#f4f1ec;color:#171717;border-color:#f4f1ec}
.film-v5-intro{font-size:12px;color:#aaa;margin:0 0 14px;min-height:1.5em}
.film-v5-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.film-v5-card{background:#1b1b1b;border:1px solid #333;border-radius:12px;padding:14px;min-width:0;display:flex;flex-direction:column;gap:9px}
.film-v5-card-top{display:flex;justify-content:space-between;gap:8px;align-items:center}
.film-v5-card-code{font-size:10px;color:#b8b8b8;letter-spacing:.12em}
.film-v5-card-grain{font-size:10px;color:#a9a9a9}
.film-v5-card h3{font-size:18px;font-weight:500;letter-spacing:-.02em;margin:0}
.film-v5-card p{font-size:12px;color:#bcbcbc;line-height:1.5;margin:0;flex:1}
.film-v5-card-tags{display:flex;gap:5px;flex-wrap:wrap}
.film-v5-card-tags span{border:1px solid #3d3d3d;border-radius:99px;padding:4px 7px;font-size:10px;color:#bcbcbc}
.film-v5-card button{margin-top:4px;background:#efede8;color:#111;border:0;border-radius:8px;padding:10px;font:inherit;font-size:12px;cursor:pointer}
.film-v5-card button:disabled{opacity:.45;cursor:not-allowed}
.film-v5-footer{font-size:11px;line-height:1.5;color:#8d8d8d;padding-top:18px}
@media(max-width:600px){.film-library-v5-dialog{width:calc(100vw - 12px);max-height:90dvh;border-radius:17px}.film-v5-shell{padding:17px}.film-v5-cards{grid-template-columns:1fr}.film-library-v5-entry{padding:5px 8px;font-size:10px}}

/* Film Library V5.2 — responsive editorial browsing, live previews and detail sheet. */
.film-library-v5-dialog [hidden]{display:none!important}
.film-v5-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 14px}
.film-v5-toolbar .film-v5-intro{margin:0;flex:1}
.film-v5-view{display:flex;flex:none;gap:2px;padding:3px;border-radius:9px;background:#292929}
.film-v5-view button{border:0;background:transparent;color:#aaa;border-radius:7px;padding:7px 10px;font:inherit;font-size:11px;cursor:pointer}
.film-v5-view button[aria-pressed="true"]{background:#e9e6e1;color:#141414}
.film-v5-cards.is-strip{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x proximity;overscroll-behavior-x:contain;scrollbar-width:thin;padding-bottom:12px}
.film-v5-cards.is-strip .film-v5-card{flex:0 0 clamp(210px,37%,270px);scroll-snap-align:start}
.film-v5-cards.is-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;overflow:visible}
.film-v5-preview,.film-v5-detail-image{position:relative;background:linear-gradient(145deg,#2c2826 0%,#514b44 42%,#282c30 100%);background-position:center;background-size:cover;border-radius:8px;aspect-ratio:4/3;overflow:hidden;display:flex;align-items:flex-end;justify-content:flex-start}
.film-v5-preview:before,.film-v5-detail-image:before{content:'';position:absolute;inset:0;background:linear-gradient(transparent 50%,#0007);pointer-events:none}
.film-v5-preview-placeholder{position:relative;z-index:1;color:#f4f4f4;font-size:10px;letter-spacing:.1em;padding:10px;text-transform:uppercase;text-shadow:0 1px 3px #0008}
.film-v5-preview.is-loaded .film-v5-preview-placeholder,.film-v5-detail-image.is-loaded .film-v5-preview-placeholder{display:none}
.film-v5-card-actions{display:flex;gap:7px;margin-top:6px}
.film-v5-card-actions button{margin:0;min-width:0;flex:1}
.film-v5-card-actions .film-v5-info{background:transparent;border:1px solid #5c5c5c;color:#eee}
.film-v5-card-actions .film-v5-apply{background:#efede8;color:#111}
.film-v5-details{padding:2px 0 8px}
.film-v5-detail-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}
.film-v5-detail-back{border:0;background:transparent;color:#e7e7e7;font:inherit;font-size:12px;padding:6px 0;cursor:pointer}
.film-v5-details h3{font-size:clamp(24px,5vw,36px);font-weight:500;letter-spacing:-.04em;margin:0 0 8px}
.film-v5-detail-description{font-size:13px;line-height:1.5;color:#bbb;margin:0 0 18px}
.film-v5-detail-image{aspect-ratio:16/9;margin-bottom:16px}
.film-v5-detail-specs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px;margin-bottom:18px}
.film-v5-detail-spec{display:flex;flex-direction:column;gap:5px;min-width:0}
.film-v5-detail-spec span{font-size:10px;letter-spacing:.12em;color:#999}
.film-v5-detail-spec strong{font-size:12px;font-weight:500;color:#eee}
.film-v5-detail-apply{border:0;background:#efede8;color:#171717;border-radius:8px;padding:12px 18px;width:100%;font:inherit;font-size:13px;cursor:pointer}
@media(max-width:600px){
 .film-v5-toolbar{align-items:flex-start;gap:8px}
 .film-v5-view button{padding:6px 8px}
 .film-v5-cards.is-strip .film-v5-card{flex-basis:min(72vw,260px)}
 .film-v5-cards.is-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .film-v5-cards.is-grid .film-v5-card{padding:9px;gap:7px}
 .film-v5-cards.is-grid .film-v5-card h3{font-size:14px}
 .film-v5-cards.is-grid .film-v5-card p{font-size:11px}
 .film-v5-cards.is-grid .film-v5-card-actions{flex-wrap:wrap}
 .film-v5-cards.is-grid .film-v5-card-actions button{flex-basis:100%;padding:8px 4px}
 .film-v5-cards.is-grid .film-v5-preview{aspect-ratio:3/4}
}

/* V5.3: opt-in adaptive finish, scoped to Film Library. */
.film-v5-adaptive{border:1px solid #393939;background:#1a1a1a;border-radius:11px;padding:11px 13px;margin-top:18px}
.film-v5-adaptive label{display:flex;align-items:center;gap:9px;color:#f2f0ed;font-size:12px;font-weight:500;cursor:pointer}
.film-v5-adaptive input{accent-color:#e6d6c1;width:16px;height:16px;margin:0}
.film-v5-adaptive-beta{margin-left:auto;color:#aaa;font-size:10px;letter-spacing:.07em}
.film-v5-adaptive p{margin:7px 0 0 25px;color:#aaa;font-size:11px;line-height:1.5}

/* Film Matching V5.4: opt-in three-direction discovery in Film Library. */
.film-v5-matching{border:1px solid #393939;border-radius:13px;background:#1b1b1b;padding:14px;margin:15px 0 18px;color:#eee}
.film-v5-matching-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.film-v5-matching-head .film-v5-eyebrow{margin:0 0 5px}
.film-v5-matching-head h3{font-size:18px;font-weight:500;letter-spacing:-.025em;margin:0}
.film-v5-matching-head button{background:transparent;border:1px solid #4b4b4b;border-radius:50%;color:#ddd;width:30px;height:30px;cursor:pointer}
.film-v5-match-status{font-size:11px;line-height:1.5;color:#aaa;margin:8px 0 12px}
.film-v5-match-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.film-v5-match-card{display:flex;flex-direction:column;gap:6px;min-width:0;background:#252525;border:1px solid #393939;border-radius:10px;padding:9px}
.film-v5-match-card .film-v5-preview{aspect-ratio:4/5}
.film-v5-match-label{font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:#aaa;margin-top:4px}
.film-v5-match-name{font-size:13px;font-weight:500;line-height:1.25}
.film-v5-match-card p{font-size:11px;line-height:1.4;color:#aaa;flex:1;margin:0}
.film-v5-match-card button{background:#eeeae5;color:#171717;border:0;border-radius:7px;padding:9px 5px;font:inherit;font-size:11px;cursor:pointer}
@media(max-width:600px){.film-v5-matching{padding:11px}.film-v5-match-cards{gap:6px}.film-v5-match-card{padding:6px}.film-v5-match-name{font-size:11px}.film-v5-match-card p{font-size:10px}.film-v5-match-card button{font-size:10px;padding:8px 3px}.film-v5-match-label{font-size:9px}}

/* Film Lab V5.5: a quiet, optional view onto existing editing controls. */
.film-v5-lab{margin-top:18px;padding:15px;border:1px solid #383838;border-radius:13px;background:#191919;color:#eee}
.film-v5-lab-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.film-v5-lab-heading .film-v5-eyebrow{margin:0 0 5px}
.film-v5-lab-heading h3{font-size:18px;font-weight:500;letter-spacing:-.025em;margin:0}
.film-v5-lab-heading button{border:1px solid #4d4d4d;background:transparent;color:#eee;border-radius:99px;padding:8px 12px;font:inherit;font-size:11px;cursor:pointer}
.film-v5-lab-description{font-size:11px;color:#aaa;line-height:1.5;margin:8px 0 0}
.film-v5-lab [hidden]{display:none!important}
.film-v5-lab-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;padding:18px 0}
.film-v5-lab-control{display:flex;flex-direction:column;gap:10px;min-width:0}
.film-v5-lab-control-head{display:flex;justify-content:space-between;gap:10px;font-size:11px;color:#d7d7d7}
.film-v5-lab-control output{color:#aaa;font-variant-numeric:tabular-nums}
.film-v5-lab-control input{width:100%;accent-color:#e7dfd4;touch-action:pan-x}
.film-v5-lab-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid #353535;padding-top:12px}
.film-v5-lab-footer span{font-size:10px;color:#aaa}
.film-v5-lab-footer button{flex:none;border:1px solid #4d4d4d;background:transparent;color:#eee;border-radius:8px;padding:8px 10px;font:inherit;font-size:11px;cursor:pointer}
.film-v5-lab-footer button:disabled{opacity:.45}
@media(max-width:600px){.film-v5-lab{padding:12px}.film-v5-lab-controls{grid-template-columns:1fr;gap:17px}.film-v5-lab-control input{min-height:24px}}

/* Mobile Film Library entry: prominent but compact, reusing the More menu. */
@media (max-width: 740px) {
  .mobile-more-menu {
    max-height: calc(100dvh - var(--mobile-dock-height) - env(safe-area-inset-top) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mobile-more-film {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .mobile-more-menu .mobile-more-film-entry {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 60px;
    padding: 10px 12px;
    text-align: left;
  }
  .mobile-more-film-entry .dock-icon { flex: none; }
  .mobile-more-film-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
  .mobile-more-film-entry .more-label { font-size: 12px; font-weight: 650; line-height: 1.1; }
  .mobile-more-film-subtitle { font-size: 10px; font-weight: 400; line-height: 1.3; color: var(--text-muted); }
  .mobile-more-film-chevron { flex: none; font-size: 21px; line-height: 1; color: var(--text-secondary); }
  .mobile-more-film-entry:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
}
