/* ===== Aura-Kamera — eigenes Design: Mystisch Violett -> Magenta ===== */

:root {
  --bg: #1a0b2e;
  --bg-2: #2a1248;
  --surface: rgba(58, 28, 102, 0.55);
  --surface-solid: #2c1551;
  --surface-2: rgba(82, 40, 130, 0.45);
  --text: #f3e9ff;
  --text-dim: #c9b6e8;
  --accent: #c026d3;          /* magenta */
  --accent-2: #8b5cf6;        /* violett */
  --accent-3: #e879f9;        /* helles magenta */
  --glow: 0 0 24px rgba(192, 38, 211, 0.55);
  --border: rgba(168, 120, 230, 0.32);
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(10, 2, 28, 0.55);
  --grad-brand: linear-gradient(135deg, #8b5cf6 0%, #c026d3 55%, #e879f9 100%);
  --grad-bg: radial-gradient(1200px 700px at 50% -10%, #3a1a6b 0%, #1a0b2e 60%, #120720 100%);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f6eefe;
  --bg-2: #efe2ff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: rgba(243, 232, 255, 0.85);
  --text: #2a0f4d;
  --text-dim: #6b4a96;
  --accent: #a21caf;
  --accent-2: #7c3aed;
  --accent-3: #c026d3;
  --glow: 0 0 22px rgba(162, 28, 175, 0.28);
  --border: rgba(124, 58, 237, 0.28);
  --shadow: 0 12px 36px rgba(80, 30, 130, 0.18);
  --grad-bg: radial-gradient(1100px 650px at 50% -10%, #f3e3ff 0%, #f6eefe 55%, #efe2ff 100%);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--grad-bg);
  background-attachment: fixed;
  min-height: 100svh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(12px, 4vw, 28px);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-orb {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: var(--glow);
  flex: 0 0 auto;
  position: relative;
}
.brand-orb::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent-3);
  opacity: 0.4;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.3px;
}
.tagline {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--glow);
  border-color: transparent;
}
.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-icon {
  padding: 10px 12px;
  border-color: var(--border);
  background: var(--surface);
  font-size: 1.05rem;
}
.btn-small { padding: 7px 12px; font-size: 0.82rem; }

/* ===== Main ===== */
.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 clamp(12px, 4vw, 28px) 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Disclaimer ===== */
.disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-3);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.disclaimer-icon { font-size: 1.3rem; color: var(--accent-3); flex: 0 0 auto; line-height: 1.2; }
.disclaimer p { margin: 0; font-size: 0.86rem; color: var(--text-dim); overflow-wrap: anywhere; }
.disclaimer strong { color: var(--text); }

/* ===== Stage / Vorschau ===== */
.stage-section { width: 100%; }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 70svh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d0420;
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 0 60px rgba(192, 38, 211, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 620px) {
  .stage { aspect-ratio: 4 / 3; }
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  z-index: 2;
}
.stage-overlay.is-hidden { display: none; }

.stage-orb {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 0 40px rgba(192, 38, 211, 0.6);
  animation: pulse 3s ease-in-out infinite;
}
.stage-msg {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 38ch;
  overflow-wrap: anywhere;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.capture-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.capture-flash.is-flash { animation: flash 0.45s ease-out; }
@keyframes flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ===== Controls ===== */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.control-row { display: flex; gap: 10px; flex-wrap: wrap; }
.main-buttons .btn { flex: 1 1 auto; min-width: 120px; }

.field { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.field-label { font-size: 0.82rem; color: var(--text-dim); font-weight: 600; }
.file-input {
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  width: 100%;
  font-size: 0.85rem;
}
.file-input::file-selector-button {
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-right: 10px;
  background: var(--accent-2);
  color: #fff;
  cursor: pointer;
}
.file-input:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 2px; }

.control-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 0;
}
.control-group legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-3);
  padding: 0 6px;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mood-btn {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 0.18s, transform 0.12s, box-shadow 0.2s;
}
.mood-btn:hover { transform: translateY(-1px); }
.mood-btn:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 2px; }
.mood-btn.is-active {
  border-color: var(--accent-3);
  box-shadow: var(--glow);
}
.mood-swatch {
  width: 100%;
  height: 28px;
  border-radius: 8px;
}
.mood-feurig { background: linear-gradient(120deg, #4a0d0d, #ff5722, #ffd54f); }
.mood-ruhig  { background: linear-gradient(120deg, #0d2a4a, #2196f3, #80deea); }
.mood-mystisch { background: linear-gradient(120deg, #2a0d4a, #c026d3, #e879f9); }

.sliders { display: flex; flex-direction: column; gap: 16px; }
.slider-field { display: flex; flex-direction: column; gap: 8px; }
.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}
.slider-head output { color: var(--accent-3); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: var(--glow);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: var(--glow);
  cursor: pointer;
}
input[type="range"]:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 4px; }

/* ===== Galerie ===== */
.gallery-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.gallery-head h2 { margin: 0; font-size: 1.05rem; }
.gallery-empty { color: var(--text-dim); font-size: 0.88rem; margin: 8px 0; }

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #0d0420;
}
.gallery-item .meta {
  padding: 6px 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.gallery-item .item-actions { display: flex; gap: 6px; padding: 0 8px 8px; }
.gallery-item .item-actions .btn { flex: 1; padding: 6px 4px; font-size: 0.72rem; }

/* ===== Info ===== */
.info-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
  box-shadow: var(--shadow);
}
.info-section summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 0;
  color: var(--accent-3);
}
.info-section summary:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 2px; }
.info-section p { margin: 0 0 14px; font-size: 0.86rem; color: var(--text-dim); overflow-wrap: anywhere; }

/* ===== Footer ===== */
.app-footer {
  text-align: center;
  padding: 18px 16px 28px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* ===== Toasts ===== */
.toast-area {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  overflow-wrap: anywhere;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: #fbbf24; }
.toast.err { border-left-color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 2, 28, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
}
.modal-title { margin: 0 0 10px; font-size: 1.15rem; color: var(--accent-3); }
.modal-body { margin: 0 0 18px; color: var(--text-dim); font-size: 0.92rem; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
