:root {
  --bg: #eef4fb;
  --card: #ffffff;
  --text: #071226;
  --muted: #64748b;
  --line: #e5e7eb;
  --dark: #030712;
  --accent: #111827;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.13), transparent 30%),
    radial-gradient(circle at bottom right, rgba(245,158,11,.12), transparent 35%),
    var(--bg);
  color: var(--text);
}

.shell {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  margin: 14px 0;
  box-shadow: 0 18px 48px rgba(15,23,42,.08);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: #020617;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: .5px;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 24px;
}

h2 {
  margin-bottom: 7px;
  font-size: 20px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  font-weight: 800;
  font-size: 13px;
}

.scanner-frame {
  border-radius: 18px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  overflow: hidden;
  min-height: 280px;
  display: grid;
  place-items: center;
}

#reader {
  width: 100%;
  max-width: 520px;
}

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

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, #020617, #737373);
  color: #fff;
}

.secondary {
  background: #fff;
  color: #020617;
  border: 1px solid var(--line);
}

.full {
  width: 100%;
  margin-top: 14px;
}

.upload-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.upload-box label,
label {
  display: block;
  font-size: 13px;
  font-weight: 900;
  color: #475569;
  margin-bottom: 8px;
}

input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
}

input:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148,163,184,.18);
}

.result-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 130px;
  border-radius: 18px;
  padding: 16px;
  background: #020617;
  color: #f8fafc;
  line-height: 1.55;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(20px);
  background: #020617;
  color: #fff;
  padding: 13px 16px;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
  max-width: calc(100% - 32px);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.success {
  color: var(--success);
}

.danger {
  color: var(--danger);
}

@media (max-width: 680px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell {
    width: min(100% - 18px, 920px);
    padding-top: 10px;
  }

  .card {
    border-radius: 18px;
    padding: 16px;
  }
}
