:root {
  color-scheme: light;
  --bg: #f5efe6;
  --bg-alt: #e8f0f2;
  --card: rgba(255, 255, 255, 0.76);
  --text: #17212b;
  --muted: #5f6b76;
  --accent: #0f766e;
  --accent-strong: #0b4f5e;
  --border: rgba(23, 33, 43, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(11, 79, 94, 0.14), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-alt));
}

.shell {
  min-height: 100vh;
  display: grid;
  gap: 2rem;
  align-items: center;
  padding: 2rem;
}

.hero,
.panel {
  width: min(960px, 100%);
  margin: 0 auto;
}

.hero {
  padding: 1.5rem 0;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-strong);
  font-size: 0.78rem;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(2.8rem, 9vw, 6rem);
}

.lede,
.meta,
p {
  color: var(--muted);
}

.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.5rem;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 70px rgba(15, 23, 42, 0.12);
}

.stack {
  display: grid;
  gap: 1rem;
}

.form {
  display: grid;
  gap: 1rem;
  max-width: 32rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
}

input,
select,
button {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  font: inherit;
}

input {
  background: rgba(255, 255, 255, 0.92);
}

select {
  background: rgba(255, 255, 255, 0.92);
}

button {
  justify-self: start;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.result {
  margin: 0;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  overflow: auto;
}

.shell-admin {
  align-items: start;
}

.admin-auth {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.65);
  display: grid;
  gap: 1rem;
}

.admin-card h2 {
  font-size: 1.5rem;
}

.scan-config-form {
  max-width: 100%;
}

.scan-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.scanner-stage {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #0f172a;
  min-height: 260px;
}

.scanner-stage video {
  width: 100%;
  min-height: 260px;
  max-height: 64vh;
  object-fit: cover;
  display: block;
}

.scanner-overlay {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.68);
  color: #f8fafc;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

.scan-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  max-width: min(92vw, 480px);
  z-index: 999;
}

.scan-toast.show {
  display: inline-flex;
}

.scan-toast.success {
  background: rgba(6, 95, 70, 0.92);
}

.scan-toast.error {
  background: rgba(153, 27, 27, 0.92);
}

.spinner {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 2px solid rgba(248, 250, 252, 0.35);
  border-top-color: #f8fafc;
  animation: spin 0.8s linear infinite;
}

.icon {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.icon.success {
  color: #dcfce7;
}

.icon.error {
  color: #fee2e2;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
  .shell {
    padding: 1rem;
  }

  .panel {
    border-radius: 18px;
  }

  .admin-auth {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .scan-toast {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}