:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1f2329;
  --sub: #667085;
  --muted: #98a2b3;
  --line: #e6e9ee;
  --soft: #f5f7fa;
  --green: #0f9d58;
  --green-bright: #12b76a;
  --green-dark: #0b7d45;
  --green-soft: #f1fbf6;
  --green-line: #b8ecd6;
  --red: #d92d20;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
    0 24px 48px -36px rgba(16, 24, 40, 0.22);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid #d8f3e6;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text strong {
  display: block;
  font-size: 15.5px;
  letter-spacing: 0.01em;
}
.brand-text em {
  display: block;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--sub);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
}
.privacy-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.14);
}

/* ---------- 主卡片 ---------- */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 拖放区 ---------- */
.drop {
  position: relative;
  min-height: clamp(520px, calc(100vh - 230px), 820px);
  display: grid;
  place-items: center;
  border: 2px dashed var(--green-line);
  border-radius: 16px;
  background: var(--green-soft);
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease,
    box-shadow 0.18s ease;
}
.drop:hover,
.drop:focus-visible {
  border-color: var(--green-bright);
  background: #eafaf2;
  box-shadow: inset 0 0 0 3px rgba(18, 183, 106, 0.04);
}
.drop:focus-visible { box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.16); }
.drop-inner {
  text-align: center;
  padding: 42px 24px;
  max-width: 620px;
}
.drop-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--surface);
  border: 1px solid #d8f3e6;
  box-shadow: 0 18px 36px -26px rgba(15, 157, 88, 0.55);
}
.drop-icon svg { width: 46px; height: 46px; }
.drop-icon.small {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  margin-bottom: 14px;
  box-shadow: none;
}
.drop-icon.small svg { width: 34px; height: 34px; }
.drop h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.lead {
  margin: 0 0 24px;
  font-size: clamp(14px, 1.4vw, 16px);
  color: var(--sub);
}
.drop-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.drop-hint { font-size: 12px; color: var(--muted); }
.micro {
  margin: 18px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.16s ease;
}
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn.primary {
  color: #fff;
  background: var(--green);
}
.btn.primary:hover:not(:disabled) {
  background: var(--green-dark);
  transform: translateY(-1px);
}
.btn.soft {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #cdeedd;
}
.btn.soft:hover:not(:disabled) { background: #e5f8ee; }
.btn.ghost {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}
.btn.ghost:hover:not(:disabled) { background: var(--soft); }
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn:disabled {
  cursor: not-allowed;
  color: #98a2b3;
  background: #eef1f4;
  border-color: transparent;
  transform: none;
}

/* ---------- 工作区 ---------- */
.workspace { animation: rise 0.28s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 14px;
}
.workspace-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.workspace-title p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--sub);
}
.workspace-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-pill {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--sub);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
}

/* ---------- 双预览 ---------- */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
  color: #344054;
}
.zoom {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.canvas-wrap {
  position: relative;
  height: clamp(320px, 50vh, 600px);
  background: var(--soft);
  overflow: hidden;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.pane-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.pane-foot {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
}
.loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 11px;
  color: #344054;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(3px);
}
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid #d8f3e6;
  border-top-color: var(--green-bright);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-bar {
  width: 170px;
  height: 3px;
  border-radius: 3px;
  background: #e8f0ea;
  overflow: hidden;
}
.loading-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green-bright);
  transition: width 0.16s linear;
}

/* ---------- 底部信息 ---------- */
.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
}
.card-title {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--muted);
  margin-bottom: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 24px;
  font-weight: 780;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--green);
}
.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(15, 157, 88, 0.12);
}
.badge.muted { color: var(--muted); font-size: 19px; }
.badge.muted::before { box-shadow: 0 0 0 4px rgba(152, 162, 179, 0.12); }
.badge.error { color: var(--red); }
.badge.error::before { box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.12); }
.badge-sub {
  font-size: 12px;
  color: var(--sub);
  margin: 5px 0 14px;
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 22px;
  margin: 0;
}
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #f0f2f5;
  font-size: 11.5px;
  min-width: 0;
}
.facts > div:nth-child(-n + 2) { border-top: 0; }
.facts dt { color: var(--sub); flex: none; }
.facts dd {
  margin: 0;
  text-align: right;
  font-weight: 620;
  word-break: break-all;
  min-width: 0;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
}
.note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.65;
  color: var(--sub);
}
.strength {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px;
  font-size: 12px;
  color: var(--sub);
}
.strength input {
  width: 100%;
  accent-color: var(--green);
  height: 18px;
}
.strength output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
  min-width: 42px;
  text-align: right;
}
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-row .btn { width: 100%; }

/* ---------- 页脚 / 浮层 ---------- */
.foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px 28px;
  display: flex;
  gap: 8px;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
}
.foot .dot { opacity: 0.6; }

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(5px);
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drag-overlay-card {
  width: min(520px, 100%);
  padding: 46px 24px;
  text-align: center;
  color: var(--ink);
  border-radius: 22px;
  border: 2px dashed var(--green-bright);
  background: var(--green-soft);
  display: grid;
  justify-items: center;
  box-shadow: 0 24px 60px -30px rgba(16, 24, 40, 0.4);
}
.drag-overlay-card .drop-icon { color: var(--green); }
.drag-overlay-card strong { font-size: 17px; letter-spacing: 0.01em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1d2939;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.25);
  animation: rise 0.2s ease;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { padding: 16px 16px 10px; }
  .shell { padding: 16px; border-radius: 18px; }
  .preview-grid { grid-template-columns: 1fr; }
  .canvas-wrap { height: clamp(300px, 48vh, 520px); }
  .workspace-head { flex-wrap: wrap; }
  .workspace-tools { width: 100%; justify-content: space-between; }
  .file-pill { max-width: calc(100% - 90px); }
  .drop { min-height: 60vh; }
}
@media (max-width: 620px) {
  .brand-text em { display: none; }
  .privacy-pill { font-size: 11px; padding: 7px 10px; }
  .shell { padding: 12px; border-radius: 16px; }
  .drop { min-height: 62vh; border-radius: 14px; }
  .drop-inner { padding: 34px 16px; }
  .drop-icon { width: 74px; height: 74px; border-radius: 20px; }
  .drop-icon svg { width: 40px; height: 40px; }
  .drop h1 { font-size: 25px; }
  .canvas-wrap { height: 44vh; min-height: 280px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts > div:nth-child(2) { border-top: 1px solid #f0f2f5; }
  .action-row { grid-template-columns: 1fr; }
  .pane-foot { display: none; }
  .foot { padding: 10px 16px 22px; font-size: 10px; }
  .toast { bottom: 16px; }
  .workspace-tools { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}