:root {
  --bg: #0b0b10;
  --surface: #16161f;
  --text: #f4f4f7;
  --muted: #a3a3b5;
  --line: rgba(255, 255, 255, 0.12);
  --study: #8b7cff;
  --news: #ff6b5b;
  --answer: #3ddc97;
  --bar-h: 92px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(to bottom, rgba(11, 11, 16, 0.9) 60%, rgba(11, 11, 16, 0));
  pointer-events: none;
}

.filters {
  pointer-events: auto;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(30, 30, 40, 0.6);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.filter {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.filter.is-active {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Feed ---------- */
.feed {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--safe-top) + var(--bar-h) + 12px) 20px calc(var(--safe-bottom) + 28px);
  overflow: hidden;
}

.card__inner {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: 2px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card h2 {
  margin: 0;
  font-size: clamp(22px, 6.4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.card p { margin: 0; }

/* ---------- Study cards ---------- */
.card--study {
  justify-content: center;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(139, 124, 255, 0.28), transparent 60%),
    radial-gradient(100% 50% at 100% 100%, rgba(61, 220, 151, 0.14), transparent 60%),
    var(--bg);
}

.card--study .pill { background: rgba(139, 124, 255, 0.18); color: #c9c1ff; }

.explanation {
  font-size: 16px;
  line-height: 1.5;
  color: #dcdce6;
}

.quiz {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.1s;
}
.quiz:active { transform: scale(0.99); }

.quiz__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--study);
}

.quiz__question {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.quiz__hint {
  font-size: 14px;
  color: var(--muted);
}

.quiz__answer {
  display: none;
  font-size: 15px;
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.quiz[aria-expanded="true"] { border-color: rgba(61, 220, 151, 0.5); }
.quiz[aria-expanded="true"] .quiz__hint { display: none; }
.quiz[aria-expanded="true"] .quiz__answer {
  display: block;
  animation: reveal 0.25s ease-out;
}
.quiz__answer strong { color: var(--answer); }

/* Opacity only: a moving answer would make the fit check think the card is too long. */
@keyframes reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- News cards ---------- */
.card--news { background: #111; }

.card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card--news::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.55) 50%, rgba(0, 0, 0, 0.92) 100%);
}

.card--news.no-image {
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(255, 107, 91, 0.25), transparent 60%),
    var(--bg);
}
.card--news.no-image::after { display: none; }

.card--news .card__inner { z-index: 1; }
.card--news .meta { color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.card--news .meta .pill { text-shadow: none; }
.card--news .pill { background: var(--news); color: #fff; }
.card--news .pill.nos { background: #e61e14; }
.card--news .pill.nyt { background: #fff; color: #000; }

.summary {
  font-size: 16px;
  line-height: 1.5;
  color: #e6e6ec;
}

.read-more {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}
.read-more:active { opacity: 0.8; }

/* ---------- Status / end cards ---------- */
.card--status {
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
  gap: 12px;
}
.card--status h2 { color: var(--text); }

.counter {
  position: fixed;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 10px);
  z-index: 10;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

@media (min-width: 700px) {
  .card { padding-left: 32px; padding-right: 32px; }
}

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


/* ---------- Likes ---------- */
:root { --like: #ff4d6d; }

.round-btn {
  pointer-events: auto;
  appearance: none;
  cursor: pointer;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(30, 30, 40, 0.6);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text);
}
.likes-link { color: var(--like); }
.likes-link svg { width: 20px; height: 20px; fill: currentColor; }

.meta__actions { margin-left: auto; display: flex; gap: 8px; }

.heart, .speak {
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 28, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
}
.speak svg, .voice-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.speak.is-playing { color: var(--study); border-color: rgba(139, 124, 255, 0.6); }
.heart svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.15s, stroke 0.15s;
}
.heart.is-liked { color: var(--like); border-color: rgba(255, 77, 109, 0.5); }
.heart.is-liked svg { fill: var(--like); stroke: var(--like); }
.heart.pop svg { animation: pop 0.35s ease-out; }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--study);
}
.card--study[data-format="veelgemaakte fout"] .kicker { color: #ffb35b; }
.card--study[data-format="voorbeeld uit het dagelijks leven"] .kicker { color: var(--answer); }
.card--study[data-format="mini-case"] .kicker { color: #5bc8ff; }
.card--study[data-format="quiz"] .kicker { color: #ff7ad9; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + var(--bar-h) + 8px);
  z-index: 20;
  transform: translate(-50%, -12px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(30, 30, 40, 0.92);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.card--end .read-more { align-self: center; border: 0; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- Mijn likes page ---------- */
body.page {
  overflow: auto;
  height: auto;
  min-height: 100%;
  background:
    radial-gradient(120% 40% at 0% 0%, rgba(255, 77, 109, 0.18), transparent 60%),
    var(--bg);
}

.page-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 40px);
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }

.back {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel .lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar__row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; margin-bottom: 6px; }
.bar__count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.bar__track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--like); min-width: 0; }
.bar--zero .bar__row { color: var(--muted); }

.like-list { list-style: none; margin: 0; padding: 0; }
.like-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.like-list li:first-child { border-top: 0; padding-top: 0; }
.like-list a, .like-list .like-title { color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.35; }
.like-list .like-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }

.progress-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 15px; }
.progress-row + .progress-row { margin-top: 8px; }
.button-secondary {
  appearance: none;
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.empty { color: var(--muted); font-size: 15px; margin: 0; }

/* ---------- Top bar rows, voice toggle, exam countdown ---------- */
.topbar__row { display: flex; align-items: center; gap: 8px; width: 100%; }
.topbar__row .filters { margin-right: auto; }
.voice-toggle .slash { display: inline; }
.voice-toggle .wave { display: none; }
.voice-toggle[aria-pressed="true"] { color: var(--study); border-color: rgba(139, 124, 255, 0.6); }
.voice-toggle[aria-pressed="true"] .slash { display: none; }
.voice-toggle[aria-pressed="true"] .wave { display: inline; }
body.voice-auto .speak { display: none; }
body.no-speech .speak, body.no-speech .voice-toggle { display: none; }

.exams { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.exam {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(30, 30, 40, 0.7);
  border: 1px solid var(--line);
  color: var(--muted);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.exam strong { color: var(--text); font-weight: 700; }
.exam.is-soon { border-color: rgba(255, 179, 91, 0.6); color: #ffd3a1; }
.exam.is-unknown { border-style: dashed; }

/* ---------- Voorbeeld ---------- */
.voorbeeld {
  border-left: 3px solid var(--answer);
  padding: 2px 0 2px 12px;
}
.voorbeeld__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--answer);
  margin-bottom: 2px;
}
.voorbeeld p { font-size: 15px; line-height: 1.45; color: #dcdce6; }

/* ---------- Charts ---------- */
.chart {
  margin: 0;
  padding: 10px 10px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  --s1: #9085e9;
  --s2: #d95926;
  --s3: #199e70;
}
.chart svg { display: block; width: 100%; height: auto; max-height: 27vh; }
.chart .grid { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.chart .axis { stroke: rgba(255, 255, 255, 0.3); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-weight: 700; }
.chart .series { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .s1 { stroke: var(--s1); }
.chart .s2 { stroke: var(--s2); }
.chart .s3 { stroke: var(--s3); }
.chart .series-label { fill: var(--text); font-size: 11px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.chart .guide { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart .guide-label { fill: var(--muted); font-size: 10px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.chart .point { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.chart .point-label { fill: var(--text); font-size: 10px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.swatch.s1 { background: var(--s1); }
.swatch.s2 { background: var(--s2); }
.swatch.s3 { background: var(--s3); }
.chart figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ---------- Multiple choice ---------- */
.mc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc .quiz__question { margin: 0; }
.mc__options { display: grid; gap: 8px; }
.mc__option {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
.mc__option[aria-disabled="true"] { cursor: default; }
.mc__letter {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
}
.mc__option.is-correct { border-color: var(--answer); background: rgba(61, 220, 151, 0.14); }
.mc__option.is-correct .mc__letter { background: var(--answer); color: #06291a; }
.mc__option.is-wrong { border-color: #ff5d5d; background: rgba(255, 93, 93, 0.14); }
.mc__option.is-wrong .mc__letter { background: #ff5d5d; color: #2b0606; }
.mc.is-answered .mc__option:not(.is-correct):not(.is-wrong) { display: none; } /* the feedback names the right answer */
.mc__feedback { margin: 0; font-size: 15px; line-height: 1.45; animation: reveal 0.25s ease-out; }
.mc__feedback strong { color: #ff8a8a; }
.mc__feedback.is-right strong { color: var(--answer); }

/* ---------- Wist ik / Wist ik niet ---------- */
.review { display: flex; flex-direction: column; gap: 8px; animation: reveal 0.25s ease-out; }
.review[hidden] { display: none; }
.review__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review__btn {
  appearance: none;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.review__btn--known[aria-pressed="true"] { background: var(--answer); border-color: var(--answer); color: #06291a; }
.review__btn--unknown[aria-pressed="true"] { background: #ffb35b; border-color: #ffb35b; color: #2e1a02; }
.review__status { margin: 0; font-size: 13px; color: var(--muted); }
.review__status:empty { display: none; }

/* ---------- Fit: a card never scrolls inside; app.js lowers --fs until it fits ---------- */
html, body, .feed, .card { touch-action: manipulation; } /* no double-tap zoom */
.card {
  --fs: 1;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.card__inner { overflow: hidden; gap: calc(14px * var(--fs)); }
.card .meta { font-size: calc(13px * var(--fs)); }
.card h2 { font-size: calc(clamp(22px, 6.4vw, 30px) * var(--fs)); }
.card .kicker { font-size: calc(13px * var(--fs)); }
.card .explanation { font-size: calc(16px * var(--fs)); line-height: 1.45; }
.card .summary { font-size: calc(16px * var(--fs)); line-height: 1.45; }
.card .voorbeeld p { font-size: calc(15px * var(--fs)); }
.card .quiz, .card .mc { padding: calc(14px * var(--fs)) calc(16px * var(--fs)); gap: calc(8px * var(--fs)); }
.card .quiz__question { font-size: calc(16px * var(--fs)); }
.card .quiz__answer, .card .mc__feedback { font-size: calc(15px * var(--fs)); }
.card .mc__options { gap: calc(8px * var(--fs)); }
.card .mc__option { font-size: calc(15px * var(--fs)); padding: calc(7px * var(--fs)) 12px; }
.card .review__btn { font-size: calc(15px * var(--fs)); }
.card .chart svg { max-height: calc(26vh * var(--fs)); }
.card .chart { padding: calc(10px * var(--fs)) 10px calc(8px * var(--fs)); }

/* Last resorts when smaller text is not enough (see fitCard in app.js). */
.card.is-tight .chart svg { max-height: 18vh; }
.card.is-tight .chart figcaption { display: none; }
.card.no-voorbeeld .voorbeeld { display: none; }
.card.no-explanation .explanation { display: none; }
.card.no-chart .chart { display: none; }
.card.is-clamped .explanation,
.card.is-clamped .summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

/* News summaries stay short. */
.card--news .summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

/* ---------- Double-tap heart ---------- */
.burst {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  pointer-events: none;
  color: var(--like);
  filter: drop-shadow(0 6px 24px rgba(255, 77, 109, 0.45));
  animation: burst 0.8s ease-out forwards;
}
.burst svg { width: 100%; height: 100%; fill: currentColor; }

@keyframes burst {
  0% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
  18% { transform: scale(1.15) rotate(4deg); opacity: 1; }
  32% { transform: scale(0.95) rotate(0deg); opacity: 1; }
  70% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(1.1) translateY(-40px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .burst { animation: burst-fade 0.6s ease-out forwards !important; }
}
@keyframes burst-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* Multiple choice: short options in a 2×2 grid; no chart caption (the alt text stays). */
.mc__options--grid { grid-template-columns: 1fr 1fr; }
.card:has(.mc) .chart figcaption { display: none; }

/* ---------- Four filters: let the tabs share the width ---------- */
.topbar__row .filters { flex: 1 1 auto; min-width: 0; }
.topbar__row .filter { flex: 1 1 auto; padding: 8px 6px; font-size: 14px; white-space: nowrap; }
.topbar__row .round-btn { width: 40px; height: 40px; }

/* ---------- News category label ---------- */
.kicker--news { color: #ffd0c9; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.card--news.no-image .kicker--news { color: var(--news); text-shadow: none; }

/* ---------- Weetjes ---------- */
.card--weetje {
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(255, 179, 91, 0.22), transparent 60%),
    radial-gradient(100% 50% at 0% 100%, rgba(91, 200, 255, 0.12), transparent 60%),
    var(--bg);
}
.card--weetje .pill { background: rgba(255, 179, 91, 0.18); color: #ffd3a1; }
.card--weetje .kicker { color: #ffb35b; }
.card--weetje[data-format="quiz"] .kicker { color: #ff7ad9; }
.card--weetje[data-format="wist je dat"] .kicker { color: #5bc8ff; }

/* ---------- Code dialog ---------- */
.code-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 5, 10, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.code-dialog {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.code-dialog h2 { margin: 0; font-size: 20px; }
.code-text { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.code-input {
  font: inherit;
  font-size: 17px; /* 16px+ keeps iPhone from zooming in */
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.code-input:focus { outline: 2px solid var(--study); outline-offset: 1px; }
.code-error { margin: 0; color: #ff8a8a; font-size: 14px; }
.code-error[hidden] { display: none; }
.code-actions { display: flex; gap: 8px; justify-content: flex-end; }
.code-actions button {
  appearance: none;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.code-view { background: transparent; color: var(--text); border: 1px solid var(--line); }
.code-save { background: var(--text); color: var(--bg); border: 0; }
.code-save:disabled { opacity: 0.6; }

/* ---------- Login status (second row of the top bar) ---------- */
.topbar__row2 { display: flex; align-items: flex-start; gap: 6px; width: 100%; }
.topbar__row2 .exams { flex: 1 1 auto; min-width: 0; }
.auth-chip {
  pointer-events: auto;
  appearance: none;
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(30, 30, 40, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}
/* Bigger touch target than the chip itself. */
.auth-chip::after { content: ""; position: absolute; inset: -9px 0; }
.auth-chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-chip[data-state="ok"] { color: var(--answer); border-color: rgba(61, 220, 151, 0.55); background: rgba(61, 220, 151, 0.12); }
.auth-chip[data-state="checking"] { color: #ffd3a1; border-color: rgba(255, 179, 91, 0.5); }
.auth-chip[data-state="view"] { color: var(--muted); }

.code-dialog { position: relative; }
.code-cancel {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Weetje buttons: Lees meer ↗ / Meer hierover ---------- */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .read-more { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; font-size: calc(15px * var(--fs, 1)); }
.more-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 91, 0.55);
  background: rgba(255, 179, 91, 0.1);
  color: #ffd3a1;
  font: inherit;
  font-size: calc(15px * var(--fs, 1));
  font-weight: 700;
  cursor: pointer;
}
.more-btn:active, .card-actions .read-more:active { opacity: 0.8; }

/* ---------- Card footer (feedback ⋯, later taste buttons) ---------- */
.card-foot { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 0; } /* padding holds the enlarged touch targets */
.foot-btn {
  appearance: none;
  position: relative;
  margin-left: auto;
  width: 36px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}
.foot-btn::after { content: ""; position: absolute; inset: -6px -4px; } /* 44px touch target */
.foot-btn svg { width: 18px; height: 18px; fill: currentColor; }
.feedback-btn.has-feedback { color: #ffd3a1; border-color: rgba(255, 179, 91, 0.5); }

/* ---------- Bottom sheet (feedback) ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(5, 5, 10, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(var(--safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0; font-size: 19px; }
.sheet-sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.sheet-text {
  font: inherit;
  font-size: 16px; /* 16px+ keeps iPhone from zooming in */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
.sheet-note { margin: 0; color: #ffd3a1; font-size: 14px; }
.sheet-note:empty { display: none; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sheet-actions button {
  appearance: none;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.sheet-cancel { background: transparent; color: var(--text); border: 1px solid var(--line); }
.sheet-send { background: var(--text); color: var(--bg); border: 0; }
.sheet-send:disabled { opacity: 0.6; }

/* ---------- Mijn likes: feedback panel ---------- */
.panel-sub { margin: 16px 0 8px; font-size: 15px; }
.panel .sheet-text { width: 100%; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-actions .button-secondary { margin-top: 10px; }
.fb-msg { margin: 10px 0 0; }
.fb-msg:empty { display: none; }
.fb-recent { margin-top: 12px; }
.voice-tip { margin: 12px 0 0; }
.voice-hint { margin: 8px 0 0; color: #ffd3a1; }
#voice-panel .button-secondary { margin-top: 10px; }

/* =========================================================
   Design experiments: 4 card styles (study cards + weetjes)
   --accent is set per course/onderwerp in app.js (themeOf).
   ========================================================= */
.card--study { --accent: var(--study); }
.card--study .pill {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: color-mix(in srgb, var(--accent) 65%, white);
}
.card--study .kicker { color: color-mix(in srgb, var(--accent) 80%, white); }

/* Swipe motion: the content of the card you land on slides in (whole block, so the fit check stays right). */
.card.is-current .card__inner { animation: card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Thin progress bar under the top bar. */
.progress-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 2px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.3s;
}
.progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  background: var(--accent, var(--study));
  transition: transform 0.45s ease, background 0.3s;
}
.progress-bar.is-hidden { opacity: 0; }

/* Short version + "Lees uitgebreider". */
.expand-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 80%, white);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Taste buttons in the footer. */
.taste { display: flex; gap: 8px; min-width: 0; }
.taste__group { display: flex; gap: 4px; }
.foot-btn.taste__btn {
  width: auto;
  margin-left: 0;
  padding: 0 10px;
  font: inherit;
  font-size: calc(12.5px * var(--fs, 1));
  font-weight: 600;
  white-space: nowrap;
}
.taste__btn::after { inset: -6px -2px; }
.taste__btn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- 1. TikTok: black, big bold headline, bright accent, stronger motion ---------- */
.card--study.style-tiktok { background: #000; }
.style-tiktok .card__inner { border-left: 4px solid var(--accent); padding-left: 14px; }
.style-tiktok h2 {
  font-size: calc(clamp(28px, 8.4vw, 38px) * var(--fs));
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.style-tiktok .pill { background: var(--accent); color: #000; }
.style-tiktok .kicker { color: var(--accent); }
.style-tiktok .quiz, .style-tiktok .mc { background: #111; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.style-tiktok.is-current .card__inner { animation: card-in-pop 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
@keyframes card-in-pop { from { opacity: 0; transform: translateY(44px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---------- 2. Premium: calm, refined type, soft colours, subtle glass ---------- */
.card--study.style-premium {
  background:
    radial-gradient(140% 70% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    linear-gradient(180deg, #121219, #0c0c12);
}
.style-premium h2 { font-weight: 600; letter-spacing: -0.015em; }
.style-premium .explanation { color: #c9c9d6; line-height: 1.6; }
.style-premium .kicker { letter-spacing: 0.14em; font-weight: 600; color: color-mix(in srgb, var(--accent) 70%, white); }
.style-premium .pill { background: rgba(255, 255, 255, 0.08); color: #e8e8f0; }
.style-premium .quiz, .style-premium .mc, .style-premium .voorbeeld, .style-premium .chart {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-radius: 22px;
}
.style-premium .voorbeeld { padding: 12px 14px; }

/* ---------- 3. Speels: every card its own bright colour, chunky buttons (Duolingo-like) ---------- */
.card--study.style-speels { background: var(--accent); }
.style-speels .meta, .style-speels .kicker, .style-speels h2, .style-speels .explanation,
.style-speels .voorbeeld p, .style-speels .voorbeeld__label, .style-speels .expand-btn,
.style-speels .review__status { color: #141414; }
.style-speels h2 { font-weight: 850; letter-spacing: -0.02em; }
.style-speels .pill { background: #141414; color: #fff; }
.style-speels .voorbeeld { border-left-color: #141414; }
.style-speels .quiz, .style-speels .mc {
  background: #fff;
  color: #141414;
  border: 2px solid #141414;
  border-bottom-width: 5px;
  border-radius: 20px;
}
.style-speels .quiz__label, .style-speels .quiz__question, .style-speels .quiz__answer,
.style-speels .quiz__hint, .style-speels .mc__feedback { color: #141414; }
.style-speels .quiz__answer strong, .style-speels .mc__feedback.is-right strong { color: #0a7a4a; }
.style-speels .mc__feedback strong { color: #c0262d; }
.style-speels .mc__option { background: #fff; color: #141414; border: 2px solid #d6d6d6; border-bottom-width: 4px; }
.style-speels .mc__letter { background: #eee; color: #141414; }
.style-speels .heart, .style-speels .speak { background: rgba(255, 255, 255, 0.4); border-color: rgba(0, 0, 0, 0.18); color: #141414; }
.style-speels .heart.is-liked { color: #d61f45; border-color: #d61f45; }
.style-speels .heart.is-liked svg { fill: #d61f45; stroke: #d61f45; }
.style-speels .review__btn { background: #fff; color: #141414; border: 2px solid #141414; border-bottom-width: 4px; }
.style-speels .foot-btn { background: rgba(255, 255, 255, 0.45); color: #141414; border-color: rgba(0, 0, 0, 0.2); }
.style-speels .taste__btn[aria-pressed="true"] { background: #141414; color: #fff; border-color: #141414; }
.style-speels .chart { background: #15151d; }
.style-speels .read-more { background: #141414; color: #fff; }
.style-speels .more-btn { background: #fff; color: #141414; border: 2px solid #141414; border-bottom-width: 4px; }

/* ---------- 4. Magazine: elegant serif headings, big emoji illustration ---------- */
.card--study.style-magazine { background: linear-gradient(180deg, #18140f, #0e0c0a); }
.style-magazine h2 {
  font-family: "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: calc(clamp(26px, 7.6vw, 34px) * var(--fs));
}
.style-magazine .explanation {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: calc(17px * var(--fs));
  line-height: 1.55;
  color: #ebe4da;
}
.style-magazine .kicker { border-top: 1px solid rgba(235, 228, 218, 0.2); padding-top: 8px; }
.style-magazine .pill { background: transparent; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.style-magazine .quiz, .style-magazine .mc { background: #1e1a15; border-color: rgba(235, 228, 218, 0.15); }
.hero {
  width: calc(92px * var(--fs));
  height: calc(92px * var(--fs));
  display: grid;
  place-items: center;
  font-size: calc(56px * var(--fs));
  line-height: 1;
  border-radius: 28px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  flex: none;
}

/* ---------- Mijn likes: Mijn smaak ---------- */
.taste-subject + .taste-subject { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.taste-subject__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.taste-lock {
  font: inherit;
  font-size: 16px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.taste-length { margin: 10px 0 0; }
/* Speels: kicker always dark on the bright background (beats the per-format kicker colours). */
.card.style-speels .kicker, .card.style-speels[data-format] .kicker { color: #141414; opacity: 0.8; }

/* =========================================================
   Chess puzzle cards
   ========================================================= */
.card--puzzle {
  --accent: #d6b25e;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(214, 178, 94, 0.16), transparent 65%),
    var(--bg);
}
.card--puzzle .pill { background: rgba(214, 178, 94, 0.2); color: #f2deae; }
.card--puzzle .kicker { color: #e8cf8f; }
.card--puzzle .card__inner { gap: calc(10px * var(--fs)); }
.puzzle-title { font-size: calc(22px * var(--fs)) !important; }
.puzzle-board {
  width: min(100%, 46vh);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  touch-action: pan-y; /* vertical swipes go to the feed; taps make moves */
}
.puzzle-board svg { display: block; }
.puzzle-status { margin: 0; min-height: 1.4em; font-size: calc(16px * var(--fs)); font-weight: 700; text-align: center; }
.puzzle-status[data-kind="good"] { color: var(--answer); }
.puzzle-status[data-kind="bad"] { color: #ff8a8a; }
.puzzle-status[data-kind="info"] { color: var(--muted); font-weight: 600; }
.puzzle-actions { justify-content: center; }
.puzzle-actions [hidden] { display: none; }
.puzzle-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.puzzle-rating { margin: 0; font-size: calc(14px * var(--fs)); color: var(--text); font-weight: 600; }
.delta { font-weight: 800; margin-left: 4px; }
.delta--up { color: var(--answer); }
.delta--down { color: #ff8a8a; }
.puzzle-credit { font-size: 12px; color: var(--muted); text-decoration: none; }

/* Mijn likes: puzzle rating chart */
.rating-chart { margin: 8px 0 0; }
.rating-chart svg { display: block; width: 100%; height: auto; }
.rating-chart figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }
.rc-grid { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.rc-tick { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.rc-line { fill: none; stroke: #d6b25e; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rc-dot { stroke: var(--surface); stroke-width: 1.5; }
.rc-win { fill: var(--answer); }
.rc-loss { fill: #ff6b6b; }
.rc-label { fill: var(--text); font-size: 11px; font-weight: 700; }
.puzzle-credit-note { margin: 10px 0 0; font-size: 12px; }

/* ---------- ⋯ next to the heart (card shows only ♥ and ⋯) ---------- */
.card-more {
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 28, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
}
.card-more svg { width: 20px; height: 20px; fill: currentColor; }
.card-more.has-feedback { color: #ffd3a1; border-color: rgba(255, 179, 91, 0.5); }
.style-speels .card-more { background: rgba(255, 255, 255, 0.4); border-color: rgba(0, 0, 0, 0.18); color: #141414; }

/* Menu sections */
.sheet-label { margin: 4px 0 -4px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sheet .taste { flex-wrap: wrap; gap: 8px; }
.sheet .taste__group { gap: 8px; }
.sheet-read { align-self: flex-start; }

/* Puzzle: ◀ / Terug naar nu / ▶ */
.puzzle-nav { display: flex; align-items: center; justify-content: center; gap: 10px; }
.puzzle-nav__btn, .puzzle-nav__now {
  appearance: none;
  min-width: 44px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.puzzle-nav__btn:disabled { opacity: 0.3; cursor: default; }
.puzzle-nav__now { color: #f2deae; border-color: rgba(214, 178, 94, 0.55); }
.puzzle-nav__now[hidden] { display: none; }
.card--puzzle.is-reviewing .puzzle-board { outline: 2px dashed rgba(214, 178, 94, 0.7); outline-offset: 3px; }
.puzzle-status.is-result { font-size: calc(22px * var(--fs)); }
.card--puzzle.puzzle-swap .puzzle-board { animation: puzzle-fade 0.35s ease-out both; } /* opacity only: keeps the fit check right */
@keyframes puzzle-fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-tools { gap: 8px; }
.sheet-claude { border-color: rgba(217, 119, 87, 0.6); color: #f4c6b4; }

/* =========================================================
   Speeltuin (playground.js): always its own dark panel, so it
   reads well in all 4 card styles (also the bright "speels").
   ========================================================= */
.pg {
  --pg-cs: #3987e5;   /* consumer surplus  (validated: blue/aqua/orange, all pairs, dark) */
  --pg-ps: #199e70;   /* producer surplus / profit */
  --pg-dwl: #d95926;  /* deadweight loss / loss */
  background: #16161f;
  color: #f4f4f7;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  text-shadow: none;
}
.pg.pg-pop { animation: puzzle-fade 0.4s ease-out; }
.pg button { font: inherit; color: inherit; }

/* Sliders: horizontal only, vertical swipes go to the feed. */
.pg-slider { display: flex; flex-direction: column; gap: 2px; }
.pg-slider__label { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pg-slider { touch-action: pan-y; } /* vertical: feed; horizontal: slider (see playground.js) */
.pg-range { width: 100%; height: 34px; margin: 0; accent-color: var(--accent, #8b7cff); touch-action: pan-y; }
@media (pointer: coarse) { .pg-range { pointer-events: none; } } /* touch goes through the wrapper */

.pg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-chip {
  appearance: none;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px !important;
  font-weight: 600;
  cursor: pointer;
}
.pg-chip[aria-pressed="true"] { background: #f4f4f7; color: #0b0b10 !important; border-color: #f4f4f7; }

/* Plots */
.pg-plot { width: 100%; height: auto; display: block; max-height: 25vh; }
.card.is-tight .pg-plot { max-height: 20vh; }
.pg-chips { flex-wrap: nowrap; }
.pg-chip { flex: 1 1 auto; padding: 0 6px; }
.pg-grid { stroke: rgba(255, 255, 255, 0.07); }
.pg-axis { stroke: rgba(255, 255, 255, 0.3); }
.pg-tick { fill: #a3a3b5; font-size: 10px; }
.pg-axislabel { fill: #a3a3b5; font-size: 11px; font-weight: 700; }
.pg-curve { fill: none; stroke: #e6e6ee; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-curve--b { stroke-dasharray: 7 4; }
.pg-curve--c { stroke-dasharray: 2 4; }
.pg-curve--shift { stroke: #a3a3b5; stroke-dasharray: 5 4; stroke-width: 1.5; }
.pg-curvelabel { fill: #f4f4f7; font-size: 11px; font-weight: 700; paint-order: stroke; stroke: #16161f; stroke-width: 3px; }
.pg-guide { stroke: #a3a3b5; stroke-width: 1.2; stroke-dasharray: 3 3; }
.pg-guidelabel { fill: #a3a3b5; font-size: 10px; font-weight: 700; }
.pg-point { fill: #f4f4f7; stroke: #16161f; stroke-width: 2; }
.pg-area { stroke-width: 1; }
.pg-area.pg-cs { fill: color-mix(in srgb, var(--pg-cs) 45%, transparent); stroke: var(--pg-cs); }
.pg-area.pg-ps { fill: color-mix(in srgb, var(--pg-ps) 45%, transparent); stroke: var(--pg-ps); }
.pg-area.pg-dwl { fill: color-mix(in srgb, var(--pg-dwl) 55%, transparent); stroke: var(--pg-dwl); }
.pg-area.pg-gov { stroke: #a3a3b5; }
.pg-hatch-bg { fill: rgba(163, 163, 181, 0.18); }
.pg-hatch-line { stroke: #a3a3b5; stroke-width: 1.5; }

.pg-info { display: flex; flex-direction: column; gap: 6px; }
.pg-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; margin: 0; }
.pg-stat dt { font-size: 11px; color: #a3a3b5; }
.pg-stat dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-stat--warn dd { color: #ffd3a1; }
.pg-stat--good dd { color: #3ddc97; }
.pg-stat--bad dd { color: #ff8a8a; }
.pg-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12.5px; }
.pg-legend li { display: flex; align-items: center; gap: 6px; }
.pg-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.pg-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.pg-swatch.pg-cs { background: var(--pg-cs); }
.pg-swatch.pg-ps { background: var(--pg-ps); }
.pg-swatch.pg-dwl { background: var(--pg-dwl); }
.pg-swatch.pg-gov { background: repeating-linear-gradient(45deg, #a3a3b5 0 2px, rgba(163, 163, 181, 0.2) 2px 5px); }
.pg-note, .pg-status { margin: 0; font-size: 13px; color: #a3a3b5; }
.pg-status--good { color: #3ddc97; }
.pg-status--warn { color: #ffd3a1; }
.pg-status--bad { color: #ff8a8a; }

/* Excel references */
.pg-head { display: flex; align-items: center; gap: 6px; }
.pg-title { flex: 1; font-weight: 700; font-size: 14px; text-align: center; }
.pg-nav {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.pg-text { margin: 0; font-size: 13px; line-height: 1.4; color: #cfcfdc; }
.pg-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #0b0b10;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
}
.pg-cellname { color: #a3a3b5; margin-right: 2px; }
.pg-eq, .pg-op { color: #e6e6ee; }
.pg-ref {
  appearance: none;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1.5px solid;
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit !important;
  font-weight: 700;
  cursor: pointer;
}
.pg-ref--0 { border-color: var(--pg-cs); color: #a9cdf6 !important; }
.pg-ref--1 { border-color: var(--pg-dwl); color: #f5b79c !important; }
.pg-note { font-family: -apple-system, sans-serif; font-size: 12px; }
.pg-gridwrap { position: relative; }
.pg-grid { display: grid; grid-template-columns: 24px repeat(5, 1fr); gap: 2px; }
.pg-corner, .pg-colhead, .pg-rowhead { font-size: 11px; color: #a3a3b5; text-align: center; align-self: center; }
.pg-cell {
  appearance: none;
  height: 30px;
  min-width: 0;
  padding: 0 3px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px !important;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.pg-cell.is-data { font-weight: 700; background: rgba(255, 255, 255, 0.08); }
.pg-cell.is-ok { background: rgba(61, 220, 151, 0.16); color: #bff3da !important; }
.pg-cell.is-wrong { background: rgba(255, 93, 93, 0.16); color: #ffc2c2 !important; }
.pg-cell.is-ref0 { box-shadow: inset 0 0 0 2px var(--pg-cs); }
.pg-cell.is-ref1 { box-shadow: inset 0 0 0 2px var(--pg-dwl); }
.pg-cell.is-source { border-style: dashed; border-color: #a3a3b5; }
.pg-cell.is-selected { outline: 2px solid #f4f4f7; outline-offset: 1px; }
.pg-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pg-arrow { stroke-width: 2; }
.pg-arrow--0 { stroke: var(--pg-cs); fill: var(--pg-cs); }
.pg-arrow--1 { stroke: var(--pg-dwl); fill: var(--pg-dwl); }
.pg-arrowhead.pg-arrow--0 { fill: var(--pg-cs); stroke: none; }
.pg-arrowhead.pg-arrow--1 { fill: var(--pg-dwl); stroke: none; }
.pg-feedback { margin: 0; font-size: 13.5px; font-weight: 700; }
.pg-feedback.is-good { color: #3ddc97; }
.pg-feedback.is-bad { color: #ff9a9a; }

/* Excel speeltuin: compact so the card text stays readable */
.pg-excel { gap: 6px; padding: 8px; }
.pg-excel .pg-cell { height: 27px; }
.pg-excel .pg-text { font-size: 12.5px; line-height: 1.35; }
.pg-excel .pg-formula { padding: 4px 8px; font-size: 14px; }
.pg-excel .pg-ref { min-height: 30px; }
.pg-excel .pg-nav { width: 34px; height: 34px; }

.pg-legend { font-size: 12px; }
.pg-legend span { white-space: nowrap; }
.pg-legend-title { margin: 0; font-size: 11px; color: #a3a3b5; }

/* Netlify shows a "Powered by Netlify" badge bottom-right on free projects:
   keep the buttons at the bottom of menus and pages clear of it. */
:root { --badge-space: 0px; } /* was 64px for the Netlify badge; Cloudflare has none */
.sheet { padding-bottom: calc(var(--safe-bottom) + 16px + var(--badge-space)); }
.page-wrap { padding-bottom: calc(var(--safe-bottom) + 40px + var(--badge-space)); }
