:root {
  --bg: #ece1d0;
  --panel: rgba(255, 249, 240, 0.8);
  --panel-strong: #fffaf2;
  --line: rgba(112, 87, 54, 0.18);
  --text: #201a16;
  --muted: #665a4c;
  --accent: #b97822;
  --accent-deep: #7a4a16;
  --accent-soft: #ecd1a8;
  --ok: #285a41;
  --warn: #9a6d16;
  --error: #8d2b2b;
  --shadow: 0 24px 60px rgba(66, 43, 13, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(188, 136, 62, 0.2), transparent 24%),
    radial-gradient(circle at right 10% top 18%, rgba(138, 109, 70, 0.09), transparent 20%),
    linear-gradient(180deg, #f3eadc 0%, #e6dac8 100%);
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  align-items: stretch;
  padding: 30px 32px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 120, 34, 0.16), transparent 66%);
  pointer-events: none;
}

.hero-copy,
.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lead {
  margin-top: 10px;
  color: var(--muted);
  max-width: 620px;
  line-height: 1.6;
  font-size: 17px;
}

.uploader {
  padding: 24px;
  margin-bottom: 22px;
}

.uploader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 20px;
}

.dropzone {
  display: block;
  border: 2px dashed rgba(185, 120, 34, 0.34);
  border-radius: 24px;
  padding: 34px 26px;
  text-align: left;
  cursor: pointer;
  background: var(--panel-strong);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dropzone.dragover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: #fff7ea;
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(40, 90, 65, 0.34);
  background: linear-gradient(180deg, #fff9f1 0%, #f7efe3 100%);
}

.dropzone input {
  display: none;
}

.drop-kicker {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent-deep);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drop-title {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.drop-hint {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.6;
}

.file-card {
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 251, 245, 0.9);
  border: 1px solid rgba(112, 87, 54, 0.12);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.file-card.ready {
  border-color: rgba(40, 90, 65, 0.3);
  box-shadow: 0 16px 34px rgba(42, 90, 65, 0.12);
}

.file-card.processing {
  border-color: rgba(185, 120, 34, 0.34);
}

.file-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.file-card-label {
  color: var(--muted);
  font-size: 13px;
}

.file-state-badge {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.file-state-badge.idle {
  background: #efe5d6;
  color: var(--muted);
}

.file-state-badge.ready {
  background: rgba(40, 90, 65, 0.12);
  color: var(--ok);
}

.file-state-badge.processing {
  background: rgba(185, 120, 34, 0.16);
  color: var(--warn);
}

.file-state-badge.success {
  background: rgba(40, 90, 65, 0.14);
  color: var(--ok);
}

.file-state-badge.error {
  background: rgba(141, 43, 43, 0.12);
  color: var(--error);
}

.file-card-body {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 0;
}

.thumb-frame {
  width: 108px;
  height: 108px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #f6ede2, #ecdfcf);
  border: 1px solid rgba(112, 87, 54, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#file-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.thumb-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#file-name {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

#file-meta-line {
  color: var(--muted);
  line-height: 1.45;
}

.actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

#submit-btn {
  background: linear-gradient(135deg, #c38a35, #9c661c);
  color: #fffaf1;
  font-weight: 700;
  min-width: 148px;
}

#submit-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.secondary-btn {
  background: rgba(230, 218, 202, 0.78);
  color: var(--text);
}

.status {
  color: var(--muted);
  font-size: 14px;
}

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

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

.status.processing {
  color: var(--warn);
}

.grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 22px;
}

.panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

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

.metric,
.result-list div {
  padding: 15px;
  border-radius: 18px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(111, 90, 54, 0.12);
}

.metric-label,
.result-list span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 24px;
}

.result-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.result-list strong {
  display: block;
  line-height: 1.5;
}

.empty-state {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 250, 243, 0.86);
  border: 1px dashed rgba(111, 90, 54, 0.16);
  border-radius: 18px;
}

.hidden {
  display: none;
}

.preview-frame {
  min-height: 540px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(182, 123, 39, 0.08) 25%, transparent 25%, transparent 75%, rgba(182, 123, 39, 0.08) 75%),
    linear-gradient(45deg, rgba(182, 123, 39, 0.08) 25%, transparent 25%, transparent 75%, rgba(182, 123, 39, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#preview-image {
  max-width: 100%;
  max-height: 72vh;
  display: none;
  animation: fadeInUp 0.24s ease;
}

.preview-placeholder {
  color: var(--muted);
  text-align: center;
  max-width: 260px;
  line-height: 1.6;
}

.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle {
  background: rgba(228, 214, 194, 0.8);
  color: var(--muted);
}

.toggle.active {
  background: #382c20;
  color: #fff7ef;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .file-card-body {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .thumb-frame {
    width: 88px;
    height: 88px;
  }

  .preview-frame {
    min-height: 320px;
  }
}
