/* Cool graphite surfaces leave the photograph as the only large color field. */
:root {
  color-scheme: dark;
  --bg: #161b24;
  --panel: #242b35;
  --panel-raised: #303846;
  --field: #303846;
  --paper: #eef1f5;
  --muted: #b0b9c7;
  --quiet: #9eabbd;
  --line: #3b4554;
  --line-soft: #333d4a;
  --accent: #db9b71;
  --on-accent: #201a17;
  --accent-soft: #3d322d;
  --surface-chrome: #11151c;
  --surface-tools: #242b35;
  --surface-filmstrip: #20262f;
  --focus: #db9b71;
  --danger: #f4a49a;
  --motion-feedback: 140ms;
  --motion-panel: 240ms;
  --motion-stage: 320ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --shadow-hover: 0 5px 14px #00000030;
  --sans: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  height: 100%;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
button, input, textarea, a, [tabindex], summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--focus); }
button:focus:not(:focus-visible) { outline: none; }
button svg { width: 16px; height: 16px; flex: 0 0 auto; }
button svg, .brand-mark svg { stroke-width: 1.65; }
a { color: var(--accent); }
::selection { color: var(--bg); background: var(--accent); }
[hidden] { display: none !important; }

/* Header: an editorial masthead above a deliberately practical workspace. */
.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 37px;
  height: 42px;
  flex: 0 0 auto;
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-copy { min-width: 0; }
.brand-name { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 500; letter-spacing: 2px; line-height: 1.35; }
.brand-tagline { margin: 4px 0 0; color: var(--muted); font-size: 11px; letter-spacing: 1.2px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.button:hover:not(:disabled) { border-color: #657184; background: var(--panel-raised); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button-primary:hover:not(:disabled) { background: #edb18a; border-color: #edb18a; color: var(--on-accent); }
.button-ghost { color: var(--muted); }
.button-icon { width: 40px; min-width: 40px; padding: 8px; }
.mobile-workspace-nav, .mobile-photo-actions { display: none; }

/* The side panels behave like tools; the image remains the focal point. */
.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  grid-template-areas: "library stage inspector";
  height: calc(100dvh - 114px);
  min-height: 500px;
  overflow: hidden;
}
.library-panel, .inspector-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background: var(--panel);
}
.library-panel { grid-area: library; padding: 26px 18px 18px; border-right: 1px solid var(--line); background: var(--surface-filmstrip); }
.inspector-panel { grid-area: inspector; padding: 25px 23px 22px; border-left: 1px solid var(--line); background: var(--surface-tools); }
.panel-kicker, .section-label {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.panel-title { margin: 7px 0 6px; font-size: 17px; font-weight: 500; letter-spacing: .3px; }
.panel-description { margin: 0 0 19px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 111px;
  margin-bottom: 21px;
  padding: 18px 10px;
  border: 1px dashed var(--line);
  background: var(--panel);
  color: var(--paper);
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.upload-zone:hover, .upload-zone:focus-within, .upload-zone.drop-active { border-color: var(--accent); background: var(--panel); }
.upload-zone > label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 65px;
  cursor: pointer;
}
.upload-zone input[type="file"], input[type="file"].visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.upload-zone svg { width: 20px; height: 20px; margin-bottom: 5px; color: var(--accent); }
.upload-zone strong { font-size: 14px; font-weight: 500; }
.upload-zone span, .upload-zone small, .upload-note { color: var(--muted); font-size: 11px; }
.photo-list { display: flex; flex-direction: column; gap: 7px; }
.library-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; color: var(--quiet); font-size: 10px; }
.library-summary > span:first-child { color: var(--muted); }
.photo-card {
  position: relative;
  display: block;
  padding: 0;
  min-height: 76px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--panel);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, opacity .16s ease;
}
.photo-card:hover { background: var(--panel); border-color: var(--line); }
.photo-card[draggable="true"] { cursor: grab; }
.photo-card[draggable="true"]:active { cursor: grabbing; }
.photo-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.photo-card.is-dragging, .photo-card.dragging { opacity: .45; }
.photo-card.drop-active { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.photo-select { display: grid; grid-template-columns: 55px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 83px; padding: 9px; border: 0; background: transparent; color: var(--paper); text-align: left; }
.photo-select:focus-visible { outline-offset: -3px; }
.photo-thumb { display: block; width: 55px; height: 65px; align-self: center; object-fit: cover; border-radius: 1px; background: var(--panel); }
.photo-info { align-self: center; min-width: 0; padding-bottom: 32px; }
.photo-index { display: block; color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }
.photo-name { display: block; margin: 3px 0; overflow: hidden; color: var(--paper); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; }
.photo-meta { display: block; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .2px; }
.photo-card-actions { position: absolute; right: 7px; bottom: 5px; display: flex; gap: 2px; }
.photo-card-actions button { display: inline-flex; justify-content: center; align-items: center; width: 34px; height: 34px; padding: 6px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.photo-card-actions button:hover { color: var(--paper); background: var(--panel); }
.photo-card-actions svg { width: 12px; height: 12px; }
.cover-badge { display: inline-block; margin-left: 6px; padding: 0 4px; color: var(--accent); border: 1px solid var(--line); border-radius: 1px; font-family: var(--sans); font-size: 8px; letter-spacing: .3px; vertical-align: 1px; }
.library-footer { margin: 22px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 10px; line-height: 1.9; }
.library-footer p { margin: 0; }
.library-footer .text-button { margin-right: 11px; }
.library-footer .small-action { display: block; margin-top: 5px; text-decoration: none; }

.stage-panel {
  grid-area: stage;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 25px 32px 20px;
  overflow: hidden;
  background-color: var(--bg);
}
.stage-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex: 0 0 auto; margin-bottom: 23px; }
.stage-heading { margin: 0; font-family: var(--sans); font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -.5px; }
.stage-toolbar .panel-kicker { margin-bottom: 7px; }
.stage-meta { margin: 6px 0 0; color: var(--quiet); font-family: var(--mono); font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; }
.stage-tools { display: flex; align-items: center; gap: 8px; }
.stage-tools .button { min-height: 40px; padding: 8px; color: var(--muted); font-size: 12px; background: var(--panel); }
.canvas-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
}
.canvas-shell::before, .canvas-shell::after { position: absolute; content: ""; width: 13px; height: 13px; border-color: var(--line); border-style: solid; pointer-events: none; }
.canvas-shell::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.canvas-shell::after { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
#magazineCanvas {
  display: block;
  max-width: calc(100% - 28px);
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--panel);
  box-shadow: none;
  touch-action: pan-y;
}
.stage-caption { display: flex; justify-content: center; align-items: center; gap: 13px; margin: 17px 0 0; color: var(--quiet); font-family: var(--mono); font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase; }
.stage-caption::before, .stage-caption::after { content: ""; width: 21px; height: 1px; background: var(--panel); }
.preview-note { margin: 7px 0 0; color: var(--quiet); text-align: center; font-size: 10px; }
.stage-bottom { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.template-description { margin: 0; color: var(--muted); font-size: 11px; }
.stage-bottom > span { color: var(--quiet); font-family: var(--mono); font-size: 9px; white-space: nowrap; }

/* Inspector fields: measured spacing and visible controls, with no card stack. */
.inspector-heading { margin: 0 0 6px; font-size: 19px; font-weight: 500; letter-spacing: .3px; }
.photo-edit-entry { margin: 0 0 25px; }
.photo-edit-entry .button { justify-content: flex-start; width: 100%; min-height: 42px; }
.photo-edit-entry .button > span:last-child { margin-left: auto; }
.photo-edit-entry p { margin: 8px 0 14px; color: var(--muted); font-size: 11px; text-align: center; }
.control-section { margin: 0 0 24px; padding: 0 0 23px; border-bottom: 1px solid var(--line); }
.control-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.control-section .section-label { margin-bottom: 13px; color: var(--muted); font-size: 11px; letter-spacing: .5px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { color: var(--muted); font-size: 13px; }
.field label > span { float: right; color: var(--quiet); font-family: var(--mono); font-size: 9px; }
.field input:not([type="checkbox"]):not([type="range"]), .field textarea, .field select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.45;
  transition: border-color .15s ease;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--line); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: var(--quiet); opacity: 1; }
.field textarea { min-height: 67px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.field-row .field { margin: 0; }
.field small { color: var(--quiet); font-size: 10px; line-height: 1.7; }
.template-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.template-option {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.template-option:hover { border-color: var(--line); background: var(--panel); }
.template-option.is-active, .template-option[aria-pressed="true"] { color: var(--paper); background: var(--panel); border-color: var(--accent); }
.template-mini { position: relative; display: block; width: 43px; height: 53px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.template-mini::before { content: ""; position: absolute; inset: 5px 4px 13px; background: #667489; }
.template-mini::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 6px; height: 2px; background: #a0abbb; box-shadow: 0 -4px 0 #505d70; }
.template-option[data-template="poster"] .template-mini::before { inset: 0; }
.template-option[data-template="poster"] .template-mini::after { left: 8px; right: 8px; bottom: 6px; }
.template-option[data-template="film"] .template-mini::before { inset: 5px 4px auto; height: 10px; background: #667489; box-shadow: 0 13px #667489, 0 26px #667489; }
.template-option[data-template="film"] .template-mini::after { bottom: 4px; height: 1px; box-shadow: none; }
.template-option[data-template="diptych"] .template-mini::before, .template-option[data-template="double"] .template-mini::before { inset: 7px auto 8px 3px; width: 16px; background: #667489; box-shadow: 19px 0 #8692a4; }
.template-option[data-template="diptych"] .template-mini::after, .template-option[data-template="double"] .template-mini::after { bottom: 3px; height: 1px; box-shadow: none; }
.template-mini span { display: none; }
.template-name { font-size: 10px; font-weight: 500; line-height: 1.4; }
.template-subtitle { color: var(--quiet); font-family: var(--mono); font-size: 8px; line-height: 1.3; letter-spacing: .4px; }
.theme-options { display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; }
.theme-swatch { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 30px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--muted); font-size: 10px; }
.theme-swatch > span { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--line); }
.theme-swatch.is-active, .theme-swatch[aria-pressed="true"] { color: var(--paper); border-color: var(--accent); background: var(--panel); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; color: var(--muted); font-size: 11px; cursor: pointer; }
.toggle-row input[type="checkbox"] {
  position: relative;
  appearance: none;
  width: 28px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.toggle-row input[type="checkbox"]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #8894a4; transition: transform .15s ease; }
.toggle-row input[type="checkbox"]:checked { border-color: var(--paper); background: var(--paper); }
.toggle-row input[type="checkbox"]:checked::before { transform: translateX(12px); background: var(--panel); }
.toggle-row input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }
.toggle-track { display: none; }
.crop-controls { margin-top: 15px; }
.range-row { margin-bottom: 14px; }
.range-row:last-child { margin-bottom: 0; }
.range-label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.range-label output, .range-label span:last-child { color: var(--accent); font-family: var(--mono); font-size: 10px; }
input[type="range"] { appearance: none; width: 100%; height: 4px; margin: 12px 0 4px; border-radius: 1px; background: var(--panel); accent-color: var(--accent); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 2px solid var(--line); border-radius: 50%; background: var(--accent); box-shadow: none; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid var(--line); border-radius: 50%; background: var(--accent); box-shadow: none; }
input[type="range"]:disabled { opacity: .35; cursor: not-allowed; }
.selected-photo-info { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin: 0 0 13px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.selected-photo-info > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-photo-info .small-action { flex: 0 0 auto; }
.selected-photo-info strong { color: var(--paper); font-weight: 400; }
.small-action, .text-button { padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; }
.small-action:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.small-action { display: inline-flex; align-items: center; gap: 6px; }
.small-action svg { width: 12px; height: 12px; }

.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 32px; padding: 0 19px; border-top: 1px solid var(--line); background: var(--panel); color: var(--quiet); font-family: var(--mono); font-size: 9px; line-height: 1.3; letter-spacing: .3px; }
.statusbar > span:first-child { display: flex; align-items: center; gap: 7px; }
.statusbar > span:first-child::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: none; }

/* Export lives in a focused dialog rather than another persistent panel. */
.export-dialog { width: min(450px, calc(100vw - 40px)); padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--paper); box-shadow: none; }
.export-dialog::backdrop { background: #080b1299; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 25px 27px 19px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 400; letter-spacing: 1px; }
.dialog-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.close-dialog { display: grid; place-items: center; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); }
.close-dialog:hover { background: var(--panel); color: var(--paper); }
.dialog-body { padding: 23px 27px; }
.dialog-body > p { margin: 0 0 17px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.export-choice { display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 9px; padding: 15px 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); cursor: pointer; text-align: left; }
.export-choice:hover { border-color: var(--line); }
.export-choice:has(input:checked) { border-color: var(--accent); background: var(--panel); }
.export-choice input { flex: 0 0 auto; accent-color: var(--accent); }
.export-choice span { display: flex; flex-direction: column; gap: 2px; }
.export-choice strong { font-size: 12px; font-weight: 500; }
.export-choice small { color: var(--muted); font-size: 10px; }
.export-format { min-width: 28px; flex: 0 0 auto; color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }
.export-choice > span:last-child { margin-left: auto; color: var(--muted); font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 27px 22px; border-top: 1px solid var(--line); }
.dialog-actions > span { color: var(--quiet); font-size: 10px; }
.toast-region { position: fixed; right: 25px; bottom: 49px; z-index: 20; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: min(370px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 17px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--paper); font-size: 12px; line-height: 1.6; box-shadow: 0 6px 24px #00000030; animation: toast-in .18s ease both; }
.toast-error { border-color: #875652; background: #3b272a; color: var(--danger); }
.empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding: 30px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.empty-state svg { width: 25px; height: 25px; margin-bottom: 5px; color: var(--quiet); }
.empty-state p { margin: 0; }
/* A dedicated darkroom keeps photo correction beside a generous, uncropped preview. */
.photo-edit-dialog { width: min(1220px, 90vw); height: min(860px, 90dvh); max-width: 90vw; max-height: 90dvh; margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--paper); box-shadow: none; }
.photo-edit-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.photo-edit-dialog::backdrop { background: #080b1299; }
.photo-edit-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 20px 25px; border-bottom: 1px solid var(--line); }
.photo-edit-heading-copy { min-width: 0; }
.photo-edit-heading h2 { margin: 5px 0 2px; font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: 1px; }
#photoEditName { max-width: 55vw; margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.photo-edit-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 0; }
.photo-edit-preview { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; padding: 24px 24px 16px; background: var(--panel); }
.photo-edit-image { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
#photoEditCanvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.is-retouching #photoEditCanvas, #photoEditCanvas.is-retouching { touch-action: none; cursor: crosshair; }
.photo-source-marker { position: absolute; width: 19px; height: 19px; border: 1px solid #fff; border-radius: 50%; background: #151b2444; box-shadow: 0 0 0 1px #11151c; transform: translate(-50%, -50%); pointer-events: none; }
.photo-source-marker::before, .photo-source-marker::after { position: absolute; top: 50%; left: 50%; content: ""; background: white; transform: translate(-50%, -50%); }
.photo-source-marker::before { width: 9px; height: 1px; }
.photo-source-marker::after { width: 1px; height: 9px; }
.photo-compare-badge { position: absolute; top: 12px; left: 12px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--accent); font-size: 11px; letter-spacing: 1px; pointer-events: none; }
.photo-preview-toolbar { display: flex; align-items: center; gap: 12px; padding-top: 17px; }
.photo-preview-toolbar .button { flex: 0 0 auto; }
#photoEditStatus { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 10px; text-align: center; }
#comparePhoto[aria-pressed="true"], #flipPhoto[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.photo-edit-controls { min-width: 0; min-height: 0; padding: 22px 24px 20px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; border-left: 1px solid var(--line); }
.photo-edit-controls:focus-visible { outline-offset: -5px; }
.photo-edit-controls .section-label { margin: 0 0 15px; font-size: 9px; letter-spacing: 1.1px; }
.photo-preset-section { margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.photo-preset-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.photo-preset-heading > span { color: var(--muted); font-size: 10px; }
.photo-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.photo-preset-card { position: relative; min-width: 0; padding: 4px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--paper); text-align: left; cursor: pointer; }
.photo-preset-card[hidden] { display: none; }
.photo-preset-card:hover { border-color: var(--line); background: var(--panel); }
.photo-preset-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--panel); }
.photo-preset-card canvas { display: block; width: 100%; height: 69px; object-fit: cover; background: var(--panel); }
.photo-preset-name { display: block; padding: 7px 4px 4px; font-size: 11px; line-height: 1.4; }
.photo-preset-badge { position: absolute; top: 9px; right: 9px; padding: 2px 4px; color: var(--muted); background: var(--panel); font-size: 8px; }
.photo-preset-badge:empty { display: none; }
.photo-preset-card.preview-unavailable canvas { background: var(--bg); }
.photo-preset-more { width: 100%; margin-top: 7px; min-height: 30px; font-size: 10px; text-align: center; }
.photo-preset-status { min-height: 34px; margin: 10px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.75; }
.photo-preset-intensity { margin-bottom: 6px; }
.photo-preset-intensity .photo-range-note { margin-top: 3px; line-height: 1.7; color: var(--muted); }
.photo-preset-undo { min-height: 30px; font-size: 10px; }
.photo-preset-undo:disabled { opacity: .5; cursor: default; }
.photo-adjustment-group { margin-bottom: 21px; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.photo-adjustment-group .range-row { margin-bottom: 15px; }
.photo-adjustment-group .range-row:last-child { margin-bottom: 0; }
.photo-edit-controls .range-label { font-size: 11px; }
.photo-edit-controls .range-label output { min-width: 38px; text-align: right; }
.photo-edit-controls input[type="range"] { margin-top: 14px; margin-bottom: 7px; }
.range-endpoints { display: flex; justify-content: space-between; margin-top: 2px; color: var(--quiet); font-size: 9px; }
.photo-geometry-actions { display: flex; gap: 8px; }
.photo-geometry-actions .button { flex: 1; padding: 8px; font-size: 11px; }
.photo-local-tools .photo-retouch-toggle, .photo-local-tools .photo-pick-source { width: 100%; }
.photo-retouch-toggle[aria-pressed="true"], .photo-pick-source[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.photo-retouch-hint, .photo-retouch-note { margin: 10px 0 13px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.photo-local-tools .photo-pick-source { margin-bottom: 17px; font-size: 11px; }
.photo-range-note { display: block; color: var(--quiet); font-size: 9px; }
.photo-retouch-actions { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.photo-retouch-actions .button { font-size: 11px; }
.photo-retouch-note { margin-bottom: 0; padding: 10px; border-left: 2px solid var(--line); background: var(--panel); color: var(--accent); }
.photo-reset { min-height: 30px; font-size: 11px; }
.photo-edit-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 25px; border-top: 1px solid var(--line); }
.photo-edit-footer p { margin: 0; color: var(--muted); font-size: 10px; }
.photo-edit-footer .button { flex: 0 0 auto; }
@media (max-width: 760px) {
  .photo-edit-dialog { height: 90dvh; }
  .photo-edit-heading { padding: 15px 18px; gap: 12px; }
  .photo-edit-heading h2 { font-size: 21px; }
  .photo-edit-heading .panel-kicker { font-size: 8px; letter-spacing: .8px; }
  .photo-edit-heading .button { padding: 10px; font-size: 11px; }
  #photoEditName { max-width: 45vw; font-size: 10px; }
  .photo-edit-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(170px, 44%) minmax(0, 1fr); }
  .photo-edit-preview { padding: 12px 15px 10px; }
  .photo-preview-toolbar { gap: 8px; padding-top: 9px; }
  .photo-preview-toolbar .button { min-height: 32px; font-size: 10px; }
  #photoEditStatus { font-size: 9px; }
  .photo-compare-badge { top: 6px; left: 6px; padding: 4px 7px; font-size: 10px; }
  .photo-edit-controls { padding: 20px; border-left: 0; border-top: 1px solid var(--line); }
  .photo-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-preset-card canvas { height: 65px; }
  .photo-edit-controls input[type="range"] { height: 5px; margin-top: 15px; margin-bottom: 10px; }
  .photo-edit-controls input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; }
  .photo-edit-controls input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; }
  .photo-edit-footer { padding: 11px 15px; gap: 10px; }
  .photo-edit-footer p { font-size: 9px; }
  .photo-edit-footer .button { padding: 9px 10px; font-size: 10px; }
}
@media (max-height: 620px) and (max-width: 760px) {
  .photo-edit-body { overflow-y: auto; grid-template-rows: 210px auto; }
  .photo-edit-controls { overflow: visible; }
  .photo-edit-heading { padding-top: 9px; padding-bottom: 9px; }
  .photo-edit-heading .panel-kicker { display: none; }
}
/* The style archive is a contact sheet; the AI room keeps handoff and returns together. */
.style-entry { margin: 0 0 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.style-library-trigger { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-raised); text-align: left; transition: border-color .15s ease, background .15s ease; }
.style-library-trigger:hover { border-color: var(--accent); background: var(--panel); }
.style-entry-copy { display: grid; gap: 7px; min-width: 0; }
.style-entry-copy .section-label { font-size: 11px; letter-spacing: .5px; color: var(--muted); }
.style-entry-copy strong { color: var(--paper); font-family: var(--serif); font-size: 18px; font-weight: 400; line-height: 1.5; }
.style-entry-arrow { align-self: center; color: var(--accent); font-size: 20px; }
.style-entry-browse { grid-column: 1 / -1; color: var(--accent); font-size: 12px; }
#styleDescription { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.ai-studio-trigger { justify-content: space-between; width: 100%; min-height: 39px; border-color: var(--line); font-size: 11px; }
.ai-studio-trigger > span:last-child { color: var(--accent); font-size: 17px; }
.style-adjustments .section-label { margin-bottom: 18px; }
.preview-mode { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 19px; margin-top: 13px; color: var(--quiet); font-size: 9px; letter-spacing: .8px; }
.preview-mode .text-button { min-height: 0; padding: 0; font-size: 10px; }
.preview-mode + .stage-caption { margin-top: 7px; }
.creation-dialog { width: min(1100px, calc(100vw - 60px)); max-width: calc(100vw - 60px); max-height: 90dvh; margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--paper); box-shadow: none; }
.creation-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.creation-dialog::backdrop { background: #080b1299; }
.creation-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; padding: 27px 30px 23px; border-bottom: 1px solid var(--line); }
.creation-dialog-heading > div { min-width: 0; }
.creation-dialog-heading h2 { margin: 4px 0 8px; font-family: var(--sans); font-size: 24px; font-weight: 500; line-height: 1.4; letter-spacing: .3px; }
.creation-dialog-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.creation-dialog-heading .button-icon { min-width: 44px; min-height: 44px; flex: 0 0 auto; font-size: 20px; font-weight: 400; }
.style-library-body { min-height: 0; padding: 20px 30px 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.style-library-note { display: flex; align-items: baseline; justify-content: space-between; gap: 22px; margin-bottom: 19px; }
.style-library-note > span { flex: 0 0 auto; color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: 1.1px; }
.style-library-note > p { max-width: 530px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; text-align: right; }
.style-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.style-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.style-filter { min-height: 38px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; }
.style-filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.style-filter:hover { border-color: var(--accent); }
.style-card[hidden] { display: none; }
.style-license-badge { align-self: flex-start; margin: 10px 2px 0; padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; }
.style-usage-notice { margin: 10px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.style-card { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 10px 10px 13px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--paper); text-align: left; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.style-card:hover { border-color: var(--line); background: var(--panel); }
.style-card.is-active { border-color: var(--accent); background: var(--panel); box-shadow: none; }
.style-card.is-active::after { position: absolute; top: 16px; right: 16px; content: "已选"; padding: 3px 7px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 9px; letter-spacing: .5px; }
.style-card-canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; margin-bottom: 12px; background: var(--panel); object-fit: contain; }
.style-card-name, .style-card > strong { display: block; margin: 0 2px 4px; color: var(--paper); font-family: var(--serif); font-size: 16px; font-weight: 400; line-height: 1.5; }
.style-card-description, .style-card > small { display: block; margin: 0 2px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.creation-status { min-height: 1.7em; margin: 14px 0 0; color: var(--accent); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.creation-status:empty { min-height: 0; margin-top: 0; }
.style-library-footer { display: flex; align-items: baseline; gap: 18px; padding: 15px 30px 18px; border-top: 1px solid var(--line); background: var(--panel); }
.style-library-footer > .section-label { flex: 0 0 auto; font-size: 9px; letter-spacing: .8px; }
#styleSources { display: flex; flex-wrap: wrap; gap: 6px 15px; min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
#styleSources a { color: var(--muted); text-decoration-color: var(--line); text-underline-offset: 3px; }
#styleSources a:hover { color: var(--accent); }
.ai-dialog { width: min(1100px, calc(100vw - 60px)); height: min(940px, 92dvh); }
.ai-dialog[open] { grid-template-rows: auto minmax(0, 1fr) auto; }
.ai-dialog .creation-dialog-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 20px 24px 16px; }
.ai-dialog .ai-connection { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); align-items: center; }
.ai-dialog-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 24px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--panel); }
.ai-dialog-footer .ai-progress { margin: 0; }
.ai-dialog-footer .ai-generate-actions { flex-wrap: nowrap; }
.ai-dialog-footer .ai-generate-actions > .button { min-width: 132px; font-size: 14px; }
.ai-dialog-footer .ai-cancel-note, .ai-dialog-footer #dismissAiJob { grid-column: 1 / -1; margin: 0; }
.ai-dialog .ai-section-description, .ai-dialog .ai-retouch-note, .ai-dialog .ai-result-note,
.ai-dialog .creation-status, .ai-dialog .ai-connection p { font-size: 12px; }
.ai-studio-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ai-brief-panel, .ai-results-panel { min-width: 0; padding: 26px 28px 28px; }
.ai-results-panel { border-left: 1px solid var(--line); background: var(--panel); }
.ai-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 13px; min-height: 26px; margin-bottom: 9px; }
.ai-section-heading .panel-kicker { flex: 0 0 auto; font-size: 9px; letter-spacing: .9px; }
.ai-current-style { padding: 3px 8px; border: 1px solid var(--line); border-radius: 2px; color: var(--accent); font-size: 10px; line-height: 1.5; text-align: right; }
.ai-studio-body h3 { margin: 0 0 9px; font-size: 19px; font-weight: 500; letter-spacing: .3px; }
.ai-section-description { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.85; }
.ai-photo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 240px; margin-bottom: 24px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ai-photo-option { position: relative; display: grid; grid-template-columns: 49px minmax(0, 1fr); align-items: center; gap: 9px; min-width: 0; min-height: 70px; padding: 7px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); cursor: pointer; }
.ai-photo-option:hover { border-color: var(--line); }
.ai-photo-option:has(input:checked) { border-color: var(--accent); background: var(--panel); }
.ai-photo-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ai-photo-option:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.ai-photo-option input[type="checkbox"] { position: absolute; top: 9px; left: 9px; width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ai-photo-option > img { display: block; width: 49px; height: 57px; background: var(--panel); object-fit: cover; }
.ai-photo-option > span { min-width: 0; overflow: hidden; color: var(--paper); font-size: 10px; line-height: 1.65; text-overflow: ellipsis; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ai-photo-list > .empty-state { grid-column: 1 / -1; }
.ai-brief-field { margin-top: 6px; margin-bottom: 18px; }
.ai-brief-field label { font-size: 13px; }
.ai-brief-field textarea { min-height: 104px; max-height: 220px; resize: vertical; font-size: 12px; line-height: 1.8; }
.ai-job-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.ai-job-actions .button { min-height: 40px; padding-right: 12px; padding-left: 12px; font-size: 11px; }
.ai-request-text { display: block; width: 100%; min-height: 140px; margin-top: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--field); color: var(--paper); font-size: 12px; line-height: 1.8; resize: vertical; }
.ai-result-mark { display: grid; place-items: center; width: 25px; height: 29px; border: 1px solid var(--line); color: var(--accent); font-family: var(--serif); font-size: 16px; }
.ai-import-result { justify-content: space-between; width: 100%; min-height: 43px; margin-bottom: 17px; border-style: dashed; border-color: var(--line); color: var(--accent); font-size: 12px; }
.ai-results { display: grid; gap: 10px; }
.ai-results:empty::before { display: block; padding: 34px 18px; border: 1px solid var(--line); content: "成片会收在这里"; color: var(--quiet); font-family: var(--serif); font-size: 15px; text-align: center; letter-spacing: 1px; }
.ai-result-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 10px 13px; min-width: 0; padding: 10px; border: 1px solid var(--line); background: var(--panel); }
.ai-result-card.is-active { border-color: var(--line); background: var(--panel); }
.ai-result-card > img { grid-row: span 2; display: block; width: 76px; height: 100px; object-fit: contain; background: var(--panel); }
.ai-result-info { min-width: 0; align-self: end; }
.ai-result-info strong, .ai-result-card h4 { display: block; margin: 0; overflow: hidden; color: var(--paper); font-size: 11px; font-weight: 500; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.ai-result-info p, .ai-result-info small { display: block; margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.ai-result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; align-self: start; }
.ai-result-actions button, .ai-result-actions a { min-height: 30px; padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; line-height: 1.5; text-decoration: none; }
.ai-result-actions button:hover, .ai-result-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ai-result-actions [data-action="remove"], .ai-result-actions .remove-result { color: var(--muted); }
.ai-result-note { margin: 19px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.9; }
.ai-import-hint { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.ai-import-hint code { display: block; font-family: var(--mono); color: var(--paper); }
.ai-connection { display: flex; align-items: flex-start; gap: 14px; margin: 0 0 17px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ai-connection p { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.ai-connection .text-button { flex: 0 0 auto; min-height: 30px; padding: 0; font-size: 11px; }
.ai-connection[data-state="ready"] p { color: #c2cddc; }
.ai-connection[data-state="offline"] p { color: var(--accent); }
.ai-generate-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.ai-generate-actions > .button { min-height: 45px; padding: 10px 17px; font-size: 12px; }
.ai-generate-actions > .button-primary { flex: 1; }
.ai-progress { margin-top: 14px; }
.ai-progress .creation-status { margin-top: 0; color: var(--muted); }
.ai-progress.is-working .creation-status { color: var(--accent); }
.ai-progress.has-error .creation-status { color: var(--danger); }
.ai-elapsed { display: inline-block; margin-top: 5px; color: var(--muted); font-family: var(--mono); font-size: 10px; font-variant-numeric: tabular-nums; }
.ai-cancel-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.ai-fallback { margin-top: 25px; border-top: 1px solid var(--line); }
.ai-fallback summary { padding: 15px 0 3px; color: var(--muted); font-size: 11px; line-height: 1.8; cursor: pointer; }
.ai-fallback summary:hover { color: var(--paper); }
.ai-fallback summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.ai-fallback-body { padding-top: 10px; }
.ai-fallback-body > p:first-child { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.ai-fallback-body .ai-import-result { margin: 19px 0 8px; }
.ai-results .ai-empty { margin: 0; padding: 40px 18px; border: 1px solid var(--line); color: var(--muted); font-family: var(--serif); font-size: 14px; line-height: 2; text-align: center; }
.ai-result-card.is-active { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
.ai-result-card.is-active > img { grid-row: auto; width: 100%; height: auto; max-height: 380px; object-fit: contain; }
.ai-result-card.is-active .ai-result-actions { gap: 17px; }
.ai-held-result .ai-result-info p { color: var(--accent); }
#dismissAiJob { min-height: 36px; margin-top: 8px; color: var(--accent); font-size: 11px; text-align: left; }
@media (max-width: 900px) {
  .style-grid { gap: 12px; }
  .style-card { padding: 8px 8px 11px; }
  .style-card-name, .style-card > strong { font-size: 14px; }
  .style-library-note { align-items: flex-start; }
  .ai-studio-body { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); }
  .ai-brief-panel, .ai-results-panel { padding: 23px; }
  .ai-photo-list { grid-template-columns: minmax(0, 1fr); max-height: 244px; }
}
@media (max-width: 639px) {
  .style-entry { margin-bottom: 24px; padding-bottom: 24px; }
  .style-library-trigger { padding: 16px; }
  .style-entry-copy strong { font-size: 20px; }
  .style-entry-browse, #styleDescription { font-size: 11px; }
  .ai-studio-trigger { min-height: 42px; font-size: 12px; }
  .creation-dialog, .ai-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: 92dvh; }
  .creation-dialog-heading { gap: 10px; padding: 20px 17px 16px; }
  .creation-dialog-heading .panel-kicker { font-size: 8px; letter-spacing: .8px; }
  .creation-dialog-heading h2 { margin-top: 7px; font-size: 21px; letter-spacing: .3px; }
  .creation-dialog-heading p:last-child { font-size: 10px; }
  .creation-dialog-heading .button-icon { width: 44px; min-width: 44px; min-height: 44px; padding: 8px; }
  .ai-dialog .creation-dialog-heading { padding: 16px; gap: 10px; }
  .ai-dialog .creation-dialog-heading h2 { font-size: 21px; margin-top: 0; }
  .ai-dialog .creation-dialog-heading p:last-child { font-size: 12px; }
  .ai-dialog-footer { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 16px; }
  .ai-dialog-footer .ai-generate-actions > .button { min-height: 44px; flex: 1; min-width: 0; }
  .ai-dialog .ai-connection { padding: 8px 10px; gap: 8px; }
  .ai-dialog .ai-connection p { font-size: 11px; }
  .style-library-body { padding: 16px 14px 19px; }
  .style-library-note { display: block; margin-bottom: 15px; }
  .style-library-note > span { font-size: 8px; }
  .style-library-note > p { margin-top: 7px; font-size: 10px; text-align: left; }
  .style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .style-card { padding: 7px 7px 10px; }
  .style-card:hover { transform: none; }
  .style-card-canvas { margin-bottom: 10px; }
  .style-card-name, .style-card > strong { margin-right: 1px; margin-left: 1px; font-size: 15px; }
  .style-card-description, .style-card > small { margin-right: 1px; margin-left: 1px; font-size: 10px; }
  .style-card.is-active::after { top: 12px; right: 12px; }
  .style-library-footer { display: block; padding: 13px 17px 16px; }
  #styleSources { gap: 3px 12px; margin-top: 7px; font-size: 9px; }
  .ai-studio-body { grid-template-columns: minmax(0, 1fr); }
  .ai-brief-panel, .ai-results-panel { padding: 22px 18px; }
  .ai-results-panel { border-left: 0; border-top: 1px solid var(--line); }
  .ai-section-description { font-size: 11px; }
  .ai-photo-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 240px; }
  .ai-photo-option { grid-template-columns: 43px minmax(0, 1fr); gap: 7px; padding: 6px; }
  .ai-photo-option > img { width: 43px; height: 57px; }
  .ai-photo-option > span { font-size: 10px; }
  .ai-photo-option input[type="checkbox"] { top: 8px; left: 8px; width: 16px; height: 16px; }
  .ai-brief-field textarea { font-size: 16px; }
  .ai-job-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ai-job-actions .button { min-height: 43px; font-size: 12px; }
  .ai-request-text { font-size: 14px; }
  .ai-result-actions button, .ai-result-actions a { min-height: 34px; font-size: 11px; }
}
.preview-switch { display: flex; gap: 4px; align-self: center; margin: 0 0 15px; padding: 3px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.preview-switch .button { min-height: 32px; padding: 6px 16px; border-color: transparent; font-size: 11px; }
.preview-switch .button[aria-pressed="true"] { background: var(--panel-raised); color: var(--paper); border-color: var(--line); }
.preview-photo-info { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.preview-photo-info:has([hidden]):not(:has(:not([hidden]))) { display: none; }
#previewPhotoName { min-width: 0; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
#previewSetCover { min-height: 34px; padding: 6px 12px; color: var(--accent); font-size: 11px; }
.artwork-text-note { margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.artwork-editor .toggle-row { margin-bottom: 16px; }
.trip-library-dialog { width: min(900px, calc(100vw - 40px)); }
.trip-library-body { min-height: 0; padding: 0 28px 28px; overflow-y: auto; }
.trip-library-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin: 20px 0; }
.trip-library-toolbar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.trip-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.trip-card { min-width: 0; padding: 12px; border: 1px solid var(--line); background: var(--panel); }
.trip-card.is-active { border-color: var(--line); }
.trip-card-cover { display: grid; place-items: center; height: 160px; overflow: hidden; background: var(--panel); color: var(--accent); font-family: var(--serif); font-size: 28px; }
.trip-card-cover > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.trip-card-info { margin: 13px 0 10px; min-width: 0; }
.trip-card-info h3, .trip-card-info strong { display: block; margin: 0 0 6px; font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.trip-card-info p, .trip-card-info time, .trip-card-info small { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.trip-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.trip-card-actions button { min-height: 36px; padding: 6px 12px; font-size: 11px; }
.trip-card-actions .secondary-button { border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--accent); }
.ai-mode-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: 0; margin: 0 0 28px; padding: 0; min-width: 0; }
.ai-mode-picker legend { padding: 0 0 10px; color: var(--paper); font-size: 12px; }
.ai-mode-picker label { display: flex; align-items: flex-start; gap: 8px; padding: 13px 11px; border: 1px solid var(--line); cursor: pointer; }
.ai-mode-picker label:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ai-mode-picker input { accent-color: var(--accent); margin: 4px 0 0; flex: 0 0 auto; }
.ai-mode-picker strong, .ai-mode-picker small { display: block; }
.ai-mode-picker strong { font-size: 13px; font-weight: 500; }
.ai-mode-picker small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.ai-mode-picker:disabled label { cursor: default; opacity: .6; }
.ai-style-picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.ai-style-picker[hidden] { display: none; }
.ai-style-picker span, .ai-style-picker strong { display: block; }
.ai-style-picker span { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.ai-style-picker strong { color: var(--paper); font-size: 14px; font-weight: 500; }
.ai-style-picker .button { flex-shrink: 0; min-height: 38px; font-size: 12px; }
.ai-intent-examples { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 13px; margin: -3px 0 23px; }
.ai-intent-examples > span { color: var(--muted); font-size: 11px; }
.ai-intent-examples button { min-height: 34px; padding: 4px 0; font-size: 12px; }
.ai-photo-option input[type="radio"] { position: absolute; top: 10px; left: 10px; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.artwork-compare-dialog { width: min(1280px, calc(100vw - 40px)); height: min(920px, 92dvh); }
.artwork-compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 24px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.artwork-compare-grid figure { margin: 0; min-width: 0; }
.artwork-compare-grid figcaption { margin-bottom: 10px; color: var(--paper); font-size: 12px; overflow-wrap: anywhere; }
.artwork-compare-grid canvas { display: block; width: 100%; height: 55vh; object-fit: contain; background: var(--field); }
.artwork-compare-status { margin: 0; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--panel); }
@media (max-width: 639px) {
  .ai-mode-picker { gap: 8px; }
  .ai-mode-picker label { padding: 10px 8px; }
  .ai-photo-option input[type="radio"] { top: 8px; left: 8px; }
  .artwork-compare-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px; }
  .artwork-compare-grid canvas { height: 34dvh; max-height: 320px; }
}
.ai-recommendations { padding: 0 0 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.ai-recommendation-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ai-recommendation-toolbar .button { min-height: 40px; font-size: 12px; color: var(--accent); border-color: var(--line); }
#aiRecommendationStatus { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
#aiRecommendationList { display: grid; gap: 12px; margin-top: 14px; }
#aiRecommendationList:empty { margin: 0; }
.ai-recommendation-card { padding: 15px; border: 1px solid var(--line); background: var(--panel); }
.ai-recommendation-card h4 { margin: 0 0 7px; font-family: var(--serif); font-weight: 400; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-recommendation-reason { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.ai-recommendation-prompt { margin: 0 0 14px; color: var(--paper); font-size: 12px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-recommendation-details { margin: 0 0 12px; }
.ai-recommendation-details summary { cursor: pointer; color: var(--muted); font-size: 12px; min-height: 36px; padding: 7px 0; }
.ai-recommendation-details .ai-recommendation-prompt { margin: 8px 0; }
.ai-recommendation-apply { min-height: 36px; padding: 7px 12px; color: var(--accent); font-size: 11px; }
@media (max-width: 639px) {
  .trip-library-dialog { width: calc(100vw - 24px); }
  .trip-library-body { padding: 0 17px 20px; }
  .trip-list { grid-template-columns: minmax(0, 1fr); }
  .preview-switch { margin-bottom: 16px; }
  .preview-switch .button { min-height: 38px; }
  .ai-recommendation-card { padding: 13px; }
  .ai-recommendation-prompt { font-size: 13px; }
}
.is-loading { cursor: progress; opacity: .6; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1550px) {
  .workspace { grid-template-columns: 256px minmax(0, 1fr) 320px; }
  .library-panel { padding-right: 23px; padding-left: 23px; }
  .inspector-panel { padding-right: 27px; padding-left: 27px; }
  .stage-panel { padding: 30px 48px 23px; }
}
@media (max-width: 1100px) and (min-width: 900px) {
  .workspace { grid-template-columns: 214px minmax(0, 1fr) 260px; }
  .library-panel { padding-left: 15px; padding-right: 15px; }
  .inspector-panel { padding-left: 17px; padding-right: 17px; }
  .stage-panel { padding-left: 20px; padding-right: 20px; }
  .stage-tools { gap: 4px; }
  .stage-tools .button { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 899px) {
  body { height: auto; }
  .topbar { height: auto; min-height: 82px; padding: 18px 21px; gap: 18px; }
  .workspace { height: auto; min-height: 0; overflow: visible; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "library" "inspector"; align-items: start; }
  .stage-panel { height: min(760px, 85dvh); min-height: 500px; padding: 25px 25px 20px; }
  .inspector-panel { align-self: stretch; overflow: visible; min-height: 100%; padding-top: 26px; }
  .library-panel { border-right: 0; border-top: 1px solid var(--line); padding: 22px 25px; overflow: visible; }
  .library-panel .upload-zone { min-height: 90px; }
  .photo-list { display: flex; flex-direction: row; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; }
  .photo-card { flex: 0 0 220px; scroll-snap-align: start; }
  .mobile-workspace-nav { position: sticky; top: 0; z-index: 10; display: flex; justify-content: center; gap: 8px; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .mobile-workspace-nav a { flex: 1; max-width: 220px; padding: 10px 6px; color: var(--muted); font-size: 13px; text-align: center; text-decoration: none; }
  .mobile-workspace-nav a:hover { background: var(--panel-raised); color: var(--paper); }
  .mobile-photo-actions { display: flex; gap: 10px; margin-top: 12px; }
  .mobile-photo-actions .button { flex: 1; min-height: 44px; }
  #photoLibrary, #workspacePreview, #workspaceInspector { scroll-margin-top: 64px; }
  .library-panel .panel-kicker { display: none; }
  .library-panel .panel-title { margin-top: 0; }
  .library-panel .panel-description { margin-bottom: 12px; }
  .library-panel .upload-zone { margin-bottom: 14px; padding: 10px; min-height: 90px; }
  .library-footer { margin-top: 12px; padding-top: 10px; }
  .library-footer .small-action { display: inline-block; margin: 0; }
  .photo-info { padding-bottom: 40px; }
  .photo-card-actions button { width: 44px; height: 44px; }
  .photo-select { gap: 8px; padding: 8px; }
  .stage-tools .button { padding-left: 7px; padding-right: 7px; }
  .top-actions { flex-wrap: wrap; gap: 6px; }
  .top-actions .button { font-size: 11px; padding: 7px 10px; }
  .brand-name { font-size: 19px; letter-spacing: 1px; }
  .brand-tagline { font-size: 11px; letter-spacing: 1px; }
  .statusbar { height: auto; min-height: 32px; padding: 9px 18px; }
}
@media (max-width: 639px) {
  .topbar { display: grid; grid-template-columns: 1fr; gap: 17px; padding: 19px 18px 15px; }
  .brand { gap: 10px; }
  .brand-mark { width: 31px; height: 36px; }
  .brand-name { font-size: 20px; letter-spacing: 1.7px; }
  .brand-tagline { margin-top: 3px; letter-spacing: 2.6px; }
  .top-actions { justify-content: flex-start; gap: 7px; flex-wrap: wrap; }
  .top-actions .button { min-height: 44px; flex: 1 1 auto; padding: 8px 10px; font-size: 12px; }
  .top-actions .button-icon { flex: 0 0 36px; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "library" "inspector"; }
  .stage-panel { height: auto; min-height: 0; padding: 23px 18px 22px; overflow: visible; }
  .stage-toolbar { align-items: center; margin-bottom: 23px; }
  .stage-heading { font-size: 20px; }
  .stage-meta { font-size: 8px; letter-spacing: .9px; }
  .stage-tools { gap: 5px; }
  .stage-tools .button { min-height: 44px; min-width: 44px; padding: 8px; }
  .canvas-shell { flex: none; min-height: 180px; }
  .canvas-shell::before, .canvas-shell::after { display: none; }
  #magazineCanvas { max-width: 100%; max-height: 62dvh; }
  .stage-caption { margin-top: 18px; }
  .stage-caption { flex-wrap: wrap; gap: 8px; font-size: 8px; letter-spacing: .8px; }
  .stage-caption::before, .stage-caption::after { display: none; }
  .stage-bottom { margin-top: 17px; gap: 10px; }
  .template-description { font-size: 10px; }
  .stage-bottom > span { font-size: 8px; }
  .inspector-panel { min-height: 0; border-left: 0; border-top: 1px solid var(--line); padding: 25px 22px 26px; }
  .inspector-heading { margin-bottom: 6px; }
  .control-section { margin-bottom: 23px; padding-bottom: 23px; }
  .field input:not([type="checkbox"]):not([type="range"]), .field textarea, .field select { min-height: 41px; font-size: 16px; }
  .field textarea { min-height: 73px; font-size: 14px; }
  .template-options { gap: 10px; }
  .template-option { gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .template-mini { width: 49px; height: 61px; }
  .template-name { font-size: 11px; }
  .theme-swatch { min-height: 36px; padding: 7px 12px; font-size: 11px; }
  .toggle-row { min-height: 30px; font-size: 12px; }
  .toggle-row input[type="checkbox"] { width: 32px; height: 18px; }
  .toggle-row input[type="checkbox"]::before { width: 12px; height: 12px; }
  .toggle-row input[type="checkbox"]:checked::before { transform: translateX(14px); }
  .range-label { font-size: 11px; }
  input[type="range"] { height: 5px; margin-top: 14px; margin-bottom: 8px; }
  input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; }
  .small-action, .text-button { min-height: 30px; font-size: 11px; }
  .library-panel { padding: 25px 22px; }
  .photo-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .photo-select { grid-template-columns: 45px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .photo-thumb { width: 45px; height: 63px; }
  .photo-name { font-size: 12px; }
  .photo-card-actions button { min-width: 44px; height: 44px; }
  .statusbar { align-items: flex-start; gap: 10px; padding: 11px 18px; font-size: 8px; }
  .statusbar > span:last-child { text-align: right; }
  .toast-region { right: 16px; bottom: 18px; }
  .export-dialog { width: calc(100vw - 28px); }
  .dialog-heading { padding: 22px 21px 17px; }
  .dialog-body { padding: 21px; }
  .dialog-actions { padding: 17px 21px 21px; }
}
@media (max-width: 370px) {
  .photo-list { grid-template-columns: 1fr; }
  .stage-tools .button { padding: 5px 6px; font-size: 9px; }
  .stage-meta { letter-spacing: .3px; }
}
/* Desktop studio: one large image, a filmstrip, and tools grouped by intent. */
.topbar-context { color: var(--muted); font-size: 12px; margin-right: auto; }
.topbar-divider { width: 1px; height: 26px; background: var(--line); }
.project-menu { position: relative; z-index: 12; }
.project-menu > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding: 8px 14px; list-style: none; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 13px; }
.project-menu > summary::-webkit-details-marker { display: none; }
.project-menu[open] > summary { border-color: var(--accent); color: var(--paper); background: var(--panel-raised); }
.project-menu-items { position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; padding: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 32px #00000030; }
.project-menu-items button, .project-menu-items a { display: block; width: 100%; text-align: left; padding: 11px 13px; border: 0; border-radius: 5px; background: transparent; color: var(--paper); font-size: 13px; text-decoration: none; }
.project-menu-items button:hover, .project-menu-items a:hover { background: var(--panel-raised); }
.project-menu-items hr { border: 0; border-top: 1px solid var(--line); margin: 5px 7px; }
.workspace-rail { display: none; }
.inspector-tabs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 0 16px; gap: 8px; border-bottom: 1px solid var(--line); }
.inspector-tabs button { min-height: 53px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; }
.inspector-tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--accent); background: transparent; box-shadow: none; font-weight: 600; }
.inspector-tabs button:hover { color: var(--paper); background: var(--panel-raised); }
.inspector-task { min-width: 0; padding: 24px; }
.task-intro { margin-bottom: 22px; }
.task-intro h2 { margin: 0 0 7px; font-size: 20px; line-height: 1.45; font-weight: 600; letter-spacing: -.4px; }
.task-intro p { margin: 0; font-size: 12px; line-height: 1.8; color: var(--muted); }
.task-symbol { display: none; }
.task-symbol svg { width: 26px; height: 26px; }
.current-photo { display: flex; gap: 12px; align-items: center; min-width: 0; margin: 0 0 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.current-photo img { width: 48px; height: 48px; object-fit: cover; border-radius: 3px; }
.current-photo > div { min-width: 0; }
.current-photo strong { display: block; font-size: 12px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.current-photo span { display: block; margin-top: 4px; color: var(--quiet); font-size: 11px; line-height: 1.6; }
.inspector-task .photo-edit-entry { margin-bottom: 28px; }
.inspector-task .photo-edit-entry .button { border-radius: 5px; min-height: 43px; font-size: 13px; }
.inspector-task .photo-edit-entry p { margin: 8px 0 14px; font-size: 11px; }
.inspector-task .ai-studio-trigger { background: var(--panel); border-color: var(--line); color: var(--paper); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-heading h3 { margin: 0; font-size: 13px; font-weight: 500; }
.section-heading > span { font-size: 11px; color: var(--quiet); }
.quick-look { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px 4px; border: 0; border-top: 1px solid var(--line-soft); background: none; text-align: left; transition: background .15s ease; }
.quick-look:hover { background: var(--panel-raised); }
.quick-look strong, .quick-look small { display: block; }
.quick-look strong { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.quick-look small { font-size: 11px; color: var(--muted); }
.quick-look b { margin-left: auto; color: var(--quiet); font-size: 17px; font-weight: 400; }
.look-sample { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 3px; border: 1px solid #a3b2a5; background: #b1c1b5; box-shadow: inset -13px 0 #e4dfd0, inset 0 -13px #6d8676; }
.cinema .look-sample { background: #42686a; border-color: #527475; box-shadow: inset -13px 0 #d3a26f, inset 0 -13px #254e55; }
.soft .look-sample { background: #e4d8c8; border-color: #d9cdbb; box-shadow: inset -13px 0 #baa792, inset 0 -13px #c7d2c6; }
.inspector-footnote { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--quiet); }
.document-type { margin: 0 0 7px; color: var(--quiet); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
#workspaceSubtitle { margin: 6px 0 0; color: var(--muted); font-size: 12px; max-width: 40ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stage-empty { text-align: center; max-width: 420px; padding: 24px; }
.empty-frame { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 22px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); }
.empty-frame svg { width: 38px; height: 38px; }
.stage-empty h3 { font-family: var(--sans); font-size: 24px; font-weight: 500; margin: 0 0 12px; }
.stage-empty p { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.stage-actionbar { display: flex; justify-content: center; gap: 0; flex: 0 0 auto; align-self: center; margin-top: 18px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 2px 5px #00000018; }
.stage-actionbar button { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 7px 16px; background: none; border: 0; border-radius: 3px; color: var(--paper); font-size: 12px; }
.stage-actionbar button + button { border-left: 1px solid var(--line); border-radius: 0 3px 3px 0; }
.stage-actionbar button:hover { background: var(--panel-raised); }
.stage-actionbar svg { width: 16px; height: 16px; color: var(--muted); }
.filmstrip-heading { display: flex; align-items: baseline; gap: 14px; }
.filmstrip-heading > span { color: var(--quiet); font-size: 11px; }
.button { border-radius: 5px; }
.button-primary { font-weight: 600; }
.button-primary:hover:not(:disabled) { background: #edb18a; border-color: #edb18a; color: var(--on-accent); }
.field input:not([type="checkbox"]):not([type="range"]), .field textarea, .field select { border-color: var(--line); border-radius: 4px; padding: 10px 11px; }
.control-section .section-label { color: var(--paper); font-size: 13px; font-family: var(--sans); letter-spacing: 0; font-weight: 500; }
.style-library-trigger { background: var(--panel-raised); border-radius: 5px; border-color: var(--line); }
.style-library-trigger:hover { background: var(--accent-soft); }
.style-entry-copy strong { font-family: var(--sans); font-size: 18px; }
.range-label, .photo-edit-controls .range-label { font-size: 12px; }
input[type="range"], .photo-edit-controls input[type="range"] { height: 22px; margin: 5px 0 0; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: #485568; }
input[type="range"]::-webkit-slider-thumb { width: 15px; height: 15px; margin-top: -6px; border: 2px solid var(--panel); background: var(--paper); box-shadow: 0 0 0 1px #8c99aa; }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #485568; }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid var(--panel); background: var(--paper); box-shadow: 0 0 0 1px #8c99aa; }
.creation-dialog, .export-dialog, .photo-edit-dialog { border-color: #485568; border-radius: 7px; background: var(--panel); box-shadow: 0 24px 72px #00000066; }
.creation-dialog::backdrop, .photo-edit-dialog::backdrop, .export-dialog::backdrop { background: #080b1299; }
.creation-dialog-heading, .photo-edit-heading { padding: 22px 28px; }
.creation-dialog-heading .panel-kicker, .photo-edit-heading .panel-kicker { font-family: var(--sans); font-size: 11px; letter-spacing: .4px; }
.photo-edit-heading h2 { font-family: var(--sans); font-size: 24px; font-weight: 500; }
.photo-edit-controls .section-label { font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.photo-preset-card { border-radius: 4px; padding: 4px; background: var(--panel); border-color: var(--line); overflow: hidden; }
.photo-preset-card canvas { height: 88px; border-radius: 4px; }
.photo-preset-name { padding: 8px 5px 5px; font-size: 12px; }
.photo-preset-more, .photo-preset-undo, .photo-preset-status, .photo-retouch-hint, .photo-edit-footer p, #photoEditStatus { font-size: 12px; }
.photo-range-note, .range-endpoints { font-size: 11px; }
.photo-edit-preview { background: var(--bg); }
.photo-edit-controls { background: var(--surface-tools); }
.photo-edit-footer { background: var(--panel); }
.photo-preview-toolbar .button { min-height: 40px; }
.photo-preview-toolbar #comparePhoto { border-radius: 4px; padding-inline: 18px; background: var(--panel); }
.ai-reference-stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 22px 26px 16px; background: var(--bg); }
.ai-reference-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; font-size: 12px; color: var(--muted); }
#aiReferenceCount { font-size: 11px; color: var(--quiet); white-space: nowrap; }
.ai-reference-canvas { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; position: relative; }
#aiReferencePreview { display: block; width: 100%; height: 100%; object-fit: contain; }
#aiReferenceEmpty { font-size: 14px; color: var(--muted); text-align: center; padding: 30px; }
.ai-reference-stage[data-state="loading"] .ai-reference-canvas::after { content: "正在准备参考照片…"; position: absolute; bottom: 15px; padding: 9px 16px; border-radius: 18px; background: var(--panel); color: var(--paper); font-size: 12px; }
.ai-reference-caption { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 14px; color: var(--muted); font-size: 12px; }
#aiReferenceName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#aiUseCurrentPhoto { min-height: 36px; flex: 0 0 auto; font-size: 12px; }
.ai-result-actions button, .ai-result-actions a { min-height: 36px; font-size: 12px; }
.ai-result-compare, .ai-result-download { color: var(--accent); }
.ai-result-card { border-color: var(--line); border-radius: 5px; background: var(--panel); }
.ai-result-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.ai-mode-picker label { border-radius: 5px; background: var(--panel); }
.ai-mode-picker label:has(:checked) { background: var(--accent-soft); }
.ai-photo-option { border-radius: 4px; }
.ai-photo-option:has(input:checked) { background: var(--accent-soft); }
.ai-recommendation-card { border-radius: 5px; background: var(--panel-raised); border-color: var(--line); }
.ai-recommendation-card h4 { font-family: var(--sans); font-size: 15px; font-weight: 500; }
.ai-recommendation-reason, .ai-recommendation-apply { font-size: 12px; }
.ai-dialog-footer { background: var(--panel); border-color: var(--line); }
.style-card { border-radius: 5px; padding: 12px; background: var(--panel); }
.style-card:hover { background: var(--panel-raised); }
.style-card.is-active { background: var(--accent-soft); }
.style-card-canvas { border-radius: 4px; }
.style-card-name, .style-card > strong { font-family: var(--sans); font-size: 16px; }
.style-card-description, .style-card > small { font-size: 12px; }
.export-choice { padding: 18px; border-radius: 5px; background: var(--panel); border-color: var(--line); }
.export-choice strong { font-size: 15px; }
.export-choice small { font-size: 12px; }
.export-format { padding: 8px; min-width: 50px; text-align: center; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-raised); font-size: 12px; }
@media (min-width: 900px) {
  .topbar { height: 66px; padding: 0 24px; gap: 24px; background: var(--panel); border-color: var(--line); }
  .brand { gap: 12px; }
  .brand-mark { width: 34px; height: 36px; border-radius: 4px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 25px; }
  .brand-name { font-size: 20px; letter-spacing: 2px; font-weight: 600; }
  .brand-tagline { font-size: 9px; margin: 1px 0 0; letter-spacing: 1.4px; }
  .top-actions .button { min-height: 40px; }
  .top-actions #openExport { min-width: 130px; margin-left: 8px; }
  .workspace { height: calc(100dvh - 94px); min-height: 600px; grid-template-columns: 76px minmax(0,1fr) 328px; grid-template-rows: minmax(0,1fr) 161px; grid-template-areas: "rail stage inspector" "rail library inspector"; overflow: hidden; }
  .workspace-rail { grid-area: rail; display: flex; flex-direction: column; align-items: stretch; padding: 20px 8px 18px; gap: 8px; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
  .workspace-rail button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 60px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; transition: color .15s ease, background .15s ease; }
  .workspace-rail svg { width: 21px; height: 21px; }
  .workspace-rail button:hover { background: var(--panel-raised); color: var(--paper); }
  .workspace-rail button[aria-pressed="true"] { background: #2b3340; color: var(--accent); border-color: #465165; }
  .rail-signature { margin-top: auto; text-align: center; color: var(--quiet); font-size: 10px; letter-spacing: 1px; line-height: 2; }
  .stage-panel { padding: 22px 30px 18px; background: var(--bg); }
  .stage-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 12px; margin-bottom: 22px; align-items: center; }
  .stage-document { min-width: 0; }
  .stage-heading { font-size: 23px; letter-spacing: -.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage-tools .button { width: 38px; min-height: 38px; background: var(--panel); border-color: var(--line); }
  .preview-switch { margin: 0; padding: 3px; border-radius: 5px; background: #20262f; border-color: var(--line); gap: 2px; }
  .preview-switch .button { border-radius: 3px; min-height: 30px; padding: 6px 14px; font-size: 12px; }
  .preview-switch .button[aria-pressed="true"] { background: var(--panel); border-color: transparent; color: var(--paper); box-shadow: 0 1px 3px #00000030; }
  .canvas-shell { min-height: 100px; }
  .canvas-shell::before, .canvas-shell::after { display: none; }
  #magazineCanvas { max-width: 100%; max-height: 100%; border-radius: 1px; box-shadow: 0 3px 18px #00000030; }
  .stage-caption, .stage-bottom, .preview-mode { display: none; }
  .preview-photo-info { gap: 12px; margin: 10px 0 0; min-height: 0; }
  .preview-photo-info #previewPhotoName { display: none; }
  #previewSetCover { font-size: 11px; min-height: 28px; padding: 3px 10px; border: 0; color: var(--muted); }
  .stage-actionbar { margin-top: 10px; }
  .library-panel { position: relative; display: grid; grid-template-columns: 96px minmax(0,1fr); grid-template-rows: 23px minmax(0,1fr); gap: 8px 16px; padding: 12px 24px 12px; border: 0; border-top: 1px solid var(--line); background: var(--surface-filmstrip); overflow: hidden; }
  .filmstrip-heading { grid-column: 1/-1; grid-row: 1; padding-right: 140px; }
  .filmstrip-heading .panel-title { margin: 0; font-size: 13px; letter-spacing: 0; }
  .library-summary { position: absolute; right: 26px; top: 17px; font-size: 11px; gap: 14px; }
  .library-summary > span:last-child { display: none; }
  .library-panel .upload-zone { grid-row: 2; grid-column: 1; min-height: 0; margin: 0; gap: 2px; padding: 7px; border-color: #4f5b6c; border-radius: 4px; background: var(--panel); }
  .library-panel .upload-zone strong { font-size: 12px; }
  .library-panel .upload-zone span, .library-panel .upload-zone small { font-size: 10px; }
  .library-panel .upload-zone svg { width: 21px; height: 21px; margin: 0 0 3px; }
  .photo-list { display: flex; flex-direction: row; grid-column: 2; grid-row: 2; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 3px 3px 7px; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .photo-card { flex: 0 0 116px; min-height: 0; height: 99px; padding: 0; border-radius: 4px; background: var(--panel); border-color: var(--line); overflow: hidden; }
  .photo-card.is-selected { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .photo-select { display: block; min-height: 0; height: 100%; padding: 5px; }
  .photo-thumb { width: 100%; height: 63px; border-radius: 2px; object-fit: cover; }
  .photo-info { display: block; padding: 0; margin-top: 5px; }
  .photo-index { position: absolute; top: 7px; left: 7px; border-radius: 2px; padding: 1px 5px; color: #fff; background: #11151ccc; font-size: 9px; letter-spacing: .2px; }
  .photo-name { font-size: 10px; margin: 0; text-align: center; line-height: 1.5; }
  .photo-meta { display: none; }
  .photo-card-actions { bottom: 3px; right: 6px; gap: 1px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
  .photo-card:hover .photo-card-actions, .photo-card:focus-within .photo-card-actions { opacity: 1; pointer-events: auto; }
  .photo-card-actions button { width: 28px; height: 28px; padding: 4px; color: var(--muted); }
  .photo-card-actions button:hover { background: var(--panel-raised); }
  .library-footer { display: none; }
  .inspector-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; border-left: 1px solid var(--line); background: var(--surface-tools); }
  .inspector-tabs { flex: 0 0 auto; padding: 0 16px; background: #20262f; }
  .inspector-task { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
  .statusbar { height: 28px; background: var(--surface-filmstrip); font-family: var(--sans); font-size: 10px; border-color: var(--line); }
  .photo-edit-dialog { width: min(1480px,96vw); max-width: 96vw; height: 94dvh; max-height: 94dvh; }
  .photo-edit-body { grid-template-columns: minmax(0,1fr) 370px; }
  .photo-edit-preview { padding: 30px; }
  .photo-edit-controls { padding: 24px; }
  .photo-edit-heading { background: var(--panel); }
  .photo-edit-heading-copy { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 20px; }
  .photo-edit-heading-copy .panel-kicker { display: none; }
  #photoEditName { font-size: 12px; }
  .photo-edit-heading h2 { margin: 0; font-size: 22px; }
  .photo-edit-heading .button { min-width: 116px; }
  .ai-dialog { width: min(1440px,96vw); max-width: 96vw; height: 94dvh; max-height: 94dvh; }
  .ai-dialog .creation-dialog-heading { grid-template-columns: minmax(0,1fr) auto auto; gap: 24px; padding: 20px 26px; align-items: center; background: var(--panel); }
  .ai-dialog .creation-dialog-heading > div:first-child { grid-column: 1; }
  .ai-dialog .creation-dialog-heading h2 { font-size: 23px; margin: 0 0 3px; }
  .ai-dialog .creation-dialog-heading .button-icon { grid-column: 3; grid-row: 1; }
  .ai-dialog .ai-connection { grid-column: 2; grid-row: 1; max-width: 390px; padding: 8px 12px; margin: 0; background: var(--panel); border-color: var(--line); }
  .ai-dialog .ai-connection p { font-size: 11px; }
  .ai-dialog .ai-studio-body { grid-template-columns: minmax(0,1fr) 410px; grid-template-rows: minmax(280px,1fr) minmax(120px,26%); grid-template-areas: "reference brief" "results brief"; overflow: hidden; }
  .ai-reference-stage { grid-area: reference; }
  .ai-dialog .ai-brief-panel { grid-area: brief; padding: 24px; overflow-y: auto; scrollbar-width: thin; border-left: 1px solid var(--line); background: var(--surface-tools); }
  .ai-dialog .ai-results-panel { grid-area: results; padding: 16px 26px; border-top: 1px solid var(--line); border-left: 0; background: var(--panel-raised); overflow-y: auto; scrollbar-width: thin; }
  .ai-results-panel .ai-section-heading { display: none; }
  .ai-results-panel h3 { font-size: 14px; margin: 0 0 10px; }
  .ai-results-panel .ai-section-description, .ai-results-panel .ai-result-note { display: none; }
  .ai-results .ai-empty { padding: 15px 18px; border-style: dashed; border-color: var(--line); border-radius: 4px; font-family: var(--sans); font-size: 12px; line-height: 1.8; text-align: left; background: transparent; }
  .ai-results { grid-template-columns: repeat(auto-fit,minmax(min(320px,100%),1fr)); gap: 10px; }
  .ai-result-card.is-active { display: grid; grid-template-columns: 64px minmax(0,1fr); grid-template-rows: auto auto; gap: 5px 14px; padding: 10px; }
  .ai-result-card.is-active > img { grid-row: 1 / 3; width: 64px; height: 82px; max-height: none; }
  .ai-result-card.is-active .ai-result-actions { gap: 5px 15px; }
  .ai-result-info p { font-size: 10px; }
  .ai-brief-panel .ai-section-heading { display: none; }
  .ai-mode-picker { margin-bottom: 20px; }
  .ai-mode-picker label { padding: 11px; }
  .ai-mode-picker small { font-size: 11px; }
  .ai-brief-panel h3 { font-size: 14px; margin-bottom: 5px; }
  .ai-brief-panel .ai-section-description { margin-bottom: 12px; font-size: 12px; }
  #aiRetouchNote { padding: 10px 12px; background: var(--panel-raised); border-radius: 4px; color: var(--muted); font-size: 11px; }
  .ai-photo-list { max-height: 100px; margin-bottom: 20px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ai-photo-option { min-height: 64px; }
  .ai-photo-option > img { height: 50px; }
  .ai-recommendations { margin-bottom: 16px; padding-bottom: 14px; }
  .ai-recommendation-toolbar .button { background: var(--panel-raised); border-color: var(--line); color: var(--paper); min-height: 42px; width: 100%; justify-content: center; }
  #aiRecommendationStatus { font-size: 11px; margin-top: 8px; }
  .ai-brief-field textarea { font-size: 13px; min-height: 110px; }
  .ai-intent-examples { gap: 5px 12px; margin-bottom: 16px; }
  .ai-intent-examples > span { display: none; }
  .ai-intent-examples button { border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; background: var(--panel); font-size: 11px; }
  .ai-fallback { margin-top: 14px; }
  .ai-dialog-footer { padding: 15px 26px; }
  .ai-dialog-footer .ai-generate-actions > .button { min-width: 170px; min-height: 45px; }
  .style-dialog { width: min(1260px,94vw); max-width: 94vw; }
  .trip-library-dialog { width: min(1040px,92vw); }
  .trip-card { border-radius: 5px; background: var(--panel); }
  .trip-card-cover { border-radius: 3px; }
  .trip-card-info h3 { font-family: var(--sans); font-size: 18px; }
}
@media (min-width: 1700px) {
  .workspace { grid-template-columns: 80px minmax(0,1fr) 352px; grid-template-rows: minmax(0,1fr) 178px; }
  .stage-panel { padding: 28px 48px 20px; }
  .inspector-task { padding: 28px; }
  .photo-card { flex-basis: 134px; height: 115px; }
  .photo-thumb { height: 78px; }
  .ai-dialog .ai-studio-body { grid-template-columns: minmax(0,1fr) 440px; }
}
@media (max-width: 1100px) and (min-width: 900px) {
  .workspace { grid-template-columns: 70px minmax(0,1fr) 300px; }
  .topbar-context, .topbar-divider { display: none; }
  .stage-panel { padding: 20px; }
  .stage-toolbar { grid-template-columns: minmax(0,1fr) auto; }
  .stage-toolbar .preview-switch { grid-column: 1; grid-row: 2; justify-self: start; }
  .stage-toolbar .stage-tools { grid-column: 2; grid-row: 1; }
  .inspector-task { padding: 20px; }
  .task-intro h2 { font-size: 18px; }
  .ai-dialog .ai-studio-body { grid-template-columns: minmax(0,1fr) 370px; }
  .ai-dialog .ai-connection { max-width: 310px; }
  .ai-dialog .creation-dialog-heading { gap: 16px; }
  .stage-actionbar button { padding-inline: 10px; }
}
@media (max-width: 899px) {
  .topbar-context, .topbar-divider { display: none; }
  .stage-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
  .stage-document { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .stage-heading { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage-toolbar .stage-tools { grid-column: 2; grid-row: 2; }
  .stage-toolbar .preview-switch { grid-column: 1; grid-row: 2; justify-self: start; margin: 0; }
  .stage-toolbar .preview-switch .button { padding-inline: 12px; }
  .filmstrip-heading { margin-bottom: 15px; }
  .inspector-panel { padding: 0; }
  .ai-reference-stage { min-height: 250px; }
  #aiReferencePreview { max-height: 240px; }
  .stage-actionbar { flex-wrap: wrap; }
}
@media print {
  @page { size: 200mm 250mm; margin: 0; }
  html, body { width: 200mm; min-width: 0; height: auto; margin: 0; padding: 0; background: white; }
  body > :not(#printArea) { display: none !important; }
  #printArea[hidden] { display: block !important; width: 200mm; height: 250mm; margin: 0; padding: 0; }
  #printArea img { display: block; width: 200mm; height: 250mm; margin: 0; object-fit: contain; break-inside: avoid; }
}

/* Export errors remain readable while download controls are disabled. */
.export-status { margin: 0 0 16px; color: var(--paper); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.export-status.is-error { padding: 12px; border: 1px solid #875652; background: #3b272a; color: var(--danger); }

/* Personal and sourced photo preset library; scoped to the existing darkroom. */
.preset-source-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.preset-source-tabs button { min-width: 0; min-height: 34px; padding: 5px 3px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.preset-source-tabs button[aria-selected="true"] { color: var(--paper); background: var(--panel-raised); box-shadow: 0 1px 3px #00000030; }
.preset-source-tabs button:focus-visible, .preset-document summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preset-section-note { margin: 0 0 12px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.preset-experiment-note { margin: 0 0 8px; padding: 9px 10px; border: 1px solid #765e4e; border-radius: 4px; color: #e9ba94; background: #382f2a; font-size: 11px; line-height: 1.6; }
#networkPresetGrid .photo-preset-card { text-align: left; }
#networkPresetGrid .photo-preset-card:disabled { opacity: .8; cursor: default; }
#networkPresetGrid .photo-preset-card:disabled .photo-preset-name { color: var(--muted); }
.preset-archive { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.preset-archive > summary { padding: 7px 0; color: var(--accent); font-size: 11px; cursor: pointer; }
.preset-family-heading { margin: 18px 0 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.preset-document { margin: 0 0 7px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); overflow-wrap: anywhere; }
.preset-document > summary { color: var(--muted); font-size: 11px; line-height: 1.7; cursor: pointer; }
.preset-document p, .preset-document li, .preset-document a, .preset-document select { font-size: 10px; line-height: 1.8; }
.preset-document p { margin: 8px 0; color: var(--muted); }
.preset-document a { color: var(--muted); }
.preset-document h5 { margin: 12px 0 5px; color: var(--muted); font-size: 10px; font-weight: 500; }
.preset-document ul { padding-left: 16px; margin: 5px 0; color: var(--muted); }
.preset-document .preset-warning { color: var(--muted); }
.preset-document select { max-width: 100%; padding: 5px; color: var(--paper); background: var(--field); border: 1px solid var(--line); }
.preset-recipe-values { margin: 6px 0; padding: 8px; color: var(--muted); background: var(--panel); white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 10px; line-height: 1.8; }
.preset-name-label { display: block; margin: 8px 0 6px; color: var(--muted); font-size: 11px; }
.preset-save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.preset-save-row input { min-width: 0; width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--paper); background: var(--field); font: inherit; font-size: 11px; }
.preset-save-row .button { min-height: 36px; font-size: 11px; }
.preset-library-actions { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-top: 7px; }
.preset-library-actions .text-button { min-height: 32px; font-size: 10px; }
.preset-library-status { margin: 9px 0; color: var(--muted); font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
.preset-library-status.is-error { padding: 8px; color: var(--danger); background: #3b272a; border: 1px solid #875652; border-radius: 4px; }
.user-preset-list { display: grid; gap: 7px; }
.user-preset-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 5px; }
.user-preset-row > button:first-child { min-width: 0; padding: 5px; border: 0; background: transparent; color: var(--muted); text-align: left; overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; cursor: pointer; }
.user-preset-row > button:first-child[aria-pressed="true"] { color: var(--muted); }
.user-preset-row .preset-delete { padding: 7px 3px; border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }

/* Surface roles carry their own contrast tokens across desktop and mobile. */
.topbar, .workspace-rail, .mobile-workspace-nav,
.creation-dialog-heading, .photo-edit-heading, .dialog-heading {
  --panel: var(--surface-chrome);
  --panel-raised: #242b35;
  --field: #303846;
  --paper: #eef1f5;
  --muted: #b0b9c7;
  --quiet: #9eabbd;
  --line: #34404d;
  --line-soft: #29323f;
  --focus: #db9b71;
  color: var(--paper);
  background: var(--panel);
}
.project-menu-items {
  --panel: #242b35;
  --panel-raised: #303846;
  --paper: #eef1f5;
  --muted: #b0b9c7;
  --quiet: #9eabbd;
  --line: #3b4554;
  --focus: #db9b71;
  color: var(--paper);
}
.creation-dialog-heading .panel-kicker, .photo-edit-heading .panel-kicker,
.dialog-heading .panel-kicker, .creation-dialog-heading .text-button {
  color: var(--accent);
}
.creation-dialog-heading .ai-connection { background: #202833; border-color: #3b4554; }
.creation-dialog-heading .ai-connection[data-state="ready"] p { color: #c2cddc; }
.creation-dialog-heading .ai-connection[data-state="offline"] p { color: var(--accent); }
.creation-dialog-heading .button-icon, .dialog-heading .close-dialog {
  color: var(--paper); border-color: #485568; background: #242b35;
}
.ai-brief-panel { background: var(--surface-tools); }
.photo-edit-footer, .ai-dialog-footer { background: #20262f; }
.style-library-body, .trip-library-body, .dialog-body { background: #20262f; }
.style-library-footer { background: #242b35; }
.style-card { background: #2a323e; }
.statusbar { background: var(--surface-filmstrip); }
.photo-edit-controls .section-label, .inspector-task .section-label { color: #d4dce8; font-weight: 600; }
.inspector-task .photo-edit-entry .ai-studio-trigger { background: #303846; border-color: #4c586b; }
.quick-look { border-top-color: var(--line); }
.current-photo { border-bottom-color: var(--line); }
.stage-actionbar { background: #242b35; border-color: #414c5d; box-shadow: 0 3px 12px #00000024; }
.photo-edit-heading h2, .creation-dialog-heading h2, .dialog-heading h2 { font-weight: 600; }

/* Ambient pixels stay behind controls and never enter the photo output canvas. */
#workspacePreview { position: relative; isolation: isolate; }
#workspacePreview > .ambient-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  pointer-events: none; background: transparent;
}
#workspacePreview > :not(.ambient-canvas) { position: relative; z-index: 1; }
.ambient-toggle { min-height: 38px; padding-inline: 10px; font-size: 11px; color: var(--muted); }
.ambient-toggle::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #647084; flex: 0 0 auto; }
.ambient-toggle[aria-pressed="true"] { color: var(--paper); background: #293240; border-color: #4c586a; }
.ambient-toggle[aria-pressed="true"]::before { background: var(--accent); }
@media (min-width: 900px) and (max-width: 1100px) {
  .stage-toolbar > .ambient-toggle { grid-column: 2; grid-row: 2; justify-self: end; }
}
@media (max-width: 899px) {
  .stage-toolbar > .ambient-toggle { grid-column: 1 / -1; grid-row: 3; justify-self: start; min-height: 34px; }
}

/* Feedback uses paint and transforms so editing controls keep their position. */
.button, .style-library-trigger, .style-filter, .quick-look, .stage-actionbar button,
.workspace-rail button, .photo-card-actions button, .project-menu > summary,
.ai-intent-examples button, .photo-preset-card, .photo-card, .style-card,
.template-option, .export-choice, .ai-photo-option {
  transition: transform var(--motion-feedback) var(--ease-out),
    box-shadow var(--motion-feedback) ease, border-color var(--motion-feedback) ease,
    background-color var(--motion-feedback) ease, color var(--motion-feedback) ease,
    opacity var(--motion-feedback) ease;
}
.button > span[aria-hidden="true"]:last-child, .style-entry-arrow, .quick-look b,
.brand-mark svg, .upload-zone svg, .look-sample {
  transition: transform var(--motion-panel) var(--ease-out), color var(--motion-feedback) ease;
}
.photo-thumb, .style-card-canvas, .photo-preset-card canvas {
  transition: transform var(--motion-panel) var(--ease-out);
}
.photo-card-actions { z-index: 2; }
.style-card.is-active::after { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.photo-preset-card[aria-pressed="true"] { background: var(--accent-soft); }
.photo-preset-card[aria-pressed="true"]::after {
  content: ""; position: absolute; right: 9px; bottom: 12px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); pointer-events: none;
}
.photo-preset-name { padding-right: 17px; }
.workspace-rail button[aria-pressed="true"] { position: relative; }
.workspace-rail button[aria-pressed="true"]::before {
  content: ""; position: absolute; left: -8px; top: 19px; bottom: 19px;
  width: 2px; border-radius: 2px; background: var(--accent); pointer-events: none;
}
.brand-mark { box-shadow: inset 0 0 0 1px #ffffff12, 0 2px 4px #00000020; }
.task-intro h2 { display: flex; align-items: center; gap: 8px; }
.task-intro h2::before { content: ""; width: 3px; height: 13px; background: var(--accent); flex: 0 0 auto; }
.section-heading > span { color: var(--accent); }
.upload-zone { transition: border-color var(--motion-feedback) ease, background-color var(--motion-feedback) ease, box-shadow var(--motion-feedback) ease; }
.upload-zone.drop-active, .library-panel .upload-zone.drop-active {
  border-color: var(--accent); border-style: solid; background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.upload-zone.drop-active svg { transform: translateY(-3px); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible,
.preset-save-row input:focus-visible {
  outline: 2px solid #db9b7166; outline-offset: 2px; border-color: var(--accent);
}
.project-menu[open] .project-menu-items { transform-origin: top right; animation: menu-enter 180ms var(--ease-out) both; }
.project-menu > summary > span { transition: transform var(--motion-feedback) ease; }
.project-menu[open] > summary > span { transform: rotate(180deg); }
.creation-dialog[open], .export-dialog[open], .photo-edit-dialog[open] {
  animation: dialog-enter var(--motion-panel) var(--ease-out) both;
}
.creation-dialog[open]::backdrop, .export-dialog[open]::backdrop, .photo-edit-dialog[open]::backdrop {
  animation: backdrop-enter var(--motion-panel) ease both;
}
.inspector-task[role="tabpanel"]:not([hidden]) { animation: panel-enter var(--motion-panel) var(--ease-out) both; }
.toast { animation: toast-in var(--motion-panel) var(--ease-out) both; border-left: 3px solid var(--accent); }
.toast-error { border-left-color: var(--danger); }
.motion-tabs { position: relative; isolation: isolate; }
.motion-tabs > button { position: relative; z-index: 1; }
.tab-indicator {
  position: absolute; z-index: 0; left: 0; top: 0; pointer-events: none;
  width: var(--indicator-w, 0px); height: var(--indicator-h, 0px);
  transform: translate(var(--indicator-x, 0px), var(--indicator-y, 0px));
  border-radius: 3px; background: var(--panel-raised); box-shadow: 0 1px 4px #00000028;
  opacity: 0;
  transition: transform var(--motion-panel) var(--ease-out),
    width var(--motion-panel) var(--ease-out), height var(--motion-panel) var(--ease-out),
    opacity var(--motion-feedback) ease;
}
.tab-indicator[data-ready="true"] { opacity: 1; }
.motion-tabs[data-indicator-kind="line"] > .tab-indicator {
  background: var(--accent); border-radius: 2px; box-shadow: none;
}
.preset-source-tabs.motion-tabs > .tab-indicator { background: var(--accent-soft); box-shadow: none; }
.motion-tabs:has(> .tab-indicator[data-ready="true"]) > button[aria-selected="true"],
.motion-tabs:has(> .tab-indicator[data-ready="true"]) > button[aria-pressed="true"] {
  background: transparent; box-shadow: none; border-color: transparent;
}
/* A solid image layer represents the range value, not a decorative gradient. */
input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--range-progress, 0%) 100% no-repeat #485568;
}
input[type="range"]::-moz-range-track {
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--range-progress, 0%) 100% no-repeat #485568;
}
input[type="range"]::-webkit-slider-thumb { transition: transform var(--motion-feedback) var(--ease-out), box-shadow var(--motion-feedback) ease; }
input[type="range"]::-moz-range-thumb { transition: transform var(--motion-feedback) var(--ease-out), box-shadow var(--motion-feedback) ease; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #db9b7140; }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px #db9b7140; }
@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
@keyframes panel-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes menu-enter {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@media (hover: hover) and (pointer: fine) {
  .button:hover:not(:disabled), .style-library-trigger:hover:not(:disabled),
  .stage-actionbar button:hover:not(:disabled), .project-menu > summary:hover {
    transform: translateY(-1px); box-shadow: var(--shadow-hover);
  }
  .button-primary:hover:not(:disabled) { background: #edb18a; border-color: #edb18a; color: var(--on-accent); box-shadow: 0 5px 14px #00000030; }
  .button:hover:not(:disabled) > span[aria-hidden="true"]:last-child,
  .style-library-trigger:hover:not(:disabled) .style-entry-arrow,
  .quick-look:hover:not(:disabled) b { transform: translate(2px, -2px); }
  .brand:hover .brand-mark svg { transform: scale(1.08); }
  .workspace-rail button:hover:not(:disabled) { transform: translateY(-1px); background: #2b3340; color: var(--paper); }
  .quick-look:hover:not(:disabled) { background: #303846; }
  .quick-look:hover:not(:disabled) .look-sample { transform: translateX(2px); }
  .photo-card:hover:not(.is-dragging):not(.dragging), .style-card:hover:not(:disabled),
  .photo-preset-card:hover:not(:disabled) {
    transform: translateY(-2px); border-color: #bf9582; box-shadow: var(--shadow-hover);
  }
  .photo-card:hover .photo-thumb, .style-card:hover:not(:disabled) .style-card-canvas,
  .photo-preset-card:hover:not(:disabled) canvas { transform: scale(1.025); }
  .photo-card.is-selected:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-hover); }
  .photo-card-actions button:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
  .template-option:hover:not(:disabled), .export-choice:hover, .ai-photo-option:hover {
    border-color: #bf9582; background: #303846;
  }
  .style-filter:hover:not(:disabled), .ai-intent-examples button:hover:not(:disabled) { transform: translateY(-1px); }
  input[type="range"]:hover:not(:disabled)::-webkit-slider-thumb { transform: scale(1.12); }
  input[type="range"]:hover:not(:disabled)::-moz-range-thumb { transform: scale(1.12); }
  .button:active:not(:disabled), .style-library-trigger:active:not(:disabled),
  .stage-actionbar button:active:not(:disabled), .quick-look:active:not(:disabled),
  .style-filter:active:not(:disabled), .photo-preset-card:active:not(:disabled),
  .style-card:active:not(:disabled), .workspace-rail button:active:not(:disabled) {
    transform: translateY(0) scale(.98); box-shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
  .button, .style-library-trigger, .stage-actionbar button, .quick-look, .style-filter,
  .photo-preset-card, .style-card, .workspace-rail button, .photo-card,
  .photo-thumb, .style-card-canvas, .photo-preset-card canvas, .brand-mark svg,
  .button > span[aria-hidden="true"]:last-child, .style-entry-arrow, .quick-look b,
  .quick-look .look-sample, .upload-zone svg, .project-menu > summary > span { transform: none !important; }
  input[type="range"]::-webkit-slider-thumb { transform: none !important; }
  input[type="range"]::-moz-range-thumb { transform: none !important; }
}

.cloud-notice{margin:14px 0;padding:11px 12px;border:1px solid #596679;border-radius:5px;background:#27313e;color:#e6ebf2;font-size:12px;line-height:1.7}
