:root {
  color-scheme: dark;
  --bg: #090a10;
  --bg-soft: #0d0e16;
  --panel: #11121b;
  --panel-raised: #171824;
  --panel-hover: #1b1c2b;
  --border: #282a3b;
  --border-soft: rgba(150, 145, 190, 0.14);
  --text: #f4f2fb;
  --text-soft: #c5c3d2;
  --muted: #8c8c9f;
  --muted-2: #626477;
  --accent: #9a83ff;
  --accent-strong: #7d63f4;
  --accent-soft: rgba(154, 131, 255, 0.14);
  --cyan: #71d8ff;
  --green: #73dfab;
  --yellow: #f6c66f;
  --red: #ff849f;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-sm: 9px;
  font-family: Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--text);
  font-size: calc(13px * var(--font-scale, 1));
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--accent-strong);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2c2e40;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #44465d;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 44% -30%, rgba(105, 82, 205, 0.17), transparent 34%),
    radial-gradient(circle at 100% 70%, rgba(53, 91, 150, 0.06), transparent 30%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(9, 10, 16, 0.84);
}

.brand-lockup,
.topbar-center,
.topbar-actions,
.eyebrow,
.api-footer-row,
.reference-toolbar,
.subfield-label,
.inline-fields,
.submit-note,
.task-card-head,
.task-state,
.task-actions,
.task-meta,
.task-time-line,
.result-action-row,
.history-subtitle,
.history-item,
.history-item-main,
.history-item-actions,
.modal-toolbar,
.modal-footer {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 11px;
  min-width: 238px;
}

.brand-mark {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(196, 179, 255, 0.42);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 24px rgba(114, 82, 233, 0.28);
}

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

.icon-brand {
  width: 21px;
  height: 21px;
  stroke-width: 1.45;
}

.brand-title {
  font-size: calc(15px * var(--font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.02em;
}

.year-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  margin-left: 5px;
  padding: 0 5px;
  color: #c2b5ff;
  border: 1px solid rgba(154, 131, 255, 0.38);
  border-radius: 5px;
  font-size: calc(9px * var(--font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.08em;
  vertical-align: 2px;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  font-weight: 650;
  letter-spacing: 0.2em;
}

.topbar-center {
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale, 1));
}

.local-indicator,
.summary-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  white-space: nowrap;
}

.local-indicator i,
.summary-live i,
.api-status i,
.mode-pill i,
.submit-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(115, 223, 171, 0.1), 0 0 12px rgba(115, 223, 171, 0.5);
}

.topbar-note {
  color: var(--muted-2);
}

.topbar-actions {
  justify-content: flex-end;
  gap: 9px;
  min-width: 238px;
}

.save-default-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  color: var(--accent);
  border: 1px solid rgba(154, 131, 255, 0.28);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 700;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.save-default-button .icon {
  width: 15px;
  height: 15px;
}

.save-default-button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(154, 131, 255, 0.2);
  transform: translateY(-1px);
}

.topbar-control {
  position: relative;
}

.font-size-glyph {
  display: inline-block;
  color: currentColor;
  font-size: calc(13px * var(--font-scale, 1));
  font-weight: 750;
  letter-spacing: -0.1em;
  line-height: 1;
  transform: translateX(-1px);
}

.topbar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  display: grid;
  width: 220px;
  gap: 3px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: menu-in 150ms ease both;
}

.topbar-menu[hidden] {
  display: none;
}

.topbar-menu-title {
  padding: 3px 7px 6px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  letter-spacing: 0.08em;
}

.topbar-menu-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.topbar-menu-title-row .topbar-menu-title {
  padding-bottom: 2px;
}

.topbar-menu-title-row strong {
  padding: 0 7px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(12px * var(--font-scale, 1));
}

.font-size-control-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  padding: 3px 7px 0;
}

.font-size-range-wrap {
  display: block;
  min-width: 0;
}

.font-size-range {
  width: 100%;
  height: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.font-size-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.font-size-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 3px 10px rgba(101, 71, 217, 0.3);
  appearance: none;
}

.font-size-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.font-size-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 3px 10px rgba(101, 71, 217, 0.3);
}

.font-size-scale {
  display: flex;
  justify-content: space-between;
  padding: 0 41px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
}

.topbar-menu-hint {
  padding: 2px 7px 4px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
}

.topbar-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  color: var(--text-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: calc(10px * var(--font-scale, 1));
  text-align: left;
}

.topbar-menu button span:last-child {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
}

.topbar-menu button:hover,
.topbar-menu button.is-selected {
  color: var(--accent);
  border-color: rgba(154, 131, 255, 0.22);
  background: var(--accent-soft);
}

.font-size-adjust {
  display: grid !important;
  place-items: center;
  width: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  color: var(--text-soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: 7px !important;
  background: var(--panel-raised) !important;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace !important;
  font-size: calc(16px * var(--font-scale, 1)) !important;
  line-height: 1 !important;
  text-align: center !important;
}

.font-size-adjust:hover {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

.font-size-adjust:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.font-size-reset {
  justify-content: center !important;
  min-height: 28px !important;
  margin: 3px 7px 0;
  padding: 0 8px !important;
  color: var(--accent) !important;
  border: 1px solid rgba(154, 131, 255, 0.22) !important;
  border-radius: 7px !important;
  background: var(--accent-soft) !important;
  font-size: calc(10px * var(--font-scale, 1)) !important;
  text-align: center !important;
}

.font-size-reset:hover {
  color: var(--text) !important;
  border-color: var(--accent) !important;
  background: rgba(154, 131, 255, 0.2) !important;
}

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

.keyboard-tip {
  color: var(--muted-2);
  font-size: calc(10px * var(--font-scale, 1));
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 20px;
  padding: 0 5px;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #151622;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  font-size: calc(9px * var(--font-scale, 1));
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(18, 19, 29, 0.8);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: #4a4868;
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.icon-button.small {
  width: 29px;
  height: 29px;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(270px, 292px) minmax(470px, 1fr) minmax(350px, 400px);
  min-height: 0;
  overflow: hidden;
}

.panel,
.workspace {
  min-width: 0;
  min-height: 0;
}

.panel {
  background: rgba(15, 16, 24, 0.68);
}

.settings-panel {
  z-index: 2;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
}

.history-panel {
  z-index: 2;
  overflow-y: auto;
  border-left: 1px solid var(--border-soft);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-heading {
  padding: 22px 18px 17px;
}

.history-heading {
  padding: 23px 18px 14px;
}

.eyebrow {
  gap: 6px;
  color: var(--accent);
  font-size: calc(9px * var(--font-scale, 1));
  font-weight: 750;
  letter-spacing: 0.17em;
  line-height: 1;
}

.eyebrow .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

h1,
h2,
p {
  margin: 0;
}

.panel-heading h1,
.panel-heading h2 {
  margin-top: 7px;
  font-size: calc(18px * var(--font-scale, 1));
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 110px;
  margin-top: 2px;
  padding: 6px 8px;
  color: #c6bbff;
  border: 1px solid rgba(154, 131, 255, 0.24);
  border-radius: 999px;
  background: rgba(154, 131, 255, 0.09);
  font-size: calc(10px * var(--font-scale, 1));
  white-space: nowrap;
}

.mode-pill i {
  width: 5px;
  height: 5px;
  background: var(--accent);
  box-shadow: none;
}

.control-form {
  padding-bottom: 24px;
}

.control-section {
  margin: 0 15px;
  padding: 16px 3px 18px;
  border-top: 1px solid var(--border-soft);
}

.control-section:first-of-type {
  border-top: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-row h2 {
  color: var(--text-soft);
  font-size: calc(11px * var(--font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.04em;
}

.section-index {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
  letter-spacing: 0.12em;
}

.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
}

.key-label {
  margin-top: 12px;
}

.text-input,
.prompt-input {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  background: #0e0f17;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.text-input {
  height: 34px;
  padding: 0 10px;
  font-size: calc(11px * var(--font-scale, 1));
}

.text-input::placeholder,
.prompt-input::placeholder {
  color: #56586b;
}

.text-input:hover,
.prompt-input:hover {
  border-color: #3b3d51;
}

.text-input:focus,
.prompt-input:focus {
  border-color: rgba(154, 131, 255, 0.72);
  background: #11121d;
  box-shadow: 0 0 0 3px rgba(154, 131, 255, 0.08);
}

.select-wrap,
.mini-field {
  position: relative;
}

.select-input {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #74758a 50%), linear-gradient(135deg, #74758a 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.input-with-action {
  position: relative;
}

.input-with-action .text-input {
  padding-right: 38px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--muted-2);
  border-radius: 6px;
  background: transparent;
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--text-soft);
  background: var(--panel-raised);
}

.input-action .icon {
  width: 15px;
  height: 15px;
}

.api-footer-row {
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
  cursor: pointer;
  user-select: none;
}

.check-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.fake-check {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: transparent;
  border: 1px solid #414356;
  border-radius: 4px;
  background: #0e0f17;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.fake-check .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.5;
}

.check-label input:checked + .fake-check {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent-strong);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  color: #ae9fff;
  background: transparent;
  font-size: calc(10px * var(--font-scale, 1));
}

.text-button:hover {
  color: #d2caff;
}

.text-button.is-busy {
  opacity: 0.68;
  pointer-events: none;
}

.text-button .icon {
  width: 13px;
  height: 13px;
}

.text-button.subtle {
  color: var(--muted);
}

.text-button.subtle:hover {
  color: var(--red);
}

.api-status {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  line-height: 1.35;
}

.api-status i {
  width: 5px;
  height: 5px;
  margin-top: 3px;
  background: var(--muted-2);
  box-shadow: none;
}

.api-status.is-valid {
  color: var(--green);
}

.api-status.is-valid i {
  background: var(--green);
  box-shadow: 0 0 8px rgba(115, 223, 171, 0.5);
}

.api-status.is-error {
  color: var(--red);
}

.api-status.is-error i {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 132, 159, 0.5);
}

.drop-zone {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 9px;
  border: 1px dashed #3a3b50;
  border-radius: 10px;
  background: #0e0f17;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  border-color: var(--accent);
  background: rgba(154, 131, 255, 0.09);
  transform: translateY(-1px);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--accent);
  border-radius: 8px;
  background: rgba(154, 131, 255, 0.12);
}

.drop-icon .icon {
  width: 15px;
  height: 15px;
}

.drop-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.drop-copy strong {
  color: var(--text-soft);
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 650;
}

.drop-copy span {
  overflow: hidden;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-count {
  margin-left: auto;
  align-self: flex-start;
  padding: 3px 5px;
  color: var(--muted);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
  white-space: nowrap;
}

.reference-toolbar {
  justify-content: space-between;
  min-height: 23px;
  margin-top: 6px;
}

.reference-mode-hint {
  overflow: hidden;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}

.reference-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0b0c12;
}

.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  background: rgba(7, 8, 12, 0.72);
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}

.reference-thumb:hover .reference-remove,
.reference-remove:focus-visible {
  opacity: 1;
}

.reference-remove:hover {
  background: rgba(215, 57, 90, 0.9);
}

.reference-remove .icon {
  width: 10px;
  height: 10px;
}

.prompt-section {
  padding-top: 17px;
}

.prompt-input {
  display: block;
  min-height: 119px;
  padding: 11px 10px;
  resize: vertical;
  font-size: calc(11px * var(--font-scale, 1));
  line-height: 1.65;
}

.prompt-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
}

.compact-controls {
  padding-bottom: 16px;
}

.subfield + .subfield {
  margin-top: 14px;
}

.subfield-label {
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
}

.value-hint {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
}

.choice-grid {
  display: grid;
  gap: 5px;
}

.ratio-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.resolution-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-button {
  min-width: 0;
  height: 29px;
  padding: 0 3px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0e0f17;
  font-size: calc(10px * var(--font-scale, 1));
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-button:hover {
  color: var(--text-soft);
  border-color: #4e4c6e;
  background: var(--panel-raised);
}

.choice-button.is-selected {
  color: #e9e4ff;
  border-color: rgba(154, 131, 255, 0.7);
  background: rgba(125, 99, 244, 0.19);
  box-shadow: inset 0 0 0 1px rgba(154, 131, 255, 0.08);
}

.choice-button:active {
  transform: scale(0.97);
}

.batch-controls {
  padding-bottom: 17px;
}

.inline-fields {
  gap: 8px;
}

.mini-field {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
}

.mini-field .text-input {
  height: 32px;
}

.submit-wrap {
  margin: 0 18px;
  padding-top: 3px;
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 45px;
  color: #fff;
  border: 1px solid rgba(203, 190, 255, 0.22);
  border-radius: 11px;
  background: linear-gradient(135deg, #9279fa, #6a50d8);
  box-shadow: 0 9px 24px rgba(98, 67, 213, 0.24);
  font-size: calc(12px * var(--font-scale, 1));
  font-weight: 700;
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.generate-button:hover {
  filter: brightness(1.08);
  box-shadow: 0 12px 29px rgba(98, 67, 213, 0.34);
  transform: translateY(-1px);
}

.generate-button:active {
  transform: translateY(1px);
}

.generate-button.is-busy {
  opacity: 0.76;
}

.generate-button.is-busy .icon {
  animation: generate-spin 900ms linear infinite;
}

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

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

.generate-mode-label {
  padding-left: 8px;
  color: rgba(255, 255, 255, 0.7);
  border-left: 1px solid rgba(255, 255, 255, 0.24);
  font-size: calc(9px * var(--font-scale, 1));
  font-weight: 600;
}

.submit-note {
  justify-content: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
}

.submit-dot {
  width: 4px;
  height: 4px;
  background: var(--accent);
  box-shadow: none;
}

.workspace {
  overflow-y: auto;
  padding: 28px clamp(22px, 4vw, 55px) 54px;
  background:
    linear-gradient(180deg, rgba(19, 18, 33, 0.34), transparent 30%),
    rgba(9, 10, 16, 0.38);
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto 22px;
}

.workspace-header h2 {
  margin-top: 9px;
  font-size: clamp(calc(23px * var(--font-scale, 1)), calc(2vw * var(--font-scale, 1)), calc(30px * var(--font-scale, 1)));
  letter-spacing: -0.045em;
}

.workspace-header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale, 1));
}

.workspace-summary {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 2px;
}

.summary-number {
  color: #d8ceff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(29px * var(--font-scale, 1));
  font-weight: 500;
  line-height: 0.9;
}

.summary-copy {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
}

.summary-live {
  color: var(--green);
  font-size: calc(9px * var(--font-scale, 1));
}

.summary-live i {
  width: 4px;
  height: 4px;
  box-shadow: none;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto 23px;
}

.stat-card {
  position: relative;
  min-height: 70px;
  padding: 12px 13px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: rgba(18, 19, 29, 0.76);
}

.stat-card::after {
  position: absolute;
  right: -13px;
  bottom: -18px;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(154, 131, 255, 0.1);
  border-radius: 50%;
  content: "";
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(19px * var(--font-scale, 1));
  font-weight: 550;
}

.stat-mark {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
}

.stat-mark.running {
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(113, 216, 255, 0.7);
}

.stat-mark.queued {
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(246, 198, 111, 0.45);
}

.stat-mark.completed {
  background: var(--green);
  box-shadow: 0 0 12px rgba(115, 223, 171, 0.5);
}

.stat-mark.failed {
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 132, 159, 0.45);
}

.task-list {
  display: grid;
  gap: 15px;
  max-width: 1120px;
  margin: 0 auto;
}

.task-card {
  padding: 17px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(17, 18, 27, 0.9);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
  animation: card-in 230ms ease both;
}

.task-card.running {
  border-color: rgba(113, 216, 255, 0.24);
}

.task-card.failed {
  border-color: rgba(255, 132, 159, 0.25);
}

.task-card.uncertain {
  border-color: rgba(246, 198, 111, 0.34);
  background: linear-gradient(135deg, rgba(39, 30, 34, 0.94), rgba(17, 18, 27, 0.92));
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-card-head {
  justify-content: space-between;
  gap: 12px;
}

.task-state {
  gap: 7px;
  color: var(--text-soft);
  font-size: calc(11px * var(--font-scale, 1));
  font-weight: 700;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.status-dot.running {
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(113, 216, 255, 0.7);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.status-dot.queued {
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(246, 198, 111, 0.38);
}

.status-dot.completed {
  background: var(--green);
  box-shadow: 0 0 10px rgba(115, 223, 171, 0.42);
}

.status-dot.failed {
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 132, 159, 0.38);
}

.task-card.uncertain .status-dot.failed {
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(246, 198, 111, 0.42);
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.56; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.14); }
}

.task-id {
  margin-left: 3px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
  font-weight: 400;
}

.task-actions {
  gap: 4px;
}

.task-action {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted-2);
  border-radius: 7px;
  background: transparent;
}

.task-action:hover {
  color: var(--text-soft);
  background: var(--panel-hover);
}

.task-action.danger:hover {
  color: var(--red);
}

.task-action .icon {
  width: 14px;
  height: 14px;
}

.task-meta {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #13141e;
  font-size: calc(9px * var(--font-scale, 1));
}

.meta-chip.model {
  color: #c9beff;
  border-color: rgba(154, 131, 255, 0.2);
  background: rgba(154, 131, 255, 0.08);
}

.task-prompt {
  max-width: 790px;
  margin-top: 13px;
  color: var(--text-soft);
  font-size: calc(11px * var(--font-scale, 1));
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-time-line {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 11px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
}

.task-time-line span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-time-line .icon {
  width: 11px;
  height: 11px;
}

.queued-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  padding: 10px 11px;
  color: var(--muted);
  border: 1px dashed rgba(246, 198, 111, 0.2);
  border-radius: 8px;
  background: rgba(246, 198, 111, 0.045);
  font-size: calc(10px * var(--font-scale, 1));
}

.task-progress {
  margin-top: 14px;
}

.task-progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: calc(9px * var(--font-scale, 1));
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #242637;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--cyan));
  transition: width 220ms ease;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 9px;
  margin-top: 15px;
}

.skeleton-card {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(142, 145, 180, 0.11);
  border-radius: 10px;
  background: linear-gradient(110deg, #171823 20%, #202235 38%, #171823 56%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.7s linear infinite;
}

@keyframes skeleton-shimmer {
  to { background-position-x: -200%; }
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0d0e15;
}

.result-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  min-height: 120px;
  padding: 0;
  background: #0a0b10;
}

.result-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(52vh, 520px);
  object-fit: contain;
  transition: transform 240ms ease, opacity 160ms ease;
}

.result-preview:hover img {
  transform: scale(1.035);
}

.result-preview.is-broken {
  display: grid;
  place-items: center;
  padding: 17px;
  color: var(--muted-2);
  font-size: calc(10px * var(--font-scale, 1));
  line-height: 1.5;
  text-align: center;
}

.result-action-row {
  justify-content: space-between;
  gap: 4px;
  padding: 7px 8px;
  border-top: 1px solid rgba(150, 145, 190, 0.1);
}

.result-index {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: calc(9px * var(--font-scale, 1));
}

.result-buttons {
  display: flex;
  gap: 2px;
}

.result-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  color: var(--muted);
  border-radius: 5px;
  background: transparent;
  font-size: calc(9px * var(--font-scale, 1));
  white-space: nowrap;
}

.result-button:hover {
  color: #cbbfff;
  background: var(--accent-soft);
}

.result-button .icon {
  width: 12px;
  height: 12px;
}

.result-button.icon-only {
  padding-right: 4px;
  padding-left: 4px;
}

.result-button.icon-only:hover {
  color: var(--red);
  background: rgba(255, 132, 159, 0.1);
}

.task-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 11px;
  color: #ffb2c2;
  border: 1px solid rgba(255, 132, 159, 0.18);
  border-radius: 8px;
  background: rgba(255, 132, 159, 0.065);
  font-size: calc(10px * var(--font-scale, 1));
  line-height: 1.5;
}

.task-error .icon {
  width: 14px;
  height: 14px;
  color: var(--red);
}

.task-error.charge-risk {
  color: #f8d798;
  border-color: rgba(246, 198, 111, 0.26);
  background: rgba(246, 198, 111, 0.07);
}

.task-error.charge-risk .icon {
  color: var(--yellow);
}

.task-empty {
  display: grid;
  justify-items: center;
  min-height: 330px;
  padding: 70px 20px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  color: #b09fff;
  border: 1px solid rgba(154, 131, 255, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(154, 131, 255, 0.16), rgba(154, 131, 255, 0.025) 62%, transparent 63%);
}

.empty-orbit::before,
.empty-orbit::after {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px rgba(154, 131, 255, 0.75);
  content: "";
}

.empty-orbit::before {
  top: 5px;
  right: 17px;
}

.empty-orbit::after {
  bottom: 9px;
  left: 13px;
  width: 5px;
  height: 5px;
  background: var(--cyan);
}

.empty-orbit .icon {
  width: 28px;
  height: 28px;
  stroke-width: 1.2;
}

.task-empty h3 {
  margin-top: 21px;
  font-size: calc(16px * var(--font-scale, 1));
  font-weight: 650;
}

.task-empty p {
  max-width: 300px;
  margin-top: 8px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale, 1));
  line-height: 1.6;
}

.history-subtitle {
  justify-content: space-between;
  padding: 0 18px 12px;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
}

.history-list {
  display: grid;
  gap: 7px;
  padding: 0 11px 20px;
}

.history-empty {
  padding: 45px 20px;
  color: var(--muted-2);
  font-size: calc(10px * var(--font-scale, 1));
  line-height: 1.6;
  text-align: center;
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 49px minmax(0, 1fr);
  grid-template-areas:
    "thumb main"
    "actions actions";
  align-items: start;
  column-gap: 9px;
  row-gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(17, 18, 27, 0.56);
  transition: border-color 160ms ease, background 160ms ease;
}

.history-item:hover {
  border-color: var(--border);
  background: var(--panel-raised);
}

.history-thumb {
  grid-area: thumb;
  display: grid;
  place-items: center;
  flex: 0 0 49px;
  width: 49px;
  height: 49px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0a0b10;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-thumb-fallback {
  color: var(--muted-2);
}

.history-thumb-fallback .icon {
  width: 18px;
  height: 18px;
}

.history-item-main {
  grid-area: main;
  align-items: flex-start;
  min-width: 0;
}

.history-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.history-model {
  overflow: hidden;
  color: var(--text-soft);
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-detail,
.history-time {
  overflow: hidden;
  color: var(--muted-2);
  font-size: calc(9px * var(--font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-size: calc(8px * var(--font-scale, 1));
}

.history-status.failed {
  color: var(--red);
}

.history-status.uncertain {
  color: var(--yellow);
}

.history-status i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.history-item-actions {
  grid-area: actions;
  position: static;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  opacity: 1;
  transform: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.history-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 4px;
  min-width: 0;
  height: 28px;
  padding: 0 7px;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(10, 11, 16, 0.9);
  font-size: calc(9px * var(--font-scale, 1));
  line-height: 1;
  white-space: nowrap;
}

.history-action-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-action:hover {
  color: #d1c7ff;
  border-color: #504c75;
  background: var(--accent-soft);
}

.history-action.danger:hover {
  color: var(--red);
}

.history-action .icon {
  width: 12px;
  height: 12px;
}

/* 操作按钮已移到历史卡片底部，保持文字和图标同排。 */
.history-item:hover .history-item-actions,
.history-item:focus-within .history-item-actions {
  opacity: 1;
  transform: none;
}

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #171824;
  box-shadow: var(--shadow);
  font-size: calc(10px * var(--font-scale, 1));
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 210ms ease both;
}

.toast.is-leaving {
  animation: toast-out 180ms ease both;
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  color: var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
}

.toast.success .toast-icon {
  color: var(--green);
  background: rgba(115, 223, 171, 0.11);
}

.toast.error .toast-icon {
  color: var(--red);
  background: rgba(255, 132, 159, 0.1);
}

.toast.warning .toast-icon {
  color: var(--yellow);
  background: rgba(246, 198, 111, 0.1);
}

.toast-icon .icon {
  width: 12px;
  height: 12px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(5px); }
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 9, 0.8);
  backdrop-filter: blur(5px);
}

.modal-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, calc(100vw - 32px));
  height: min(920px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid #36374c;
  border-radius: 16px;
  background: #11121b;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.54);
  animation: modal-in 180ms ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.98) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-toolbar {
  justify-content: space-between;
  padding: 17px 19px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-toolbar h2 {
  margin-top: 5px;
  font-size: calc(15px * var(--font-scale, 1));
}

.modal-image-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: clamp(14px, 2.4vw, 32px);
  background: #090a10;
  overscroll-behavior: contain;
}

.modal-image-wrap img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-footer {
  justify-content: space-between;
  gap: 12px;
  padding: 13px 19px;
  border-top: 1px solid var(--border-soft);
}

.modal-footer > span {
  overflow: hidden;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 0 10px;
  color: #d5ccff;
  border: 1px solid rgba(154, 131, 255, 0.3);
  border-radius: 7px;
  background: rgba(154, 131, 255, 0.1);
  font-size: calc(10px * var(--font-scale, 1));
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: rgba(154, 131, 255, 0.65);
  background: rgba(154, 131, 255, 0.17);
}

.secondary-button .icon {
  width: 13px;
  height: 13px;
}

@media (max-width: 1080px) {
  .app-grid {
    grid-template-columns: minmax(250px, 278px) minmax(410px, 1fr) minmax(270px, 320px);
  }

  .workspace {
    padding-right: 25px;
    padding-left: 25px;
  }

  .topbar-note,
  .keyboard-tip {
    display: none;
  }
}

@media (max-width: 950px) and (min-width: 821px) {
  .app-grid {
    grid-template-columns: minmax(240px, 260px) minmax(390px, 1fr) minmax(220px, 250px);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100%;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 65px;
    padding: 0 14px;
  }

  .brand-lockup,
  .topbar-actions {
    min-width: auto;
  }

  .topbar-center {
    display: none;
  }

  .app-grid {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .settings-panel,
  .history-panel,
  .workspace {
    overflow: visible;
    border: 0;
  }

  .settings-panel {
    order: 1;
  }

  .workspace {
    order: 2;
    padding: 28px 16px 45px;
  }

  .history-panel {
    order: 3;
    padding-bottom: 25px;
  }

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

  .settings-heading,
  .history-heading {
    padding-right: 16px;
    padding-left: 16px;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card:nth-child(4),
  .stat-card:nth-child(5) {
    grid-column: span 1;
  }
}

@media (max-width: 490px) {
  .save-default-label {
    display: none;
  }

  .save-default-button {
    width: 32px;
    padding-right: 0;
    padding-left: 0;
  }

  .brand-title {
    font-size: calc(13px * var(--font-scale, 1));
  }

  .brand-subtitle {
    font-size: calc(8px * var(--font-scale, 1));
  }

  .year-badge {
    display: none;
  }

  .workspace-header {
    align-items: flex-start;
  }

  .workspace-summary {
    display: none;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row .stat-card:first-child {
    grid-column: span 2;
  }

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

  .modal {
    padding: 12px;
  }

  .modal-dialog {
    width: 100%;
    height: min(650px, 92vh);
  }

  .modal-image-wrap {
    padding: 12px;
  }
}

/* 亮色主题：保持浅背景上的文字、边框和控件对比度。 */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb;
  --bg-soft: #e9edf6;
  --panel: #ffffff;
  --panel-raised: #f7f8fc;
  --panel-hover: #eef1f8;
  --border: #d5dbe8;
  --border-soft: rgba(53, 64, 91, 0.15);
  --text: #192033;
  --text-soft: #3f4a60;
  --muted: #667085;
  --muted-2: #8791a5;
  --accent: #6547d9;
  --accent-strong: #5135c1;
  --accent-soft: rgba(101, 71, 217, 0.1);
  --cyan: #147ca7;
  --green: #087950;
  --yellow: #9b6400;
  --red: #c33f62;
  --shadow: 0 24px 72px rgba(48, 61, 93, 0.16);
}

html[data-theme="light"] body {
  background: var(--bg);
}

html[data-theme="light"] .app-shell {
  background:
    radial-gradient(circle at 44% -30%, rgba(105, 82, 205, 0.1), transparent 34%),
    radial-gradient(circle at 100% 70%, rgba(53, 91, 150, 0.06), transparent 30%),
    var(--bg);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.78);
}

html[data-theme="light"] .workspace {
  background:
    linear-gradient(180deg, rgba(123, 102, 217, 0.06), transparent 30%),
    rgba(243, 245, 251, 0.68);
}

html[data-theme="light"] .text-input,
html[data-theme="light"] .prompt-input,
html[data-theme="light"] .choice-button,
html[data-theme="light"] .drop-zone {
  color: var(--text);
  border-color: var(--border);
  background-color: #ffffff;
}

html[data-theme="light"] .choice-button.is-selected {
  color: #2f216f;
  border-color: #6547d9;
  background: linear-gradient(180deg, #eee9ff 0%, #ded5ff 100%);
  box-shadow: inset 0 0 0 1px rgba(101, 71, 217, 0.18), 0 0 0 2px rgba(101, 71, 217, 0.13);
  font-weight: 700;
}

html[data-theme="light"] .choice-button.is-selected:hover {
  color: #241458;
  border-color: #5135c1;
  background: linear-gradient(180deg, #e7e0ff 0%, #d4c9ff 100%);
}

html[data-theme="light"] .text-input::placeholder,
html[data-theme="light"] .prompt-input::placeholder {
  color: #9aa3b4;
}

html[data-theme="light"] .text-input:hover,
html[data-theme="light"] .prompt-input:hover {
  border-color: #aeb8ca;
}

html[data-theme="light"] .text-input:focus,
html[data-theme="light"] .prompt-input:focus {
  border-color: rgba(101, 71, 217, 0.65);
  background-color: #ffffff;
}

html[data-theme="light"] .icon-button,
html[data-theme="light"] kbd,
html[data-theme="light"] .fake-check,
html[data-theme="light"] .drop-count,
html[data-theme="light"] .history-action {
  background: #f7f8fc;
}

html[data-theme="light"] .save-default-button {
  color: #5940bd;
  border-color: rgba(101, 71, 217, 0.24);
  background: rgba(101, 71, 217, 0.08);
}

html[data-theme="light"] .save-default-button:hover {
  color: #40269f;
  border-color: #806bd4;
  background: rgba(101, 71, 217, 0.14);
}

html[data-theme="light"] .icon-button:hover,
html[data-theme="light"] .input-action:hover,
html[data-theme="light"] .history-item:hover .history-action {
  background: var(--panel-hover);
}

html[data-theme="light"] .mode-pill {
  color: #5940bd;
  background: rgba(101, 71, 217, 0.08);
}

html[data-theme="light"] .text-button {
  color: #5d43c4;
}

html[data-theme="light"] .text-button:hover {
  color: #40269f;
}

html[data-theme="light"] .drop-zone:hover,
html[data-theme="light"] .drop-zone.is-dragover {
  background: rgba(101, 71, 217, 0.08);
}

html[data-theme="light"] .reference-thumb,
html[data-theme="light"] .history-thumb,
html[data-theme="light"] .result-preview {
  background: #eef1f7;
}

html[data-theme="light"] .reference-remove {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(28, 35, 50, 0.72);
}

html[data-theme="light"] .stat-card,
html[data-theme="light"] .task-card,
html[data-theme="light"] .result-card {
  background: #ffffff;
}

html[data-theme="light"] .summary-number,
html[data-theme="light"] .meta-chip.model {
  color: #5940bd;
}

html[data-theme="light"] .meta-chip {
  background: #f4f6fb;
}

html[data-theme="light"] .task-card.uncertain {
  background: linear-gradient(135deg, #fffaf0, #ffffff);
}

html[data-theme="light"] .progress-track {
  background: #dce2ed;
}

html[data-theme="light"] .skeleton-card {
  border-color: rgba(73, 86, 116, 0.12);
  background: linear-gradient(110deg, #edf0f6 20%, #dfe5ef 38%, #edf0f6 56%);
}

html[data-theme="light"] .task-error {
  color: #a52f4f;
  border-color: rgba(195, 63, 98, 0.2);
  background: rgba(195, 63, 98, 0.06);
}

html[data-theme="light"] .task-error.charge-risk {
  color: #805100;
  border-color: rgba(155, 100, 0, 0.22);
  background: rgba(155, 100, 0, 0.07);
}

html[data-theme="light"] .history-item {
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .history-action:hover {
  color: #4d35ad;
  border-color: #a69bd1;
}

html[data-theme="light"] .modal-backdrop {
  background: rgba(21, 28, 44, 0.52);
}

html[data-theme="light"] .modal-dialog {
  border-color: #cbd3e2;
  background: #ffffff;
}

html[data-theme="light"] .modal-image-wrap {
  background: #f2f4f8;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #c5ccda;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #aeb8ca;
}
