:root {
  --bg: #0f0b1e;
  --bg-2: #1c1536;
  --text: #f6f3ff;
  --muted: #b9b2d6;
  --accent: #ffd166;
  --accent-text: #241a00;
  --ok: #7ee2a8;
  --error: #ff8a8a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(60rem 30rem at 50% -10rem, rgba(255, 209, 102, 0.18), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Eerste stap (nog geen foto): knop verticaal in het midden van het scherm. */
.app:has(#result[hidden]) {
  min-height: 100vh;
  min-height: 100svh; /* zonder de in- en uitschuivende adresbalk op gsm */
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3.25rem;
  padding: .75rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible, .link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--bg-2); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.15); }
/* Camera-knop: zwart vlak met het neon-camera-icoon (camera.webp heeft zelf een zwarte achtergrond). */
.btn-camera {
  display: block;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 40px -12px rgba(255, 255, 255, 0.25);
  transition: transform .08s ease, box-shadow .2s ease;
}
.btn-camera img { display: block; width: 100%; height: auto; }
.btn-camera:hover { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 12px 48px -10px rgba(255, 255, 255, 0.4); }
.btn-camera:active { transform: scale(0.98); }
.btn-camera:has(+ input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Na een foto: camera-knop voorlopig verbergen (geen nieuwe foto vanuit stap 2).
   Terugzetten als kleinere knop: width: 9rem; align-self: center; border-radius: 16px; */
.app:has(#result:not([hidden])) .btn-camera { display: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.message { margin: 0; padding: .75rem 1rem; border-radius: var(--radius); background: rgba(255, 138, 138, 0.12); color: var(--error); }

.result { display: flex; flex-direction: column; gap: 1rem; }

.preview { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.preview img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.preview-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
  aspect-ratio: 3 / 4; max-height: 50vh; width: 100%; color: var(--muted); text-align: center; padding: 1rem;
}

.actions { display: flex; flex-direction: column; gap: .6rem; }
.link { color: #b9b2d6; text-align: center; text-underline-offset: 3px; padding: .25rem; }
.note { margin: 0; color: var(--muted); font-size: .95rem; text-align: center; }

.upload { display: flex; flex-direction: column; gap: .5rem; padding: .9rem 1rem; border-radius: var(--radius); background: var(--bg-2); }
.status { margin: 0; display: flex; align-items: center; gap: .5rem; }
.status[data-state="busy"] { color: var(--muted); }
.status[data-state="done"] { color: var(--ok); }
.status[data-state="error"] { color: var(--error); }
.status[data-state="done"]::before { content: "✓"; font-weight: 700; }

progress { width: 100%; height: .5rem; appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.1); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .btn, .btn-camera { transition: none; }
}
