:root {
  --bg: #f2ede2;
  --panel: rgba(255, 251, 245, 0.96);
  --ink: #18211c;
  --muted: #536057;
  --line: #d7cab5;
  --accent: #205c4a;
  --accent-soft: rgba(32, 92, 74, 0.1);
  --accent-strong: #174738;
  --warm: #a14f37;
  --warm-soft: rgba(161, 79, 55, 0.12);
  --shadow: 0 18px 44px rgba(61, 47, 28, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(32, 92, 74, 0.16), transparent 22%),
    radial-gradient(circle at 90% 0%, rgba(161, 79, 55, 0.12), transparent 26%),
    linear-gradient(180deg, #f5f0e7 0%, #efe7db 100%);
}

body.has-modal {
  overflow: hidden;
}

code, pre {
  font-family: "Cascadia Code", Consolas, monospace;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 92px auto 48px;
}

.top-download {
  position: fixed;
  top: 22px;
  right: max(18px, calc((100vw - 1180px) / 2 + 18px));
  z-index: 30;
}

.desktop-download-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 10px 17px 10px 12px;
  border: 1px solid rgba(32, 92, 74, 0.24);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 251, 245, 0.98), rgba(238, 247, 240, 0.94));
  color: var(--accent-strong);
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(61, 47, 28, 0.12);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.desktop-download-link:hover {
  border-color: rgba(32, 92, 74, 0.55);
  box-shadow: 0 18px 38px rgba(61, 47, 28, 0.16);
  transform: translateY(-1px);
}

.download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  border-radius: 15px;
  background: var(--accent);
  color: #fffaf1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, 0.12);
}

.download-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.15;
}

.download-copy strong {
  font-size: 14px;
  font-weight: 900;
}

.download-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.95fr;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(215, 202, 181, 0.88);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 251, 245, 0.98), rgba(241, 232, 219, 0.92));
  box-shadow: var(--shadow);
}

.hero-home {
  align-items: start;
}

.hero-slim {
  grid-template-columns: 1.4fr 0.9fr;
}

.hero-copy h1 {
  margin: 0 0 8px;
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  text-wrap: pretty;
}

.hero-card,
.panel,
.alert,
.notice-modal {
  border: 1px solid rgba(215, 202, 181, 0.88);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 22px;
}

.hero-card h2,
.panel-head h2,
.panel h2,
.notice-modal h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.3;
}

.hero-card ul,
.checklist,
.downloads {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.alert {
  margin-top: 18px;
  padding: 16px 18px;
  border-color: rgba(161, 79, 55, 0.28);
  background: rgba(255, 244, 239, 0.95);
  color: var(--warm);
  font-weight: 600;
}

.notice-panel {
  margin-top: 18px;
}

.notice-text {
  display: grid;
  gap: 12px;
}

.notice-text p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  text-wrap: pretty;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(320px, 0.68fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 24px;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-head p,
.meta,
small {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  text-wrap: pretty;
}

.mode-switch {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-pill {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.mode-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.mode-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 700;
}

.mode-pill input:checked + span {
  border-color: rgba(32, 92, 74, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
}

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

.field > span {
  font-weight: 700;
}

textarea,
input[type="file"],
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
}

textarea {
  padding: 14px;
  resize: vertical;
  min-height: 120px;
  color: var(--ink);
  line-height: 1.62;
}

input[type="file"] {
  padding: 11px 12px;
}

.text-input {
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
}

.readonly-input {
  background: #f2f6f3;
  color: var(--accent-strong);
  border-style: dashed;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mode-panel.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.submit-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.subpanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: #f8f2e8;
  border: 1px solid rgba(215, 202, 181, 0.88);
}

button,
.ghost-link,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

button {
  border: none;
  background: linear-gradient(135deg, #205c4a, #2b7a61);
  color: white;
}

button:hover,
.secondary-btn:hover {
  filter: brightness(0.97);
}

button:disabled,
button.is-submitting {
  cursor: wait;
  opacity: 0.72;
  filter: grayscale(0.12);
}

.secondary-btn {
  border: 1px solid rgba(32, 92, 74, 0.18);
  background: white;
  color: var(--accent);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tip-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: #f6f0e6;
  border: 1px solid rgba(215, 202, 181, 0.88);
}

.compact-card {
  padding: 16px;
}

.tip-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  text-wrap: pretty;
}

.tip-card h3,
.preview-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.tip-card pre,
.preview-card pre,
.panel pre.json,
.panel pre {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: #fbf7f1;
  border: 1px solid rgba(215, 202, 181, 0.88);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  line-height: 1.58;
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-queued,
.status-running {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-completed {
  background: rgba(32, 92, 74, 0.18);
  color: var(--accent);
}

.status-failed {
  background: var(--warm-soft);
  color: var(--warm);
}

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

.reuse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.result-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.small-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.downloads a,
.ghost-link {
  color: var(--accent);
}

.downloads a:hover,
.ghost-link:hover {
  color: var(--accent-strong);
}

.preview-card + .preview-card {
  margin-top: 18px;
}

.footer-panel {
  margin-top: 18px;
}

.summary-card + .summary-card,
.table-preview-card + .table-preview-card {
  margin-top: 16px;
}

.summary-card,
.table-preview-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(215, 202, 181, 0.88);
  background: #faf6ef;
}

.summary-card h3,
.table-preview-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.kv-list {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 8px 14px;
  margin: 0;
}

.kv-list dt {
  color: var(--muted);
  font-weight: 700;
}

.kv-list dd {
  margin: 0;
  line-height: 1.7;
  text-wrap: pretty;
}

.table-wrap {
  overflow-x: auto;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: #fffdf9;
  border: 1px solid rgba(215, 202, 181, 0.88);
  border-radius: 12px;
  overflow: hidden;
}

.result-table th,
.result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(215, 202, 181, 0.66);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  background: #f2eadf;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 26, 23, 0.48);
  backdrop-filter: blur(4px);
}

.notice-modal {
  width: min(720px, 100%);
  padding: 24px;
}

.notice-modal p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.78;
  text-wrap: pretty;
}

.notice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.discover-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.helper-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  text-wrap: pretty;
}

.site-footer {
  width: min(100% - 32px, 1180px);
  margin: 18px auto 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 880px) {
  .hero,
  .hero-slim,
  .grid,
  .upload-grid,
  .reuse-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    margin-top: 84px;
  }

  .top-download {
    top: 12px;
    right: 10px;
  }

  .desktop-download-link {
    min-height: 50px;
    padding: 8px 12px 8px 9px;
    border-radius: 18px;
  }

  .hero,
  .panel,
  .alert,
  .notice-modal {
    border-radius: 18px;
  }

  .hero-copy h1 {
    font-size: clamp(32px, 10vw, 46px);
  }

  .notice-actions {
    justify-content: stretch;
  }

  .secondary-btn {
    width: 100%;
  }
}
