:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #171f2b;
  --text: #eef4fb;
  --muted: #9eb0c3;
  --accent: #62d8b0;
  --accent-2: #59a9ff;
  --border: #263241;
  --danger: #ff8b8b;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(89,169,255,.11), transparent 35rem),
    radial-gradient(circle at top right, rgba(98,216,176,.09), transparent 32rem),
    var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

button, .file-button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: .8rem 1rem;
  cursor: pointer;
  transition: .18s ease;
}

button:hover:not(:disabled), .file-button:hover {
  transform: translateY(-1px);
  border-color: #40546a;
}

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

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071018;
  border: none;
  font-weight: 800;
}

.file-button input { display: none; }

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.hero {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .13em;
  font-size: .76rem;
  margin: 0 0 .5rem;
}

h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 0; line-height: 1.02; }
h2 { margin: 0 0 14px; font-size: 1.15rem; }
.lead { color: var(--muted); max-width: 760px; line-height: 1.7; }

.privacy-badge, .mode-pill {
  white-space: nowrap;
  background: rgba(98,216,176,.1);
  border: 1px solid rgba(98,216,176,.28);
  color: var(--accent);
  padding: .55rem .8rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
}

.notice {
  border: 1px solid rgba(255,139,139,.25);
  background: rgba(255,139,139,.07);
  color: #ffd5d5;
  padding: 13px 15px;
  border-radius: 14px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--border);
  background: rgba(18,24,33,.9);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #05080c;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.guide {
  position: absolute;
  inset: 11%;
  border: 2px solid rgba(255,255,255,.82);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.26);
  pointer-events: none;
}

.guide-label {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.65);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .78rem;
}

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

.hint, .output-header p, footer p, .details p, .details li, #status {
  color: var(--muted);
  line-height: 1.6;
}

.progress-wrap { margin-top: 18px; }
.progress-track {
  height: 8px;
  background: #0a0e13;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .18s ease;
}

.results {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.result-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(255,255,255,.018);
}
.result-item span { color: var(--muted); }

.output-card { margin-top: 18px; }
.output-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.canvas-wrap {
  position: relative;
  margin-top: 12px;
  border-radius: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  background: #05080c;
  min-height: 280px;
  display: grid;
  place-items: center;
}

.canvas-wrap.empty canvas { display: none; }
canvas#outputCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: none;
}

#emptyMessage {
  color: var(--muted);
  padding: 40px 20px;
}

.details { margin-top: 18px; }
.details ul { padding-left: 1.25rem; }
footer { text-align: center; margin-top: 20px; font-size: .9rem; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .hero, .output-header { flex-direction: column; }
  .app-shell { width: min(100% - 18px, 1180px); padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
