/* Lucky's Block. Palet: PICO-8. Eén lettertype (systeem-sans), geen kaarten. */
:root {
  --cream: #fff1e8;
  --ink: #1d2b53;
  --ink-soft: #3b456b;
  --sky: #29adff;
  --sky-pale: #e8f6ff;
  --red: #ff004d;
  --plum: #7e2553;
  --grass: #008751;
  --stone: #c2c3c7;
  --road: #5f574f;
  --yellow: #ffec27;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --lot: 128px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
}
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--plum); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

h1, h2 { font-family: var(--font); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.1rem, 5.5vw, 4rem); font-weight: 800; max-width: 16ch; }
h2 { font-size: 1.25rem; font-weight: 750; }

.visually-hidden, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Kop ---------- */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter);
}
.wordmark {
  font-weight: 800; font-size: 1.125rem; text-decoration: none; letter-spacing: 0.02em;
  text-transform: uppercase;
}
.wordmark::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  background: var(--red); vertical-align: -1px;
  clip-path: polygon(50% 0, 100% 45%, 100% 100%, 0 100%, 0 45%);
}
.header-count { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- Intro ---------- */
.intro {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: end;
  padding: clamp(24px, 6vw, 72px) var(--gutter) clamp(28px, 5vw, 56px);
}
.hero-house { margin: 0; }
.hero-stage { position: relative; background: var(--sky); padding: 36px 0 0; display: flex; justify-content: center; border-bottom: 34px solid var(--road); box-shadow: inset 0 -12px 0 var(--stone); }
.hero-canvas { width: min(70%, 288px); height: auto; aspect-ratio: 1; image-rendering: pixelated; display: block; margin-bottom: 12px; }
.hero-lucky { position: absolute; right: 12%; bottom: 8px; width: 72px; height: 60px; image-rendering: pixelated; }
.hero-house figcaption { margin-top: 12px; font-size: 0.9375rem; color: var(--ink-soft); }
.lede { font-size: clamp(1.0625rem, 2vw, 1.25rem); max-width: 56ch; margin: 20px 0 28px; color: var(--ink-soft); }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.plots-left { margin: 0; font-weight: 600; }
.mine { margin: 16px 0 0; }

.button {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 6px;
  background: var(--ink); color: var(--cream);
  font: 700 1rem/1 var(--font); text-decoration: none;
  box-shadow: 0 4px 0 var(--plum);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.button:hover { color: var(--cream); transform: translateY(-1px); box-shadow: 0 5px 0 var(--plum); }
.button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--plum); }
.button:disabled { opacity: 0.6; cursor: progress; }
.button--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.button--ghost:hover { color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.button--small { min-height: 36px; padding: 0 14px; font-size: 0.9375rem; box-shadow: none; }
.link-button { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Straat ---------- */
.street-section { background: var(--sky); padding: 28px 0 0; }
.street-title { padding: 0 var(--gutter) 20px; color: var(--ink); font-size: 1.125rem; }
.street {
  list-style: none; margin: 0; padding: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--lot), 1fr));
}
.lot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-height: calc(var(--lot) + 46px); padding-top: 14px;
}
/* Stoep en weg onder elk kavel: samen een doorlopende straat per rij. */
.lot::after {
  content: ""; align-self: stretch; height: 30px;
  background: var(--road); border-top: 10px solid var(--stone);
}
.lot-link { display: block; line-height: 0; }
.lot-house {
  width: calc(var(--lot) - 16px); height: calc(var(--lot) - 16px);
  image-rendering: pixelated; display: block;
}
.lot-link:hover .lot-house { transform: translateY(-2px); }
.lot-house { transition: transform 160ms var(--ease-out); }
.lot--empty::before {
  content: ""; width: calc(var(--lot) - 28px); height: 10px; background: var(--grass); margin-bottom: 0;
}
.lot-number {
  position: absolute; bottom: 21px; left: 50%; transform: translate(-50%, 50%);
  font-size: 0.6875rem; font-weight: 700; line-height: 1; color: var(--ink); white-space: nowrap;
}
.lot--mine .lot-number { background: var(--yellow); padding: 1px 4px; border-radius: 3px; }
.lucky {
  position: absolute; right: -10px; bottom: 26px; width: 36px; height: 30px; z-index: 1;
  image-rendering: pixelated; pointer-events: none;
}
.lot--free { justify-content: flex-end; }
.free-plot {
  appearance: none; cursor: pointer; width: calc(var(--lot) - 24px); height: calc(var(--lot) - 24px); margin-bottom: 4px;
  border: 2px dashed var(--ink); border-radius: 4px; background: rgba(255, 241, 232, 0.6);
  color: var(--ink); font: 700 0.875rem/1.2 var(--font); padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.free-plot span { font-size: 1.75rem; line-height: 1; }
.free-plot:hover { background: var(--cream); }
.free-plot--ghost { cursor: default; border-color: rgba(29, 43, 83, 0.28); background: transparent; }

/* Het nieuwe huisje landt op zijn kavel: oorzaak (jouw klik) naar plek (de straat). */
.lot--landing .lot-house { animation: land 420ms var(--ease-out) both; }
@keyframes land {
  from { transform: translateY(-28px); opacity: 0; }
  60% { transform: translateY(3px); opacity: 1; }
  to { transform: translateY(0); opacity: 1; }
}

.street-note {
  margin: 0; padding: 14px var(--gutter) 22px; background: var(--road); color: var(--cream); font-size: 0.9375rem;
}

/* ---------- Vragen ---------- */
.faq {
  display: grid; gap: 32px clamp(24px, 4vw, 56px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  padding: clamp(40px, 7vw, 88px) var(--gutter);
}
.faq-item p { margin: 10px 0 0; max-width: 60ch; color: var(--ink-soft); }

.site-footer { padding: 24px var(--gutter) 40px; border-top: 1px solid rgba(29, 43, 83, 0.15); font-size: 0.9375rem; color: var(--ink-soft); }
.site-footer p { margin: 0; }

/* ---------- Editor ---------- */
.editor {
  border: 0; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--cream); color: var(--ink); border-radius: 10px;
}
.editor::backdrop { background: rgba(29, 43, 83, 0.55); }
.editor[open] { animation: editor-in 220ms var(--ease-out); }
@keyframes editor-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.editor-inner { padding: clamp(16px, 3vw, 28px); }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-button {
  appearance: none; border: 0; background: none; cursor: pointer; font: 400 2rem/1 var(--font);
  width: 44px; height: 44px; color: var(--ink);
}
.editor-help { margin: 6px 0 16px; color: var(--ink-soft); font-size: 0.9375rem; }
.editor-body { display: grid; grid-template-columns: minmax(0, 448px) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-canvas { display: block; touch-action: none; cursor: crosshair; image-rendering: pixelated; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tool {
  appearance: none; cursor: pointer; min-height: 40px; padding: 0 12px; border-radius: 6px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink); font: 600 0.9375rem/1 var(--font);
}
.tool[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.palette { display: grid; grid-template-columns: repeat(4, 44px); gap: 8px; }
.swatch {
  appearance: none; cursor: pointer; width: 44px; height: 44px; border-radius: 6px;
  border: 2px solid rgba(29, 43, 83, 0.25); background: var(--c);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--ink); }
.editor-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 20px; }
.editor-note { margin: 0; font-size: 0.875rem; color: var(--ink-soft); }
.editor-status { margin: 12px 0 0; min-height: 1.6em; font-weight: 600; }
.editor-status.is-error { color: #b0003a; }

/* ---------- Huispagina ---------- */
.house-main {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px);
  align-items: end; padding: clamp(16px, 4vw, 56px) var(--gutter) clamp(40px, 6vw, 80px);
}
.house-stage { background: var(--sky); padding: 32px 24px 0; display: flex; flex-direction: column; align-items: center; }
.house-canvas--big { width: min(100%, 384px); height: auto; aspect-ratio: 1; image-rendering: pixelated; display: block; }
.house-stage .sidewalk { align-self: stretch; margin: 0 -24px; height: 34px; background: var(--road); border-top: 12px solid var(--stone); }
.empty-lot { margin: 40px 0; max-width: 28ch; text-align: center; font-weight: 600; }
.house-info h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
.house-info > p { margin: 12px 0 24px; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.share-status { min-height: 1.6em; margin: 14px 0 0; font-weight: 600; }
.report-line { margin: 20px 0 0; font-size: 0.9375rem; color: var(--ink-soft); }

/* ---------- Losse pagina's ---------- */
.page-narrow { max-width: 720px; padding: clamp(40px, 8vw, 96px) var(--gutter); }
.page-narrow h1 { margin-bottom: 16px; }
.beheer-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.beheer-item { display: flex; gap: 16px; align-items: center; }
.beheer-item[data-status="1"] { background: #ffe3ea; }
.beheer-item[data-status="2"] { opacity: 0.55; }
.beheer-item .house-canvas { width: 96px; height: 96px; image-rendering: pixelated; }
.beheer-item p { margin: 0 0 8px; }

/* ---------- Mobiel ---------- */
@media (max-width: 640px) {
  :root { --lot: 86px; }
  .intro { grid-template-columns: 1fr; }
  .hero-canvas { width: 52%; }
  .hero-lucky { width: 54px; height: 45px; right: 10%; }
  .free-plot { font-size: 0.75rem; }
  .free-plot span { font-size: 1.375rem; }
  .editor-body { grid-template-columns: 1fr; }
  .palette { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .swatch { width: 100%; height: auto; aspect-ratio: 1; }
  .house-main { grid-template-columns: 1fr; }
  .lucky { width: 24px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
