:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #172326;
  --muted: #637176;
  --line: #d6e1de;
  --line-strong: #b9c9c5;
  --brand: #0f766e;
  --brand-strong: #0a5d57;
  --brand-soft: #dff2ee;
  --accent: #ea580c;
  --accent-soft: #fff0e5;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #15803d;
  --ok-soft: #e6f5ea;
  --blue: #2563eb;
  --shadow: 0 1px 2px rgba(23, 35, 38, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-en {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}

.privacy-pill svg {
  width: 15px;
  height: 15px;
}

.layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 20px;
  max-width: 1460px;
  margin: 0 auto;
  padding: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.tool-btn span {
  font-weight: 600;
}

.tool-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tool-btn.is-active {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-left: 3px solid var(--brand);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-foot strong {
  color: var(--ink);
  font-size: 13px;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ad-slot {
  min-height: 90px;
  overflow: hidden;
  border-radius: var(--radius);
}

.ad-banner {
  width: 100%;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 90px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}

.ad-placeholder span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.ad-placeholder em {
  font-size: 12px;
  font-style: normal;
  color: var(--accent);
}

.workbench {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.tool-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.tool-head p {
  margin: 5px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.files-panel {
  padding: 14px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 210px;
  padding: 28px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.dropzone:hover,
.dropzone.is-dragover,
.dropzone:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}

.dropzone svg {
  width: 34px;
  height: 34px;
  color: var(--brand);
}

.drop-title {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.drop-hint {
  font-size: 13px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.file-list:empty {
  display: none;
}

.file-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.file-main {
  min-width: 0;
}

.file-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.file-status {
  justify-self: end;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.file-status.is-pending {
  color: var(--muted);
}

.file-status.is-processing {
  color: var(--blue);
}

.file-status.is-done {
  color: var(--ok);
}

.file-status.is-error {
  color: var(--danger);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  transition: color 120ms ease, border-color 120ms ease;
}

.icon-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.settings-panel {
  position: sticky;
  top: 78px;
  overflow: hidden;
}

.settings-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field output {
  color: var(--brand-strong);
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
  outline: 2px solid rgba(15, 118, 110, 0.18);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row .field[data-img-option="width"],
.field-row .field[data-img-option="height"] {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.field-note {
  margin: 0;
  padding: 9px 11px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  margin-top: 4px;
  border: 0;
  color: #fff;
  background: var(--brand);
}

.primary-btn:hover {
  background: var(--brand-strong);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-btn svg,
.ghost-btn svg {
  width: 17px;
  height: 17px;
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}

.ghost-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.results-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.output-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.output-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.output-icon svg {
  width: 18px;
  height: 18px;
}

.output-main {
  min-width: 0;
}

.output-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-meta {
  color: var(--muted);
  font-size: 12px;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-preview {
  grid-column: 2 / -1;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-2);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.results-empty svg {
  width: 28px;
  height: 28px;
  color: var(--line-strong);
}

.results-empty p {
  margin: 0;
  font-size: 13px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 14px;
  color: var(--muted);
  font-size: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.doc-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.doc-nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.doc-nav a:hover {
  color: var(--brand-strong);
}

.docs-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.doc-article {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.doc-article h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.doc-article h2 {
  margin: 30px 0 10px;
  font-size: 19px;
  letter-spacing: 0;
}

.doc-article h3 {
  margin: 20px 0 8px;
  font-size: 16px;
  letter-spacing: 0;
}

.doc-article p,
.doc-article li {
  color: #2d3a3e;
  font-size: 14px;
  line-height: 1.75;
}

.doc-article ul,
.doc-article ol {
  padding-left: 22px;
}

.doc-article li {
  margin: 6px 0;
}

.doc-article a {
  color: var(--brand-strong);
}

.doc-date {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.doc-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  color: #3b2a1e;
  background: var(--accent-soft);
}

.docs-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

.consent-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(760px, calc(100vw - 24px));
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(23, 35, 38, 0.18);
  transform: translateX(-50%);
}

.consent-banner[hidden] {
  display: none;
}

.consent-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.consent-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.consent-banner p a {
  color: var(--brand-strong);
}

.consent-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.consent-actions .primary-btn,
.consent-actions .ghost-btn {
  min-height: 36px;
  padding: 7px 14px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(23, 35, 38, 0.22);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: var(--danger);
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .sidebar > .ad-slot {
    display: none;
  }

  .tool-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar-foot {
    display: none;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 12px;
  }

  .brand-en {
    display: none;
  }

  .privacy-pill {
    padding: 7px 10px;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .tool-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .tool-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .file-status {
    grid-column: 2 / -1;
    justify-self: start;
    margin-top: -4px;
  }

  .output-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .output-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .text-preview {
    grid-column: 1 / -1;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .consent-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .consent-actions {
    width: 100%;
  }

  .consent-actions button {
    flex: 1;
  }

  .doc-article {
    padding: 22px 18px;
  }

  .doc-article h1 {
    font-size: 23px;
  }
}
