:root {
  --bg: #1a0f1a;
  --bg-2: #2a1525;
  --text: #fef7f0;
  --text-dim: #c8b8c8;
  --primary: #dc2626;
  --primary-hover: #ef4444;
  --accent: #16a34a;   /* julegrøn */
  --accent-2: #fbbf24; /* gold for Santa hat trim */
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(220, 38, 38, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(22, 163, 74, 0.18) 0%, transparent 50%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

header {
  text-align: center;
  padding: 32px 16px 16px;
}
header h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tagline { color: var(--text-dim); margin-top: 6px; font-size: 14px; }

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.stage {
  width: 100%;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.step { display: none; flex-direction: column; align-items: center; gap: 18px; }
.stage[data-step="permission"] .step-permission,
.stage[data-step="capture"] .step-capture,
.stage[data-step="preview"] .step-preview,
.stage[data-step="processing"] .step-processing,
.stage[data-step="result"] .step-result,
.stage[data-step="error"] .step-error {
  display: flex;
}

button, .ghost {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  padding: 12px 22px;
  transition: all 140ms;
  border: 0;
}

.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}
.primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.primary:active { transform: translateY(0); }

.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-decoration: none;
}
.ghost:hover { background: rgba(255, 255, 255, 0.15); }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.styles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.style {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 4px 6px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all 160ms ease-out;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.style img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  transition: transform 160ms ease-out;
}
.style span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.style:hover img { transform: scale(1.1) rotate(-3deg); }
.style:active { transform: translateY(1px); }

/* Per-theme button colors */
.style-80er {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.22), rgba(34, 211, 238, 0.18));
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.25), inset 0 0 18px rgba(34, 211, 238, 0.12);
}
.style-80er:hover {
  border-color: rgba(236, 72, 153, 1);
  box-shadow: 0 0 28px rgba(236, 72, 153, 0.6), inset 0 0 22px rgba(34, 211, 238, 0.25);
}

.style-90er {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(124, 58, 237, 0.18));
  border-color: rgba(250, 204, 21, 0.7);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.25), inset 0 0 18px rgba(124, 58, 237, 0.12);
}
.style-90er:hover {
  border-color: rgba(250, 204, 21, 1);
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.55), inset 0 0 22px rgba(124, 58, 237, 0.22);
}

.style-dansktop {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(220, 38, 38, 0.18));
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.25), inset 0 0 18px rgba(220, 38, 38, 0.12);
}
.style-dansktop:hover {
  border-color: rgba(251, 191, 36, 1);
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.55), inset 0 0 22px rgba(220, 38, 38, 0.25);
}

.style-disco {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.22), rgba(168, 85, 247, 0.22));
  border-color: rgba(192, 192, 192, 0.7);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.3), inset 0 0 18px rgba(255, 255, 255, 0.08);
}
.style-disco:hover {
  border-color: rgba(232, 232, 232, 1);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.6), inset 0 0 22px rgba(255, 255, 255, 0.15);
}

.hint { color: var(--text-dim); font-size: 13px; text-align: center; }
.hint.small { font-size: 11px; opacity: 0.7; }
.share-hint {
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
}

/* video + captured img */
video, #captured, #result {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: black;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
video { transform: scaleX(-1); }   /* mirror live preview for natural feel */

.shoot {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2), 0 6px 20px rgba(0,0,0,0.4);
  border: 0;
  padding: 0;
  position: relative;
}
.shoot::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.shoot:active { transform: scale(0.92); }

.spinner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err { color: #fca5a5; text-align: center; }

footer {
  text-align: center;
  padding: 16px;
  color: var(--text-dim);
  font-size: 12px;
}

#canvas { display: none; }

@media (max-width: 480px) {
  header { padding: 20px 12px 8px; }
  .stage { padding: 16px; border-radius: 12px; }
  .shoot { width: 64px; height: 64px; }
}
