* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #5c6470;
  --line: #e2e5e9;
  --surface: #fff;
  --accent: #a14116;
  --accent-soft: #fff0e6;
  --canvas: #f5f6f8;
}
[hidden] { display: none !important; }
body { margin: 0; background: #fcfcfd; color: var(--ink); font: 15px/1.6 system-ui, "Microsoft YaHei", sans-serif; }
button, textarea, input, select { font: inherit; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
header { border-bottom: 1px solid var(--line); }
.wrap { width: min(1280px, 100% - 48px); margin-inline: auto; }
nav { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .quota { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; }
.brand { color: var(--ink); font-weight: 650; }
.quota { font-size: 13px; }
main { padding-block: 36px 48px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
p, h1, h2 { margin: 0; }
.eyebrow { font-size: 13px; font-weight: 650; color: var(--accent); }
h1 { margin-block: 4px 8px; font-size: clamp(32px, 5vw, 50px); line-height: 1.08; letter-spacing: -.045em; }
.intro p:last-child, dialog p { color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 28px -24px #242b38; }
.editor { padding: 18px; }
label, h2 { font-size: 16px; font-weight: 680; }
textarea { display: block; width: 100%; min-height: 152px; margin-top: 10px; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfc; color: var(--ink); font-size: 16px; }
textarea::placeholder { color: var(--muted); font-size: 14px; }
.examples, .actions, .preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.examples { margin-block: 8px 14px; }
.examples[hidden] + .hint { margin-top: 12px; }
.hint { margin-block: 0 10px; color: var(--muted); font-size: 12px; }
.versions { padding: 0 14px 12px; }
#versionList { display: grid; gap: 6px; max-height: 210px; overflow: auto; }
.version { text-align: left; overflow-wrap: anywhere; }
#compareControls { display: grid; gap: 4px; margin-top: 10px; }
#compareControls label { font-size: 13px; }
#compareVersion { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 6px 10px; }
.examples button { min-height: 36px; padding-inline: 8px; border: 0; border-radius: 8px; background: var(--canvas); color: var(--muted); cursor: pointer; font-size: 12px; }
.button { min-height: 42px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 650; cursor: pointer; }
.button:hover, .examples button:hover, .button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.primary { border-color: #ffd8c4; background: var(--accent-soft); color: var(--accent); }
.primary:hover { background: #ffe3d3; }
button:disabled { opacity: .58; cursor: default; }
#taskNotice { margin: 12px 0 0; overflow-wrap: anywhere; }
#taskNotice[data-error="true"], .publish-status[data-error="true"] { color: #a32e20; }
details { margin-top: 8px; color: var(--muted); }
summary { cursor: pointer; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 65px; padding: 10px 14px; }
.preview-stage { display: grid; place-items: start center; min-height: 520px; padding: 10px; background: var(--canvas); border-radius: 0 0 17px 17px; }
.preview-stage.comparing { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.preview-pane { width: 100%; min-width: 0; }
.preview-label { margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.empty { align-self: center; text-align: center; padding: 24px; color: var(--muted); }
.empty strong { color: var(--ink); }
.empty p { margin-top: 6px; font-size: 13px; }
iframe { display: block; margin-inline: auto; width: 100%; max-width: 100%; height: clamp(510px, 64vh, 800px); background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.preview-stage.mobile iframe { max-width: 390px; }
.publish-status, .published { padding: 10px 14px; font-size: 13px; overflow-wrap: anywhere; }
.preview-note { margin: 0 14px 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 12px; overflow-wrap: anywhere; }
.preview-note code { font-size: 11px; }
.progress {
  width: calc(100% - 40px); max-width: none;
  height: calc(100dvh - 40px); max-height: none;
  padding: 0; border-radius: 20px; background: var(--surface);
  box-shadow: 0 24px 80px #2229363a; overflow: hidden;
}
.progress[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: work-open .2s ease-out; }
.progress::backdrop { background: #23283266; }
.progress-head, .progress-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px clamp(14px, 3vw, 40px);
}
.progress-head { border-bottom: 1px solid var(--line); }
.progress-head h2 { font-size: 19px; line-height: 1.3; }
.progress-head .work-model { margin: 0 0 2px; font-size: 12px; }
.progress-head button { flex-shrink: 0; }
.work-scroll { overflow: auto; overscroll-behavior: contain; }
.work-thread { width: min(820px, 100%); margin-inline: auto; padding: clamp(20px, 4vw, 46px) clamp(14px, 3vw, 28px); }
.work-thread .work-prompt {
  width: fit-content; max-width: min(100%, 660px); margin: 0 0 24px auto;
  padding: 11px 15px; background: var(--accent-soft); color: var(--ink);
  border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.work-run {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 9px 12px; border-radius: 10px; background: var(--canvas);
  position: relative; isolation: isolate; overflow: hidden;
}
.work-run[data-state="running"] { background: var(--accent-soft); }
.work-run[data-state="running"]::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(102deg, transparent 16%, #ffd2b9 37%, #fff 49%, #ffd2b9 61%, transparent 84%);
  animation: work-sweep 1.9s linear infinite;
}
.work-run > * { position: relative; }
.work-run #status { margin: 0; min-width: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.work-run[data-state="running"] #status { color: var(--accent); font-weight: 650; }
.work-run #status[data-error="true"] { color: #a32e20; }
.work-run .work-time { margin-left: auto; }
.work-time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pulse {
  width: 8px; height: 8px; margin-inline: 2px; flex: none; border-radius: 50%;
  background: var(--accent); animation: work-pulse 1.6s ease-out infinite;
}
.work-wait {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; padding: 12px 14px; border: 1px solid #f0c7aa;
  border-radius: 10px; background: #fff8f2; overflow-wrap: anywhere;
}
.work-wait .work-wait-heading { margin: 0; color: #87401c; font-size: 13px; font-weight: 650; }
.work-wait .work-wait-detail { margin: 4px 0 0; font-size: 12px; }
.work-wait .work-wait-detail span { display: inline-block; margin-right: 12px; }
.work-wait .button { flex: none; }
.work-trace-fold { margin: 15px 0 0; }
.work-trace-fold > summary, .wt-row > summary {
  display: flex; align-items: center; gap: 9px; min-height: 38px;
  padding: 5px 8px; border-radius: 8px; list-style: none; font-size: 13px;
}
.work-trace-fold > summary { width: fit-content; font-weight: 650; }
.work-trace-fold > summary::-webkit-details-marker, .wt-row > summary::-webkit-details-marker { display: none; }
.work-trace-fold > summary::before, .wt-row > summary::after {
  content: ""; width: 6px; height: 6px; flex: none;
  border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg);
}
.work-trace-fold[open] > summary::before, .wt-row[open] > summary::after { transform: rotate(135deg); }
.work-trace-fold > summary:hover, .wt-row > summary:hover { background: var(--canvas); color: var(--ink); }
.work-trace { list-style: none; margin: 4px 0 0 10px; padding: 0 0 0 8px; border-left: 1px solid var(--line); }
.wt-row { margin: 0; }
.wt-row.current > summary { background: var(--accent-soft); color: var(--accent); box-shadow: inset 2px 0 var(--accent); }
.wt-row[data-error="true"] .wt-label { color: #a32e20; }
.wt-icon, .wt-icon svg { width: 16px; height: 16px; flex: none; }
.wt-label { font-weight: 600; overflow-wrap: anywhere; }
.wt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.trace-body {
  margin: 2px 6px 8px; padding: 10px 12px; max-height: 260px; overflow: auto;
  background: var(--canvas); border-radius: 8px; font-size: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.wt-thought .trace-body { background: transparent; border-radius: 0; border-left: 1px solid var(--line); margin-left: 15px; font: inherit; font-size: 13px; }
.work-output { margin-top: 20px; padding: 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.work-thread .work-result-note { margin: 12px 0 0; padding: 0 2px; font-size: 13px; }
.progress-foot { border-top: 1px solid var(--line); }
.progress-foot p { margin: 0; font-size: 12px; }
body:has(.progress[open]) { overflow: hidden; }
.floating { position: fixed; right: 24px; bottom: 24px; z-index: 60; background: var(--accent-soft); border-color: #ffd8c4; color: var(--accent); box-shadow: 0 16px 40px -20px #242b38; }
@keyframes work-open { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes work-pulse { from { box-shadow: 0 0 0 0 #a1411650; } to { box-shadow: 0 0 0 7px #a1411600; } }
@keyframes work-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .progress[open], .pulse { animation: none; }
  .work-run[data-state="running"]::before { display: none; animation: none; }
}
@media (max-width: 760px) {
  .progress { width: calc(100% - 12px); height: calc(100dvh - 12px); border-radius: 14px; }
  .progress-foot { flex-wrap: wrap; gap: 6px; padding-block: 10px; }
  .progress-foot .actions { margin-left: auto; }
  .wt-row > summary { gap: 7px; }
  .work-wait { align-items: flex-start; flex-wrap: wrap; }
  .floating { right: 12px; bottom: 12px; }
}
.published span { color: var(--muted); margin-right: 4px; }
dialog { width: min(420px, 100% - 32px); padding: 20px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); }
dialog::backdrop { background: #22293660; }
dialog p { margin-block: 8px 16px; }
dialog input { display: block; width: 100%; margin-block: 6px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
dialog .actions { justify-content: flex-end; }
.publish-result { box-shadow: 0 24px 64px #22293640; }
.publish-result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.publish-result-head h2 { flex: 1; font-size: 19px; }
.publish-check { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #216344; background: #e9f7ee; font-weight: 750; }
.publish-result-close { width: 42px; padding: 0; border-color: transparent; font-size: 22px; line-height: 1; }
.publish-result label { font-size: 13px; }
.publish-result input { background: var(--canvas); font-size: 16px; }
.publish-result a.button { display: inline-flex; align-items: center; text-decoration: none; }
#publishCopyStatus { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 760px) {
  .wrap { width: calc(100% - 24px); }
  main { padding-top: 23px; }
  .layout { grid-template-columns: 1fr; }
  .preview-stage { min-height: 390px; }
  .preview-stage.comparing { grid-template-columns: 1fr; }
  .intro { align-items: flex-start; }
  .intro .button { flex-shrink: 0; }
}
