
    :root {
      color-scheme: light;
      --canvas: #f4f6fa;
      --surface: #ffffff;
      --surface-soft: #f8fafc;
      --surface-blue: #fffaf1;
      --line: #eaedf3;
      --line-strong: #dbe2ec;
      --text: #1e2733;
      --muted: #5c6573;
      --muted-2: #8c93a2;
      --brand: #30456f;
      --brand-dark: #253757;
      --brand-soft: #eef2ff;
      --success: #556273;
      --success-soft: #f1f4f8;
      --warning: #b08f35;
      --warning-soft: #fff8e8;
      --sidebar: #131c2a;
      --sidebar-muted: #9ba2ac;
      --shadow: 0 12px 32px rgba(35, 46, 65, 0.10);
      --status-green: #798899;
      --radius-xl: 20px;
      --radius-lg: 16px;
      --radius-md: 12px;
      --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-width: 1040px;
      height: 100vh;
      overflow: hidden;
      background: var(--canvas);
      color: var(--text);
      font-family: var(--font);
      font-size: 14px;
      -webkit-font-smoothing: antialiased;
    }

    button,
    textarea,
    input { font: inherit; }

    button { cursor: pointer; }

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

    .sidebar {
      position: sticky;
      top: 0;
      display: flex;
      flex-direction: column;
      height: 100vh;
      padding: 24px 16px 18px;
      background: var(--sidebar);
      color: var(--text);
    }

    .brand {
      position: relative;
      display: flex;
      align-items: center;
      padding: 0 10px 26px;
    }

    .brand-btn {
      width: 100%;
      border: 0;
      border-radius: var(--radius-md);
      padding: 0;
      background: transparent;
      color: inherit;
      text-align: left;
      cursor: pointer;
      transition: background 150ms ease;
    }

    .brand-btn:hover,
    .brand-btn:focus-visible {
      background: rgba(255, 255, 255, 0.08);
      outline: none;
    }

    .brand-copy strong,
    .brand-copy span { display: block; }

    .brand-copy strong { font-size: 16px; letter-spacing: 0.01em; }

    .brand-copy span {
      margin-top: 2px;
      color: var(--sidebar-muted);
      font-size: 11px;
    }

    .page-toolbar {
      display: none;
    }

    .nav-label {
      margin: 8px 12px 9px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.12em;
    }

    .nav-list {
      display: grid;
      gap: 5px;
    }

    .nav-item {
      display: flex;
      width: 100%;
      align-items: center;
      gap: 11px;
      padding: 11px 12px;
      border: 0;
      border-radius: var(--radius-md);
      background: transparent;
      color: #bcc5d2;
      text-align: left;
      transition: background 150ms ease, color 150ms ease;
    }

    .nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
    .nav-item.active { background: rgba(48, 69, 111, 0.18); color: #fff; }

    .nav-icon {
      display: grid;
      width: 21px;
      height: 21px;
      flex: 0 0 21px;
      place-items: center;
    }

    .nav-icon svg { width: 19px; height: 19px; }

    .main-shell {
      min-width: 0;
      height: 100vh;
      overflow: hidden;
      background: #f5f7fb;
      --surface: #ffffff;
      --surface-soft: #f3f6fc;
      --surface-blue: #fff9ee;
      --line: #dde5f1;
      --line-strong: #d0dced;
      --text: #182338;
      --muted: #516178;
      --muted-2: #7f8fa5;
      --brand: #284e7a;
      --brand-dark: #1f3f67;
      --brand-soft: #e9f0ff;
      --success: #4d6072;
      --success-soft: #ecf2fb;
      --warning: #b1872b;
      --warning-soft: #fff4da;
      --shadow: 0 12px 30px rgba(25, 39, 65, 0.10);
      --status-green: #8b9aae;
    }

    .page {
      display: none;
      max-width: 1540px;
      margin: 0 auto;
      height: 100%;
      padding: 18px 24px 16px;
      overflow: hidden;
    }

    .page.active {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .page-heading {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 24px;
      margin-bottom: 12px;
    }

    .page-heading h1 {
      margin: 0;
      font-size: clamp(24px, 2vw, 30px);
      line-height: 1.2;
      letter-spacing: -0.03em;
    }

    .page-heading p {
      margin: 7px 0 0;
      color: var(--muted);
      font-size: 13px;
    }

    .draft-state {
      display: flex;
      align-items: center;
      gap: 7px;
      color: var(--muted);
      font-size: 12px;
    }

    .draft-state::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 999px;
      background: var(--status-green);
    }

    .workspace-grid {
      display: grid;
      grid-template-columns: minmax(280px, 0.82fr) minmax(390px, 1.35fr) minmax(270px, 0.76fr);
      gap: 18px;
      align-items: stretch;
      flex: 1;
      min-height: 0;
    }

    .panel {
      border: 1px solid var(--line);
      border-radius: var(--radius-xl);
      background: var(--surface);
      box-shadow: var(--shadow);
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px 12px;
      border-bottom: 1px solid var(--line);
    }

    .panel-title {
      display: flex;
      align-items: center;
      gap: 9px;
      font-size: 14px;
      font-weight: 700;
    }

    .panel-note {
      color: var(--muted);
      font-size: 11px;
      white-space: nowrap;
    }

    .step-number {
      display: grid;
      width: 24px;
      height: 24px;
      place-items: center;
      border-radius: var(--radius-md);
      background: var(--brand-soft);
      color: var(--brand);
      font-size: 12px;
      font-weight: 800;
    }

    .subject-panel { overflow: hidden; }

    .portrait-wrap {
      flex: 1;
      min-height: 0;
      padding: 12px 10px 8px;
      background: var(--surface-soft);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .portrait-stage {
      position: relative;
      display: grid;
      max-width: 260px;
      aspect-ratio: 9 / 13;
      margin: 0 auto;
      overflow: hidden;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: #ffffff;
      padding: 12px;
    }

    .person-placeholder {
      width: 100%;
      height: 100%;
      border: 1px dashed #d7e0eb;
      border-radius: calc(var(--radius-lg) - 4px);
      background: #fbfdff;
      overflow: hidden;
    }

    .portrait-stage img {
      position: absolute;
      z-index: 2;
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: calc(var(--radius-md) - 2px);
    }

    .portrait-badge {
      margin: 8px auto 0;
      text-align: center;
      color: var(--muted-2);
      font-size: 11px;
      letter-spacing: 0.02em;
    }

    .subject-actions {
      display: grid;
      gap: 10px;
      padding: 12px 14px 12px;
      border-top: 1px solid var(--line);
    }

    .button {
      display: inline-flex;
      min-height: 42px;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: 0;
      border-radius: var(--radius-md);
      padding: 0 15px;
      font-weight: 700;
      transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
    }

    .button:active { transform: translateY(1px); }
    .button.primary { background: var(--brand); color: #fff; }
    .button.primary:hover { background: var(--brand-dark); }
    .button.secondary { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
    .button.secondary:hover { background: var(--surface-soft); }
    .button.ghost { min-height: 34px; padding: 0 10px; background: transparent; color: var(--brand); font-size: 12px; }
    .button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

    .voice-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 13px;
      border-radius: var(--radius-md);
      background: var(--success-soft);
    }

    .voice-summary {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
    }

    .voice-summary .round-icon {
      display: grid;
      width: 30px;
      height: 30px;
      flex: 0 0 30px;
      place-items: center;
      border-radius: 999px;
      background: #edf0f6;
      color: var(--success);
    }

    .voice-summary strong,
    .voice-summary span { display: block; }
    .voice-summary strong { color: var(--text); font-size: 11px; }
    .voice-summary span { margin-top: 2px; color: var(--muted); font-size: 10px; }

    .script-panel {
      display: flex;
      min-height: 0;
      flex-direction: column;
      overflow: hidden;
    }

    .script-editor {
      width: 100%;
      min-height: 0;
      flex: 1;
      resize: none;
      border: 0;
      outline: 0;
      padding: 16px;
      background: var(--surface);
      color: var(--text);
      font-size: 16px;
      line-height: 1.85;
    }

    .script-toolbar {
      min-height: 0;
      border-top: 1px solid var(--line);
      padding: 8px 14px 0;
      color: var(--muted);
    }

    .script-editor::placeholder { color: #98a1ae; }

    .script-footer {
      padding: 10px 14px 12px;
      border-top: 1px solid var(--line);
      background: var(--surface-soft);
    }

    .script-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      color: var(--muted);
      font-size: 11px;
    }

    .duration-meter {
      height: 5px;
      margin-top: 10px;
      overflow: hidden;
      border-radius: 999px;
      background: #ebeff6;
    }

    .duration-fill {
      width: 0;
      height: 100%;
      border-radius: inherit;
      background: var(--brand);
      transition: width 180ms ease, background 180ms ease;
    }

    .upload-hint {
      color: var(--muted-2);
      font-size: 11px;
      line-height: 1.45;
    }

    .retention-note {
      margin: 0;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    .settings-panel { align-self: stretch; overflow: hidden; }

    .settings-body { display: grid; gap: 12px; padding: 14px; min-height: 0; }

    .setting-group { display: grid; gap: 9px; }

    .setting-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: var(--text);
      font-size: 12px;
      font-weight: 700;
    }

    .setting-label span { color: var(--muted); font-size: 10px; font-weight: 500; }

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

    .mode-card {
      position: relative;
      display: grid;
      grid-template-columns: 18px 1fr auto;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 12px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-md);
      background: var(--surface);
      color: var(--text);
      text-align: left;
    }

    .mode-card.active { border-color: var(--warning); background: var(--surface-blue); box-shadow: 0 0 0 2px rgba(176, 143, 53, 0.20); }
    .mode-card[disabled] { cursor: not-allowed; opacity: 0.58; }

    .radio-mark {
      width: 17px;
      height: 17px;
      border: 1.5px solid #d2d9e3;
      border-radius: 999px;
      background: var(--surface);
    }

    .mode-card.active .radio-mark { border: 5px solid var(--brand); }

    .mode-copy strong,
    .mode-copy span { display: block; }
    .mode-copy strong { font-size: 12px; }
    .mode-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; }

    .mode-badge {
      padding: 4px 6px;
      border-radius: var(--radius-md);
      background: #f8f2e1;
      color: #806c3a;
      font-size: 9px;
      font-weight: 700;
    }

    .summary-card {
      display: grid;
      gap: 10px;
      padding: 13px;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--surface-soft);
    }

    .summary-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      color: var(--muted);
      font-size: 11px;
    }

    .summary-row strong { color: var(--text); font-size: 11px; }

    .generate-wrap {
      display: grid;
      gap: 9px;
      padding-top: 2px;
    }

    .generate-wrap .button { min-height: 48px; font-size: 14px; }

    .prototype-tip {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      margin-top: 10px;
      padding: 11px 13px;
      border: 1px solid #f0e1b7;
      border-radius: var(--radius-md);
      background: var(--warning-soft);
      color: var(--warning);
      font-size: 11px;
      line-height: 1.55;
    }

    .history-panel { overflow: hidden; }

    .history-tools {
      display: flex;
      gap: 10px;
      padding: 16px 18px;
      border-bottom: 1px solid var(--line);
      background: var(--surface-soft);
    }

    .search-input {
      width: min(360px, 100%);
      height: 39px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-md);
      padding: 0 13px;
      outline: 0;
      background: var(--surface);
    }

    .history-table { width: 100%; border-collapse: collapse; }
    .history-table th,
    .history-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: left; }
    .history-table th { color: var(--muted); background: var(--surface); font-size: 10px; letter-spacing: 0.06em; }
    .history-table td { font-size: 12px; }
    .history-table tr:last-child td { border-bottom: 0; }

    .thumb {
      display: inline-grid;
      width: 42px;
      height: 56px;
      margin-right: 10px;
      place-items: center;
      vertical-align: middle;
      border-radius: var(--radius-md);
      background: linear-gradient(145deg, #edf1f7, #f3f0eb);
      color: var(--muted);
      font-size: 9px;
    }

    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border-radius: 999px;
      background: var(--success-soft);
      color: var(--success);
      font-size: 10px;
      font-weight: 700;
    }

    .toast {
      position: fixed;
      z-index: 10;
      right: 24px;
      bottom: 24px;
      max-width: 340px;
      padding: 12px 15px;
      border-radius: var(--radius-md);
      border: none;
      background: var(--sidebar);
      color: #fff;
      box-shadow: 0 16px 40px rgba(30, 44, 58, 0.25);
      font-size: 12px;
      opacity: 0;
      transform: translateY(8px);
      pointer-events: none;
      transition: opacity 160ms ease, transform 160ms ease;
    }

    .toast.show { opacity: 1; transform: translateY(0); }

    .file-input { display: none; }

    @media (max-width: 1220px) {
      body { min-width: 960px; }
      .app-shell { grid-template-columns: 196px minmax(0, 1fr); }
      .workspace-grid { grid-template-columns: minmax(250px, 0.8fr) minmax(350px, 1.25fr); }
      .page { padding: 14px 16px 14px; }
      .page-heading { gap: 16px; margin-bottom: 10px; }
      .panel-head { padding: 12px 14px 10px; }
      .portrait-wrap { padding: 10px; }
      .subject-actions { padding: 8px 12px 10px; }
      .settings-body { grid-template-columns: 1fr 1fr 1fr; align-items: end; }
      .settings-panel { grid-column: 1 / -1; }
      .generate-wrap { align-self: stretch; }
    }
  
