:root {
  color-scheme: light;
  --bg-top: #f6efe2;
  --bg-bottom: #dce7f7;
  --page: #f8fafc;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(20, 36, 58, 0.12);
  --text: #162235;
  --muted: #5b6b82;
  --accent: #b44d12;
  --accent-strong: #8f3704;
  --accent-soft: rgba(180, 77, 18, 0.12);
  --success: #1e7a4b;
  --danger: #ad2f2f;
  --shadow: 0 20px 40px rgba(18, 31, 53, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 35%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px 22px;
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 238, 0.9)),
    var(--page);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -46px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 77, 18, 0.18), transparent 70%);
  pointer-events: none;
}

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

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.08;
}

.hero-copy,
.hero-note {
  max-width: 44rem;
  color: var(--muted);
}

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

.upload-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.upload-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 28px rgba(180, 77, 18, 0.24);
}

.upload-button:hover,
.secondary-button:hover,
.text-button:hover,
.result-action:hover {
  transform: translateY(-1px);
}

.upload-button input {
  display: none;
}

.secondary-button {
  background: rgba(22, 34, 53, 0.08);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.92rem;
  color: var(--muted);
}

.field input,
.field select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(26, 43, 69, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.field-value {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(26, 43, 69, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(22, 34, 53, 0.06);
  color: var(--text);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
}

.checkbox-field input {
  min-height: auto;
  margin: 0;
}

.dropzone {
  padding: 24px 16px;
  border: 2px dashed rgba(180, 77, 18, 0.35);
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(180, 77, 18, 0.08));
  color: var(--muted);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(180, 77, 18, 0.16));
  transform: scale(1.01);
}

.dropzone p {
  margin: 0;
}

.dropzone-subcopy {
  margin-top: 6px !important;
  font-size: 0.92rem;
}

.summary-card,
.status-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(22, 34, 53, 0.06);
  color: var(--text);
}

.file-list,
.results-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.file-card,
.result-card {
  padding: 14px;
  border: 1px solid rgba(26, 43, 69, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
}

.file-card-header,
.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.file-name,
.result-name {
  margin: 0;
  word-break: break-word;
  font-weight: 700;
}

.meta-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill-pending {
  background: rgba(22, 34, 53, 0.08);
}

.pill-processing {
  background: rgba(180, 77, 18, 0.12);
  color: var(--accent-strong);
}

.pill-success {
  background: rgba(30, 122, 75, 0.14);
  color: var(--success);
}

.pill-error {
  background: rgba(173, 47, 47, 0.12);
  color: var(--danger);
}

.result-card {
  cursor: pointer;
}

.result-card.is-selected {
  border-color: rgba(180, 77, 18, 0.4);
  box-shadow: 0 10px 24px rgba(180, 77, 18, 0.12);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.result-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.preview-empty,
.preview-card {
  min-height: 260px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(220, 231, 247, 0.42));
}

.preview-empty {
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.preview-card {
  margin: 0;
  overflow: hidden;
}

.preview-card img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: repeating-linear-gradient(
    45deg,
    rgba(22, 34, 53, 0.05),
    rgba(22, 34, 53, 0.05) 12px,
    rgba(255, 255, 255, 0.8) 12px,
    rgba(255, 255, 255, 0.8) 24px
  );
}

.preview-card figcaption {
  padding: 14px 16px 18px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

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

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
  }

  .hero,
  .panel {
    border-radius: 24px;
  }

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

  .file-card-header,
  .result-card-header,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    flex-direction: column;
  }

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