html, body { height: 100%; margin: 0; background: #fff; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; color:#111; }
canvas { display:block; width:100%; height:100%; }

/* Landing brand (logo perfect gecentreerd) */
#landingBrand{
  position: fixed;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100% - 40px));
  text-align: center;
  z-index: 5;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}

#landingBrand img{
  display: block;
  margin: 0 auto;
  width: min(620px, 80vw);
  height:auto;
}

#tagline{
  margin-top: 10px;
  font-size: 15px;
  letter-spacing: .3px;
  color:#666;
}

body.has-result #landingBrand{
  opacity: 0;
  transform: translate(-50%, -60%);
}

/* UI: compact, gecentreerd, niet te breed */
#ui{
  position: fixed;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  width: min(860px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  z-index: 20;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  border: 1px solid #eee;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  backdrop-filter: blur(6px);
  transition: top .45s ease, transform .45s ease, box-shadow .45s ease;
}

body.has-result #ui{
  top: 14px;
  transform: translateX(-50%);
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}

/* Search: begrensde breedte zodat de input niet te lang wordt */
#searchCol{
  position: relative;
  max-width: 560px;
}

#q{
  width: 100%;
  max-width: 560px;
  padding: 14px 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  background: #fff;
}

#q:focus{ border-color: #bdbdbd; }

/* Suggestions */
#suggest{
  position:absolute; left:0; right:0;
  top: calc(100% + 8px);
  background:#fff;
  border:1px solid #e7e7e7;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.10);
  overflow:hidden;
  display:none;
  z-index: 25;
}

.s-item{ padding: 10px 12px; cursor:pointer; display:grid; gap:2px; }
.s-item:hover{ background:#f6f6f6; }
.s-topline{ font-size: 13px; color:#111; }
.s-sub{ font-size: 12px; color:#666; }

/* Controls */
#controls{
  display:flex;
  gap:8px;
  flex-wrap: nowrap;
  justify-content:flex-end;
  align-items:center;
}

button{
  padding: 12px 14px;
  border: 1px solid #ddd;
  background:#fff;
  border-radius: 12px;
  cursor:pointer;
  font-size:14px;
  white-space:nowrap;
}

button:hover{ background:#f7f7f7; }
button:disabled{ opacity:.55; cursor:not-allowed; }

/* Export dropdown */
.menu{ position: relative; display:inline-block; }

.menu-panel{
  position:absolute;
  right:0;
  top: calc(100% + 8px);
  background:#fff;
  border:1px solid #e7e7e7;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.10);
  padding: 6px;
  display:none;
  z-index: 30;
}

.menu-panel button{
  width: 100%;
  text-align:left;
  border-radius: 10px;
  border: 0;
  padding: 10px 12px;
}

.menu-panel button:hover{ background:#f6f6f6; }

/* Place label bottom center */
#placeLabel{
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  z-index: 15;
  font-size: 14px;
  color: #111;
  background: rgba(255,255,255,0.92);
  border: 1px solid #eee;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.06);
  display:none;
}

body.has-result #placeLabel{ display:block; }

/* Status bottom */
#status{
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: rgba(255,255,255,0.92);
  font-size: 12px;
  color: #111;
  z-index: 50;
  display:flex;
  justify-content: space-between;
  gap: 10px;
  align-items:center;
}

#status .muted{ color:#555; }
#msg.err{ color:#b00020; }
#msg.ok{ color:#0a7a2f; }


/* Visueel verbergen, wél in DOM (indexeerbaar) */
.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  clip-path:inset(50%) !important;
  white-space:nowrap !important;
  border:0 !important;
}

/* Extra zekerheid: SEO-blok blijft altijd verborgen */
#seo-text[hidden]{ display:none !important; }



/* Terug knop linksboven */
.back-button {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 2000;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0.85;
}

.back-button:hover {
  opacity: 1;
}

.back-button svg {
  width: 100%;
  height: 100%;
}

.back-button circle {
  fill: transparent;
  stroke: #000;
  stroke-width: 2;
}

.back-button polyline {
  fill: none;
  stroke: #000;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-button[hidden] {
  display: none !important;
}


/* Print tweaks */
@media print {
  #placeLabel { display: none !important; }
  /* optional: hide UI controls in print */
  #ui, #landingBrand, .back-button { display: none !important; }
  body { margin: 0 !important; }
}

html, body { background: #ffffff; }

.hint {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #333;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  z-index: 50;
}
.hidden { display: none; }


/* --- Fix: prevent black background before first render --- */
html, body { background: #fff !important; }
#landingBrand { background: transparent !important; }
#c { background: transparent !important; }



/* Progress bar in status */
.progress-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:12px;
}
.progress-text{
  font-size:12px;
  color:#666;
  white-space:nowrap;
}
.progress{
  width:180px;
  height:8px;
  border-radius:999px;
  background:rgba(0,0,0,0.08);
  overflow:hidden;
}
.progress-bar{
  height:100%;
  width:0%;
  border-radius:999px;
  background:rgba(0,0,0,0.35);
  transition:width 180ms ease;
  transform: translateX(0);
  will-change: transform;
}

/* Animated (indeterminate) when busy */
.progress.is-busy .progress-bar{
  width: 40% !important;
  animation: citylines-progress 1.1s ease-in-out infinite;
}
@keyframes citylines-progress{
  0%   { transform: translateX(-90%); }
  50%  { transform: translateX(60%); }
  100% { transform: translateX(190%); }
}

@media (max-width: 900px){
  .progress{ width:120px; }
  .progress-text{ display:none; }
}


/* Slow render hint */
.slow-hint{
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  color: #333;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.16);
  z-index: 60;
}
.slow-hint.hidden{ display:none; }
@media (max-width: 900px){
  .slow-hint{ bottom: 78px; max-width: 92vw; text-align:center; }
}



/* =========================
   Mobile responsive fixes
   ========================= */
@media (max-width: 900px){

  #controls{
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  #controls input{
    width: 92vw;
    max-width: 92vw;
  }

  #controls button{
    flex: 1 1 auto;
    min-width: 90px;
  }

  #suggestions{
    width: 92vw;
    left: 50% !important;
    transform: translateX(-50%);
  }

  #backBtn{
    width: 36px;
    height: 36px;
    top: 10px;
    left: 10px;
  }

  #canvasWrap{
    padding-top: 110px;
  }

  #status{
    flex-wrap: wrap;
    gap: 6px;
  }

  .progress{
    width: 120px;
  }

  .slow-hint{
    bottom: 90px;
    max-width: 92vw;
    text-align: center;
  }
}

@media (max-width: 520px){

  #controls{
    flex-direction: column;
    align-items: stretch;
  }

  #controls button{
    width: 100%;
  }
}
