:root {
  --ink: #161616;
  --paper: #f7f4ee;
  --panel: #fffdfa;
  --line: #d8d0c4;
  --muted: #70685d;
  --accent: #0e7c66;
  --accent-strong: #075947;
  --warn: #9d2f2f;
  --shadow: 0 24px 80px rgba(40, 32, 22, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 22, 22, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(22, 22, 22, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 26px 26px;
  font-family: Avenir Next, Avenir, Helvetica Neue, sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(216, 226, 220, 0.9);
  background: rgba(255, 255, 255, 0.96);
  padding: 24px 48px;
}

.brand-section {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #1e2838;
  text-decoration: none;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.brand-name {
  color: #1e2838;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav-section {
  display: flex;
  align-items: center;
  gap: 48px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #f7f9f7;
  padding: 14px 40px;
}

.nav-link {
  color: #384659;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: #1e2838;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(420px, 1.14fr);
  gap: 18px;
  align-items: stretch;
}

.mast {
  grid-column: 1 / -1;
  border-top: 3px solid var(--ink);
  padding-top: 22px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 840px;
  font-family: Georgia, Times New Roman, serif;
  font-size: clamp(38px, 5.8vw, 78px);
  line-height: 0.98;
}

h1 span {
  display: block;
}

h1 span + span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.5em;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
}

.subcopy {
  max-width: 700px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 16px;
}

.limit-banner {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  border: 1px solid rgba(157, 47, 47, 0.28);
  border-radius: 8px;
  background: #fff4ef;
  color: var(--warn);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

.limit-banner strong {
  color: #7b2020;
  font-size: 14px;
}

.drop-zone {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 2px dashed #b7aa9a;
  border-radius: 8px;
  background:
    radial-gradient(circle at 24px 24px, rgba(14, 124, 102, 0.18) 0 2px, transparent 3px),
    #fbfaf6;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  transform: translateY(-1px);
  background-color: #f1faf5;
}

.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
}

.drop-title {
  font-size: 24px;
  font-weight: 800;
}

.drop-title + .drop-meta {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.drop-meta,
.file-line,
label span {
  color: var(--muted);
  font-size: 13px;
}

#file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.btn,
button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: #111827;
  color: #fff;
}

.btn-secondary {
  border-color: #111827;
  background: #fff;
  color: #111827;
}

.btn-secondary:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.file-line {
  min-height: 20px;
  margin-top: 12px;
}

.file-list-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.file-list {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.file-list th,
.file-list td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.file-list th {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.file-list td {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.file-list tr:last-child td {
  border-bottom: 0;
}

.file-list tr.is-over-limit td {
  background: #fff4ef;
  color: var(--warn);
  font-weight: 700;
}

.status-text {
  margin-bottom: 6px;
}

.progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1ede5;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.progress.is-error .progress-bar {
  background: var(--warn);
}

.progress.is-cancelled .progress-bar {
  background: #8f877c;
}

.progress.is-done .progress-bar {
  background: var(--accent-strong);
}

.file-list th:nth-child(1),
.file-list td:nth-child(1) {
  width: 44%;
}

.file-list th:nth-child(2),
.file-list td:nth-child(2) {
  width: 20%;
}

.file-list th:nth-child(3),
.file-list td:nth-child(3) {
  width: 16%;
}

.file-list th:nth-child(4),
.file-list td:nth-child(4) {
  width: 20%;
}

.output-panel {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.actions {
  display: flex;
  gap: 8px;
}

.result-list {
  display: grid;
  max-height: 480px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  background: #fffdfa;
}

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

.result-card {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.result-card:last-child {
  border-bottom: 0;
}

.result-card.is-error {
  background: #fff4ef;
}

.result-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.result-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.3;
}

.result-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.result-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.result-card-actions button {
  min-height: 34px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
}

.result-card pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(216, 208, 196, 0.8);
  border-radius: 6px;
  background: #191815;
  color: #f8f3e7;
  padding: 10px;
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.output {
  min-height: 0;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #191815;
  color: #f8f3e7;
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.site-footer {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 22px 0 0;
}

.mini-program-card {
  width: min(440px, 100%);
  border: 1px solid #e3d7bd;
  border-radius: 28px;
  background: linear-gradient(180deg, #f4ecdc 0%, #fffaf0 100%);
  padding: 16px 24px 18px;
  text-align: center;
}

.mini-program-kicker {
  color: #a3916e;
  font-family: Georgia, Times New Roman, serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-program-code {
  display: grid;
  width: min(320px, 100%);
  aspect-ratio: 854 / 576;
  place-items: center;
  margin: 4px auto 10px;
  border: 1px solid #dfcc9e;
  border-radius: 24px;
  background: #fff;
  overflow: hidden;
}

.mini-program-code img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-program-caption {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.official-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  color: var(--ink);
  padding: 6px 14px 6px 8px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.official-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.official-link img {
  display: block;
  width: 28px;
  height: 28px;
}

@media (max-width: 860px) {
  .top-nav {
    align-items: stretch;
    flex-direction: column;
    padding: 18px 20px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand-name {
    font-size: 22px;
  }

  .nav-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }

  .nav-link {
    display: grid;
    min-height: 44px;
    place-items: center;
    border-bottom: 1px solid #d8e2dc;
    font-size: 15px;
  }

  .nav-link:nth-child(odd) {
    border-right: 1px solid #d8e2dc;
  }

  .nav-link:nth-child(n + 3) {
    border-bottom: 0;
  }

  .shell {
    width: min(100vw - 20px, 680px);
    padding: 22px 0;
  }

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

  h1 {
    font-size: 40px;
  }

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

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

  .result-card-head {
    grid-template-columns: 1fr;
  }

  .result-card-actions {
    justify-content: flex-start;
  }

  .file-list {
    min-width: 620px;
  }
}
