:root {
  --bg: #f5f1e8;
  --ink: #182026;
  --muted: #5c6a74;
  --card: rgba(255, 255, 255, 0.84);
  --line: rgba(24, 32, 38, 0.12);
  --accent: #b7512c;
  --accent-strong: #8f3b1d;
  --shadow: 0 18px 40px rgba(24, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(183, 81, 44, 0.18), transparent 24%),
    radial-gradient(circle at right 20%, rgba(24, 32, 38, 0.08), transparent 20%),
    linear-gradient(180deg, #fff8ee 0%, var(--bg) 100%);
  min-height: 100vh;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

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

.hero {
  padding: 40px;
  margin-top: 32px;
}

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

h1,
h2,
h3 {
  margin: 0 0 12px;
}

.subtitle,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.button,
button {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.button.secondary,
button.secondary {
  background: #e6dccd;
  color: var(--ink);
}

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

.button.secondary:hover,
button.secondary:hover {
  background: #d8cab4;
}

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

.span-4 {
  grid-column: span 4;
}

.span-6 {
  grid-column: span 6;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card {
  padding: 24px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 108px;
  font-family: inherit;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #171e24;
  color: #f7efe2;
  border-radius: 16px;
  padding: 16px;
  overflow: auto;
  font-size: 13px;
}

.preview-frame {
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
}

.preview-frame img {
  max-width: 100%;
  height: auto;
  display: block;
}

.status {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(183, 81, 44, 0.1);
  color: var(--ink);
  font-size: 14px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.small {
  font-size: 12px;
}

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

.pill {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(183, 81, 44, 0.12);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.table-shell {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th,
.result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.result-table th {
  position: sticky;
  top: 0;
  background: #f7efe2;
  z-index: 1;
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.thumb-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.thumb-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #fff;
}

.thumb-meta {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.camera-shell {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(24, 32, 38, 0.96) 0%, rgba(24, 32, 38, 0.84) 100%);
  aspect-ratio: 4 / 3;
  min-height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.camera-video {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
  background: #0f1418;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.camera-frame {
  width: min(78%, 420px);
  aspect-ratio: 3.6 / 1;
  border: 2px solid rgba(255, 248, 238, 0.92);
  border-radius: 18px;
  box-shadow:
    0 0 0 999px rgba(15, 20, 24, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.camera-overlay-text {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 20, 24, 0.64);
  color: #fff8ee;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

button:disabled,
.button[hidden] {
  cursor: default;
}

@media (max-width: 900px) {
  .span-4,
  .span-8,
  .span-6 {
    grid-column: span 12;
  }

  .hero {
    padding: 28px;
  }

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

  .camera-shell,
  .camera-video {
    min-height: 320px;
  }

  .section-head,
  .batch-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .section-head {
    align-items: stretch;
  }
}
