:root {
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #18222d;
  --muted: #5f6c79;
  --subtle: #8c98a5;
  --line: #dfe5eb;
  --line-strong: #b8c3ce;
  --accent: #d74b32;
  --accent-dark: #b83c27;
  --accent-soft: #fff2ee;
  --success: #287a55;
  --danger: #b42318;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fafbfc 0, var(--canvas) 260px),
    var(--canvas);
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.topbar {
  display: flex;
  align-items: center;
  width: min(1120px, calc(100% - 48px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand strong {
  font-size: 15px;
  font-weight: 680;
}

.brand span {
  color: var(--subtle);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.84fr);
  gap: clamp(48px, 7vw, 88px);
  width: min(1120px, calc(100% - 48px));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 44px 0 64px;
  align-items: center;
}

.hero-copy {
  min-width: 0;
  padding: 20px 0;
}

h1 {
  margin: 0;
  font-size: clamp(46px, 5.2vw, 67px);
  font-weight: 740;
  letter-spacing: -0.045em;
  line-height: 1.01;
}

h1 span {
  display: block;
}

.title-muted {
  color: #747f8a;
}

.lead {
  max-width: 540px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.format-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 32px;
  color: var(--subtle);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.format-hints span {
  position: relative;
}

.format-hints span + span::before {
  position: absolute;
  left: -13px;
  color: var(--line-strong);
  content: "/";
}

.stage {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface);
  box-shadow:
    0 2px 4px rgba(24, 34, 45, 0.04),
    0 22px 60px rgba(24, 34, 45, 0.1);
}

.stage-head {
  display: flex;
  min-height: 58px;
  padding: 0 6px 14px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stage-head > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.stage-head strong {
  font-size: 14px;
  font-weight: 680;
}

.stage-head > div span {
  color: var(--subtle);
  font-size: 10px;
}

.stage-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.stage-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.drop-zone {
  display: flex;
  min-height: 250px;
  margin-top: 12px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragging {
  border-color: var(--accent);
  outline: none;
  background: var(--accent-soft);
}

.drop-zone.busy {
  pointer-events: none;
  opacity: 0.55;
}

.drop-kicker {
  color: var(--subtle);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 660;
}

.drop-zone > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.upload-progress {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
  background: var(--surface-soft);
}

.upload-progress.complete {
  border-color: #d4e7dc;
  background: #f5faf7;
}

.preview-frame {
  width: 64px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef2f5;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.progress-content {
  min-width: 0;
}

.progress-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
}

.progress-title-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-title-row span {
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  background: #e3e8ed;
}

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

.progress-content p {
  margin: 7px 0 0;
  color: var(--subtle);
  font-size: 9px;
}

.result-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.result-heading strong {
  color: var(--success);
  font-size: 13px;
}

.result-heading span {
  color: var(--subtle);
  font-size: 9px;
}

.format-list {
  display: flex;
  flex-direction: column;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.format-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #edf0f3;
  align-items: center;
}

.format-item:first-child {
  border-top: 0;
}

.format-info {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  align-items: baseline;
}

.format-info strong {
  color: var(--accent);
  font-size: 9px;
  font-weight: 620;
}

.format-info code {
  overflow: hidden;
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-copy {
  padding: 2px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.format-copy:hover {
  color: var(--accent);
}

.error-panel {
  display: flex;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #f0c9c5;
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  flex-direction: column;
  gap: 3px;
  background: #fff5f3;
}

.error-panel strong {
  color: var(--danger);
  font-size: 11px;
}

.error-panel span {
  color: #76514d;
  font-size: 10px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(320px, calc(100vw - 40px));
  padding: 9px 12px;
  border-radius: 4px;
  color: #ffffff;
  background: rgba(24, 34, 45, 0.94);
  box-shadow: 0 10px 30px rgba(24, 34, 45, 0.18);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .page {
    grid-template-columns: 1fr;
    gap: 42px;
    min-height: auto;
    padding-top: 40px;
  }

  .hero-copy {
    max-width: 720px;
    padding: 0;
  }

  .stage {
    width: min(100%, 640px);
  }
}

@media (max-width: 560px) {
  .topbar,
  .page {
    width: calc(100% - 32px);
  }

  .topbar {
    min-height: 58px;
  }

  .brand span {
    display: none;
  }

  .page {
    gap: 30px;
    padding: 28px 0 46px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 48px);
    line-height: 1.04;
  }

  .lead {
    font-size: 14px;
  }

  .format-hints {
    margin-top: 23px;
  }

  .stage {
    padding: 10px;
  }

  .stage-head {
    min-height: 52px;
  }

  .drop-zone {
    min-height: 218px;
  }

  .upload-progress {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .preview-frame {
    width: 52px;
  }

  .format-info {
    grid-template-columns: 46px minmax(0, 1fr);
  }
}
