:root {
  color-scheme: dark;
  --bg: #06070a;
  --bg-soft: #090a0f;
  --panel: #0d0e14;
  --panel-2: #11121a;
  --panel-3: #151622;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(139, 92, 246, 0.34);
  --text: #f5f3ff;
  --muted: #9a98a8;
  --subtle: #666473;
  --violet: #8b5cf6;
  --violet-bright: #a78bfa;
  --violet-dark: #5b21b6;
  --cyan: #67e8f9;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --sidebar: 224px;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 8%, rgba(91, 33, 182, 0.14), transparent 28rem),
    linear-gradient(180deg, #08090d 0%, #050609 100%);
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
::selection { background: rgba(139, 92, 246, 0.44); }

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: rgba(7, 8, 12, 0.96);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.06em;
  background: linear-gradient(145deg, #a78bfa, #6d28d9 72%);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.34);
}

.brand-copy { min-width: 0; }
.brand-name { font-size: 13px; font-weight: 900; letter-spacing: 0.14em; }
.brand-sub { margin-top: 2px; color: var(--subtle); font-size: 8px; letter-spacing: 0.2em; }

.sidebar-scroll { flex: 1; overflow: auto; padding: 18px 10px; }
.nav-label {
  padding: 0 10px 8px;
  color: #555361;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-link {
  min-height: 42px;
  margin: 3px 0;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #aaa8b6;
  font-size: 13px;
  font-weight: 620;
  transition: 160ms ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.035); border-color: var(--line); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139,92,246,.15), rgba(139,92,246,.035));
  border-color: rgba(139, 92, 246, 0.32);
  box-shadow: inset 2px 0 0 var(--violet);
}
.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.09);
  color: var(--violet-bright);
  font-size: 10px;
  font-weight: 900;
}
.nav-link.active .nav-icon { background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.34); }

.sidebar-status {
  margin: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,255,255,.025), rgba(139,92,246,.035));
}
.status-kicker { color: var(--subtle); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.status-line { display: flex; align-items: center; gap: 8px; margin-top: 7px; color: #c9c6d2; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px currentColor; }
.status-dot.ok { color: var(--green); background: var(--green); }
.status-dot.warn { color: var(--amber); background: var(--amber); }
.status-dot.bad { color: var(--red); background: var(--red); }

.main-shell { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 66px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(7, 8, 12, 0.87);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--subtle); font-size: 11px; letter-spacing: .09em; }
.breadcrumb strong { color: #ddd9e8; font-weight: 750; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; color: #858391; font-size: 11px; }
.save-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(52,211,153,.5); }

.content { width: min(1260px, 100%); margin: 0 auto; padding: 34px 30px 70px; }
.eyebrow { color: var(--violet-bright); font-size: 9px; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.page-heading { margin: 8px 0 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.05; letter-spacing: -.045em; }
.page-intro { max-width: 760px; margin: 13px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17,18,26,.94), rgba(10,11,16,.96));
  box-shadow: var(--shadow);
}
.panel-head { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 22px; }
.panel-title { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-note { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(251,191,36,.22);
  border-radius: 12px;
  background: rgba(120, 76, 10, 0.12);
  color: #d5c7a8;
  font-size: 12px;
  line-height: 1.65;
}
.notice.info { border-color: rgba(103,232,249,.18); background: rgba(8,91,109,.1); color: #b9dfe5; }
.notice.success { border-color: rgba(52,211,153,.2); background: rgba(6,95,70,.1); color: #bde6d5; }
.notice.error { border-color: rgba(251,113,133,.26); background: rgba(136,19,55,.11); color: #f1c3cc; }
.notice-mark { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; border: 1px solid currentColor; font-size: 10px; font-weight: 900; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 24px; }
.step-tab {
  min-height: 56px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.015);
  color: #767482;
  cursor: pointer;
  text-align: left;
}
.step-tab:hover { border-color: rgba(139,92,246,.26); color: #bbb7c8; }
.step-tab.active { color: #fff; border-color: rgba(139,92,246,.42); background: rgba(139,92,246,.085); }
.step-tab.done { color: #bcb8c8; }
.step-num { color: var(--violet-bright); font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .11em; }
.step-name { font-size: 12px; font-weight: 720; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
label, .field-label { color: #dbd8e5; font-size: 12px; font-weight: 700; }
.required { color: var(--red); }
.hint { color: var(--subtle); font-size: 10px; font-weight: 500; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: rgba(3,4,7,.56);
  color: var(--text);
  transition: 150ms ease;
}
.input, .select { min-height: 45px; padding: 0 13px; }
.textarea { min-height: 128px; padding: 12px 13px; resize: vertical; line-height: 1.65; }
.input::placeholder, .textarea::placeholder { color: #4c4a56; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(139,92,246,.72); box-shadow: 0 0 0 3px rgba(139,92,246,.1); }
.field-error { min-height: 14px; color: #fda4af; font-size: 10px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card { position: relative; display: block; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-content {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.018);
  cursor: pointer;
  transition: 160ms ease;
}
.choice-card:hover .choice-content { border-color: rgba(139,92,246,.3); transform: translateY(-1px); }
.choice-card input:checked + .choice-content { border-color: rgba(139,92,246,.7); background: linear-gradient(145deg, rgba(139,92,246,.14), rgba(139,92,246,.035)); box-shadow: inset 0 0 0 1px rgba(139,92,246,.18); }
.choice-kicker { color: var(--violet-bright); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.choice-title { font-size: 15px; font-weight: 780; }
.choice-description { color: var(--muted); font-size: 11px; line-height: 1.55; }
.choice-sample { margin-top: auto; color: #6f6c7b; font-size: 10px; line-height: 1.45; }

.button-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.button-row.end { justify-content: flex-end; }
.btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: #d7d3e1;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
  transition: 150ms ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(139,92,246,.42); color: #fff; }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn.primary { border-color: #8b5cf6; background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #fff; box-shadow: 0 10px 26px rgba(91,33,182,.25); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #9d75fa, #7c3aed); }
.btn.danger { border-color: rgba(251,113,133,.3); color: #fda4af; }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 10px; }
.btn.icon { width: 42px; padding: 0; }

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

.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}
.summary-item { min-height: 72px; padding: 14px 16px; background: rgba(11,12,17,.96); }
.summary-key { color: var(--subtle); font-size: 8px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.summary-value { margin-top: 8px; color: #e9e6f0; font-size: 12px; font-weight: 730; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.result-toolbar h2 { margin: 0; font-size: 18px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result-list { display: grid; gap: 14px; }
.result-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.014); }
.result-card-head { min-height: 48px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.result-index { color: var(--violet-bright); font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.result-card-actions { display: flex; gap: 7px; }
.result-columns { display: grid; grid-template-columns: 1fr 1fr; }
.result-column { min-width: 0; padding: 18px; }
.result-column + .result-column { border-left: 1px solid var(--line); background: rgba(255,255,255,.012); }
.result-label { margin-bottom: 10px; color: var(--subtle); font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.result-text { margin: 0; color: #ece9f3; font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-translation { color: #aaa7b4; }
.warning-list { display: grid; gap: 8px; margin: 0 0 14px; }

.chat-box { margin-top: 18px; }
.chat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.chat-input { min-height: 46px; max-height: 160px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.quick-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.02); color: #8d8a98; font-size: 10px; cursor: pointer; }
.quick-chip:hover { color: #ddd9e8; border-color: rgba(139,92,246,.35); }

.empty-state { min-height: 280px; display: grid; place-items: center; padding: 36px; text-align: center; color: var(--muted); }
.empty-orbit { width: 74px; height: 74px; margin: 0 auto 18px; display: grid; place-items: center; border: 1px solid rgba(139,92,246,.34); border-radius: 22px; background: radial-gradient(circle, rgba(139,92,246,.18), rgba(139,92,246,.035)); color: var(--violet-bright); font-size: 23px; font-weight: 900; box-shadow: 0 0 40px rgba(139,92,246,.12); }
.empty-state h3 { margin: 0 0 8px; color: #ddd9e8; font-size: 17px; }
.empty-state p { max-width: 430px; margin: 0; font-size: 12px; line-height: 1.7; }

.studio-grid { display: grid; grid-template-columns: minmax(320px, 410px) minmax(0, 1fr); gap: 18px; align-items: start; }
.studio-controls { position: sticky; top: 84px; }
.preset-list { display: grid; gap: 8px; }
.preset-button { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); color: #aaa7b4; text-align: left; font-size: 11px; line-height: 1.55; cursor: pointer; }
.preset-button:hover { color: #fff; border-color: rgba(139,92,246,.4); background: rgba(139,92,246,.055); }
.dropzone { position: relative; min-height: 116px; display: grid; place-items: center; padding: 18px; border: 1px dashed rgba(139,92,246,.34); border-radius: 12px; background: rgba(139,92,246,.025); text-align: center; color: var(--muted); cursor: pointer; overflow: hidden; }
.dropzone:hover, .dropzone.dragover { border-color: var(--violet); background: rgba(139,92,246,.07); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.reference-preview { width: 100%; max-height: 230px; object-fit: contain; border-radius: 9px; }
.reference-source { margin-top: 8px; padding: 9px 11px; border: 1px solid rgba(139,92,246,.25); border-radius: 8px; background: rgba(139,92,246,.055); color: #bbb4ca; font-size: 12px; line-height: 1.55; }
.dropzone-title { color: #d4d0dd; font-size: 12px; font-weight: 760; }
.dropzone-note { margin-top: 6px; color: var(--subtle); font-size: 10px; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; }
.segment span { min-height: 42px; display: grid; place-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 9px; color: #898694; background: rgba(255,255,255,.015); font-size: 10px; font-weight: 720; cursor: pointer; text-align: center; }
.segment input:checked + span { color: #fff; border-color: rgba(139,92,246,.62); background: rgba(139,92,246,.12); }

.canvas-panel { min-height: 610px; overflow: hidden; }
.canvas-stage { min-height: 520px; display: grid; place-items: center; padding: 22px; background-color: #08090e; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 28px 28px; }
.generated-image { display: block; max-width: 100%; max-height: 620px; object-fit: contain; border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.52); }
.progress-wrap { width: min(420px, 86%); text-align: center; }
.progress-ring { width: 58px; height: 58px; margin: 0 auto 18px; border: 2px solid rgba(139,92,246,.18); border-top-color: var(--violet-bright); border-radius: 50%; animation: spin 1s linear infinite; }
.progress-title { color: #eeeaf5; font-size: 15px; font-weight: 780; }
.progress-note { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.6; }
@keyframes spin { to { transform: rotate(360deg); } }

.history-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 10px; margin-top: 12px; }
.history-card { overflow: hidden; display: grid; grid-template-rows: auto auto; border: 1px solid var(--line); border-radius: 10px; background: #08090e; }
.history-card:hover { border-color: rgba(139,92,246,.52); }
.history-card-preview { position: relative; aspect-ratio: 1; overflow: hidden; padding: 0; border: 0; background: #08090e; cursor: pointer; }
.history-card-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .18s ease; }
.history-card-preview:hover img { transform: scale(1.025); }
.history-card-preview span { position: absolute; inset: auto 6px 6px; padding: 5px 7px; border-radius: 6px; background: rgba(0,0,0,.72); color: #f1edf7; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-reference-button { min-height: 38px; padding: 8px; border: 0; border-top: 1px solid var(--line); background: rgba(139,92,246,.075); color: #cbb4ee; font-size: 12px; font-weight: 720; cursor: pointer; }
.history-reference-button:hover { color: #fff; background: rgba(139,92,246,.15); }
.history-reference-button:disabled { opacity: .55; cursor: wait; }

.toast-stack { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(17,18,26,.96); color: #ddd9e8; box-shadow: var(--shadow); font-size: 11px; line-height: 1.55; animation: toast-in .18s ease-out; }
.toast.success { border-color: rgba(52,211,153,.3); }
.toast.error { border-color: rgba(251,113,133,.34); color: #fecdd3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-nav-button { display: none; }
.mobile-overlay { display: none; }

@media (max-width: 980px) {
  :root { --sidebar: 210px; }
  .studio-grid { grid-template-columns: 1fr; }
  .studio-controls { position: static; }
  .canvas-panel { min-height: 480px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 24px 0 70px rgba(0,0,0,.5); }
  body.menu-open .sidebar { transform: translateX(0); }
  .mobile-overlay { position: fixed; inset: 0; z-index: 18; display: none; background: rgba(0,0,0,.58); }
  body.menu-open .mobile-overlay { display: block; }
  .main-shell { width: 100%; }
  .topbar { min-height: 58px; padding: 0 16px; }
  .mobile-nav-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
  .breadcrumb { flex: 1; }
  .save-state { display: none; }
  .content { padding: 24px 15px 50px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .choice-grid, .result-columns { grid-template-columns: 1fr; }
  .result-column + .result-column { border-left: 0; border-top: 1px solid var(--line); }
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .panel-head, .panel-body { padding: 17px; }
  .button-row { flex-wrap: wrap; }
  .button-row .btn { flex: 1; }
  .chat-row { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
  .canvas-stage { min-height: 400px; padding: 14px; }
}

@media (max-width: 430px) {
  .page-heading { font-size: 30px; }
  .steps { gap: 6px; }
  .step-tab { min-height: 50px; padding: 8px; gap: 6px; }
  .step-name { font-size: 10px; }
  .summary-bar { grid-template-columns: 1fr; }
  .summary-item { min-height: 58px; }
  .result-toolbar { align-items: flex-start; flex-direction: column; }
  .option-grid { grid-template-columns: 1fr; }
}

.mt-17 { margin-top: 17px; }
.mt-18 { margin-top: 18px; }
.m-0 { margin: 0; }
.prompt-tall { min-height: 190px; }

/* 可读性增强与主题切换 */
body { font-size: 15px; line-height: 1.55; }
.brand-name { font-size: 15px; letter-spacing: .1em; }
.brand-sub { font-size: 11px; letter-spacing: .13em; }
.nav-label { font-size: 12px; color: #777483; }
.nav-link { min-height: 46px; font-size: 14px; }
.nav-icon { width: 24px; height: 24px; font-size: 11px; }
.status-kicker { font-size: 11px; }
.status-line, .breadcrumb, .save-state { font-size: 12px; }
.eyebrow { font-size: 12px; }
.page-intro { font-size: 15px; line-height: 1.75; }
.panel-note, .notice { font-size: 13px; }
.step-num { font-size: 11px; }
.step-name { font-size: 13px; }
label, .field-label { font-size: 13px; }
.hint, .field-error { font-size: 12px; }
.input, .textarea, .select { font-size: 14px; line-height: 1.65; }
.choice-kicker, .result-label, .summary-key { font-size: 11px; }
.choice-title { font-size: 16px; }
.choice-description { font-size: 13px; }
.choice-sample { font-size: 12px; }
.btn { min-height: 44px; font-size: 13px; }
.btn.small { min-height: 38px; font-size: 12px; }
.summary-value, .panel-note, .dropzone-title { font-size: 13px; }
.result-text { font-size: 15px; }
.quick-chip, .preset-button, .dropzone-note, .segment span { font-size: 12px; }
.quick-chip { min-height: 36px; }
.preset-button { min-height: 44px; }

.yili-theme-toggle {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: #d7d3e1;
  font: 750 12px/1 inherit;
  cursor: pointer;
  transition: 150ms ease;
}
.yili-theme-toggle:hover { color: #fff; border-color: rgba(139,92,246,.5); transform: translateY(-1px); }
.yili-theme-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(139,92,246,.14);
  color: var(--violet-bright);
  font: 850 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.yili-theme-floating { position: fixed; z-index: 9998; top: 14px; right: 18px; }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f9;
  --bg-soft: #eceef5;
  --panel: #ffffff;
  --panel-2: #f8f8fc;
  --panel-3: #eeecf8;
  --line: rgba(30, 27, 48, .13);
  --line-strong: rgba(109, 40, 217, .34);
  --text: #1b1924;
  --muted: #5d5969;
  --subtle: #74707f;
  --violet: #7c3aed;
  --violet-bright: #6d28d9;
  --violet-dark: #5b21b6;
  --cyan: #0e7490;
  --green: #047857;
  --amber: #a16207;
  --red: #be123c;
  --shadow: 0 18px 54px rgba(55, 48, 84, .11);
}
html[data-theme="light"], html[data-theme="light"] body {
  background: #f4f5f9;
  color: var(--text);
}
html[data-theme="light"] body {
  background-image:
    radial-gradient(circle at 82% 8%, rgba(124,58,237,.09), transparent 28rem),
    linear-gradient(180deg, #fafafe 0%, #f1f2f7 100%);
}
[data-theme="light"] .sidebar,
[data-theme="light"] .topbar {
  background: rgba(255,255,255,.93);
  border-color: var(--line);
}
[data-theme="light"] .brand-name,
[data-theme="light"] .page-heading,
[data-theme="light"] .panel-title,
[data-theme="light"] label,
[data-theme="light"] .field-label,
[data-theme="light"] .result-toolbar h2,
[data-theme="light"] .empty-state h3 { color: #1b1924; }
[data-theme="light"] .brand-sub,
[data-theme="light"] .nav-label,
[data-theme="light"] .hint,
[data-theme="light"] .summary-key,
[data-theme="light"] .result-label { color: #6d6879; }
[data-theme="light"] .nav-link { color: #565161; }
[data-theme="light"] .nav-link:hover { color: #241f32; background: rgba(109,40,217,.055); }
[data-theme="light"] .nav-link.active { color: #3b196e; background: linear-gradient(90deg, rgba(124,58,237,.12), rgba(124,58,237,.025)); }
[data-theme="light"] .panel,
[data-theme="light"] .sidebar-status {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(247,247,252,.97));
  border-color: var(--line);
}
[data-theme="light"] .step-tab,
[data-theme="light"] .choice-content,
[data-theme="light"] .btn,
[data-theme="light"] .quick-chip,
[data-theme="light"] .preset-button,
[data-theme="light"] .segment span,
[data-theme="light"] .result-card {
  background: rgba(255,255,255,.72);
  color: #514c5c;
  border-color: var(--line);
}
[data-theme="light"] .step-tab.active,
[data-theme="light"] .choice-card input:checked + .choice-content,
[data-theme="light"] .segment input:checked + span {
  color: #32125f;
  background: rgba(124,58,237,.1);
  border-color: rgba(109,40,217,.45);
}
[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
  background: #fff;
  color: #201d29;
  border-color: rgba(30,27,48,.18);
}
[data-theme="light"] .input::placeholder,
[data-theme="light"] .textarea::placeholder { color: #9893a3; }
[data-theme="light"] .summary-bar { background: var(--line); }
[data-theme="light"] .summary-item { background: rgba(255,255,255,.95); }
[data-theme="light"] .summary-value,
[data-theme="light"] .result-text { color: #272330; }
[data-theme="light"] .result-translation,
[data-theme="light"] .choice-description,
[data-theme="light"] .panel-note,
[data-theme="light"] .page-intro,
[data-theme="light"] .empty-state { color: #625d6e; }
[data-theme="light"] .result-column + .result-column { background: rgba(245,244,250,.72); }
[data-theme="light"] .canvas-stage {
  background-color: #edeef5;
  background-image: linear-gradient(rgba(39,35,48,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(39,35,48,.055) 1px, transparent 1px);
}
[data-theme="light"] .dropzone { background: rgba(124,58,237,.035); color: #625d6e; }
[data-theme="light"] .reference-source { color: #51475d; background: rgba(124,58,237,.07); border-color: rgba(109,40,217,.22); }
[data-theme="light"] .history-card, [data-theme="light"] .history-card-preview { background: #fff; }
[data-theme="light"] .history-reference-button { color: #5b258e; background: #f6f0fc; border-color: #ddd3e9; }
[data-theme="light"] .history-reference-button:hover { color: #42126e; background: #eee3fa; }
[data-theme="light"] .toast { background: rgba(255,255,255,.98); color: #2c2736; }
[data-theme="light"] .yili-theme-toggle { background: #fff; color: #3d3749; }
[data-theme="light"] .yili-theme-toggle:hover { color: #3b196e; }
[data-theme="light"] .notice { color: #735819; background: rgba(245,158,11,.09); }
[data-theme="light"] .notice.info { color: #155e75; background: rgba(6,182,212,.08); }
[data-theme="light"] .notice.success { color: #065f46; background: rgba(16,185,129,.08); }
[data-theme="light"] .notice.error { color: #9f1239; background: rgba(244,63,94,.08); }

:focus-visible {
  outline: 3px solid rgba(139,92,246,.42);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 760px) {
  .yili-theme-toggle { width: 38px; padding: 0; }
  .yili-theme-toggle > span:last-child { display: none; }
}
