/* Vlietstad: gedeelde stijl voor de stad en de gebouwpagina's. */
:root {
  --sky: #b9d3e6;
  --panel: rgba(16, 24, 34, 0.86);
  --panel-solid: #121b26;
  --fg: #eef3f8;
  --muted: #9fb0c2;
  --line: rgba(238, 243, 248, 0.14);
  --accent: #3fc1c9;
  --accent-ink: #062126;
  --display: "Sora", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
[hidden] { display: none !important; }
body { background: var(--sky); color: var(--fg); font-family: var(--body); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 6;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(to bottom, rgba(16,24,34,0.1), rgba(16,24,34,0.55));
}
.card { background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 16px; padding: 28px; max-width: 27rem; width: 100%; display: grid; gap: 16px; }
.card h1 { font: 700 2.1rem/1.1 var(--display); margin: 0; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--muted); line-height: 1.55; }
.card .note { font-size: 0.85rem; }
.card .note.err { color: #f0a8a0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 0.9rem; align-items: center; }
kbd { font: 600 0.74rem var(--display); letter-spacing: 0.04em; border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; white-space: nowrap; justify-self: start; }
.ibadge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 0.8rem var(--display); justify-self: start; }
.btn { font: 600 1rem var(--display); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 12px 18px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, .x:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.touch-only { display: none; }
body.touch .touch-only { display: grid; }
body.touch .desk-only { display: none; }

#cross { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,0.85); box-shadow: 0 0 0 1px rgba(0,0,0,0.25); z-index: 2; pointer-events: none; transition: transform .15s; }
#cross.aim { transform: scale(2.2); background: var(--accent); }
#hint { position: fixed; left: 50%; top: calc(50% + 18px); transform: translateX(-50%); background: var(--panel); border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; z-index: 2; pointer-events: none; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
#hint b { font-family: var(--display); font-weight: 600; color: var(--accent); }

#hud { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-radius: 10px; padding: 10px 12px; font-size: 0.8rem; line-height: 1.5; font-variant-numeric: tabular-nums; z-index: 3; pointer-events: none; display: grid; gap: 2px; max-width: calc(100% - 32px); }
#hud b { font-family: var(--display); font-weight: 600; color: var(--accent); }
#hud .sub { color: var(--muted); }
body.touch #hud { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }

#exitBtn { position: fixed; z-index: 3; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(62px + env(safe-area-inset-top, 0px)); font-size: 0.85rem; padding: 10px 14px; }

#info {
  position: fixed; z-index: 7; top: calc(16px + env(safe-area-inset-top, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: max(16px, env(safe-area-inset-right, 0px)); width: min(25rem, calc(100% - 32px));
  background: var(--panel-solid); border-radius: 16px; overflow-y: auto; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35); animation: slide .22s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #info { animation: none; } #cross { transition: none; } }
.swatch { height: 120px; flex: none; position: relative; overflow: hidden; }
.swatch canvas { width: 100%; height: 100%; display: block; }
.x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(16,24,34,0.7); color: var(--fg); font-size: 1.2rem; cursor: pointer; }
.info-body { padding: 20px 22px 22px; display: grid; gap: 16px; }
.eyebrow { font: 600 0.72rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
#iName { font: 700 1.6rem/1.15 var(--display); margin: 4px 0 0; letter-spacing: -0.015em; text-wrap: balance; }
#iAddr { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin: 0; }
.stats div { background: var(--panel-solid); padding: 10px 12px; min-width: 0; }
.stats dt { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font: 600 1.05rem var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#iText { margin: 0; line-height: 1.6; color: #d6dfe8; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 0.78rem; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); }
.actions { display: grid; gap: 8px; margin-top: 4px; }
@media (max-width: 640px) {
  #info { top: auto; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); width: auto; max-height: 74%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .swatch { height: 80px; }
}

#joy { position: fixed; left: calc(28px + env(safe-area-inset-left, 0px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); background: rgba(16,24,34,0.25); z-index: 3; display: none; pointer-events: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255,255,255,0.75); }
body.touch.playing #joy { display: block; }

#searchBtn { position: fixed; z-index: 3; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); font-size: 0.85rem; padding: 9px 14px; background: var(--panel); color: var(--fg); border: 1px solid var(--line); display: inline-flex; gap: 8px; align-items: center; }
#searchBtn[hidden] { display: none !important; }
#searchBtn kbd { padding: 1px 6px; }
body.touch #searchBtn kbd { display: none; }
#search { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); width: min(30rem, calc(100% - 32px)); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
#sInput { width: 100%; font: 500 1rem var(--body); color: var(--fg); background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; outline: none; user-select: text; -webkit-user-select: text; }
#sInput:focus { border-color: var(--accent); }
#sList { list-style: none; margin: 0; padding: 0; max-height: min(22rem, 55vh); overflow-y: auto; display: grid; gap: 2px; }
#sList li { display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#sList li[aria-selected="true"] { background: rgba(63,193,201,0.18); }
#sList .ic { grid-row: span 2; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font: 700 0.72rem var(--display); color: var(--accent-ink); }
#sList .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sList .nm mark { background: none; color: var(--accent); }
#sList .sb { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sList .empty { color: var(--muted); cursor: default; display: block; }
#search .note { margin: 0 4px 2px; color: var(--muted); font-size: 0.75rem; }
a.btn { text-decoration: none; text-align: center; display: block; }
.card .eyebrow { margin-bottom: -8px; }

/* Inloggen: links boven (op telefoons rechts boven) */
#account { position: fixed; z-index: 7; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; gap: 12px; align-items: center; background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: 0.85rem; max-width: calc(50% - 100px); }
#account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#account a { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
#account a:hover { text-decoration: underline; }
body.touch #account { left: auto; right: max(16px, env(safe-area-inset-right, 0px)); }

/* Inrichten in de unit-pop-up */
.decor { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.decor h3 { font: 600 0.72rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0; }
.decor-row { display: grid; grid-template-columns: 6rem 46px 1fr; align-items: center; gap: 10px; font-size: 0.9rem; }
.decor-row input[type=color] { width: 46px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
.decor-row label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.decor-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.decor-actions .note, #iDecorNote { color: var(--muted); font-size: 0.85rem; margin: 0; }
#iDecorNote a { color: var(--accent); }
.btn.small { font-size: 0.85rem; padding: 8px 12px; }

/* Overgang naar een andere verdieping */
#fade { position: fixed; inset: 0; background: #0b1117; opacity: 0; pointer-events: none; transition: opacity .26s ease; z-index: 9; }
#fade.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #fade { transition: none; } }

/* Keuzeknoppen in de pop-up (lift) */
.choices { display: grid; gap: 6px; }
.choice { display: grid; gap: 2px; text-align: left; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--fg); cursor: pointer; font: inherit; }
.choice:hover { border-color: rgba(63,193,201,0.6); background: rgba(63,193,201,0.1); }
.choice:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.choice .cl { font: 600 0.95rem var(--display); }
.choice .cs { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice.current { cursor: default; border-color: rgba(63,193,201,0.5); background: rgba(63,193,201,0.14); }

/* Huren of wachtlijst in de unit-pop-up */
.rent { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.rent .note { margin: 0; color: #d6dfe8; font-size: 0.92rem; line-height: 1.5; }
.rent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rent-actions .btn { font-size: 0.92rem; padding: 10px 16px; display: inline-block; }

/* Kleur en logo van een auto */
.decor-row.wide { grid-template-columns: 6rem 1fr; }
.decor-row input[type=text] { width: 100%; min-width: 0; background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: var(--fg); font: inherit; user-select: text; -webkit-user-select: text; }
.decor-row input[type=text]:focus { outline: none; border-color: var(--accent); }
.filebox { display: flex; gap: 8px; flex-wrap: wrap; }
.filebox .btn { display: inline-block; cursor: pointer; }

.decor .manage { color: var(--accent); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.decor .manage:hover { text-decoration: underline; }
