:root {
  color-scheme: dark;
  --bg: #111310;
  --surface: #181b17;
  --surface-2: #20241f;
  --line: #343931;
  --text: #f4f1e9;
  --muted: #aaa99f;
  --accent: #ff6845;
  --accent-soft: rgba(255, 104, 69, .12);
  --success: #69c58a;
  --text-body: 16px;
  --text-secondary: 13px;
  --text-caption: 12px;
  --text-title: 16px;
  --text-button: 15px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); font-size: var(--text-body); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.task-nav {
  height: 64px;
  padding: 0 clamp(18px, 3vw, 52px);
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 19, 16, .96);
}
.task-brand { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; color: #111310; background: #f5f2ea; font: 800 22px/1 Georgia, serif; }
.task-brand strong, .task-brand small { display: block; letter-spacing: 0; }
.task-brand strong { font-size: 17px; }
.task-brand small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
.nav-meta { margin-left: auto; display: flex; gap: 20px; color: var(--muted); font-size: var(--text-caption); }
.nav-meta span { display: inline-flex; align-items: center; gap: 6px; }
.nav-meta svg { width: 16px; height: 16px; color: var(--success); }
.back-link { min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.back-link:hover { border-color: var(--muted); background: var(--surface); }
.back-link svg { width: 16px; height: 16px; }

.task-nav-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-caption); font-weight: 700; }
.task-nav-switch select { height: 38px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 2px; color: var(--text); background: var(--surface); font-size: 13px; }
.task-shell { height: calc(100svh - 110px); min-height: 610px; display: grid; grid-template-columns: minmax(500px, .95fr) minmax(500px, 1.05fr); }
.task-copy { min-height: 0; padding: 14px clamp(24px, 2.6vw, 42px) 8px; overflow-y: auto; scrollbar-width: thin; border-right: 1px solid var(--line); }
.task-heading { max-width: 760px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 1.6px; }
h1 { max-width: 720px; margin: 0; font: 600 38px/1.1 Georgia, "Songti SC", serif; letter-spacing: 0; }
.task-lead { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.task-points { display: none; }
.task-points span { min-height: 34px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); color: #d8d5cb; font-size: var(--text-secondary); }
.task-points svg { width: 14px; height: 14px; color: var(--accent); }

.brief-form { max-width: 760px; }
.brief-heading { padding-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); }
.brief-heading span { font-size: var(--text-title); font-weight: 800; }
.brief-heading small { color: var(--muted); font-size: var(--text-caption); }
.brief-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; padding: 7px 0; }
.brief-field { display: grid; gap: 4px; }
.brief-field.wide { grid-column: 1 / -1; }
.brief-field label { color: #dad7cf; font-size: var(--text-secondary); font-weight: 700; }
.brief-field label span { color: var(--muted); font-weight: 500; }
.brief-field input, .brief-field select, .brief-field textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: 0;
  color: var(--text);
  background: #121511;
  font-size: 14px;
}
.brief-field textarea { min-height: 58px; resize: vertical; line-height: 1.45; }
.brief-field input:focus, .brief-field select:focus, .brief-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.prompt-preview { margin-top: 2px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); }
.prompt-preview > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.prompt-preview span { color: var(--muted); font-size: 10px; font-weight: 700; }
.prompt-preview button { padding: 3px 0; display: inline-flex; align-items: center; gap: 5px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.prompt-preview button:hover { color: var(--text); }
.prompt-preview svg { width: 13px; height: 13px; }
.prompt-preview output { max-height: 68px; margin-top: 6px; display: block; overflow: auto; color: #e4e0d6; font-size: 12px; line-height: 1.6; }
.task-presets, .task-source-panel, .task-prompt-editor { margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface-2); }
.task-source-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }
.task-source-panel .task-panel-heading { grid-column: 1 / -1; margin: 0; }
.task-source-panel .task-upload { min-width: 0; }
.task-presets { margin: 7px 0 7px; display: flex; align-items: center; gap: 10px; }
.task-presets .task-panel-heading { flex: 0 0 auto; margin: 0; }
.task-presets .task-panel-heading small { display: none; }
.task-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.task-panel-heading > span { font-size: var(--text-secondary); font-weight: 800; }
.task-panel-heading small, .task-prompt-hint { color: var(--muted); font-size: var(--text-caption); }
.task-preset-list { display: flex; flex-wrap: wrap; gap: 6px; }
.task-preset-button { min-height: 29px; padding: 0 9px; border: 1px solid #4a5148; border-radius: 4px; color: #d8d5cb; background: #141713; cursor: pointer; font-size: var(--text-secondary); font-weight: 700; }
.task-preset-button:hover, .task-preset-button.is-active { border-color: var(--accent); color: #fff; background: var(--accent-soft); }
.task-upload { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 5px 10px; border: 1px dashed #596055; color: var(--text); cursor: pointer; }
.task-upload:hover, .task-upload.is-dragover { border-color: var(--accent); background: rgba(255, 104, 69, .08); }
.task-upload > svg { width: 20px; height: 20px; color: var(--accent); flex: 0 0 auto; }
.task-upload span { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.task-upload strong { font-size: 14px; }
.task-upload small { color: var(--muted); font-size: var(--text-caption); }
.task-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.task-source-previews { display: flex; align-items: center; gap: 5px; }
.task-source-preview { position: relative; width: 54px; height: 54px; flex: 0 0 54px; overflow: hidden; border: 1px solid var(--line); background: #10120f; }
.task-source-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.task-source-preview span { position: absolute; left: 5px; bottom: 5px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 2px; color: #111310; background: rgba(245,242,234,.92); font-size: 11px; font-weight: 900; }
.task-source-preview button { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: rgba(12,14,11,.78); cursor: pointer; }
.task-source-preview button svg { width: 15px; height: 15px; }
.task-prompt-editor { padding: 0; }
.task-prompt-editor summary { min-height: 34px; padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; font-size: var(--text-secondary); font-weight: 700; }
.task-prompt-editor summary::-webkit-details-marker { display: none; }
.task-prompt-editor summary svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.task-prompt-editor[open] summary svg { transform: rotate(180deg); }
.task-prompt-content { padding: 0 10px 10px; }
.task-prompt-editor textarea { width: 100%; min-height: 104px; padding: 10px 12px; resize: vertical; border: 1px solid var(--line); outline: 0; color: var(--text); background: #121511; font-size: 15px; line-height: 1.6; }
.task-prompt-editor textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.task-panel-heading button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: var(--text-caption); }
.task-panel-heading button:hover { color: var(--text); }
.task-panel-heading button svg { width: 13px; height: 13px; }
.task-prompt-hint { display: block; margin-top: 6px; }
.task-auth { position: fixed; z-index: 20; top: 50%; left: 50%; width: min(360px, calc(100vw - 32px)); margin: 0; padding: 20px; display: grid; gap: 10px; transform: translate(-50%, -50%); border: 1px solid rgba(255, 104, 69, .55); background: #20241f; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.task-auth:not([hidden])::before { content: ''; position: fixed; z-index: -1; inset: -100vh; background: rgba(0,0,0,.45); }
.task-auth[hidden], .visual-case[hidden] { display: none; }
.task-auth strong { font-size: 14px; }
.task-auth .task-auth-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; min-height: 28px; padding: 0; display: grid; place-items: center; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.task-auth-close svg { width: 18px; height: 18px; }
.task-auth > a { color: var(--muted); font-size: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.task-auth input { min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); color: var(--text); background: #121511; outline: 0; }
.task-auth button { min-height: 38px; border: 1px solid var(--accent); color: #fff; background: var(--accent); cursor: pointer; font-weight: 800; }
.task-auth p { min-height: 15px; margin: 0; color: #ff9982; font-size: var(--text-secondary); }
.task-generation-status { min-height: 17px; margin: 5px 0 0; color: var(--muted); font-size: var(--text-secondary); }
.task-generation-status:empty { display: none; }
.task-generation-status.is-error { color: #ff9982; }
.start-button.is-loading { opacity: .7; cursor: wait; }
.start-button { width: 100%; min-height: 46px; margin-top: 7px; padding: 0 18px; display: grid; grid-template-columns: 20px 1fr 20px; align-items: center; border: 1px solid var(--accent); border-radius: 2px; color: #fff; background: var(--accent); cursor: pointer; font-size: var(--text-button); font-weight: 800; }
.start-button:hover { filter: brightness(1.07); }
.start-button svg { width: 19px; height: 19px; }
.price-note { margin: 3px 0 0; display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: var(--text-caption); }
.price-note strong { color: var(--success); }

.task-visual { min-width: 0; min-height: 0; padding: 18px; display: grid; grid-template-rows: minmax(0, 1fr); background: #0d0f0c; }
.task-visual figure { min-height: 0; margin: 0; position: relative; overflow: hidden; background: var(--surface); }
.task-visual figure::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 9, 7, .88), transparent 45%); pointer-events: none; }
.task-visual img { width: 100%; height: 100%; display: block; object-fit: contain; }
body[data-task="old-photo-restore"] .task-visual img { object-fit: contain; background: #171a18; }
.task-visual figcaption { position: absolute; z-index: 1; left: 24px; right: 24px; bottom: 22px; }
.task-visual figcaption span, .task-visual figcaption strong { display: block; letter-spacing: 0; }
.task-visual figcaption span { color: var(--accent); font-size: 9px; font-weight: 800; }
.task-visual figcaption strong { margin-top: 6px; font: 600 clamp(23px, 2.3vw, 38px)/1.12 Georgia, "Songti SC", serif; }
.visual-source { display: inline-block; margin-top: 8px; color: #dedbd2; font-size: 11px; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; }
.visual-source[hidden] { display: none; }
.visual-case { position: absolute; z-index: 2; top: 20px; right: 20px; width: min(270px, 42%); padding: 12px 13px; border: 1px solid rgba(244,241,233,.2); background: rgba(13,15,12,.74); backdrop-filter: blur(12px); }
.visual-case > span, .visual-case strong, .visual-case p { display: block; letter-spacing: 0; }
.visual-case > span { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.visual-case > span svg { width: 13px; height: 13px; }
.visual-case strong { margin-top: 7px; color: var(--text); font-size: 14px; }
.visual-case p { max-height: 54px; margin: 5px 0 0; overflow: auto; color: #d0cec5; font-size: 10px; line-height: 1.55; }
.task-rule { display: none; }
.task-rule > span { display: none; }
.task-rule p { min-width: 0; margin: 0; padding: 13px 15px; border-right: 1px solid var(--line); }
.task-rule p:last-child { border-right: 0; }
.task-rule b, .task-rule small { display: block; letter-spacing: 0; }
.task-rule b { font-size: 13px; }
.task-rule small { margin-top: 4px; color: var(--muted); font-size: var(--text-caption); line-height: 1.45; }
.result-download { position: absolute; z-index: 3; right: 20px; bottom: 20px; min-height: 42px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.5); color: #111310; background: #f5f2ea; font-size: 13px; font-weight: 800; }
.result-download[hidden] { display: none; }
.result-download svg { width: 17px; height: 17px; }

.task-footer { min-height: 46px; padding: 0 clamp(18px, 3vw, 52px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-caption); }
.task-footer nav { display: flex; gap: 18px; }
.task-footer a:hover { color: var(--text); }
.task-toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 10px 14px; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; color: #111310; background: #f5f2ea; font-size: 12px; font-weight: 700; transition: opacity .18s, transform .18s; }
.task-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1040px) {
  .task-shell { grid-template-columns: 1fr 1fr; }
  .task-copy { padding: 18px 22px; }
  .task-visual { padding: 14px; }
  .nav-meta { display: none; }
  .task-nav-switch > span { display: none; }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .eyebrow, .task-lead { display: none; }
  .task-source-panel .task-panel-heading small { display: none; }
  .task-source-preview { width: 42px; height: 42px; flex-basis: 42px; }
}

@media (max-width: 760px) {
  .task-nav { height: 62px; padding: 0 14px; }
  .brand-mark { width: 36px; height: 36px; font-size: 18px; }
  .task-brand strong { font-size: 15px; }
  .task-brand small { display: none; }
  .task-nav-switch { margin-left: auto; }
  .task-nav-switch select { max-width: 116px; }
  .back-link { margin-left: auto; padding: 0 10px; }
  .task-shell { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .task-copy { order: 1; overflow: visible; padding: 20px 16px 24px; border-right: 0; }
  h1 { font-size: 42px; }
  .task-lead { font-size: 14px; }
  .task-presets { flex-wrap: wrap; }
  .task-source-panel { display: block; }
  .task-source-panel .task-panel-heading { margin-bottom: 6px; }
  .task-source-previews { margin-top: 6px; }
  .brief-fields { grid-template-columns: 1fr; }
  .brief-field.wide { grid-column: auto; }
  .brief-field input, .brief-field select, .brief-field textarea { font-size: 16px; }
  .task-prompt-editor textarea, .task-auth input { font-size: 16px; }
  .task-source-preview { width: 54px; flex-basis: 54px; }
  .prompt-preview output { max-height: 100px; }
  .price-note { align-items: flex-start; flex-direction: column; gap: 3px; }
  .task-visual { order: 0; height: min(36vh, 280px); padding: 0; display: block; }
  .task-visual figure { height: 100%; }
  .task-visual img { min-height: 0; }
  .visual-case { top: 14px; right: 14px; width: min(250px, 64%); padding: 10px; }
  .visual-case p { max-height: 43px; }
  .result-download { right: 14px; bottom: 14px; }
  .task-rule { display: none; }
  .task-footer { padding: 14px 16px; align-items: flex-start; flex-direction: column; }
  .task-footer nav { gap: 12px; flex-wrap: wrap; }
}

@media (max-width: 470px) {
  .back-link { width: 40px; padding: 0; justify-content: center; font-size: 0; }
  .task-nav { gap: 8px; }
  .task-nav-switch select { max-width: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
