﻿:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-soft: #223047;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --primary: #3b82f6;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 12% 18%, #1e293b 0%, #0f172a 46%, #0b1120 100%);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-a {
  background: #3b82f6;
  top: -70px;
  right: -60px;
}

.bg-glow-b {
  background: #22c55e;
  bottom: -90px;
  left: -70px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 600px);
  margin: 0 auto;
  padding: 20px 14px 34px;
}

.hero {
  text-align: center;
  margin-bottom: 16px;
}

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

.hero h1 {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  color: #f8fafc;
}

.camera-card,
.preview-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(23, 33, 51, 0.95));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 22px 42px rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(10px);
}

.preview-card {
  margin-top: 14px;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  overflow: hidden;
  background: #0b1220;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

#video,
#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  transform: scaleX(-1);
}

#overlayCanvas {
  pointer-events: none;
}

.meta-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.status-badge {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  animation: fadeIn 0.25s ease;
}

.status.valid {
  color: #d1fae5;
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.45);
}

.status.warning {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
}

.status.invalid {
  color: #fee2e2;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
}

.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.55);
  position: relative;
  transition: all 0.25s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s ease;
}

.switch-wrap input:checked + .switch-ui {
  background: rgba(59, 130, 246, 0.5);
  border-color: rgba(59, 130, 246, 0.75);
}

.switch-wrap input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.camera-controls {
  display: grid;
  justify-items: center;
  margin-top: 14px;
  gap: 8px;
}

.shutter-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 36% 30%, #ffffff 0%, #dde6f4 75%);
  box-shadow: 0 12px 22px rgba(2, 6, 23, 0.45);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.shutter-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 14px 24px rgba(2, 6, 23, 0.5);
}

.shutter-btn:active {
  transform: scale(0.96);
}

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

.shutter-label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.preview-card h2 {
  margin: 2px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}

#previewCanvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #0b1220;
  display: block;
}

.debug-info {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  white-space: pre-wrap;
}

.preview-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.save-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.26);
  border: 1px solid rgba(59, 130, 246, 0.5);
  cursor: pointer;
  transition: all 0.25s ease;
}

.save-btn:hover {
  background: rgba(59, 130, 246, 0.38);
  transform: translateY(-1px);
}

.save-btn:active {
  transform: translateY(0);
}

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

@keyframes fadeIn {
  from {
    opacity: 0.5;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .hero h1 {
    font-size: 20px;
  }

  .camera-card,
  .preview-card {
    padding: 16px;
  }
}
