:root {
  color-scheme: light;
  --bg: #f4f5f1;
  --panel: #fff;
  --ink: #1f302a;
  --muted: #65746d;
  --line: #dce3dc;
  --brand: #126a55;
  --soft: #edf3eb;
  --danger: #a43730;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.6 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #76aa8d;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 14px;
}
a {
  color: inherit;
  text-decoration: none;
}
textarea {
  resize: vertical;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
  padding: 10px 12px;
  color: var(--ink);
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #91bfa9;
  outline-offset: 1px;
}
label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}
.hint,
.muted,
.optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.hint {
  line-height: 1.7;
  margin-top: 8px;
}
.optional {
  margin-left: 6px;
}
button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 13px;
  line-height: 1.4;
}
.primary {
  background: var(--brand);
  color: white;
  font-weight: 600;
}
.primary:hover:not(:disabled) {
  background: #0b533f;
}
.ghost {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}
.ghost:hover:not(:disabled) {
  background: var(--soft);
}
.text-button {
  padding: 5px 0;
  background: none;
  color: var(--brand);
  font-size: 12px;
}
.full {
  width: 100%;
  margin-top: 16px;
}
.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line);
  background: #f9faf6;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  border-radius: 11px;
  width: 42px;
  height: 42px;
  font: 22px serif;
}
.brand strong {
  font-size: 18px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
#draftStatus {
  font-size: 12px;
  color: var(--muted);
}
.workspace {
  max-width: 1548px;
  margin: auto;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  padding: 28px 24px 60px;
}
.sidebar,
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: start;
}
.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.step {
  color: var(--brand);
  font:
    12px ui-monospace,
    monospace;
  margin-right: 6px;
}
.upload-zone {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 158px;
  background: var(--soft);
  border: 1px dashed #99b29f;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 400;
}
.upload-zone strong {
  font-size: 14px;
}
.upload-zone span:last-of-type {
  color: var(--muted);
  font-size: 12px;
}
.upload-icon {
  color: var(--brand);
  font-size: 28px;
  line-height: 1.2;
}
.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone:focus-within {
  outline: 2px solid var(--brand);
}
.upload-zone.dragging {
  background: #d9e8d7;
}
.upload-zone.busy {
  opacity: 0.5;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.password-row {
  display: flex;
  gap: 8px;
}
.password-row input {
  flex: 1;
}
.password-row button {
  flex: 0 0 auto;
}
.remember-device {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
}
.remember-device input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}
.auth-card .full {
  margin-top: 12px;
}
.style-hint {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  font-size: 13px;
  line-height: 1.7;
}
.style-hint p {
  margin: 0;
}
.style-hint .style-example {
  margin-top: 5px;
  color: var(--muted);
}
.style-example span {
  color: var(--ink);
}
.style-hint .hint {
  margin-top: 8px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.actions.compact {
  margin: 0;
  gap: 6px;
}
.task-status {
  font-size: 12px;
  color: var(--brand);
  margin-top: 12px;
}
.error {
  padding: 10px;
  border: 1px solid #edcac4;
  background: #fff4f1;
  color: var(--danger);
  border-radius: 8px;
  margin-top: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.badge {
  background: var(--soft);
  color: var(--brand);
  font-size: 11px;
  white-space: nowrap;
  border-radius: 20px;
  padding: 4px 10px;
}
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.thumb {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #fafbf8;
}
.thumb.cover {
  border-color: var(--brand);
}
.thumb img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  display: block;
}
.thumb-name {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 5px;
}
.thumb-actions {
  display: flex;
  justify-content: space-between;
  padding: 0 3px 3px;
  gap: 2px;
}
.thumb-actions button {
  font-size: 11px;
  padding: 2px 4px;
  background: transparent;
  color: var(--muted);
}
.thumb-cover {
  display: block;
  width: 100%;
  font-size: 10px;
  border-radius: 0;
  padding: 3px;
  background: var(--soft);
  color: var(--brand);
}
.welcome {
  padding: clamp(28px, 5vw, 70px);
  background: #eaf0e3;
  border: 1px solid #dbe5d4;
  border-radius: 14px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.eyebrow {
  font-size: 12px;
  color: var(--brand);
  letter-spacing: 2px;
}
.welcome h1 {
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.35;
  letter-spacing: -2px;
  margin: 22px 0;
}
.welcome p {
  max-width: 440px;
  color: var(--muted);
  line-height: 1.9;
}
.flow {
  display: flex;
  gap: 30px;
  margin: 30px 0 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--brand);
}
.fact-cards {
  display: grid;
  gap: 14px;
}
.fact-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  padding: 14px;
  background: #f9fbf7;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.fact-card img {
  width: 72px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
}
.fact-content {
  min-width: 0;
}
.fact-content h3 {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.fact-fields {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
}
.fact-fields label {
  font-size: 12px;
  margin: 8px 0 4px;
}
.fact-fields textarea {
  font-size: 12px;
  background: white;
  padding: 8px;
}
.result-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 10px;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(230px, 1fr);
  gap: 24px;
}
.editor {
  min-width: 0;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.label-row label {
  margin-top: 10px;
}
.title-options {
  display: grid;
  gap: 7px;
  margin: 4px 0 12px;
}
.title-option {
  display: block;
  width: 100%;
  text-align: left;
  background: #fafbf8;
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 10px;
}
.title-option[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand);
}
.preview-wrap {
  min-width: 0;
}
.preview-label {
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0;
}
.note-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}
.note-preview > img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}
.note-content {
  padding: 18px;
}
.note-content h3 {
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.note-content p {
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 12px;
}
.preview-tags {
  color: var(--brand);
}
details {
  margin-top: 14px;
}
details.card {
  margin-top: 0;
  font-size: 12px;
}
summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
details[open] > summary {
  margin-bottom: 14px;
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.compare-grid > div {
  min-width: 0;
  padding: 12px;
  background: #f5f7f2;
  border-radius: 8px;
}
.compare-grid pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.8;
  max-height: 320px;
  overflow: auto;
}
#versionLabel {
  margin-left: 8px;
}
#metricsList {
  padding-left: 18px;
  color: var(--muted);
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #233a30;
  color: white;
  padding: 11px 18px;
  border-radius: 10px;
  max-width: calc(100vw - 32px);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.toast.show {
  opacity: 1;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    padding: 22px 18px;
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .preview-wrap {
    max-width: 400px;
    width: 100%;
    margin: auto;
  }
  .fact-fields {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px;
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 14px 16px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .top-actions {
    width: 100%;
    justify-content: space-between;
  }
  .workspace {
    grid-template-columns: 1fr;
    padding: 16px 12px 36px;
    gap: 18px;
  }
  .sidebar,
  .main {
    gap: 16px;
  }
  .welcome {
    min-height: 300px;
    padding: 28px;
  }
  .welcome h1 {
    letter-spacing: -1px;
  }
  .flow {
    gap: 22px;
    font-size: 11px;
  }
  .section-head {
    align-items: flex-start;
  }
  .result-toolbar {
    flex-wrap: wrap;
  }
  .fact-card {
    grid-template-columns: 52px 1fr;
    padding: 10px;
    gap: 10px;
  }
  .fact-card img {
    width: 52px;
    height: 70px;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .thumb img {
    height: 110px;
  }
  .card {
    padding: 16px;
  }
  .preview-wrap {
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
