/* Raad de huizenprijs — mobielvriendelijke styling.
   Mobile-first; op grotere schermen wordt de kaart gecentreerd en breder. */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1a2230;
  --muted: #6b7688;
  --line: #e6e9f0;
  --brand: #1f6feb;
  --brand-dark: #1857c0;
  --good: #1aa06d;
  --bad: #e0483d;
  --gold: #f4b400;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 30, 60, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(31, 111, 235, 0.25);
}
.logo {
  font-size: 1.05rem; margin: 0; font-weight: 700;
  background: none; border: none; color: inherit; font-family: inherit;
  padding: 0; cursor: pointer; text-align: left;
}
.logo:hover { opacity: 0.85; }
.session { display: flex; gap: 12px; font-size: 0.9rem; white-space: nowrap; }
.session b { font-variant-numeric: tabular-nums; }

/* ---- Layout ---- */
#app {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px;
}
.screen { animation: fade 0.25s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card.center { text-align: center; }

/* ---- Start ---- */
.intro h2 { margin: 0 0 6px; font-size: 1.3rem; }
.intro p { margin: 0 0 16px; color: var(--muted); }
.lbl { display: block; font-size: 0.82rem; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }

.text-input, .price-number {
  width: 100%;
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
.text-input:focus { border-color: var(--brand); }

.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  flex: 1;
  min-width: 130px;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #eef2fb; color: var(--brand); }
.btn-block { width: 100%; flex: none; margin-top: 14px; }
.btn-link { background: none; color: var(--muted); text-decoration: underline; margin-top: 10px; width: 100%; }

/* ---- Difficulty segmented control ---- */
.difficulty { margin-top: 18px; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-btn { flex: 1; padding: 10px; background: #fff; border: none; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg-btn.is-active { background: var(--brand); color: #fff; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }

.msg { margin-top: 12px; font-size: 0.9rem; min-height: 1.2em; }
.msg.error { color: var(--bad); }
.msg.ok { color: var(--good); }

/* ---- Carousel ---- */
.carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #dfe3ec;
  border-radius: 12px;
  overflow: hidden;
}
.carousel-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 1.6rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}
.car-nav.prev { left: 8px; } .car-nav.next { right: 8px; }
.car-count {
  position: absolute; bottom: 8px; right: 10px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 0.78rem;
  padding: 2px 8px; border-radius: 10px;
}
.dots { display: flex; justify-content: center; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dot.is-active { background: var(--brand); }

/* ---- Specs ---- */
.place-line { font-size: 1.15rem; font-weight: 700; margin: 12px 2px 4px; }
.specs { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.specs li { background: #f7f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 0.92rem; }
.specs li .k { display: block; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.specs li .v { font-weight: 700; }

/* ---- Guess ---- */
.guess { margin-top: 16px; }
.price-display { display: flex; align-items: center; gap: 8px; font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.price-number { font-size: 1.4rem; font-weight: 800; border: none; border-bottom: 2px solid var(--brand); border-radius: 0; padding: 4px 0; }
.price-number:focus { outline: none; }
.slider { width: 100%; margin: 10px 0 4px; accent-color: var(--brand); height: 28px; }
.slider-ends { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }

/* ---- Result ---- */
.result { text-align: center; }
.score-big { font-size: 4rem; font-weight: 900; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.score-label { color: var(--muted); margin-bottom: 12px; }
.bonus-badge { display: inline-block; background: var(--gold); color: #4a3500; font-weight: 700; padding: 6px 12px; border-radius: 20px; margin-bottom: 12px; }
.reveal { text-align: left; margin: 16px 0; border-top: 1px solid var(--line); }
.reveal-row { display: flex; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.reveal-row span { color: var(--muted); }
.reveal-row b { font-variant-numeric: tabular-nums; }
.funda-link { display: inline-block; margin: 6px 0 14px; color: var(--brand); font-weight: 600; text-decoration: none; }
.funda-link:hover { text-decoration: underline; }

/* ---- Spinner ---- */
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; margin: 10px auto; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Footer ---- */
.foot { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --card: #182031; --ink: #e8ecf4; --muted: #93a0b5;
    --line: #2a3448; --brand: #4b8bff;
  }
  .btn-ghost { background: #21304d; }
  .specs li, .price-number { background: transparent; }
  .seg-btn { background: var(--card); }
  .text-input { background: #0f1728; }
}

/* ---- Theater-knop op de carousel ---- */
.car-theater {
  position: absolute; top: 8px; right: 10px;
  width: 34px; height: 34px; border: none; border-radius: 8px;
  background: rgba(0,0,0,0.5); color: #fff; font-size: 1.1rem;
  cursor: pointer; display: grid; place-items: center;
}
.car-theater:hover { background: rgba(0,0,0,0.7); }

/* ---- Theatermodus (fullscreen foto-overlay) ---- */
.theater {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 10, 18, 0.95);
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.theater-img {
  max-width: 96vw; max-height: 90vh; object-fit: contain;
  border-radius: 6px; user-select: none;
}
.theater-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}
.theater-nav:hover { background: rgba(255,255,255,0.26); }
.theater-nav.prev { left: 12px; } .theater-nav.next { right: 12px; }
.theater-close {
  position: absolute; top: 14px; right: 16px;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 1.4rem;
  cursor: pointer;
}
.theater-close:hover { background: rgba(255,255,255,0.26); }
.theater-count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: #fff; font-size: 0.9rem;
  padding: 4px 12px; border-radius: 12px;
}

/* ---- Nieuwste-woningen lijst ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list-head h2 { margin: 4px 0; font-size: 1.25rem; }
.list-head .btn-link { width: auto; margin: 0; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-top: 10px;
}
.card-mini {
  background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; border: 1.5px solid transparent;
  transition: transform 0.06s ease, border-color 0.15s ease;
}
.card-mini:hover { transform: translateY(-2px); border-color: var(--brand); }
.card-mini .thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #dfe3ec; display: block; }
.card-mini .body { padding: 8px 10px; }
.card-mini .ttl { font-weight: 700; font-size: 0.92rem; }
.card-mini .sub { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.card-mini.is-guessed { opacity: 0.55; }
.card-mini .badge {
  display: inline-block; margin-top: 4px; font-size: 0.7rem; font-weight: 700;
  color: var(--good); background: rgba(26,160,109,0.12); padding: 1px 7px; border-radius: 10px;
}

/* ---- Wider screens ---- */
@media (min-width: 620px) {
  .logo { font-size: 1.2rem; }
}
