:root {
  color-scheme: light;
  --bg: #f3efe5;
  --bg-accent: #efe4c8;
  --surface: rgba(255, 252, 245, 0.9);
  --surface-strong: #fffdf8;
  --ink: #1f1d19;
  --muted: #6d6659;
  --line: rgba(61, 49, 27, 0.12);
  --primary: #c5621a;
  --primary-strong: #9f4b10;
  --success: #1f8f57;
  --danger: #ba3329;
  --warning: #d68b10;
  --shadow: 0 22px 48px rgba(68, 51, 22, 0.16);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(197, 98, 26, 0.22), transparent 28%),
    radial-gradient(circle at left center, rgba(214, 139, 16, 0.18), transparent 24%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  color: var(--ink);
  font-family: "Archivo", sans-serif;
}

body {
  padding: 20px 16px 40px;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(100%, 640px);
  margin: 0 auto;
}

.topbar,
.panel-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 16px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  line-height: 1;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.7rem;
}

.app {
  display: grid;
  gap: 16px;
}

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

.panel.centered {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.field span {
  color: var(--muted);
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--ink);
}

button {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: var(--primary);
  color: #fff8f2;
}

button.secondary {
  background: #1f1d19;
  color: white;
}

button.ghost {
  background: rgba(31, 29, 25, 0.07);
  color: var(--ink);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.divider {
  position: relative;
  text-align: center;
  color: var(--muted);
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
}

.divider span {
  position: relative;
  padding: 0 10px;
  background: var(--surface);
}

.camera-card {
  position: relative;
  overflow: hidden;
  margin: 16px 0 12px;
  border-radius: 22px;
  background: #0f0f0f;
  aspect-ratio: 3 / 4;
}

.camera-card.large {
  aspect-ratio: 4 / 5;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 18% 12%;
  border: 3px solid rgba(255, 248, 242, 0.88);
  border-radius: 24px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.identity-card,
.event-card,
.result {
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  position: relative;
}

.identity-card,
.result {
  padding: 16px;
}

.event-card {
  padding: 16px 16px 14px;
  display: grid;
  gap: 10px;
}

.event-card time {
  color: var(--muted);
  font-size: 0.92rem;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.message {
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 600;
}

.message.error {
  background: rgba(186, 51, 41, 0.1);
  color: var(--danger);
}

.message.info {
  background: rgba(214, 139, 16, 0.12);
  color: #855708;
}

.message.success {
  background: rgba(31, 143, 87, 0.11);
  color: var(--success);
}

.result.success {
  border-color: rgba(31, 143, 87, 0.22);
  background: linear-gradient(180deg, rgba(31, 143, 87, 0.12), rgba(255, 253, 248, 0.98));
}

.result.error {
  border-color: rgba(186, 51, 41, 0.24);
  background: linear-gradient(180deg, rgba(186, 51, 41, 0.1), rgba(255, 253, 248, 0.98));
}

.result h3 {
  margin-bottom: 6px;
}

.result .result-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result.success .result-badge {
  background: rgba(31, 143, 87, 0.14);
  color: var(--success);
}

.result.error .result-badge {
  background: rgba(186, 51, 41, 0.14);
  color: var(--danger);
}

.scan-alert {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 14, 9, 0.58);
  backdrop-filter: blur(10px);
}

.scan-alert-card {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(186, 51, 41, 0.18);
  background: linear-gradient(180deg, #fff3f1, #fffdf8);
  box-shadow: 0 28px 60px rgba(49, 18, 15, 0.22);
}

.scan-alert-card h3 {
  margin: 8px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.45rem;
}

.scan-alert-message {
  margin-bottom: 16px;
  color: var(--ink);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(31, 29, 25, 0.12);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 420px) {
  body {
    padding-inline: 12px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}
