@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #377AFF;
  --blue-dark: #2B62CC;
  --blue-light: #EEF3FF;
  --sage: #8DAB7F;
  --sage-light: #E8F0E4;
  --sage-dark: #5d7d52;
  --dark: #1A1A2E;
  --text: #2C2C3A;
  --muted: #6B7280;
  --light: #9CA3AF;
  --bg: #F7F8FA;
  --white: #FFFFFF;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.12);
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'DM Sans', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --panel-w: 300px;
  --bar-h: 54px;
  --foot-h: 36px;
}

html, body { width: 100%; height: 100%; overflow: hidden; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); }

/* ── TOPBAR ─────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: rgba(247,248,250,0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; flex-shrink: 0;
}
.brand img { width: 28px; height: 28px; display: block; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 1rem; color: var(--dark);
  white-space: nowrap;
}
.brand-name em { color: var(--blue); font-style: normal; }
.topbar-div { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.meet-tag {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 1rem; color: var(--muted);
  flex-shrink: 0;
}
.topbar-right {
  margin-left: auto; display: flex;
  align-items: center; gap: 0.5rem;
}
.lang-pills {
  display: flex; gap: 1px;
  background: var(--border); border-radius: 6px; padding: 2px;
  flex-shrink: 0;
}
.lang-pill {
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 9px; border-radius: 4px;
  cursor: pointer; color: var(--muted);
  transition: all 0.15s; user-select: none;
}
.lang-pill.active { background: var(--white); color: var(--dark); box-shadow: var(--shadow-sm); }
.reset-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
  font-size: 0.9rem; transition: all 0.15s;
  flex-shrink: 0;
}
.reset-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.guide-btn {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0 0.9rem; height: 32px;
  background: var(--blue); color: white;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.guide-btn:hover { background: var(--blue-dark); }
.guide-btn .btn-text { display: inline; }

/* ── CANVAS ─────────────────────────────────────────── */
#canvas {
  position: fixed; inset: 0;
  top: var(--bar-h); bottom: var(--foot-h);
  overflow: hidden; background: var(--bg);
}
#canvas::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 25% 35%, rgba(55,122,255,0.03) 0%, transparent 55%),
    radial-gradient(circle at 78% 62%, rgba(141,171,127,0.04) 0%, transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,0,0,.02) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,0,0,.02) 40px);
  pointer-events: none;
}
#canvas-inner { position: absolute; inset: 0; }
#svg-lines {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

/* ── DOMAIN NODES ─────────────────────────────────────── */
.domain-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 86px; height: 86px; border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; z-index: 10;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-sm);
  user-select: none; text-align: center;
  padding: 0 6px;
  animation: nodePulse 5s ease-in-out infinite;
}
.domain-node:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-light), var(--shadow);
  transform: translate(-50%, -50%) scale(1.07);
  animation: none;
}
.domain-node.active {
  border-color: var(--blue); background: var(--blue);
  box-shadow: 0 0 0 6px var(--blue-light), var(--shadow-lg);
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 30; animation: none;
}
.domain-node.dimmed {
  opacity: 0.18; transform: translate(-50%, -50%) scale(0.88);
  pointer-events: none; animation: none;
}
.domain-node.adjacent { opacity: 0.52; animation: none; }
.domain-node.adjacent:hover { opacity: 1; }
.domain-node.suggested {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px var(--sage-light);
}
.node-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.node-label {
  font-size: 0.47rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); line-height: 1.25;
  max-width: 72px; word-break: break-word;
}
.domain-node.active .node-icon { filter: grayscale(1) brightness(10); }
.domain-node.active .node-label { color: rgba(255,255,255,0.85); }

.suggest-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 1.5px dashed rgba(141,171,127,0.55);
  animation: spin 10s linear infinite; pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nodePulse {
  0%,100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 4px var(--blue-light), var(--shadow-sm); }
}

/* ── SUB NODES ───────────────────────────────────────── */
.sub-node {
  position: absolute;
  transform: translate(-50%, -50%) scale(0);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--white); border: 1.5px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 20; opacity: 0;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-sm);
}
.sub-node.visible { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.sub-node:hover {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--sage-light), var(--shadow);
  transform: translate(-50%, -50%) scale(1.12);
}
.sub-node.selected-sub { border-color: var(--sage); background: var(--sage); }
.sub-node.active-sub {
  border-color: var(--sage-dark);
  box-shadow: 0 0 0 4px var(--sage-light), var(--shadow);
}
.sub-num { font-size: 0.62rem; font-weight: 700; color: var(--muted); }
.sub-node.selected-sub .sub-num { color: white; }
.sub-node.active-sub .sub-num { color: var(--sage-dark); }

.sub-connector {
  position: absolute; background: var(--border); height: 1px;
  transform-origin: left center; pointer-events: none; z-index: 5;
  opacity: 0; transition: opacity 0.35s;
}
.sub-connector.visible { opacity: 1; }
.sub-connector.selected-line { background: var(--sage-light); height: 2px; }

/* ── LEFT PANEL ──────────────────────────────────────── */
#left-panel {
  position: fixed; left: 0; top: var(--bar-h); bottom: var(--foot-h);
  width: var(--panel-w);
  background: var(--white); border-right: 1px solid var(--border);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#left-panel.open { transform: translateX(0); }
.lp-header {
  padding: 1.25rem 1.25rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem; flex-shrink: 0;
}
.panel-back {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; color: var(--light);
  cursor: pointer; margin-bottom: 1rem;
  transition: color 0.15s;
}
.panel-back:hover { color: var(--blue); }
.panel-top-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.panel-icon { font-size: 1.75rem; flex-shrink: 0; }
.panel-tag {
  display: inline-block;
  font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--blue); background: var(--blue-light);
  padding: 0.18rem 0.55rem; border-radius: 4px; margin-bottom: 0.3rem;
}
.panel-domain-name {
  font-family: var(--font-serif);
  font-size: 1.2rem; color: var(--dark); line-height: 1.2;
}
.lp-body { padding: 1rem 1.25rem; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel-desc {
  font-size: 0.8rem; color: var(--muted);
  line-height: 1.55; margin-bottom: 1.1rem;
}
.panel-section {
  font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--light); margin-bottom: 0.5rem;
}
.adj-list { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.adj-item {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.78rem; color: var(--text); transition: all 0.15s;
}
.adj-item:hover { border-color: var(--blue); background: var(--blue-light); }
.adj-top { display: flex; align-items: center; gap: 0.5rem; }
.adj-name { flex: 1 1 auto; }
.adj-item:hover .adj-name { color: var(--blue); }
.adj-strength { display: flex; align-items: center; gap: 0.45rem; }
.adj-bar {
  flex: 1 1 auto; height: 5px; background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.adj-bar-fill { display: block; height: 100%; background: var(--muted); border-radius: 999px; }
.adj-bar-fill.research { background: var(--blue); }
.adj-pct { font-size: 0.62rem; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.adj-basis {
  font-size: 0.54rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 1px 5px; border-radius: 4px; flex-shrink: 0;
}
.adj-basis.schatting { background: var(--bg); color: var(--light); }
.adj-basis.onderzoek { background: var(--blue-light); color: var(--blue-dark); }
.adj-bron { font-size: 0.6rem; color: var(--light); line-height: 1.4; }

/* ── KAARTLEGENDA ───────────────────────────────────── */
#map-legend {
  position: absolute; left: 1rem; bottom: 1rem; z-index: 3;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.4rem 0.7rem; background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px); border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.6rem; color: var(--muted);
  pointer-events: none;
}
#map-legend .ml-title {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--light);
}
#map-legend .ml-item { display: inline-flex; align-items: center; gap: 0.3rem; }
#map-legend .ml-line { display: inline-block; width: 16px; border-radius: 999px; background: var(--dark); }
#map-legend .ml-line.thin { height: 1px; opacity: 0.35; }
#map-legend .ml-line.thick { height: 3px; opacity: 0.7; }
#map-legend .ml-line.research { height: 3px; background: var(--blue); opacity: 0.8; }
@media (max-width: 700px) { #map-legend { display: none; } }
.subs-mini-list { display: flex; flex-direction: column; gap: 0.25rem; }
.sub-mini {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.4rem 0.55rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.75rem; color: var(--muted); line-height: 1.35;
  transition: all 0.15s;
}
.sub-mini:hover { border-color: var(--sage); background: var(--sage-light); color: var(--text); }
.sub-mini.active-mini { border-color: var(--sage-dark); background: var(--sage-light); color: var(--sage-dark); font-weight: 500; }
.sub-mini-n { font-size: 0.65rem; font-weight: 700; color: var(--blue); flex-shrink: 0; margin-top: 1px; }

/* ── RIGHT PANEL ─────────────────────────────────────── */
#right-panel {
  position: fixed; right: 0; top: var(--bar-h); bottom: var(--foot-h);
  width: 310px; background: var(--white);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto; display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#right-panel.open { transform: translateX(0); }
.rp-header { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.rp-close {
  float: right; cursor: pointer; color: var(--light);
  font-size: 0.9rem; padding: 2px; transition: color 0.15s;
}
.rp-close:hover { color: var(--text); }
.rp-domain-tag {
  font-size: 0.62rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.35rem;
  display: block; clear: both;
}
.rp-sub-title {
  font-family: var(--font-serif);
  font-size: 1rem; color: var(--dark); line-height: 1.3;
}
.rp-body { padding: 1rem 1.25rem; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.rp-statement-box {
  background: var(--sage-light);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.75rem 0.85rem; margin-bottom: 0.75rem;
}
.rp-statement { font-size: 0.88rem; color: var(--dark); line-height: 1.5; font-weight: 500; }
.rp-statement-en { font-size: 0.75rem; color: var(--muted); margin-top: 0.3rem; font-style: italic; }
.rp-section { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--light); margin-bottom: 0.5rem; }
.rp-how {
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem; margin-bottom: 0.75rem;
  font-size: 0.8rem; color: var(--text); line-height: 1.5;
}
.rp-add-btn {
  width: 100%; padding: 0.6rem;
  background: var(--sage); border: none;
  border-radius: var(--radius-sm); color: white;
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s; margin-bottom: 0.5rem;
}
.rp-add-btn:hover { background: var(--sage-dark); }
.rp-add-btn.added { background: var(--sage-dark); }
.rp-q-btn {
  width: 100%; padding: 0.55rem;
  background: none; border: 1.5px solid var(--blue);
  border-radius: var(--radius-sm); color: var(--blue);
  font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.rp-q-btn:hover { background: var(--blue-light); }
.rp-divider { height: 1px; background: var(--border); margin: 0.85rem 0; }
.rp-others { display: flex; flex-direction: column; gap: 0.3rem; }
.rp-other-item {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.75rem; color: var(--text); line-height: 1.35;
  transition: all 0.15s;
}
.rp-other-item:hover { border-color: var(--sage); background: var(--sage-light); }
.rp-other-item.sel { border-color: var(--sage); background: var(--sage-light); color: var(--sage-dark); }
.rp-check { margin-left: auto; font-size: 0.65rem; color: var(--sage-dark); flex-shrink: 0; }

/* ── QUESTIONS PANEL ─────────────────────────────────── */
#questions-panel {
  position: fixed; right: 0; top: var(--bar-h); bottom: var(--foot-h);
  width: 310px; background: var(--white);
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto; display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#questions-panel.open { transform: translateX(0); }
.qp-header { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.qp-back {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.72rem; color: var(--light); cursor: pointer;
  margin-bottom: 0.75rem; transition: color 0.15s;
}
.qp-back:hover { color: var(--blue); }
.qp-title { font-family: var(--font-serif); font-size: 1rem; color: var(--dark); line-height: 1.3; }
.qp-sub-tag { font-size: 0.65rem; color: var(--muted); margin-top: 0.2rem; }
.qp-body { padding: 1rem 1.25rem; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.question-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem; margin-bottom: 0.45rem;
  cursor: pointer; transition: all 0.15s;
}
.question-item:hover { border-color: var(--sage); background: var(--sage-light); }
.question-item.selected { border-color: var(--sage); background: var(--sage-light); }
.q-text { font-size: 0.82rem; color: var(--text); line-height: 1.45; }
.q-meta { font-size: 0.68rem; color: var(--light); margin-top: 0.3rem; }
.q-check { float: right; color: var(--sage-dark); font-size: 0.75rem; }

/* ── BASKET ──────────────────────────────────────────── */
#basket {
  position: fixed;
  bottom: calc(var(--foot-h) + 1rem);
  right: 1.25rem;
  z-index: 150;
}
.basket-tray {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.25rem; margin-bottom: 0.5rem;
  width: 290px; max-height: 370px; overflow-y: auto;
  display: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.basket-tray.open { display: block; }
.basket-tray-title { font-family: var(--font-serif); font-size: 1rem; color: var(--dark); margin-bottom: 0.75rem; }
.basket-empty { font-size: 0.78rem; color: var(--light); font-style: italic; text-align: center; padding: 0.5rem 0; }
.basket-group { margin-bottom: 0.75rem; }
.basket-group-name { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--blue); margin-bottom: 0.3rem; }
.basket-item {
  display: flex; align-items: flex-start; gap: 0.4rem;
  font-size: 0.76rem; color: var(--muted);
  padding: 0.25rem 0; border-bottom: 1px solid var(--bg); line-height: 1.4;
}
.basket-item::before { content: '>'; color: var(--sage); flex-shrink: 0; margin-top: 1px; }
.basket-rm { margin-left: auto; cursor: pointer; color: var(--light); font-size: 0.62rem; flex-shrink: 0; padding-top: 2px; }
.basket-rm:hover { color: #e55; }
.basket-foot { padding-top: 0.75rem; border-top: 1px solid var(--border); }
.btn-export {
  width: 100%; padding: 0.6rem;
  background: var(--blue); border: none;
  border-radius: var(--radius-sm); color: white;
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-export:hover { background: var(--blue-dark); }
.basket-pill {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 24px; padding: 0.4rem 1rem;
  cursor: pointer; font-size: 0.78rem; font-weight: 500;
  color: var(--text); box-shadow: var(--shadow-sm); transition: all 0.15s;
}
.basket-pill:hover { border-color: var(--blue); }
.basket-count {
  background: var(--sage); color: white;
  font-size: 0.62rem; font-weight: 700;
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}

/* ── TIP ─────────────────────────────────────────────── */
#explore-tip {
  position: fixed; bottom: calc(var(--foot-h) + 1rem); left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,46,0.8); color: rgba(255,255,255,0.9);
  padding: 0.45rem 1.1rem; border-radius: 20px;
  font-size: 0.72rem; pointer-events: none; z-index: 80;
  white-space: nowrap; transition: opacity 0.6s;
}
#explore-tip.gone { opacity: 0; }

/* ── ROUTE B MODAL ───────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; top: var(--bar-h);
  background: rgba(26,26,46,0.35); z-index: 160;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem;
  width: 400px; max-width: calc(100vw - 2rem);
}
.modal-card h2 { font-family: var(--font-serif); font-size: 1.4rem; color: var(--dark); margin-bottom: 0.3rem; }
.modal-card > p { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.25rem; }
.form-row { margin-bottom: 0.85rem; }
.form-row label { display: block; font-size: 0.73rem; font-weight: 600; color: var(--text); margin-bottom: 0.28rem; }
.form-row select {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.82rem;
  color: var(--text); background: var(--bg);
  appearance: none; cursor: pointer; transition: border-color 0.15s;
}
.form-row select:focus { outline: none; border-color: var(--blue); }
.modal-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.btn-primary {
  flex: 1; padding: 0.6rem;
  background: var(--blue); border: none;
  border-radius: var(--radius-sm); color: white;
  font-family: var(--font-sans); font-size: 0.84rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost {
  padding: 0.55rem 1rem;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--muted);
  font-family: var(--font-sans); font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--border); color: var(--text); }

/* ── RESET CONFIRM ───────────────────────────────────── */
#reset-overlay {
  position: fixed; inset: 0; top: var(--bar-h);
  background: rgba(26,26,46,0.35); z-index: 160;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#reset-overlay.open { opacity: 1; pointer-events: all; }
.reset-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 1.75rem;
  width: 340px; max-width: calc(100vw - 2rem); text-align: center;
}
.reset-card h3 { font-family: var(--font-serif); font-size: 1.2rem; color: var(--dark); margin-bottom: 0.5rem; }
.reset-card p { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.5; }
.reset-actions { display: flex; gap: 0.6rem; justify-content: center; }
.btn-danger {
  padding: 0.6rem 1.25rem;
  background: #e55; border: none;
  border-radius: var(--radius-sm); color: white;
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #c44; }

/* ── EXPORT MODAL ────────────────────────────────────── */
#export-modal {
  position: fixed; inset: 0; top: var(--bar-h);
  background: rgba(26,26,46,0.5); z-index: 170;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  padding: 1rem;
}
#export-modal.open { opacity: 1; pointer-events: all; }
.export-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem;
  width: 600px; max-width: 100%;
  max-height: 80vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.export-card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem;
}
.export-card-header h2 { font-family: var(--font-serif); font-size: 1.3rem; color: var(--dark); }
.export-close { cursor: pointer; color: var(--light); font-size: 1rem; transition: color 0.15s; }
.export-close:hover { color: var(--text); }
.export-about {
  background: var(--blue-light); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; margin-bottom: 1.25rem;
  font-size: 0.8rem; color: var(--text); line-height: 1.55;
}
.export-about strong { color: var(--blue); }
.export-domain { margin-bottom: 1.1rem; }
.export-domain-name {
  font-weight: 600; font-size: 0.82rem; color: var(--dark);
  margin-bottom: 0.2rem; display: flex; align-items: center; gap: 0.4rem;
}
.export-domain-desc { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.4rem; line-height: 1.45; }
.export-sub { font-size: 0.77rem; color: var(--text); padding: 0.25rem 0; display: flex; align-items: flex-start; gap: 0.4rem; }
.export-sub::before { content: '>'; color: var(--sage); flex-shrink: 0; }
.export-how { font-size: 0.72rem; color: var(--light); padding-left: 1rem; font-style: italic; }
.export-source { font-size: 0.7rem; color: var(--light); margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.export-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.btn-pdf {
  flex: 1; min-width: 140px; padding: 0.6rem;
  background: var(--blue); border: none;
  border-radius: var(--radius-sm); color: white;
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-pdf:hover { background: var(--blue-dark); }
.btn-mailto {
  flex: 1; min-width: 140px; padding: 0.6rem;
  background: none; border: 1.5px solid var(--sage);
  border-radius: var(--radius-sm); color: var(--sage-dark);
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.btn-mailto:hover { background: var(--sage-light); border-color: var(--sage-dark); }

/* ── FOOTER ──────────────────────────────────────────── */
#footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--foot-h);
  background: rgba(247,248,250,0.97);
  border-top: 1px solid var(--border);
  z-index: 200;
  display: flex; align-items: center;
  padding: 0 1.25rem;
  gap: 1.5rem; justify-content: flex-end;
}
.foot-link {
  font-size: 0.65rem; color: var(--light); text-decoration: none;
  transition: color 0.15s; white-space: nowrap;
}
.foot-link:hover { color: var(--blue); }
.foot-sep { width: 1px; height: 10px; background: var(--border); }
.foot-copy { font-size: 0.63rem; color: var(--light); margin-right: auto; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --panel-w: 260px; }
  #topbar { padding: 0 0.75rem; gap: 0.65rem; }
  .topbar-right { gap: 0.35rem; }
  .guide-btn .btn-text { display: none; }
  .guide-btn { padding: 0 0.6rem; font-size: 1rem; }
  .brand-name { display: none; }
  .topbar-div:first-of-type { display: none; }
  .meet-tag { font-size: 0.9rem; }
  .domain-node { width: 72px; height: 72px; padding: 0 4px; }
  .node-icon { font-size: 0.9rem; }
  .node-label { font-size: 0.4rem; max-width: 60px; }
  .sub-node { width: 40px; height: 40px; }
  .sub-num { font-size: 0.56rem; }
  #left-panel, #right-panel, #questions-panel { width: min(calc(100vw - 12px), 320px); }
  #basket { right: 0.75rem; left: 0.75rem; }
  .basket-tray { width: 100%; max-height: 50vh; }
  .basket-pill { width: max-content; margin-left: auto; }
  #explore-tip { max-width: calc(100vw - 1.5rem); white-space: normal; text-align: center; }
  .modal-card, .reset-card { padding: 1.1rem; max-height: calc(100vh - var(--bar-h) - 1.5rem); overflow-y: auto; }
  .modal-actions, .reset-actions, .export-actions { flex-direction: column; }
  .btn-primary, .btn-ghost, .btn-danger, .btn-pdf, .btn-mailto { width: 100%; }
  .export-card { padding: 1.1rem; max-height: calc(100vh - var(--bar-h) - 1.5rem); }
  #footer {
    padding: 0 0.75rem;
    gap: 0.75rem;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .foot-copy { display: none; }
}
@media (max-width: 420px) {
  :root { --panel-w: calc(100vw - 20px); }
  #topbar { padding: 0 0.5rem; gap: 0.45rem; }
  .meet-tag { font-size: 0.82rem; }
  .lang-pill { padding: 3px 7px; }
  .reset-btn, .guide-btn { height: 30px; }
  .domain-node { width: 64px; height: 64px; }
  .node-label { font-size: 0.37rem; max-width: 52px; }
  .sub-node { width: 36px; height: 36px; }
  #right-panel, #questions-panel { width: calc(100vw - 20px); }
  #footer { gap: 0.5rem; }
  .foot-sep { display: none; }
  .foot-link { font-size: 0.6rem; }
}

/* ── SEARCH ─────────────────────────────────────────── */
#search-wrap { position: relative; flex: 1; max-width: 340px; margin-left: 0.5rem; }
#search-input {
  width: 100%; padding: 0.42rem 0.75rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); font-family: var(--font-sans);
  font-size: 0.78rem; color: var(--text);
}
#search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(55,122,255,0.12); }
#search-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 60vh; overflow-y: auto; z-index: 300;
}
#search-results.open { display: block; }
.sr-item {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.55rem 0.75rem; cursor: pointer;
  border-bottom: 1px solid var(--bg); font-size: 0.78rem;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--blue-light); }
.sr-type {
  flex-shrink: 0; font-size: 0.58rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: 4px;
}
.sr-thema { background: var(--blue-light); color: var(--blue-dark); }
.sr-uitkomst { background: var(--sage-light); color: var(--sage-dark); }
.sr-vraag { background: #FDF3E7; color: #B8762A; }
.sr-label { color: var(--text); line-height: 1.35; flex: 1; }
.sr-ctx {
  margin-left: auto; flex-shrink: 0; font-size: 0.62rem; color: var(--light);
  max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-empty { padding: 0.8rem 0.9rem; font-size: 0.75rem; color: var(--muted); }
.sr-empty a { color: var(--blue); font-weight: 600; text-decoration: none; margin-left: 0.3rem; }

/* ── CONTRIBUTE ─────────────────────────────────────── */
.contribute-btn {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.42rem 0.85rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--white); color: var(--text);
  font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.contribute-btn:hover { border-color: var(--sage); color: var(--sage-dark); background: var(--sage-light); }
#contribute-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(26,26,46,0.45); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 1rem;
}
#contribute-overlay.open { display: flex; }
.contribute-card { position: relative; max-height: 88vh; overflow-y: auto; }
.modal-close {
  position: absolute; top: 0.8rem; right: 1rem;
  font-size: 1.3rem; color: var(--light); cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.form-row textarea, .form-row input[type="text"], .form-row input[type="email"] {
  width: 100%; padding: 0.5rem 0.65rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.8rem; color: var(--text);
  background: var(--white); resize: vertical;
}
.form-row textarea:focus, .form-row input:focus { outline: none; border-color: var(--blue); }
.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
#contribute-done { display: none; text-align: center; padding: 0.5rem 0; }
.c-done-icon {
  width: 44px; height: 44px; margin: 0 auto 0.8rem;
  border-radius: 50%; background: var(--sage-light); color: var(--sage-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
}
#contribute-done h3 { font-family: var(--font-serif); font-size: 1.2rem; color: var(--dark); margin-bottom: 0.5rem; }
#contribute-done p { font-size: 0.78rem; color: var(--muted); line-height: 1.55; margin-bottom: 1.1rem; }

/* ── WELCOME ────────────────────────────────────────── */
#welcome-overlay {
  display: none; position: fixed; inset: 0; z-index: 420;
  background: rgba(26,26,46,0.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 1rem;
}
#welcome-overlay.open { display: flex; }
.welcome-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem;
  max-width: 460px; width: 100%;
}
.welcome-card h2 { font-family: var(--font-serif); font-size: 1.6rem; color: var(--dark); margin-bottom: 0.4rem; }
.welcome-card > p { font-size: 0.82rem; color: var(--muted); line-height: 1.55; margin-bottom: 1.3rem; }
.welcome-options { display: flex; flex-direction: column; gap: 0.6rem; }
.welcome-opt {
  display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto;
  column-gap: 0.75rem; align-items: center; text-align: left;
  padding: 0.8rem 0.9rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white);
  font-family: var(--font-sans); cursor: pointer; transition: all 0.15s;
}
.welcome-opt:hover { border-color: var(--blue); background: var(--blue-light); }
.wo-icon {
  grid-row: 1 / 3; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg); color: var(--dark); font-size: 1rem;
}
.wo-title { font-size: 0.85rem; font-weight: 600; color: var(--dark); }
.wo-sub { font-size: 0.7rem; color: var(--muted); }

/* ── QUESTION BADGES & CONTRIBUTE HINT ──────────────── */
.q-badge {
  display: inline-block; margin-left: 0.4rem; vertical-align: middle;
  font-size: 0.55rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px;
}
.q-badge.review { background: #FDF3E7; color: #B8762A; }
.q-badge.validated { background: var(--sage-light); color: var(--sage-dark); }
.q-src { font-size: 0.62rem; color: var(--light); margin-top: 0.2rem; }
.qp-contribute {
  margin-top: 1.2rem; padding: 0.85rem 0.9rem;
  background: var(--sage-light); border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.qp-contribute-txt { font-size: 0.72rem; color: var(--sage-dark); line-height: 1.4; flex: 1; min-width: 140px; }
.qp-contribute-btn {
  padding: 0.4rem 0.8rem; border: 1px solid var(--sage);
  border-radius: var(--radius-sm); background: var(--white); color: var(--sage-dark);
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.qp-contribute-btn:hover { background: var(--sage); color: var(--white); }

@media (max-width: 720px) {
  #search-wrap { display: none; }
  .contribute-btn .btn-text { display: none; }
  .form-split { grid-template-columns: 1fr; }
}

/* ── RELATIETYPE-LABEL ──────────────────────────────── */
.adj-kind {
  margin-left: auto; font-size: 0.58rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--blue-dark); background: var(--blue-light);
  padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
