:root {
  --ikea-blue: #0051BA;
  --bg: #0a0a0a;
  /* Neutrale donkergrijze paneelkleur, gelijk aan het grijs van een macOS
     browservenster in dark mode (zoals aangeleverd als referentie) — bewust
     R=G=B (echt grijs, geen kleurzweem), in tegenstelling tot de vorige
     poging die net iets te veel blauw in de mix had en daardoor niet als
     "grijs" oogde. */
  --panel-bg: rgba(52, 52, 51, 0.97);
  --panel-border: rgba(255, 255, 255, 0.10);
  /* Iets helderder blauw dan --ikea-blue, alléén gebruikt voor tekst/randen
     bovenop het donkere paneel: puur IKEA-blauw (#0051BA) is te donker om
     leesbaar te contrasteren met dit donkergrijs. Buiten het paneel (titel,
     stats, knop-achtergronden) blijft gewoon --ikea-blue in gebruik. */
  --panel-blue: #5aa3ff;
  --text-muted: #a3a9b3;
  --record-red: #ff0000;
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute must always win, regardless of any element's own
   `display` rule below (several use #id selectors with higher specificity
   than the UA stylesheet's `[hidden]{display:none}`). */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#canvas.looking {
  cursor: none;
}

/* Nooit zichtbaar: alleen gebruikt als bron voor captureStream() tijdens
   een opname, op een hogere resolutie dan de live-weergave. */
#record-canvas {
  position: fixed;
  top: 0;
  left: -99999px;
  pointer-events: none;
}

/* ---------- Titel ---------- */

#title {
  position: absolute;
  top: 18px;
  left: 22px;
  z-index: 20;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ikea-blue);
  pointer-events: none;
  user-select: none;
}

/* ---------- Drop zone ---------- */

#dropzone {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: background 0.15s ease;
}

#dropzone.drag-over {
  background: #101010;
}

#dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 64px;
  border: 1.5px dashed rgba(0, 81, 186, 0.45);
  border-radius: 14px;
  transition: border-color 0.15s ease;
}

#dropzone.drag-over #dropzone-inner {
  border-color: var(--ikea-blue);
}

#dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--ikea-blue);
}

#dropzone-text {
  margin: 0;
  color: var(--ikea-blue);
  font-size: 14px;
  font-weight: 500;
}

#import-btn,
#load-new-btn {
  appearance: none;
  border: none;
  background: var(--ikea-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

#import-btn:hover,
#load-new-btn:hover {
  opacity: 0.88;
}

#import-btn:active,
#load-new-btn:active {
  transform: scale(0.97);
}

/* ---------- Laadindicator ---------- */

#loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40vh;
  gap: 10px;
  pointer-events: none;
}

#loading-bar-track {
  width: 220px;
  height: 3px;
  background: rgba(0, 81, 186, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

#loading-bar {
  width: 30%;
  height: 100%;
  background: var(--ikea-blue);
  border-radius: 2px;
  animation: loading-sweep 1.1s ease-in-out infinite;
}

@keyframes loading-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

#loading-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--ikea-blue);
  font-weight: 500;
}

/* ---------- Foutmelding ---------- */

#error-msg {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: #fff;
  color: #b3261e;
  border: 1px solid rgba(179, 38, 30, 0.25);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  max-width: 70vw;
}

/* ---------- Foto- en opnameknop (los, samen horizontaal gecentreerd) ---------- */
/* De verticale positie (`top`) wordt in main.js gezet, gelijk aan de hoogte
   van de "Muisgevoeligheid"-slider in het paneel — dat paneel hangt vast aan
   de onderkant van het venster, dus die hoogte staat niet vooraf vast. De
   horizontale centrering gebeurt hier puur in CSS, op de wrapper. */

#capture-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
}

#record-btn {
  appearance: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--record-red);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease, border-radius 0.15s ease;
}

#record-btn:hover {
  transform: scale(1.05);
}

#record-btn:active {
  transform: scale(0.95);
}

#record-btn.recording {
  border-radius: 16px;
  animation: record-pulse 1.4s ease-in-out infinite;
}

#photo-btn {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

#photo-btn svg {
  width: 22px;
  height: 22px;
}

#photo-btn:hover {
  transform: scale(1.05);
}

#photo-btn:active {
  transform: scale(0.95);
}

@keyframes record-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 0, 0, 0.5); }
  50% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(255, 0, 0, 0); }
}

/* ---------- Bedieningspaneel (rechtsonder) ---------- */

#panel {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 18px;
  width: 240px;
  max-height: min(86vh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

/* ---------- Opname-opslaan-dialoog ---------- */

#record-save-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 22px 26px;
  width: 300px;
  text-align: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35);
}

#record-save-title {
  margin: 0 0 6px 0;
  color: var(--panel-blue);
  font-size: 15px;
  font-weight: 700;
}

#record-save-filename {
  margin: 0 0 16px 0;
  color: var(--text-muted);
  font-size: 11.5px;
  word-break: break-all;
}

#record-save-actions {
  display: flex;
  gap: 10px;
}

#record-save-btn,
#record-discard-btn {
  flex: 1;
  appearance: none;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 8px;
  cursor: pointer;
}

#record-save-btn {
  background: var(--ikea-blue);
  color: #fff;
}

#record-save-btn:hover {
  opacity: 0.88;
}

#record-discard-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#record-discard-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Kleurfilter (boven de brandpuntsafstand-slider) ---------- */

#filter-control {
  margin-bottom: 14px;
}

#filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--panel-blue);
  margin-bottom: 8px;
}

#filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 3px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.filter-btn:hover {
  transform: scale(1.08);
}

.filter-btn:active {
  transform: scale(0.95);
}

.filter-btn.is-active {
  box-shadow: 0 0 0 2px var(--panel-blue);
}

.swatch {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.swatch-none {
  background: transparent;
}

.swatch-bw {
  background: linear-gradient(135deg, #f2f2f2 50%, #16161a 50%);
}

.swatch-ir {
  background: linear-gradient(135deg, #0fa8b3 0%, #f01f61 55%, #ff5fa8 100%);
}

.swatch-nature {
  background: linear-gradient(135deg, #29e065 20%, #2b1c10 100%);
}

.swatch-irbw {
  background: linear-gradient(135deg, #f5f7fa 35%, #0a1526 100%);
}

/* ---------- Tilt-shift (onder de brandpuntsafstand-slider) ---------- */

#tiltshift-control {
  margin-bottom: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#tiltblur-toggle-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--panel-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease;
}

#tiltblur-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

#tiltblur-toggle-btn:active {
  transform: scale(0.97);
}

#tiltblur-toggle-btn.is-active {
  background: var(--panel-blue);
  color: #0a0a0a;
  border-color: var(--panel-blue);
}

/* Duidelijk ingesprongen/omkaderd, zodat zichtbaar is dat dit sub-menu écht
   bij de "Tilt-shift"-knop erboven hoort — losse sliders zouden anders al
   snel verward kunnen worden met de algemene besturing eronder (Snelheid,
   Muisgevoeligheid, ...). */
#tiltblur-controls {
  margin-top: 12px;
  padding: 10px 0 2px 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

/* Splitst de vier sliders in twee kleine, apart gelabelde groepjes — "waar
   zit de scherpe band" versus "hoe sterk/breed is het effect" — zodat het
   niet als één ondoorzichtige lijst van vier losse getallen aanvoelt. */
.subsection-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}

#tiltblur-controls .subsection-label:not(:first-child) {
  margin-top: 14px;
}

.control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 12px;
}

.control label {
  grid-column: 1 / 2;
  font-size: 12px;
  font-weight: 600;
  color: var(--panel-blue);
}

.control-value {
  grid-column: 2 / 3;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.control input[type="range"] {
  grid-column: 1 / 3;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  margin: 8px 0 0 0;
}

.control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel-blue);
  cursor: pointer;
  border: none;
}

.control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel-blue);
  cursor: pointer;
  border: none;
}

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

#orientation-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--panel-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease;
}

#orientation-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

#orientation-btn:active {
  transform: scale(0.97);
}

#orientation-value {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: right;
}

#hint {
  margin: 4px 0 12px 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

#load-new-btn {
  width: 100%;
  padding: 8px 0;
  font-size: 12px;
  background: transparent;
  color: var(--panel-blue);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

#load-new-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

/* ---------- Stats ---------- */

#stats {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 20;
  font-size: 11px;
  color: var(--ikea-blue);
  opacity: 0.75;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
