:root {
  color-scheme: light;
  --bg: #eef5fb;
  --surface: #ffffff;
  --line: #cbdcec;
  --line-strong: #9bb8d4;
  --text: #172033;
  --muted: #5c6c80;
  --blue: #1769d1;
  --blue-strong: #0f55ad;
  --green: #11845b;
  --red: #c2413a;
  --amber: #9a6500;
  --shadow: 0 18px 44px rgba(20, 60, 110, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.workspace {
  width: min(780px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.limit {
  flex: 0 0 auto;
  border: 1px solid #f0c76c;
  color: var(--amber);
  background: #fff8e8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
}

.upload-panel {
  display: grid;
  gap: 16px;
}

.drop-zone {
  min-height: 230px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.drop-zone:hover,
.drop-zone.is-dragover {
  border-color: var(--blue);
  background: #eef6ff;
}

.drop-zone.is-dragover {
  transform: translateY(-1px);
}

.drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e2f0ff;
  color: var(--blue);
}

.drop-icon svg {
  width: 30px;
  height: 30px;
}

.drop-title {
  font-size: 18px;
  font-weight: 700;
}

.drop-subtitle {
  color: var(--muted);
  font-size: 14px;
  max-width: 520px;
  line-height: 1.7;
}

.preview-panel {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.preview-panel img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf2f7;
}

.file-meta {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.file-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  color: var(--blue);
  border-color: var(--line-strong);
  background: #f8fbff;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg {
  width: 19px;
  height: 19px;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf6;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.18s ease;
}

.progress-bar.is-waiting {
  width: 100%;
  animation: pulse 1.05s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.55;
  font-size: 14px;
}

.message.error {
  color: var(--red);
  background: #fff0ef;
  border: 1px solid #f3b7b3;
}

.message.success {
  color: var(--green);
  background: #edfff8;
  border: 1px solid #9edfc9;
}

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

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-strong);
}

.primary-button:disabled {
  border-color: #a9bfd7;
  background: #a9bfd7;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--blue);
  background: #fff;
}

.secondary-button:hover {
  border-color: var(--blue);
  background: #f8fbff;
}

.result-panel {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.result-panel label {
  font-weight: 700;
  font-size: 14px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 40px;
  gap: 8px;
}

.result-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #f8fbff;
}

@media (max-width: 620px) {
  .shell {
    padding: 16px 10px;
    place-items: start center;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 22px;
  }

  .limit {
    width: fit-content;
  }

  .drop-zone {
    min-height: 210px;
    padding: 18px;
  }

  .preview-panel {
    grid-template-columns: 64px minmax(0, 1fr) 40px;
  }

  .preview-panel img {
    width: 64px;
    height: 64px;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
