/* ==========================================================================
   Klavertje Scanner — stylesheet
   Donker thema (zelfde basis als Force Tracker), maar met een groen/gouden
   accentpaar: groen voor "aan het zoeken/berekenen", goud voor een
   bevestigde vondst van een klavertje van geluk.
   ========================================================================== */

:root{
  --bg: #050C08;
  --panel: #0C1912;
  --panel-2: #12211A;
  --line: #1E3327;
  --accent: #3FE07A;      /* zoek-groen */
  --gold: #FFC94A;        /* vondst-goud */
  --gold-dim: #8A6B1E;
  --white: #F4FAF6;
  --muted: #6E8C7C;
  --danger: #FF4D4D;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-ui);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body{
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.screen{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}
.screen[hidden]{ display: none !important; }

/* ---------------------------------------------------------------------- */
/* Setup screen                                                          */
/* ---------------------------------------------------------------------- */

.setup-screen{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(63,224,122,0.10), transparent 60%),
    var(--bg);
  padding: 24px 24px max(24px, env(safe-area-inset-bottom) + 12px);
  padding-top: max(48px, env(safe-area-inset-top) + 28px);
}

.setup-card{ width: 100%; max-width: 420px; text-align: center; }

.brand{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-mark{
  width: 14px; height: 14px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px 2px rgba(63,224,122,0.6);
  flex-shrink: 0;
}

.brand-title{
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--white);
}
.brand-title span{ color: var(--gold); }

.brand-sub{
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin: 0 0 36px;
}

.setup-form{ display: flex; flex-direction: column; gap: 18px; }
.field{ text-align: left; }

.field label{
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.field-row{
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.field-row select{
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  padding: 16px 18px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.field-row select option{ color: var(--white); background: #0B1610; }
.field-row:focus-within{ border-color: var(--accent); }

.field-hint{
  margin: 8px 2px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.btn-start{
  margin-top: 10px;
  padding: 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #05170E;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-start:active{ transform: scale(0.98); }
.btn-start:disabled{ opacity: 0.5; cursor: not-allowed; }

.setup-error{ min-height: 18px; color: var(--danger); font-size: 13px; margin: 0; }

.setup-note{
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------- */
/* Live scan screen                                                      */
/* ---------------------------------------------------------------------- */

.live-screen{ background: #000; }

.camera-feed{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
video.camera-feed{ visibility: hidden; } /* alleen bron voor canvas */

.overlay-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.scrim{
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(0,0,0,0.30) 0%, rgba(0,0,0,0.02) 20%, rgba(0,0,0,0.02) 55%, rgba(0,0,0,0.40) 100%);
  pointer-events: none;
}

.acquiring-overlay{
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,12,8,0.55);
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.acquiring-overlay.hidden{ opacity: 0; }

.calibrate-text{
  color: var(--white);
  font-size: clamp(16px, 4.5vw, 22px);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  background: rgba(5,12,8,0.6);
  padding: 14px 22px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

/* Gouden flits exact op de gevonden locatie -------------------------- */
.find-flash{
  position: absolute;
  z-index: 5;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.3);
}
.find-flash.show{
  animation: cloverPop 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.find-flash svg{ width: 100%; height: 100%; overflow: visible; }

@keyframes cloverPop{
  0%   { opacity: 0; transform: scale(0.2); }
  12%  { opacity: 1; transform: scale(1.25); }
  22%  { opacity: 1; transform: scale(0.95); }
  30%  { opacity: 1; transform: scale(1.05); }
  38%  { opacity: 1; transform: scale(1); }
  82%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08); }
}

/* ---------------------------------------------------------------------- */
/* HUD                                                                    */
/* ---------------------------------------------------------------------- */

.hud{
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.hud-top{
  position: absolute;
  top: max(16px, env(safe-area-inset-top) + 8px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.icon-btn{
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12,25,18,0.75);
  color: var(--white);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.status-pill{
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(12,25,18,0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--white);
}

.status-dot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px rgba(63,224,122,0.7);
  animation: statusPulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes statusPulse{
  0%, 100%{ opacity: 0.5; transform: scale(0.85); }
  50%{ opacity: 1; transform: scale(1.15); }
}

.found-counter{
  pointer-events: none;
  background: rgba(12,25,18,0.75);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------- */
/* Menu                                                                   */
/* ---------------------------------------------------------------------- */

.menu-overlay{
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,12,8,0.75);
  padding: 24px;
}
.menu-overlay[hidden]{ display: none; }

.menu-panel{
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
}

.menu-title{
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}

.menu-divider{ height: 1px; background: var(--line); margin: 16px 0; }

.btn-menu-action{
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--white);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  margin-top: 8px;
}
.btn-menu-action:first-of-type{ margin-top: 0; }
.btn-menu-action:active{ transform: scale(0.98); }

.btn-menu-primary{ background: var(--accent); border-color: var(--accent); color: #05170E; }
.btn-menu-close{ color: var(--muted); }

@media (prefers-reduced-motion: reduce){
  .acquiring-overlay, .find-flash.show, .status-dot{ animation: none; transition: none; }
}
