:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --text: #20242a;
  --muted: #64707d;
  --line: #d9dee5;
  --panel: #ffffff;
  --soft: #eef3f8;
  --accent: #1264a3;
  --accent-strong: #0a4c82;
  --ok: #18794e;
  --warn: #aa4b00;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  min-height: 84px;
  padding: 18px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(22px, 3vw, 32px);
}

h2 {
  font-size: 18px;
}

.status {
  display: grid;
  gap: 8px;
  min-width: 180px;
  color: var(--muted);
  font-size: 13px;
}

.top-link {
  justify-self: end;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.top-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.meter {
  height: 8px;
  overflow: hidden;
  background: var(--soft);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: start;
  padding: 28px clamp(18px, 4vw, 48px) 48px;
}

form {
  display: grid;
  gap: 18px;
}

.form-band,
.preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-band {
  padding: 24px;
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.step {
  display: inline-flex;
  width: 34px;
  height: 30px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
}

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

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.upload-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.upload-band {
  border-color: #b8c7d5;
}

label,
.choice {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.wide {
  grid-column: 1 / -1;
}

span,
legend {
  color: #303741;
  font-size: 14px;
  font-weight: 650;
}

b {
  color: #c2410c;
}

input,
select,
button {
  min-height: 42px;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 100, 163, 0.14);
}

input[readonly] {
  color: #3d4752;
  background: #f3f6f9;
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: #c2410c;
}

small {
  color: var(--muted);
  font-size: 12px;
}

.choice {
  align-content: start;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
}

.choice legend {
  padding: 0 4px;
}

.choice label {
  display: inline-flex;
  align-items: center;
  margin-right: 16px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.choice input {
  width: 18px;
  min-height: auto;
  margin: 0 7px 0 0;
}

.file-drop {
  padding: 14px;
  background: var(--soft);
  border: 1px dashed #aeb9c5;
  border-radius: 8px;
}

.file-drop input[type="file"] {
  padding: 8px;
  background: #fff;
}

.notice {
  padding: 12px 14px;
  color: #44515f;
  background: #f8fafc;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  font-size: 14px;
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 0 0;
  background: linear-gradient(to top, var(--bg) 70%, rgba(246, 247, 249, 0));
}

button {
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  color: #fff;
  background: var(--accent);
}

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

.secondary,
.preview button {
  color: var(--accent);
  background: #fff;
  border-color: #b8c7d5;
}

.secondary:hover,
.preview button:hover {
  background: var(--soft);
}

.preview {
  position: sticky;
  top: 112px;
  overflow: hidden;
}

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

pre {
  min-height: 360px;
  max-height: calc(100vh - 260px);
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #172033;
  background: #f9fbfd;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.message {
  min-height: 42px;
  padding: 12px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.message.ok {
  color: var(--ok);
}

.message.warn {
  color: var(--warn);
}

[hidden] {
  display: none !important;
}

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

  .preview {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    position: static;
    display: grid;
  }

  .layout {
    padding: 18px 14px 34px;
  }

  .form-band {
    padding: 18px;
  }

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

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

  .upload-actions {
    display: grid;
  }

  .actions {
    position: static;
    display: grid;
  }

  button {
    width: 100%;
  }
}
