:root {
  --ink: #121814;
  --paper: #e8e2d6;
  --panel: #1a221c;
  --panel-2: #243028;
  --line: rgba(232, 226, 214, 0.18);
  --accent: #c4a35a;
  --accent-ink: #1a1408;
  --good: #6fbf8a;
  --bad: #e07a5f;
  --muted: rgba(232, 226, 214, 0.68);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--paper);
  background: var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(196, 163, 90, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(111, 191, 138, 0.08), transparent 50%),
    linear-gradient(165deg, #0f1410 0%, #1a221c 45%, #101612 100%);
}

body {
  min-height: 100dvh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  gap: 14px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.brand h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.health {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 10px;
  white-space: nowrap;
}

.health.ok {
  color: var(--good);
  border-color: rgba(111, 191, 138, 0.35);
}

.health.bad {
  color: var(--bad);
  border-color: rgba(224, 122, 95, 0.4);
}

.stage {
  display: grid;
  gap: 12px;
  align-content: start;
}

.viewport {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #050705;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

#preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #050705;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}

.placeholder-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.placeholder-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.result {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  padding: 14px 16px;
}

.result[data-decision="AUTHENTIC"] {
  border-color: rgba(111, 191, 138, 0.45);
}

.result[data-decision="SUSPECT_COPY"] {
  border-color: rgba(224, 122, 95, 0.5);
}

.result[data-decision="INCONCLUSIVE"],
.result[data-decision="DECODED_UNCALIBRATED"] {
  border-color: rgba(212, 176, 106, 0.45);
}

.result-badge {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0;
}

.result-grid dt {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.result-grid dd {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-all;
}

.result-note {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.actions {
  display: grid;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  padding: 14px 16px;
  cursor: pointer;
  text-align: center;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-size: 1.02rem;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
}

.file-btn {
  display: grid;
  place-items: center;
}

.status {
  min-height: 1.2em;
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (min-width: 720px) {
  .app {
    padding-top: 28px;
  }

  .viewport {
    aspect-ratio: 1 / 1;
  }
}
