:root {
  color-scheme: light;
  --paper: #f4f8f7;
  --paper-soft: #f8fcfa;
  --white: #ffffff;
  --ink: #263b36;
  --muted: #6f817c;
  --line: #dceae6;
  --line-strong: #c8e1da;
  --mint: #3f9f8e;
  --mint-strong: #2f8274;
  --mint-soft: #ddf3ed;
  --sky: #76aec4;
  --sky-soft: #e4f0f5;
  --gold: #efb45c;
  --danger: #d56d70;
  --danger-soft: #fbeaec;
  --success: #4e9d7b;
  --shadow: 0 6px 20px rgba(57, 115, 103, 0.07);
  --shadow-raised: 0 12px 32px rgba(47, 108, 95, 0.11);
  --radius: 12px;
  --font-ui:
    "Aptos",
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei UI",
    sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% 0%, rgba(118, 174, 196, 0.14), transparent 28%),
    radial-gradient(circle at 8% 48%, rgba(99, 181, 161, 0.06), transparent 24%),
    var(--paper);
  color: var(--ink);
}

button,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(220, 234, 230, 0.92);
  background: rgba(250, 253, 252, 0.94);
  box-shadow: 0 6px 24px rgba(61, 145, 130, 0.035);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 236px;
}

.brand-seal {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px 12px 12px 4px;
  color: #fff;
  background: linear-gradient(135deg, #64b7a7, #86bdd5);
  box-shadow: 0 7px 16px rgba(75, 154, 141, 0.18);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-copy small {
  margin-top: 2px;
  color: #79a198;
  font-size: 11px;
  font-weight: 500;
}

.desk-context {
  display: grid;
  align-content: center;
  min-height: 38px;
  margin-left: 26px;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.desk-context span {
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.desk-context strong {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 96px;
  margin-left: auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #78ad9f;
  box-shadow: 0 0 0 5px rgba(95, 171, 152, 0.11);
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 28px 60px;
}

.workspace {
  display: grid;
  gap: 16px;
}

.workspace-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 3px 2px 19px;
  border-bottom: 1px solid var(--line);
  animation: enter 0.45s ease-out both;
}

.eyebrow,
.section-label {
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.eyebrow {
  margin-bottom: 6px;
}

.workspace-intro h1 {
  max-width: 760px;
  font-size: clamp(24px, 2.3vw, 32px);
  font-weight: 720;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.workspace-intro > div:first-child > p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-chip {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid #d4e8e3;
  border-radius: 9px;
  color: #5f8179;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 5px 16px rgba(57, 115, 103, 0.04);
  font-size: 11px;
  font-weight: 650;
}

.workflow-chip i {
  width: 18px;
  height: 1px;
  background: #c5ddd7;
}

.layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(520px, 1.08fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(220, 228, 224, 0.96);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 18px rgba(20, 35, 29, 0.045);
  animation: enter 0.5s ease-out both;
}

.layout > .panel:nth-child(2) {
  animation-delay: 0.06s;
}

.panel-heading,
.queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading {
  margin-bottom: 1px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.queue-head h2 {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
}

.panel-heading p:last-child,
.queue-head p:not(.section-label) {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.step-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #d7ebe6;
  border-radius: 999px;
  color: #5b8d82;
  background: #f0f9f6;
  font-size: 10px;
  font-weight: 700;
}

.controls {
  display: grid;
  gap: 17px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field > span,
.field > label,
.field-head label {
  color: #36534c;
  font-size: 13px;
  font-weight: 700;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

textarea,
select {
  min-width: 0;
  border: 1px solid #cfe1dc;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fcfefd;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

textarea {
  min-height: 164px;
  padding: 12px 13px;
  line-height: 1.65;
  resize: vertical;
}

select {
  min-height: 42px;
  padding: 9px 12px;
}

textarea:hover,
select:hover {
  border-color: #a9d2c8;
  background: var(--white);
}

textarea:focus,
select:focus {
  border-color: #69ac9e;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(63, 159, 142, 0.13);
}

.folder-row,
.actions,
.queue-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-row,
.queue-actions {
  flex-wrap: wrap;
}

.folder-row {
  min-width: 0;
}

.folder-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.requirements {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  counter-reset: requirements;
}

.requirements div {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 86px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid #e1ece9;
  border-radius: 10px;
  background: linear-gradient(145deg, #fbfefd, #f3faf8);
  counter-increment: requirements;
}

.requirements div::after {
  content: counter(requirements, decimal-leading-zero);
  position: absolute;
  right: 8px;
  bottom: -8px;
  color: rgba(63, 159, 142, 0.08);
  font-size: 30px;
  font-weight: 800;
}

.requirements strong {
  position: relative;
  z-index: 1;
  color: #36534c;
  font-size: 11px;
}

.requirements span {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
}

.model-static {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #cfe1dc;
  border-radius: 9px;
  color: var(--ink);
  background: #f4f9f7;
}

.model-static strong {
  font-size: 13px;
}

.model-static small,
.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quality-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.quality-card {
  min-width: 0;
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 9px;
  border-color: #d6e7e2;
  color: #526c65;
  background: #fbfefd;
  text-align: left;
}

.quality-card strong,
.quality-card span,
.quality-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-card strong {
  color: #31584f;
  font-size: 12px;
}

.quality-card span {
  font-size: 12px;
  font-weight: 750;
}

.quality-card small {
  color: var(--muted);
  font-size: 12px;
}

.quality-card.is-selected {
  border-color: #58aa9a;
  color: #287665;
  background: linear-gradient(145deg, #eaf8f4, #f6fbfa);
  box-shadow: 0 0 0 2px rgba(63, 159, 142, 0.12);
}

.quality-card:focus-visible {
  outline: 3px solid rgba(63, 159, 142, 0.23);
  outline-offset: 2px;
}

.quality-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #d9e9e4;
  border-radius: 8px;
  color: #526c64;
  background: #f6fbf9;
  font-size: 11px;
  line-height: 1.6;
}

.pricing-note {
  margin-top: 8px;
  color: #526c64;
  font-size: 11px;
  line-height: 1.6;
}

.pricing-note summary {
  cursor: pointer;
  width: fit-content;
  color: #368478;
  font-weight: 650;
}

.pricing-note p {
  margin: 7px 0 0;
}

button {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(63, 159, 142, 0.23);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, #55a999, #6cacc5);
  box-shadow: 0 8px 18px rgba(72, 157, 142, 0.16);
}

.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #489b8c, #5b9eb9);
  box-shadow: 0 10px 24px rgba(72, 157, 142, 0.2);
}

.secondary {
  border-color: var(--line);
  color: #55736c;
  background: var(--white);
}

.secondary:hover:not(:disabled) {
  border-color: #aacfc6;
  color: var(--mint-strong);
  background: #f5fbf9;
}

.ghost {
  border-color: #c9e5de;
  color: var(--mint-strong);
  background: #edf8f5;
}

.actions {
  padding-top: 2px;
}

.actions .primary {
  min-width: 132px;
}

#stopButton {
  border-color: #efd5d5;
  color: #b85c61;
  background: #fffafa;
}

#stopButton:hover:not(:disabled) {
  border-color: #e5bfc1;
  background: var(--danger-soft);
}

.queue {
  display: grid;
  grid-template-rows: auto auto minmax(330px, 1fr);
  gap: 16px;
  min-height: 520px;
}

.queue-head {
  align-items: center;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #deebe7;
}

#progressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5bb3a3, #82bfd6);
  box-shadow: 0 0 12px rgba(91, 179, 163, 0.28);
  transition: width 0.25s ease;
}

.file-list {
  position: relative;
  min-height: 330px;
  max-height: 470px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
    repeating-linear-gradient(135deg, #edf7f4 0 10px, #f7fbfa 10px 20px);
  scrollbar-color: #bddbd4 transparent;
  scrollbar-width: thin;
}

.file-list:empty::before {
  content: "选择图片后，处理队列会显示在这里";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #92a59f;
  font-size: 12px;
  text-align: center;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid #edf2f0;
  background: rgba(255, 255, 255, 0.96);
  transition: background 0.16s ease;
}

.file-row:hover {
  background: #f8fcfa;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: #355048;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  min-width: 60px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  text-align: center;
}

.badge.pending {
  color: #6f817c;
  background: #edf3f1;
}

.badge.running {
  color: #9a6b25;
  background: #fff0cf;
  box-shadow: 0 0 0 4px rgba(239, 180, 92, 0.08);
}

.badge.done {
  color: #34705c;
  background: #e8f4ec;
}

.badge.failed {
  color: #ad575b;
  background: var(--danger-soft);
}

.icon-button {
  min-height: 30px;
  padding: 4px 8px;
  border-color: transparent;
  color: #b85c61;
  background: transparent;
}

.icon-button:hover:not(:disabled) {
  color: #a94c51;
  background: var(--danger-soft);
}

.compact-button {
  min-height: 30px;
  padding: 4px 9px;
}

.compare-panel {
  display: grid;
  gap: 14px;
}

.compare-view {
  --split: 50%;
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #31584f;
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 40%, rgba(80, 135, 122, 0.18), transparent 35%),
    #152821;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.compare-view img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compare-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}

.compare-label {
  position: absolute;
  top: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 48, 41, 0.76);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
}

.compare-label-before {
  left: 13px;
}

.compare-label-after {
  right: 13px;
}

.compare-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  border: 0;
  outline: none;
  background: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.22);
  cursor: ew-resize;
  transform: translateX(-50%);
}

.compare-slider:focus-visible {
  box-shadow:
    0 0 0 3px rgba(99, 181, 161, 0.5),
    0 0 16px rgba(255, 255, 255, 0.22);
}

.compare-slider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid #cce4de;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 43%, #6b9e92 43% 47%, transparent 47% 53%, #6b9e92 53% 57%, transparent 57%),
    #fff;
  box-shadow: 0 8px 20px rgba(12, 40, 33, 0.3);
  transform: translate(-50%, -50%);
}

.log-panel {
  display: grid;
  gap: 12px;
  border-color: #31584f;
  color: #d9eee8;
  background: linear-gradient(145deg, #233d37, #294b43);
  box-shadow: 0 9px 24px rgba(27, 58, 50, 0.12);
}

.log-panel .queue-head h2 {
  color: #f1faf7;
  font-size: 15px;
}

.log-panel .secondary {
  border-color: rgba(201, 229, 222, 0.2);
  color: #c7e4dc;
  background: rgba(255, 255, 255, 0.07);
}

.log-panel .secondary:hover:not(:disabled) {
  border-color: rgba(201, 229, 222, 0.42);
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

#logOutput {
  min-height: 96px;
  max-height: 230px;
  margin: 0;
  padding: 14px 15px;
  overflow: auto;
  border: 1px solid rgba(201, 229, 222, 0.12);
  border-radius: 9px;
  color: #a9cec4;
  background: rgba(12, 32, 27, 0.3);
  font-family: Consolas, "SFMono-Regular", "Courier New", monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .desk-context {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .queue {
    min-height: 460px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 62px;
    padding: 0 16px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-seal {
    width: 38px;
    height: 38px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .brand-copy small {
    display: none;
  }

  .status-pill {
    min-width: 0;
    padding: 7px 10px;
  }

  .app-shell {
    padding: 18px 14px 44px;
  }

  .workspace-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .workflow-chip {
    width: 100%;
    justify-content: center;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading,
  .queue-head,
  .field-head {
    align-items: flex-start;
  }

  .requirements {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .queue-head {
    flex-direction: column;
  }

  .queue {
    grid-template-rows: auto auto minmax(280px, 1fr);
  }

  .file-list {
    min-height: 280px;
  }

  .compare-view {
    min-height: 280px;
  }
}

@media (max-width: 520px) {
  .workspace-intro h1 {
    font-size: 24px;
  }

  .requirements {
    grid-template-columns: 1fr;
  }

  .requirements div {
    min-height: 68px;
  }

  .folder-row > button,
  .actions > button {
    flex: 1 1 auto;
  }

  .queue-actions {
    width: 100%;
  }

  .queue-actions button {
    flex: 1 1 auto;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .file-row .compact-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Prompt library and built-in field guide */
.topbar-actions,
.prompt-actions,
.custom-save-row,
.drawer-section-title,
.warning-dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  margin-left: auto;
}

.topbar-actions .status-pill {
  margin-left: 4px;
}

.topbar-button {
  min-height: 34px;
  padding: 6px 11px;
  border-color: transparent;
  color: #55736c;
  background: transparent;
}

.topbar-button:hover:not(:disabled) {
  color: var(--mint-strong);
  background: #edf7f4;
}

.preset-stage {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d8e9e4;
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(245, 251, 249, 0.96), rgba(248, 252, 253, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(65, 145, 130, 0.025) 32px 33px);
}

.preset-stage .field-head {
  align-items: center;
}

.field-label {
  display: block;
  color: #36534c;
  font-size: 12px;
  font-weight: 750;
}

.preset-stage small {
  display: block;
  margin-top: 2px;
  color: #7d938d;
  font-size: 11px;
}

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

.featured-preset {
  position: relative;
  min-height: 68px;
  padding: 10px 10px 9px;
  overflow: hidden;
  border-color: #d4e7e2;
  color: #35564d;
  background: rgba(255, 255, 255, 0.92);
  text-align: left;
}

.featured-preset::after {
  content: attr(data-order);
  position: absolute;
  right: 7px;
  bottom: -7px;
  color: rgba(62, 150, 132, 0.08);
  font-size: 28px;
  font-weight: 850;
}

.featured-preset:hover:not(:disabled),
.featured-preset.is-active {
  border-color: #8fc9bb;
  color: var(--mint-strong);
  background: #f4fbf9;
  box-shadow: 0 7px 18px rgba(62, 144, 127, 0.09);
}

.featured-preset span,
.featured-preset small {
  position: relative;
  z-index: 1;
  display: block;
}

.featured-preset span {
  font-weight: 750;
}

.featured-preset small {
  margin-top: 3px;
  overflow: hidden;
  color: #7f938e;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-head > div > label,
.active-preset {
  display: inline-block;
}

.active-preset {
  margin-left: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #577d73;
  background: #edf6f3;
  font-size: 10px;
  font-weight: 700;
}

.output-constraint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 11px;
  border-left: 3px solid #86b8cb;
  border-radius: 0 8px 8px 0;
  color: #6b817b;
  background: #f4f8fa;
  font-size: 10px;
}

.output-constraint strong {
  flex: 0 0 auto;
  color: #466f7e;
}

.drawer-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  pointer-events: none;
  background: rgba(20, 42, 36, 0.38);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.drawer-backdrop.is-open {
  pointer-events: auto;
  opacity: 1;
}

.side-drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 28px));
  height: 100dvh;
  border-left: 1px solid #d9e8e4;
  background: #fbfdfc;
  box-shadow: -20px 0 60px rgba(23, 65, 56, 0.17);
  opacity: 0;
  pointer-events: none;
  transform: translateX(104%);
  transition: transform 0.28s ease, opacity 0.2s ease;
}

.side-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid #dce9e6;
  background:
    radial-gradient(circle at 88% 0%, rgba(118, 174, 196, 0.16), transparent 35%),
    #f7fbfa;
}

.drawer-header h2 {
  margin: 3px 0 2px;
  color: #28473f;
  font-size: 20px;
}

.drawer-header p:last-child,
.drawer-section-title p {
  color: #778b86;
  font-size: 11px;
}

.drawer-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: #d7e6e2;
  border-radius: 50%;
  color: #607c75;
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

.drawer-body {
  min-height: 0;
  padding: 18px 22px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-search {
  display: grid;
  gap: 6px;
}

.drawer-search span {
  color: #45675e;
  font-size: 11px;
  font-weight: 750;
}

.drawer-search input,
.custom-save-row input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.drawer-search input:focus,
.custom-save-row input:focus {
  border-color: #78b9aa;
  box-shadow: 0 0 0 3px rgba(63, 159, 142, 0.12);
}

.category-filters {
  display: flex;
  gap: 6px;
  margin: 12px 0 15px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border-color: #dce9e6;
  border-radius: 999px;
  color: #657d77;
  background: #fff;
  font-size: 11px;
}

.category-filter.is-active {
  border-color: #6db09f;
  color: #fff;
  background: #3e8f7f;
}

.preset-list,
.custom-preset-list,
.workshop-list {
  display: grid;
  gap: 9px;
}

.preset-card,
.custom-preset-card,
.workshop-card {
  padding: 13px;
  border: 1px solid #dce9e6;
  border-radius: 10px;
  background: #fff;
}

.preset-card-head,
.preset-card-actions,
.custom-preset-head,
.workshop-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-card h3,
.custom-preset-card h4,
.workshop-card h4 {
  margin: 0;
  color: #34564d;
  font-size: 13px;
}

.preset-card p,
.custom-preset-card p,
.workshop-card p {
  margin: 6px 0 0;
  color: #71847f;
  font-size: 11px;
  line-height: 1.55;
}

.preset-card-actions {
  margin-top: 10px;
}

.risk-badge,
.category-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.category-badge {
  color: #587d73;
  background: #edf6f3;
}

.risk-badge {
  color: #a25e2a;
  background: #fff1df;
}

.risk-note {
  color: #a4673a !important;
}

.custom-preset-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #dce9e6;
}

.drawer-section-title {
  justify-content: space-between;
  margin-bottom: 10px;
}

.drawer-section-title h3 {
  margin: 0 0 2px;
  color: #304f47;
  font-size: 15px;
}

.drawer-section-title > span {
  color: #759089;
  font-size: 11px;
}

.custom-save-row input {
  flex: 1 1 auto;
}

.inline-message {
  min-height: 18px;
  margin: 5px 0 7px;
  color: #5f7f77;
  font-size: 10px;
}

.custom-preset-card button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 10px;
}

.custom-preset-head > div:last-child {
  display: flex;
  gap: 4px;
}

.empty-state {
  padding: 20px;
  border: 1px dashed #cfdfdb;
  border-radius: 10px;
  color: #81938f;
  background: #f8fbfa;
  font-size: 11px;
  text-align: center;
}

.help-content {
  scroll-behavior: smooth;
}

.help-nav {
  position: sticky;
  z-index: 2;
  top: -18px;
  display: flex;
  gap: 6px;
  margin: -2px 0 20px;
  padding: 10px 0;
  overflow-x: auto;
  background: #fbfdfc;
}

.help-nav a {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #dce9e6;
  border-radius: 999px;
  color: #5d7b73;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}

.help-section {
  position: relative;
  padding: 0 0 26px 44px;
}

.help-section + .help-section {
  padding-top: 22px;
  border-top: 1px solid #e1ece9;
}

.help-index {
  position: absolute;
  top: 0;
  left: 0;
  color: #a9cec5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
}

.help-section + .help-section .help-index {
  top: 22px;
}

.help-section h3 {
  margin: 0 0 8px;
  color: #304f47;
  font-size: 16px;
}

.help-section > p,
.help-section li,
.help-section details p {
  color: #687e78;
  font-size: 12px;
  line-height: 1.7;
}

.help-section img {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid #d7e5e1;
  border-radius: 9px;
  background: #eef5f3;
}

.help-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-steps li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 9px 10px;
  border-left: 2px solid #84bdaf;
  background: #f5faf8;
}

.help-section ul {
  margin: 0;
  padding-left: 18px;
}

.privacy-note {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #ecd8b7;
  border-radius: 9px;
  color: #866435;
  background: #fff9ef;
  font-size: 11px;
}

.help-before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.help-before-after figure {
  margin: 0;
}

.help-before-after img {
  height: 150px;
  margin: 0;
  object-fit: cover;
}

.help-before-after figcaption {
  margin-top: 5px;
  color: #71847f;
  font-size: 10px;
  text-align: center;
}

.workshop-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.preset-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(210px, 0.8fr);
  gap: 16px;
  margin: 14px 0 4px;
  padding: 12px;
  border: 1px solid #cfe1dc;
  border-radius: 12px;
  background: linear-gradient(145deg, #f8fcfb, #eef6f3);
}

.preset-preview.hidden {
  display: none;
}

.preset-preview-media {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background: #dfe9e5;
  aspect-ratio: 4 / 3;
}

.preset-preview-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-chip {
  position: absolute;
  bottom: 9px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(27, 52, 45, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(20, 42, 35, 0.18);
}

.preview-chip-before {
  left: 9px;
}

.preview-chip-after {
  right: 9px;
  background: rgba(43, 129, 112, 0.9);
}

.preset-preview figcaption {
  align-content: center;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.preset-preview figcaption strong {
  color: var(--ink);
  font-size: 17px;
}

.preset-preview figcaption p,
.preset-preview figcaption small {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.preset-preview figcaption small {
  font-size: 12px;
}

.help-section details {
  padding: 10px 0;
  border-bottom: 1px solid #e1ebe8;
}

.help-section summary {
  color: #3c5e55;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.help-section details p {
  margin: 7px 0 0;
}

.warning-dialog {
  width: min(480px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid #ead6b6;
  border-radius: 14px;
  color: var(--ink);
  background: #fffdf9;
  box-shadow: 0 25px 80px rgba(35, 55, 49, 0.24);
}

.warning-dialog::backdrop {
  background: rgba(19, 41, 35, 0.5);
}

.warning-dialog-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px;
}

.warning-dialog-body h2 {
  margin: 3px 0 8px;
  font-size: 18px;
}

.warning-dialog-body p:not(.section-label) {
  margin-top: 6px;
  color: #705f49;
  font-size: 12px;
  line-height: 1.65;
}

.warning-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #9b642e;
  background: #ffedd5;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 800;
}

.warning-dialog-actions {
  justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid #efe3d1;
}

.danger-confirm {
  background: linear-gradient(135deg, #b87545, #c98a51);
}

body.drawer-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .preset-preview {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-button {
    padding: 5px 7px;
    font-size: 11px;
  }

  .topbar-actions #serviceStatus {
    display: none;
  }

  .featured-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt-actions {
    width: 100%;
    flex-wrap: wrap;
    margin-top: 7px;
  }

  .side-drawer {
    width: 100vw;
    border-left: 0;
  }

  .drawer-header,
  .drawer-body {
    padding-right: 16px;
    padding-left: 16px;
  }

  .custom-save-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 440px) {
  .topbar-button:first-child {
    display: none;
  }

  .featured-presets {
    grid-template-columns: 1fr 1fr;
  }

  .featured-preset {
    min-height: 62px;
  }

  .help-section {
    padding-left: 34px;
  }

  .help-before-after {
    grid-template-columns: 1fr;
  }
}
