:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f1f5fb;
  --surface-blue: #eef5ff;
  --ink: #172033;
  --muted: #667085;
  --subtle: #8a96a8;
  --line: #d9e2ef;
  --line-strong: #c4d1e2;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e7efff;
  --accent: #b45309;
  --success: #047857;
  --success-soft: #ecfdf5;
  --error: #b42318;
  --error-soft: #fff1f0;
  --shadow: 0 18px 44px rgba(25, 42, 70, 0.08);
  --shadow-soft: 0 8px 22px rgba(25, 42, 70, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #f4f7fb 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 3px;
}

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

.workspace {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.brand-lockup {
  display: grid;
  gap: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: 0;
}

.health {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.health.ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfe8d4;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.workflow-step {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}

.workflow-step.active {
  background: var(--primary-soft);
  border-color: #bad0ff;
  color: var(--primary);
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 18px;
  align-items: stretch;
}

.drop-panel,
.controls {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

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

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  width: 100%;
  min-height: 360px;
  border: 0;
  border-radius: 0;
  padding: 32px 24px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(238, 245, 255, 0.82), rgba(255, 255, 255, 0.96)),
    var(--surface-blue);
  text-align: center;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  background:
    linear-gradient(180deg, rgba(231, 239, 255, 0.94), rgba(255, 255, 255, 0.98)),
    var(--surface-blue);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.22);
}

.drop-mark {
  width: 54px;
  height: 54px;
  display: block;
  border-radius: 14px;
  border: 1px solid #c9d8f0;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
  position: relative;
}

.drop-mark::before,
.drop-mark::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary);
}

.drop-mark::before {
  top: 22px;
}

.drop-mark::after {
  top: 30px;
}

.drop-main {
  display: block;
  max-width: 520px;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 760;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.drop-sub {
  display: block;
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.file-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.file-strip > div {
  min-width: 0;
}

.file-name {
  margin: 0 0 3px;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.batch-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.batch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}

.batch-item.success {
  border-color: #bfe8d4;
  background: var(--success-soft);
}

.batch-item.error {
  border-color: #ffd0cb;
  background: var(--error-soft);
}

.batch-main {
  min-width: 0;
}

.batch-name,
.batch-detail {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.batch-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.batch-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.batch-item.error .batch-detail {
  color: var(--error);
}

.batch-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 72px;
}

.batch-status {
  max-width: 120px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.batch-item.success .batch-status {
  color: var(--success);
}

.batch-item.error .batch-status {
  color: var(--error);
}

.mini-button {
  min-height: 32px;
  max-width: 120px;
  border: 1px solid #bad0ff;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 650;
}

.primary-button,
.ghost-button,
.download-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 720;
  text-decoration: none;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: center;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button,
.download-button {
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.primary-button:hover,
.download-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #d8e0ea;
  color: #7a8798;
  box-shadow: none;
  transform: none;
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--muted);
}

.ghost-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.progress-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7f7;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease, background-color 180ms ease;
}

.progress-panel.success .progress-fill {
  background: var(--success);
}

.progress-panel.error .progress-fill {
  background: var(--error);
}

.status-box {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-box.error {
  color: var(--error);
  background: var(--error-soft);
  border-color: #ffd0cb;
}

.status-box.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfe8d4;
}

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

.matrix-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.matrix h2 {
  margin-bottom: 0;
  font-size: 19px;
  font-weight: 760;
}

.matrix p {
  margin-bottom: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.format-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: stretch;
}

.format-item {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  height: 100%;
}

.format-item h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 740;
  line-height: 1.25;
}

.format-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .matrix-header {
    display: grid;
  }

  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .format-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health {
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding: 10px 0;
  }

  .workspace {
    padding: 12px;
    border-radius: 12px;
  }

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

  .drop-zone {
    min-height: 300px;
    padding: 24px 14px;
  }

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

  .file-strip {
    align-items: stretch;
    flex-direction: column;
  }

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

  .batch-actions {
    justify-items: stretch;
  }

  .batch-status {
    max-width: none;
    text-align: left;
  }
}
