:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #102033;
  --muted: #6b7a90;
  --line: #d9e2ec;
  --primary: #0b6bcb;
  --primary-dark: #0953a0;
  --success: #11875d;
  --success-soft: #eaf8f1;
  --warning: #b57100;
  --warning-soft: #fff4df;
  --error: #c63b3b;
  --error-soft: #ffeded;
  --shadow: 0 16px 40px rgba(16, 32, 51, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, #f8fbff 0%, #f3f6fb 45%, #eef2f8 100%);
}

body {
  padding: 24px;
}

.app-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.view {
  display: none;
  width: min(100%, 760px);
}

.view-active {
  display: block;
}

.scan-card,
.result-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.scan-card {
  padding: 32px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.scan-card h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.subtext {
  margin: 14px auto 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.camera-frame {
  margin-top: 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0f1720;
  border: 1px solid #1f2d3d;
}

#reader {
  width: 100%;
  background: #000;
}

#reader__scan_region {
  min-height: 340px;
  background: #111;
}

#reader section {
  border: none !important;
}

#reader video {
  border-radius: 0 !important;
}

#reader button,
#reader select,
#reader input {
  font-family: inherit !important;
  font-size: 15px !important;
  border-radius: 12px !important;
}

.scan-status {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.result-card {
  padding: 36px 30px 28px;
  text-align: center;
}

.result-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
}

.result-kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.result-card h2 {
  margin: 10px 0 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.result-message {
  margin: 16px auto 0;
  max-width: 34ch;
  font-size: 18px;
  line-height: 1.65;
  color: var(--muted);
}

.result-meta {
  margin-top: 28px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.meta-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.meta-value {
  font-weight: 800;
  text-align: right;
  word-break: break-word;
}

.meta-item-group {
  align-items: center;
}

.meta-value-group {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.primary-btn {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
}

.result-card.state-success .result-icon {
  background: var(--success-soft);
  color: var(--success);
}

.result-card.state-duplicate .result-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.result-card.state-error .result-icon {
  background: var(--error-soft);
  color: var(--error);
}

.result-card.is-loading .result-icon {
  background: #edf3ff;
  color: var(--primary);
}

@media (max-width: 768px) {
  body {
    padding: 14px;
  }

  .app-shell {
    min-height: calc(100vh - 28px);
  }

  .view {
    width: 100%;
  }

  .scan-card {
    padding: 24px 18px;
  }

  .result-card {
    padding: 28px 18px 22px;
  }

  #reader__scan_region {
    min-height: 300px;
  }

  .meta-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .meta-value {
    text-align: left;
  }

  .meta-value-group {
    font-size: 30px;
  }
}