:root {
  --creme: #f1e8d8;
  --creme-2: #e6dac4;
  --rood: #9e1f25;
  --rood-licht: #c4383f;
  --donker: #1c1b19;
  --donker-2: #2b2926;
  --grijs: #6f675c;
  --groen: #2f9e55;
  --oranje: #e07b12;
  --blauw: #5a6f8a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --balk: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--donker);
  color: var(--donker);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

/* ---------- balk ---------- */
#balk {
  position: fixed; inset: 0 0 auto 0; height: var(--balk); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--donker); color: var(--creme);
  border-bottom: 3px solid var(--rood);
}
.merk { display: flex; align-items: center; gap: 8px; font-family: var(--serif); white-space: nowrap; }
.merk .la {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  background: var(--rood); color: var(--creme); font-weight: 700; font-size: 14px; border-radius: 3px;
}
.merk .naam { font-size: 17px; letter-spacing: .02em; }
.merk .sub { font-size: 13px; color: #c9bda8; font-style: italic; }
#teller { display: flex; gap: 14px; font-size: 14px; flex-wrap: wrap; justify-content: center; }
#teller .stuk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#teller .stuk b { font-weight: 700; font-variant-numeric: tabular-nums; }
#teller .sep { color: #7d7466; }
#teller .laden { color: #c9bda8; font-style: italic; }
.bol { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.bol.werkt { background: var(--groen); box-shadow: 0 0 0 2px rgba(47,158,85,.25); }
.bol.wacht { background: var(--oranje); }
.bol.klaar { background: #b8ad9b; }
.bol.slaapt { background: var(--blauw); }
.rechts { display: flex; align-items: center; gap: 10px; }
#klok { font-variant-numeric: tabular-nums; font-size: 14px; color: #d8ccb6; white-space: nowrap; }
#geluid {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: transparent; border: 1px solid #5a534a; border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--creme);
}
#geluid svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#geluid[aria-pressed="true"] { background: var(--rood); border-color: var(--rood); }
#geluid:focus-visible, button:focus-visible { outline: 2px solid var(--oranje); outline-offset: 2px; }

/* ---------- scène ---------- */
#scene { position: fixed; inset: var(--balk) 0 0 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#labels { position: fixed; inset: var(--balk) 0 0 0; pointer-events: none; overflow: hidden; z-index: 5; }

.label {
  position: absolute; left: 0; top: 0; transform-origin: 50% 100%;
  pointer-events: auto; cursor: pointer; user-select: none;
  background: rgba(241, 232, 216, .93); color: var(--donker);
  border: 1px solid rgba(28, 27, 25, .18); border-radius: 7px;
  padding: 3px 8px 4px; max-width: 190px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  will-change: transform;
}
.label .kop { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 12.5px; line-height: 1.25; white-space: nowrap; }
.label .kop b { font-family: var(--serif); font-size: 13.5px; }
.label .fn { color: var(--grijs); font-size: 11px; }
.label .doet { font-style: italic; font-size: 11.5px; line-height: 1.25; color: #3d3831; margin-top: 1px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label.rustig .doet { -webkit-line-clamp: 1; color: #6f675c; }
.label.wacht { border-color: var(--oranje); box-shadow: 0 0 0 2px rgba(224,123,18,.35), 0 2px 6px rgba(0,0,0,.2); }
.label.gekozen { border-color: var(--rood); box-shadow: 0 0 0 2px var(--rood), 0 2px 8px rgba(0,0,0,.25); z-index: 3; }
.label.ver .doet { display: none; }
.label.weg { display: none; }

#tip {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6;
  background: rgba(28,27,25,.78); color: var(--creme); font-size: 12.5px; padding: 6px 12px; border-radius: 999px;
  pointer-events: none; transition: opacity .6s; white-space: nowrap;
}
#tip.weg { opacity: 0; }

/* ---------- bord "Wacht op jou" ---------- */
#bord {
  position: fixed; left: 14px; top: calc(var(--balk) + 14px); z-index: 10;
  width: 320px; max-height: calc(100% - var(--balk) - 28px); display: flex; flex-direction: column;
  background: var(--creme); border-radius: 10px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); border-top: 5px solid var(--rood);
}
#bordKop {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px dashed rgba(28,27,25,.25); text-align: left;
}
#bordKop .titel { font-family: var(--serif); font-size: 18px; font-weight: 700; flex: 1; }
#bordKop .aantal {
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--oranje); color: #fff; font-weight: 700; font-size: 14px;
}
#bordKop .aantal.nul { background: var(--groen); }
#bordKop .pijl { width: 18px; height: 18px; fill: none; stroke: var(--donker); stroke-width: 2.2; transition: transform .2s; }
#bord.dicht #bordKop .pijl { transform: rotate(-90deg); }
#bord.dicht #bordInhoud { display: none; }
#bordInhoud { overflow-y: auto; padding: 6px 14px 12px; font-size: 13.5px; line-height: 1.4; }
#bordInhoud h3 {
  font-family: var(--serif); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--rood); margin: 12px 0 6px;
}
#bordInhoud ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#bordInhoud li { background: #fffaf0; border: 1px solid rgba(28,27,25,.1); border-radius: 6px; padding: 7px 9px; }
#bordInhoud li.klik { cursor: pointer; }
#bordInhoud li.klik:hover { border-color: var(--oranje); }
#bordInhoud .wie { font-weight: 700; font-family: var(--serif); }
#bordInhoud .nr { display: inline-block; font-weight: 700; color: var(--rood); margin-right: 4px; font-variant-numeric: tabular-nums; }
#bordInhoud .klein { color: var(--grijs); font-size: 12px; }
#bordInhoud .leeg { color: var(--grijs); font-style: italic; background: transparent; border: 0; padding: 2px 0; }
#bordInhoud .voet { margin-top: 12px; color: var(--grijs); font-size: 11.5px; }

/* ---------- klikpaneel ---------- */
#paneel {
  position: fixed; right: 14px; top: calc(var(--balk) + 14px); z-index: 11;
  width: 360px; max-height: calc(100% - var(--balk) - 28px); overflow-y: auto;
  background: var(--creme); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  border-top: 5px solid var(--donker);
}
#paneel[hidden] { display: none; }
#paneelSluit {
  position: absolute; right: 8px; top: 6px; width: 34px; height: 34px; border: 0; background: transparent;
  font-size: 26px; line-height: 1; cursor: pointer; color: var(--grijs); border-radius: 50%;
}
#paneelSluit:hover { background: rgba(28,27,25,.08); color: var(--donker); }
#paneelInhoud { padding: 14px 16px 16px; font-size: 14px; line-height: 1.45; }
.dossier-kop { display: flex; align-items: baseline; gap: 8px; padding-right: 30px; }
.dossier-kop h2 { font-family: var(--serif); font-size: 24px; margin: 0; }
.dossier-kop .fn { color: var(--grijs); }
.statuschip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: #fffaf0; border: 1px solid rgba(28,27,25,.15);
}
.statuschip.wacht { background: #fdebd6; border-color: var(--oranje); }
.statuschip.werkt { background: #dff1e4; border-color: var(--groen); }
.dossier h4 {
  font-family: var(--serif); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--rood); margin: 16px 0 4px;
}
.dossier p { margin: 0; }
.dossier .vraag { background: #fdebd6; border-left: 4px solid var(--oranje); padding: 8px 10px; border-radius: 4px; }
.dossier ul { margin: 0; padding-left: 18px; }
.dossier li { margin: 3px 0; }
.dossier .grijs { color: var(--grijs); font-style: italic; }
.dossier .knop {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 9px 14px; border-radius: 8px;
  background: var(--donker); color: var(--creme); text-decoration: none; font-weight: 600; font-size: 14px;
}
.dossier .knop:hover { background: var(--rood); }
.dossier .uitleg { font-size: 12px; color: var(--grijs); margin-top: 6px; }

/* ---------- aanmelden ---------- */
body.login { display: grid; place-items: center; min-height: 100%; overflow: auto; padding: 16px; }
.loginkaart {
  width: 100%; max-width: 340px; background: var(--creme); border-radius: 12px; padding: 24px;
  border-top: 6px solid var(--rood); box-shadow: 0 10px 30px rgba(0,0,0,.4); display: grid; gap: 10px;
}
.loginkaart h1 { font-family: var(--serif); margin: 4px 0 8px; font-size: 28px; }
.loginkaart .merk { color: var(--donker); }
.loginkaart label { font-size: 14px; color: var(--grijs); }
.loginkaart input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 8px; border: 1px solid #b9ad99; background: #fffaf0; }
.loginkaart button { font-size: 16px; padding: 11px; border-radius: 8px; border: 0; background: var(--donker); color: var(--creme); cursor: pointer; font-weight: 600; }
.loginkaart button:hover { background: var(--rood); }
.loginkaart .fout { color: var(--rood); margin: 0; font-size: 14px; }

/* ---------- gsm ---------- */
@media (max-width: 760px) {
  :root { --balk: 84px; }
  #balk { flex-wrap: wrap; height: var(--balk); padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); align-content: center; row-gap: 4px; }
  .merk { flex: 1; min-width: 0; }
  .merk .naam { font-size: 15px; }
  .merk .sub, #klok .stad, #teller .sep { display: none; }
  #teller { order: 3; width: 100%; gap: 4px 12px; font-size: 12.5px; }
  #geluid { padding: 5px 8px; }
  #geluid .tekst { display: none; }
  #bord {
    left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 46%;
  }
  #bord.dicht { max-height: none; }
  #paneel { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 62%; z-index: 12; }
  #tip { bottom: auto; top: calc(var(--balk) + 10px); font-size: 11.5px; }
  .label { max-width: 150px; padding: 2px 6px 3px; }
  .label .kop { font-size: 11.5px; }
  .label .kop b { font-size: 12.5px; }
  .label .fn { display: none; }
  .label .doet { font-size: 10.5px; -webkit-line-clamp: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
