﻿:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-strong: #eaf1f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef4fb;
  --line: #dbe4ef;
  --line-strong: #c7d4e5;
  --text: #102033;
  --muted: #64748b;
  --muted-strong: #475569;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #dbeafe;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --success: #059669;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-lift: 0 24px 60px rgba(37, 99, 235, 0.16);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(37, 99, 235, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.14), transparent 34rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 44%, #eef6ff 100%);
  background-attachment: fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 72%);
}

body.debug-page {
  background:
    radial-gradient(circle at 8% 4%, rgba(37, 99, 235, 0.12), transparent 24rem),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.1), transparent 28rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 50%, #eef6ff 100%);
}

.debug-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.debug-header,
.debug-summary,
.debug-panel {
  border: 1px solid rgba(219, 228, 239, 0.92);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.debug-header,
.debug-summary,
.debug-panel {
  border-radius: var(--radius-lg);
}

.debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.debug-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-header h1 {
  margin: 0;
  font-size: 26px;
}

.debug-header-actions {
  display: inline-flex;
  gap: 8px;
}

.debug-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.debug-toolbar {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(219, 228, 239, 0.92);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  padding: 14px 18px;
}

.debug-mode-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.debug-controls .field {
  min-width: 0;
}

.debug-toggle {
  min-height: 40px;
  align-self: end;
}

.debug-summary-item {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.debug-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.debug-summary-item strong {
  font-size: 15px;
}

.debug-panels {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
}

.debug-panel {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.debug-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.debug-sections {
  display: grid;
  gap: 12px;
}

.debug-section-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 246, 255, 0.9));
  padding: 12px;
}

.debug-section-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.debug-section-block pre,
.debug-final-prompt {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  line-height: 1.7;
  color: var(--text);
}

.debug-final-prompt {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}

.debug-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.86);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

@media (max-width: 960px) {
  .debug-summary,
  .debug-controls,
  .debug-panels {
    grid-template-columns: 1fr;
  }
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input[type="text"],
input[type="number"],
select {
  min-height: 40px;
  padding: 0 12px;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

textarea {
  min-height: 150px;
  padding: 13px 14px;
  line-height: 1.68;
  resize: vertical;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.62);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), var(--shadow-sm);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(376px, 424px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 0 4px 0 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.content {
  min-width: 0;
  padding: 0;
}

.section,
.content-top,
.gallery-card {
  border: 1px solid rgba(219, 228, 239, 0.92);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.section {
  border-radius: var(--radius-lg);
  padding: 12px;
}

.quick-panel.section {
  padding: 8px 9px;
}

.section h2,
.content h2,
.gallery-title {
  margin: 0;
}

.quick-panel {
  display: grid;
  gap: 6px;
  border-color: rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.quick-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.quick-panel-head-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.quick-panel-head span {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
}

.quick-panel-head strong {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 11px;
}

.playground-entry {
  width: 100%;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  font-size: 11px;
  padding: 0 8px;
}

.quick-panel-close-button {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
}

.playground-entry::after {
  content: "↗";
  font-size: 13px;
}

.workspace-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.82);
}

.workspace-nav-link {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  box-shadow: none;
}

.workspace-nav-link::after {
  content: "↗";
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.7;
}

.provider-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef4fb;
}

.provider-switch-button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.provider-switch-button:hover {
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.7);
}

.provider-switch-button.active {
  border-color: rgba(37, 99, 235, 0.22);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.config-section {
  padding-top: 8px;
  padding-bottom: 8px;
}

.config-section .section-heading {
  margin-bottom: -2px;
}

.config-section .section-heading .button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.config-section .field-grid {
  gap: 6px;
  margin-top: 6px;
}

.config-section .field > span {
  margin-bottom: 3px;
  font-size: 10px;
}

.config-section input[type="text"],
.config-section select {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.config-section .toggle-row {
  margin-top: 6px;
}

.config-section .toggle-field {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 11px;
}

.config-section .advanced-group {
  margin-top: 6px;
  border-radius: 16px;
}

.config-section .advanced-group-summary {
  padding: 7px 9px;
}

.config-section .advanced-group-copy strong {
  font-size: 11px;
}

.config-section .advanced-group-body {
  padding: 0 9px 8px;
}

.config-section .dir-picker-row .button {
  min-height: 24px;
}

.retry-settings-panel {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.62);
}

.retry-settings-panel .toggle-field {
  min-height: 30px;
  padding: 5px 8px;
}

.retry-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
}

.retry-count-field input {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.retry-settings-tip {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
}

.section {
  background: rgba(255, 255, 255, 0.9);
}

.section-heading,
.content-top,
.gallery-head,
.action-row,
.task-reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-heading {
  margin-bottom: 0;
}

.section-heading h2,
.content-top h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-heading h2::before,
.content-top h2::before {
  width: 7px;
  height: 16px;
  border-radius: 999px;
  content: "";
  background: linear-gradient(180deg, #38bdf8, var(--primary));
  box-shadow: 0 6px 15px rgba(37, 99, 235, 0.24);
}

.content-top {
  position: sticky;
  top: 16px;
  z-index: 20;
  margin-bottom: 10px;
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  align-items: flex-start;
}

.content-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.gallery-batch-move-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.content-heading-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.content-top h2 {
  font-size: 18px;
}

.gallery-group-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 980px;
}

.gallery-group-order-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gallery-group-field {
  display: inline-grid;
  grid-template-columns: auto minmax(160px, 240px);
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.gallery-group-field select {
  min-height: 28px;
  border: none;
  border-radius: 999px;
  background-color: transparent;
  box-shadow: none;
}

.gallery-batch-move-field select {
  min-width: 148px;
}

.gallery-group-path {
  display: inline-flex;
  align-items: center;
  max-width: 520px;
  min-height: 30px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  align-items: end;
}

.field-grid-single {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  grid-template-rows: auto minmax(32px, auto);
  align-content: end;
  min-width: 0;
}

.field > span,
.task-reference-title {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.field select,
.field input,
.field textarea {
  width: 100%;
  min-width: 0;
}

.config-section .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-section .field-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.dir-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 5px;
}

#saveImageDir {
  min-width: 0;
}

.toggle-row {
  margin-top: 10px;
}

.advanced-group {
  margin-top: 8px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.72) 0%, rgba(255, 255, 255, 0.92) 100%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.advanced-group[open] {
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
}

.advanced-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}

.advanced-group-summary::-webkit-details-marker {
  display: none;
}

.advanced-group-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.advanced-group-kicker {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.advanced-group-copy strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.advanced-group-state {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.advanced-group-state::before,
.advanced-group-state::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 1.8px;
  border-radius: 999px;
  content: "";
  background: #2563eb;
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.advanced-group-state::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.advanced-group[open] .advanced-group-state::after {
  opacity: 0;
}

.advanced-group-body {
  padding: 0 11px 10px;
}

.advanced-group-body .field-grid:first-child,
.advanced-group-body .toggle-row:first-child {
  margin-top: 0;
}

.toggle-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.toggle-field:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.toggle-field input {
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  appearance: none;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.toggle-field input::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  content: "";
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  transition: transform 0.18s ease;
}

.toggle-field input:checked {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.toggle-field input:checked::after {
  transform: translateX(14px);
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.inline-field select {
  width: 64px;
  min-height: 28px;
  padding: 0 24px 0 8px;
  border: none;
  box-shadow: none;
  background-color: transparent;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.task-page-switcher {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(219, 228, 239, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-sm);
}

.task-page-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.task-page-summary strong {
  color: var(--text);
}

.task-page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-page-tabs {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.task-page-tab.active {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: none;
}

.task-page-tab[aria-pressed="true"] {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.task-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  padding: 8px;
}

.task-item::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--primary), #38bdf8, #14b8a6);
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.task-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-order,
.task-status,
.reference-order,
.gallery-credit {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.task-order,
.reference-order {
  color: #1d4ed8;
  background: var(--primary-soft);
}

.task-status-idle {
  display: none;
}

.task-status-loading {
  color: #92400e;
  background: var(--warning-soft);
}

.task-status-queued {
  color: #1d4ed8;
  background: var(--primary-soft);
}

.task-status-stopped {
  color: #475569;
  background: #e2e8f0;
}

.task-status-success {
  color: #047857;
  background: var(--success-soft);
}

.task-status-error {
  color: #be123c;
  background: var(--danger-soft);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.task-copy-count-field {
  min-height: 28px;
  padding-right: 3px;
}

.task-copy-count {
  width: 42px;
  min-height: 22px;
  padding: 0 5px;
  border: none;
  box-shadow: none;
  background: transparent;
}

.task-prompt {
  min-height: 58px;
  padding: 7px 9px;
  line-height: 1.55;
  background: #ffffff;
}

.task-prompt-tools {
  display: grid;
  gap: 6px;
}

.task-prompt-ai-row,
.task-prompt-history-row {
  display: grid;
  gap: 5px;
  align-items: center;
}

.task-prompt-ai-row {
  grid-template-columns: auto auto auto;
  justify-content: start;
}

.task-prompt-history-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  padding: 6px;
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
}

.task-prompt-history-label {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.task-prompt-history-select {
  min-width: 0;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.task-scene-analysis {
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.88));
  overflow: hidden;
}

.task-scene-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.task-scene-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.task-scene-tip {
  margin: 0 10px 8px;
  padding: 7px 9px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  color: #92400e;
  background: rgba(255, 251, 235, 0.86);
  font-size: 11px;
  line-height: 1.5;
}

.task-scene-preset-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  margin: 0 10px 8px;
  padding: 7px;
  border: 1px solid rgba(191, 219, 254, 0.86);
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.74);
}

.task-scene-preset-label {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.task-scene-preset-select {
  min-width: 0;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .task-scene-preset-row {
    grid-template-columns: 1fr 1fr;
  }

  .task-scene-preset-label,
  .task-scene-preset-select {
    grid-column: 1 / -1;
  }
}

.task-scene-grid {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.task-scene-field {
  display: grid;
  grid-template-columns: minmax(88px, auto) auto;
  gap: 6px;
  align-items: center;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
}

.task-scene-field textarea {
  grid-column: 1 / -1;
  min-height: 58px;
  resize: vertical;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  line-height: 1.55;
}

.task-scene-ai {
  justify-self: end;
  min-width: 42px;
}

.task-log-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
}

.task-log-modal[hidden] {
  display: none;
}

.task-log-dialog {
  width: min(920px, 96vw);
  max-height: min(760px, 92vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(226, 232, 240, 0.94);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

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

.task-log-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.task-log-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-log-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.task-log-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.78);
}

.task-log-card-succeeded {
  border-color: rgba(34, 197, 94, 0.28);
}

.task-log-card-failed {
  border-color: rgba(244, 63, 94, 0.32);
}

.task-log-status {
  padding: 4px 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.task-log-meta,
.task-log-message {
  margin: 0;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.5;
}

.task-log-url-box {
  padding: 8px;
  border-radius: 12px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.task-log-url-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.task-log-url-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.task-log-url-list code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 11px;
}

.prompt-writer-modal[hidden] {
  display: none;
}

.prompt-writer-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
}

.prompt-writer-dialog {
  width: min(560px, 100%);
  border: 1px solid rgba(219, 228, 239, 0.96);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  padding: 16px;
}

.prompt-writer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.prompt-writer-head h3 {
  margin: 0;
  font-size: 18px;
}

.prompt-writer-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.prompt-writer-close {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.prompt-writer-field {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
}

.prompt-writer-field textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
  resize: vertical;
  line-height: 1.65;
}

.prompt-writer-field textarea:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.prompt-writer-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.prompt-writer-examples button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #1e40af;
  background: var(--primary-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.prompt-writer-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.prompt-writer-status.is-error {
  color: var(--danger);
}

.prompt-writer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.task-reference-head {
  gap: 6px;
}

.task-reference-tools {
  gap: 4px;
  flex-wrap: wrap;
}

.task-reference-title {
  font-size: 12px;
}

.task-reference-list {
  gap: 6px;
  margin-top: 8px;
}

.task-reference-block {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
}

.task-reference-head {
  margin-bottom: 4px;
}

.task-reference-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.task-reference-title {
  margin: 0;
}

.task-reference-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 5px;
}

.task-reference-option {
  display: grid;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.task-reference-option:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.task-reference-option input {
  margin: 0;
  accent-color: var(--primary);
}

.task-reference-thumb,
.reference-image,
.reference-empty-thumb,
.reference-placeholder {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), transparent),
    repeating-conic-gradient(from 45deg, #f8fafc 0% 25%, #eef2f7 0% 50%) 50% / 18px 18px;
}

.task-reference-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
}

.task-reference-name {
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.task-reference-empty {
  min-height: 54px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.72);
}

.button,
.icon-button,
.preview-tool,
.preview-close {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.button:hover,
.icon-button:hover,
.preview-tool:hover,
.preview-close:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.preview-tool:focus-visible,
.preview-close:focus-visible,
.reference-preview:focus-visible,
.gallery-preview:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.button-mini {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.button-primary {
  border-color: rgba(37, 99, 235, 0.04);
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.24);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--primary-strong), #0284c7);
  box-shadow: var(--shadow-lift);
}

.button-secondary {
  border-color: var(--line);
  background: #ffffff;
  color: #1e293b;
}

.button-secondary:hover {
  border-color: rgba(37, 99, 235, 0.34);
  background: #eff6ff;
  color: #1d4ed8;
}

.button-danger,
.task-delete,
.reference-delete {
  border-color: rgba(225, 29, 72, 0.22);
  background: var(--danger-soft);
  color: #be123c;
}

.button-danger:hover,
.task-delete:hover,
.reference-delete:hover {
  border-color: rgba(225, 29, 72, 0.35);
  background: #fecdd3;
  color: #9f1239;
}

.icon-button {
  min-width: 36px;
  min-height: 30px;
  padding: 0 8px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.icon-button:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: #eff6ff;
  color: #1d4ed8;
}

.file-button {
  position: relative;
}

.status {
  margin-top: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 11px;
  font-size: 13px;
  font-weight: 700;
}

.status-idle {
  border-color: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
  background: var(--primary-soft);
}

.status-loading {
  border-color: rgba(217, 119, 6, 0.18);
  color: #92400e;
  background: var(--warning-soft);
}

.status-success {
  border-color: rgba(5, 150, 105, 0.18);
  color: #047857;
  background: var(--success-soft);
}

.status-error {
  border-color: rgba(225, 29, 72, 0.18);
  color: #be123c;
  background: var(--danger-soft);
}

.generation-progress {
  margin-top: 8px;
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.76);
}

.generation-progress[hidden] {
  display: none !important;
}

.generation-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
}

.generation-progress-head strong {
  font-variant-numeric: tabular-nums;
}

.generation-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(191, 219, 254, 0.9);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

.generation-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8, #22c55e);
  transition: width 0.35s ease;
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.28);
}
.generation-progress-note {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.reference-panel {
  margin-top: 12px;
}

.empty-inline,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.58);
}

.empty-state::before {
  content: "\6682\65e0\56fe\7247\ff0c\751f\6210\540e\4f1a\663e\793a\5728\8fd9\91cc";
  font-size: 14px;
  font-weight: 700;
}

.gallery > .empty-state {
  grid-column: 1 / -1;
  min-height: calc(100vh - 148px);
}

.reference-list {
  display: grid;
  gap: 8px;
}

.reference-list.disabled {
  opacity: 0.64;
}

.reference-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  padding: 6px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.reference-item:hover {
  border-color: rgba(37, 99, 235, 0.26);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.reference-item.reference-slot-dragging {
  border-color: rgba(37, 99, 235, 0.72);
  background: rgba(219, 234, 254, 0.82);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14), 0 14px 30px rgba(15, 23, 42, 0.1);
}

.reference-item-empty,
.reference-item.reference-slot-card {
  grid-template-columns: 52px minmax(0, 1fr) auto;
}

.reference-item-empty {
  opacity: 0.76;
}

.reference-empty-thumb,
.reference-image,
.reference-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.reference-empty-thumb {
  border: 1px dashed var(--line-strong);
}

.reference-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.reference-preview,
.gallery-preview {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: zoom-in;
}

.reference-preview:disabled {
  cursor: default;
}

.reference-image {
  display: block;
  object-fit: cover;
  border: 1px solid rgba(203, 213, 225, 0.7);
}

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

.reference-order {
  white-space: nowrap;
}

.detail-prompt,
.detail-provider-call,
.detail-provider-request,
.detail-provider-prompt,
.detail-provider-note {
  word-break: break-word;
}

.reference-size {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.reference-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.reference-add {
  width: auto;
  min-width: 62px;
}

.task-reference-list .reference-item.reference-slot-card {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: stretch;
  min-width: 0;
  overflow: visible;
}

.task-reference-list .reference-preview {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 10px;
}

.task-reference-list .reference-meta {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.task-reference-list .reference-size {
  display: none;
}

.task-reference-list .reference-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  justify-content: stretch;
}

.task-reference-list .reference-actions .button,
.task-reference-list .reference-actions .icon-button {
  width: 100%;
  min-width: 0;
  padding-left: 5px;
  padding-right: 5px;
}

button:disabled,
select:disabled,
textarea:disabled,
a[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.reference-preview:disabled {
  opacity: 1;
  cursor: default;
}

.gallery {
  display: grid;
  gap: 8px;
}

.gallery-group-section {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(219, 228, 239, 0.94);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

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

.gallery-group-summary {
  display: grid;
  gap: 4px;
}

.gallery-group-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.gallery-group-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.gallery-group-path-inline {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 800;
}

.gallery-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.gallery-group-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
  justify-content: start;
}

.gallery-group-empty {
  min-height: 120px;
}

.gallery-group-body .gallery-card {
  width: 100%;
  max-width: none;
  justify-self: start;
}

.gallery-card {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  min-height: 0;
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-card.is-selected {
  border-color: rgba(37, 99, 235, 0.48);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 24px 60px rgba(15, 23, 42, 0.13);
}

.gallery-card:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}

.gallery-card.is-selected:hover {
  border-color: rgba(37, 99, 235, 0.56);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13), 0 28px 70px rgba(15, 23, 42, 0.15);
}

.gallery-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  color: #0f172a;
  font-size: 11px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.gallery-select-input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.gallery-preview {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.94);
  border-right: none;
  border-bottom: 1px solid var(--line);
}

.gallery-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: 0;
  box-sizing: border-box;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent),
    #e2e8f0;
  transition: transform 0.28s ease;
}

.gallery-card:hover .gallery-image {
  transform: scale(1.018);
}

.gallery-body {
  min-width: 0;
  padding: 7px 7px 8px;
}

.gallery-head {
  align-items: flex-start;
  gap: 5px;
}

.gallery-title {
  color: #0f172a;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.gallery-time {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
}

.gallery-group-name {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 15px;
  margin: 2px 0 0;
  padding: 0 5px;
  overflow: hidden;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 8px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-credit {
  flex: 0 0 auto;
  color: #0369a1;
  background: #e0f2fe;
  min-height: 15px;
  padding: 0 6px;
  font-size: 9px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 5px;
}

.detail-box {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  background: var(--surface-2);
}

.detail-box span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.detail-box strong {
  color: #1e293b;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.25;
}

.detail-text {
  display: none;
}

.gallery-time,
.detail-text p {
  margin-left: 0;
  margin-right: 0;
}

.detail-text p {
  margin-top: 2px;
  margin-bottom: 0;
}

.detail-provider-call,
.detail-provider-request,
.detail-provider-prompt,
.detail-provider-note {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.detail-provider-request,
.detail-provider-note,
.detail-provider-prompt {
  margin-top: 2px;
}

.detail-prompt {
  margin-top: 5px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334155;
  font-size: 8px;
  line-height: 1.3;
  background: #f8fafc;
}

.gallery-prompt-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 6px;
  align-items: center;
  min-height: 0;
  margin-top: 5px;
  padding: 5px 6px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.9);
}

.gallery-prompt-label {
  color: #64748b;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
}

.gallery-prompt-text {
  grid-column: 1 / -1;
  display: -webkit-box;
  max-height: 2.6em;
  margin: 0;
  overflow: hidden;
  color: #334155;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gallery-prompt-copy {
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
  font-size: 8px;
  font-weight: 850;
  cursor: pointer;
}

.gallery-prompt-copy:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.13);
}

.gallery-card-group-field {
  display: inline-grid;
  grid-template-columns: auto minmax(88px, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  padding: 2px 4px 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: #f8fafc;
  width: fit-content;
  max-width: 100%;
}

.gallery-card-group-field span {
  font-size: 8px;
  font-weight: 850;
  white-space: nowrap;
}

.gallery-card-group-field select {
  min-height: 22px;
  border: none;
  border-radius: 999px;
  padding: 0 22px 0 8px;
  background-color: transparent;
  box-shadow: none;
  font-size: 10px;
  min-width: 0;
}

.action-row {
  margin-top: 5px;
}

.action-row .button {
  flex: 1;
  min-height: 28px;
  font-size: 9px;
}

.gallery-touch-edit {
  border-color: rgba(14, 165, 233, 0.24);
  color: #075985;
  background: #e0f2fe;
}

.gallery-psd {
  border-color: rgba(124, 58, 237, 0.22);
  color: #5b21b6;
  background: #ede9fe;
}

.home-touch-edit-modal[hidden] {
  display: none;
}

.home-touch-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(12px);
}

.home-touch-edit-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 24px;
  background: #f8fafc;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.38);
}

.home-touch-edit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.home-touch-edit-toolbar strong {
  display: block;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.home-touch-edit-toolbar span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-touch-edit-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
}

.home-touch-edit-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.12), transparent 30%),
    #e2e8f0;
}

.home-touch-edit-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.home-touch-edit-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.home-touch-edit-selection {
  position: absolute;
  border: 2px solid #38bdf8;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.16);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.32), 0 0 0 4px rgba(14, 165, 233, 0.18);
  pointer-events: none;
}

.home-touch-edit-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.home-touch-edit-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.home-touch-edit-prompt {
  min-height: 132px;
  resize: vertical;
}

.home-touch-edit-tip {
  padding: 8px 10px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 12px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.home-touch-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-touch-edit-actions .button {
  flex: 1 1 auto;
}

.home-touch-edit-status {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.home-touch-edit-status-idle {
  color: var(--muted-strong);
  background: #f1f5f9;
}

.home-touch-edit-status-loading {
  color: #1d4ed8;
  background: var(--primary-soft);
}

.home-touch-edit-status-error {
  color: #be123c;
  background: var(--danger-soft);
}

.home-touch-edit-status-success {
  color: #047857;
  background: var(--success-soft);
}

.point-replica-admin-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(14, 165, 233, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(224, 242, 254, 0.9), rgba(255, 255, 255, 0.95));
}

.point-replica-admin-panel[hidden] {
  display: none;
}

.point-replica-text-rules textarea {
  min-height: 76px;
  resize: vertical;
}

.point-replica-tip {
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: #075985;
  background: rgba(14, 165, 233, 0.1);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.55;
}

.point-replica-mask-button {
  border-color: rgba(14, 165, 233, 0.24);
  color: #075985;
  background: #e0f2fe;
}

.point-replica-mask-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  font-size: 10px;
  font-weight: 900;
}

.point-replica-editor-modal[hidden] {
  display: none;
}

.point-replica-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(12px);
}

.point-replica-editor-dialog {
  width: min(1240px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 24px;
  background: #f8fafc;
  box-shadow: 0 28px 90px rgba(2, 6, 23, 0.42);
}

.point-replica-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.point-replica-editor-toolbar strong {
  display: block;
  color: #0f172a;
  font-size: 16px;
  font-weight: 950;
}

.point-replica-editor-toolbar span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.point-replica-editor-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
}

.point-replica-editor-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    #e2e8f0;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.point-replica-editor-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 156px);
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.point-replica-editor-overlay {
  position: absolute;
  cursor: crosshair;
  touch-action: none;
}

.point-replica-editor-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.point-replica-editor-note {
  padding: 9px 10px;
  border-radius: 12px;
  color: #075985;
  background: rgba(14, 165, 233, 0.1);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.55;
}

.point-replica-editor-tools,
.point-replica-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.point-replica-editor-tools .button,
.point-replica-editor-actions .button {
  flex: 1 1 auto;
}

.point-replica-editor-tools .button.active {
  color: #ffffff;
  border-color: #0f172a;
  background: #0f172a;
}

.point-replica-editor-panel .field {
  display: grid;
  gap: 6px;
}

.point-replica-editor-panel .field span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.point-replica-editor-panel input[type="range"] {
  width: 100%;
}

.point-replica-editor-status {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 820;
  line-height: 1.45;
}

.point-replica-editor-status-idle {
  color: var(--muted-strong);
  background: #f1f5f9;
}

.point-replica-editor-status-loading {
  color: #1d4ed8;
  background: var(--primary-soft);
}

.point-replica-editor-status-error {
  color: #be123c;
  background: var(--danger-soft);
}

.point-replica-editor-status-success {
  color: #047857;
  background: var(--success-soft);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(18px);
}

.preview-modal[hidden] {
  display: none;
}

.preview-toolbar,
.preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  color: #f8fafc;
}

.preview-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  margin-top: 14px;
}

.preview-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at center, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.95)),
    #020617;
  padding: 16px;
}

.preview-canvas {
  display: block;
  max-width: min(96vw, 1800px);
  max-height: calc(100vh - 190px);
  transform-origin: center center;
  transition: transform 0.16s ease;
  background: #020617;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}

.preview-source-image {
  display: none;
}

.preview-sidebar {
  display: grid;
  gap: 14px;
  align-content: start;
}

.preview-panel {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.84);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  padding: 13px;
  color: #f8fafc;
}

.preview-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.preview-panel-note {
  min-height: 18px;
  color: #cbd5e1;
  font-size: 12px;
}

.preview-chart,
.preview-curve {
  display: block;
  width: 100%;
  border-radius: 14px;
  background: #020617;
}

.preview-curve {
  cursor: crosshair;
}

.preview-tool,
.preview-close {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(148, 163, 184, 0.36);
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  box-shadow: none;
}

.preview-tool:hover,
.preview-close:hover {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(30, 41, 59, 0.92);
}

.preview-close {
  border-color: rgba(251, 113, 133, 0.36);
  color: #fecdd3;
}

.preview-download {
  min-width: 72px;
}

.preview-download.is-disabled,
.gallery-download.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.history-picker-layout {
  grid-template-columns: 1fr;
}

.history-picker-panel {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.96);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.history-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.history-picker-item {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.history-picker-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
}

.history-picker-item.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13), 0 18px 42px rgba(37, 99, 235, 0.14);
}

.history-picker-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e2e8f0;
}

.history-picker-meta {
  display: grid;
  gap: 4px;
  padding: 9px 10px 10px;
}

.history-picker-name,
.history-picker-note {
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.history-picker-name {
  color: #0f172a;
  font-weight: 850;
}

.history-picker-note {
  color: var(--muted);
}

.preview-tool:disabled,
.preview-close:disabled,
.preview-download.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

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

  .preview-stage {
    max-height: 52vh;
  }

  .point-replica-editor-layout {
    grid-template-columns: 1fr;
  }

  .point-replica-editor-stage {
    min-height: 320px;
    max-height: 58vh;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .content-top {
    top: 12px;
  }

  .content-top {
    align-items: stretch;
  }

  .content-heading-stack,
  .content-actions {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    gap: 14px;
    padding: 14px;
  }

  .section,
  .content-top,
  .gallery-card {
    border-radius: 20px;
  }

  .gallery-group-panel {
    align-items: stretch;
  }

  .gallery-group-order-actions {
    width: 100%;
  }

  .gallery-group-field {
    grid-template-columns: 1fr;
    width: 100%;
    border-radius: 16px;
  }

  .gallery-group-path {
    width: 100%;
    max-width: none;
    border-radius: 16px;
  }

  .gallery-card-group-field {
    grid-template-columns: auto minmax(0, 1fr);
    width: fit-content;
  }

  .field-grid,
  .detail-grid,
  .dir-picker-row {
    grid-template-columns: 1fr;
  }

  .advanced-group-summary,
  .advanced-group-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .advanced-group-body {
    padding-bottom: 12px;
  }

  .section-heading,
  .content-top,
  .task-reference-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions .button,
  .section-actions .inline-field {
    flex: 1 1 auto;
  }

  .gallery-group-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .gallery-group-actions {
    width: 100%;
    justify-content: stretch;
  }

  .gallery-group-actions .button {
    flex: 1 1 auto;
  }

  .gallery > .empty-state {
    min-height: 320px;
  }

  .reference-item,
  .reference-item-empty,
  .reference-item.reference-slot-card {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .reference-empty-thumb,
  .reference-image,
  .reference-placeholder {
    width: 50px;
    height: 50px;
  }

  .task-head {
    flex-direction: column;
  }

  .task-meta {
    width: 100%;
  }

  .task-actions {
    width: 100%;
    justify-content: stretch;
  }

  .task-actions .icon-button {
    flex: 1;
  }

  .task-copy-count-field {
    flex: 1 1 120px;
  }

  .task-copy-count {
    width: 100%;
  }

  .task-prompt-history-row {
    grid-template-columns: 1fr 1fr;
  }

  .task-prompt-ai-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .task-prompt-history-label {
    grid-column: 1 / -1;
  }

  .task-prompt-history-select {
    grid-column: 1 / -1;
  }

  .inline-field {
    width: 100%;
    justify-content: space-between;
  }

  .task-reference-list {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  }

  .reference-list > .reference-actions,
  .reference-item:not(.reference-slot-card) .reference-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reference-item:not(.reference-slot-card) .reference-delete {
    min-width: 0;
  }

  .preview-modal {
    padding: 12px;
  }

  .point-replica-editor-modal {
    padding: 10px;
  }

  .point-replica-editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .point-replica-editor-toolbar .preview-close {
    width: 100%;
  }

  .point-replica-editor-layout {
    padding: 10px;
  }

  .point-replica-editor-stage {
    min-height: 260px;
  }

  .preview-actions {
    flex-wrap: wrap;
  }
}

.web-hidden {
  display: none !important;
}

.web-update-button::after {
  content: none !important;
}
