:root {
  --bg: #f4efe7;
  --bg-strong: #efe7da;
  --panel: rgba(255, 251, 247, 0.88);
  --panel-border: rgba(81, 59, 38, 0.12);
  --text: #241911;
  --muted: #715948;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --danger: #b42318;
  --shadow: 0 16px 36px rgba(68, 48, 31, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

/* ── 视图切换 ── */
.view {
  position: fixed;
  inset: 0;
  transition: opacity 280ms ease, transform 280ms ease;
}

.view.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

/* ── 页面1：落地页 ── */
.view-landing {
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 520px;
  width: 100%;
  padding: 0 24px;
}

.landing-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.landing-sub {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.landing-inner .drop-zone {
  width: 100%;
  padding: 60px 24px;
  cursor: default;
}

.drop-zone-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.pick-btn {
  width: 100%;
  justify-content: center;
  cursor: pointer;
}

.pick-btn input[type="file"] {
  display: none;
}

/* ── 页面2：工作台 ── */
.view-workspace {
  overflow: hidden;
}

.drop-zone-sm {
  padding: 14px 16px;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(159, 83, 40, 0.16), transparent 24%),
    linear-gradient(180deg, #fbf8f4 0%, var(--bg) 100%);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(113, 89, 72, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(113, 89, 72, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 80%);
}

.workspace-shell {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  overflow: hidden;
}

.export-btn {
  margin-top: 12px;
  width: 100%;
}

.back-btn {
  align-self: flex-start;
}

.page-shell {
  position: relative;
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 18px 18px;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  gap: 12px;
  min-height: 0;
}

.hero-copy,
.hero-card,
.panel {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 14px 18px;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-strong);
}

.hero-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  font-family: "Cascadia Code", "Source Code Pro", monospace;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}

.hero-text,
.hint {
  color: var(--muted);
  line-height: 1.45;
}

.hero-text {
  margin: 0;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.hero-card {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: stretch;
}

.metric {
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(239, 231, 218, 0.9));
  border: 1px solid rgba(81, 59, 38, 0.08);
}

.metric-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 0;
}

.dashboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
  gap: 10px;
  align-items: stretch;
  min-height: 0;
}

.panel {
  min-height: 0;
  padding: 14px 16px;
}

.panel-controls,
.panel-progress,
.panel-results {
  min-height: 0;
}

.panel-progress {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.panel-results {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.picker-grid,
.settings-grid,
.stats-grid,
.actions {
  display: grid;
  gap: 10px;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.04);
  transition: border-color 160ms, background 160ms;
  cursor: default;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone-icon {
  font-size: 28px;
  line-height: 1;
}

.drop-zone-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.drop-zone-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.drop-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.2);
  cursor: pointer;
  transition: background 160ms, transform 160ms;
}

.drop-btn:hover {
  background: rgba(15, 118, 110, 0.2);
  transform: translateY(-1px);
}

.drop-btn input[type="file"] {
  display: none;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.picker,
.settings-grid label,
.stat-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(81, 59, 38, 0.08);
}

.picker span,
.settings-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="file"] {
  width: 100%;
}

input[type="text"],
input[type="number"] {
  border: 1px solid rgba(81, 59, 38, 0.16);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 251, 247, 0.96);
  font: inherit;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-row span {
  margin-bottom: 0;
}

.actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #155e75);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(81, 59, 38, 0.12);
}

.btn-ghost {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.08);
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 22px;
  font-family: "Cascadia Code", "Source Code Pro", monospace;
}

.progress-bar {
  margin: 12px 0 10px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(113, 89, 72, 0.12);
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0f766e, #ea580c);
  transition: width 200ms ease;
}

.log-box {
  min-height: 0;
  height: 170px;
  max-height: 170px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #1d170f;
  color: #f8f5f0;
  font-family: "Cascadia Code", "Source Code Pro", monospace;
  line-height: 1.5;
  white-space: pre-wrap;
}

.table-wrap {
  min-height: 0;
  height: 100%;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(81, 59, 38, 0.12);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: rgba(255, 255, 255, 0.75);
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(239, 231, 218, 0.98);
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(81, 59, 38, 0.1);
  vertical-align: top;
}

td.small,
th.small {
  white-space: nowrap;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
}

.status-ok {
  color: var(--accent-strong);
  font-weight: 700;
}

.status-warn {
  color: #9a3412;
  font-weight: 700;
}

.status-error {
  color: var(--danger);
  font-weight: 700;
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .page-shell {
    height: auto;
    display: block;
    padding: 18px 14px 36px;
  }

  .hero,
  .dashboard-row,
  .picker-grid,
  .settings-grid,
  .stats-grid,
  .actions,
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .hero-title-row {
    display: block;
  }

  .hero-text {
    margin-top: 8px;
    text-align: left;
    white-space: normal;
  }

  .log-box,
  .table-wrap {
    height: auto;
    max-height: none;
  }
}
