:root {
  --bg: #f4efe5;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-border: rgba(102, 77, 46, 0.14);
  --text: #2b2118;
  --muted: #756455;
  --primary: #2f6f4f;
  --accent: #d67c3c;
  --danger: #b94d34;
  --success: #2f6f4f;
  --shadow: 0 18px 50px rgba(67, 45, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 124, 60, 0.22), transparent 28%),
    radial-gradient(circle at right center, rgba(47, 111, 79, 0.16), transparent 24%),
    linear-gradient(135deg, #f8f4ec 0%, #efe3cf 100%);
  min-height: 100vh;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 56px;
}

.hero {
  margin-bottom: 24px;
}

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

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
  max-width: 760px;
  line-height: 1.7;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(10px);
}

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

#fileInput {
  display: none;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #4e8d68);
}

.button.secondary,
.button.ghost {
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(43, 33, 24, 0.1);
}

.drop-zone {
  margin-top: 18px;
  padding: 28px 20px;
  border: 2px dashed rgba(47, 111, 79, 0.28);
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(247, 240, 228, 0.92));
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(238, 249, 242, 0.96), rgba(247, 240, 228, 0.96));
  transform: translateY(-1px);
}

.drop-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.drop-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.workspace,
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.preview-card,
.camera-card,
.result-card,
.history-card {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(43, 33, 24, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.preview-card h2,
.camera-card h2,
.result-card h2,
.history-card h2 {
  margin: 0;
  font-size: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(214, 124, 60, 0.14);
  color: #8d4a20;
  font-size: 12px;
  font-weight: 700;
}

.tag.success {
  background: rgba(47, 111, 79, 0.14);
  color: var(--success);
}

#previewImage,
#camera {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  background: #e9e1d2;
}

#previewImage {
  display: none;
}

.placeholder,
.hint,
.status,
.meta {
  color: var(--muted);
}

.meta,
.hint {
  margin: 12px 0 0;
  line-height: 1.7;
}

.result-card p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(43, 33, 24, 0.12);
}

.result-card p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(245, 240, 233, 0.9);
  border: 1px solid rgba(43, 33, 24, 0.08);
}

.history-main,
.history-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-main span,
.history-sub span,
.history-name {
  color: var(--muted);
  font-size: 14px;
}

.history-name {
  margin-top: 8px;
  word-break: break-all;
}

.status-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(43, 33, 24, 0.08);
}

.status-box[data-state="success"] {
  background: rgba(235, 248, 240, 0.92);
  border-color: rgba(47, 111, 79, 0.24);
}

.status-box[data-state="error"] {
  background: rgba(252, 239, 236, 0.96);
  border-color: rgba(185, 77, 52, 0.22);
}

.status-box[data-state="loading"] {
  background: rgba(255, 247, 232, 0.96);
  border-color: rgba(214, 124, 60, 0.24);
}

.status {
  margin: 0;
  line-height: 1.7;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .workspace,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .actions {
    gap: 10px;
  }

  .button {
    width: 100%;
  }
}
