/* Verenas Heilung — richting A, Morgenlicht. Kleuren staan bovenaan, zodat een andere richting snel te zetten is. */
@font-face { font-family: 'Lora'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/lora-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/lora-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/source-sans-3-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/source-sans-3-latin-600-normal.woff2') format('woff2'); }

:root {
  --ground: #FBF3EA;
  --card: #FFFFFF;
  --ink: #3A2A33;
  --muted: #6B5560;
  --accent: #9B3554;
  --accent-ink: #FFFFFF;
  --soft: #F4E4DA;
  --line: #EAD9CE;
  --edge: #A8897B;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', -apple-system, 'Segoe UI', Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Opbouw: één kolom, op een groot scherm in het midden. */
.app { min-height: 100dvh; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  background: var(--ground);
}
.brand { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.2; white-space: nowrap; }
.topbar-actions { display: flex; gap: 4px; align-items: center; flex: none; }

.btn {
  min-height: 48px; padding: 0 20px; border-radius: 24px; border: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--edge); }
.btn.quiet { background: transparent; color: var(--accent); padding: 0 12px; }
.btn.block { width: 100%; }
.pill {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--edge);
  background: transparent; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; padding: 4px 18px 18px; min-height: 0; }

/* Navigatie onderaan */
.tabs {
  position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  padding: 8px 12px calc(10px + var(--safe-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.tab {
  min-height: 56px; border: none; border-radius: 16px; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tab[aria-current="page"] { background: var(--soft); color: var(--accent); }

/* Eerste stappen, pincode */
.gate { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom)); max-width: 460px; margin: 0 auto; width: 100%; }
.gate h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.25; }
.gate p { margin: 0; }
.gate .muted { color: var(--muted); font-size: 16px; }
.field { width: 100%; min-height: 56px; padding: 0 18px; border: 1px solid var(--edge); border-radius: 16px; background: var(--card); font-size: 22px; letter-spacing: 2px; text-transform: uppercase; text-align: center; }
.error { color: #8A1F3C; font-weight: 600; font-size: 16px; min-height: 24px; }
.notice { padding: 14px 16px; border-radius: 16px; background: var(--soft); font-size: 16px; }

.letter-card.consent { padding: 20px; border-radius: 20px; background: var(--card); box-shadow: 0 1px 2px rgba(58, 42, 51, .1); }
.consent h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: 22px; }
.consent ul { margin: 8px 0 0; padding-left: 20px; }
.consent li { margin: 6px 0; }
.signature { margin: 12px 0 0; font-family: var(--serif); font-weight: 600; }
.icon.bold { stroke-width: 2; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.dots { display: flex; justify-content: center; gap: 18px; margin: 4px 0; }
.dot { width: 18px; height: 18px; border-radius: 9px; border: 2px solid var(--accent); }
.dot.filled { background: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 320px; margin: 0 auto; width: 100%; }
.key {
  height: 68px; border-radius: 34px; border: 1px solid var(--line); background: var(--card);
  font-size: 28px; font-weight: 600; font-family: var(--sans);
}
.key:active { background: var(--soft); }
.key.ghost { background: transparent; border-color: transparent; font-size: 16px; color: var(--muted); }

/* Brieven */
.section-title { margin: 6px 0 14px; font-family: var(--serif); font-weight: 600; font-size: 22px; }
.letters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.letter-item {
  width: 100%; text-align: left; padding: 16px 18px; border: none; border-radius: 20px;
  background: var(--card); box-shadow: 0 1px 2px rgba(58, 42, 51, .1);
  display: flex; flex-direction: column; gap: 4px;
}
.letter-item .date { font-size: 14px; font-weight: 600; color: var(--accent); }
.letter-item .title { font-family: var(--serif); font-weight: 600; font-size: 19px; line-height: 1.3; }
.letter-item .preview { font-size: 16px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { color: var(--muted); padding: 24px 4px; }

.letter { background: var(--card); border-radius: 20px; padding: 22px 20px; box-shadow: 0 1px 2px rgba(58, 42, 51, .1); }
.letter .date { font-size: 14px; font-weight: 600; color: var(--accent); }
.letter h2.letter-title { margin: 4px 0 16px; font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.25; }
.prose p { margin: 0 0 14px; }
.prose h2, .prose h3, .prose h4 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 22px 0 8px; line-height: 1.3; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose blockquote { margin: 0 0 14px; padding: 12px 16px; border-radius: 14px; background: var(--soft); font-style: italic; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.prose a { word-break: break-word; }
.back { align-self: flex-start; margin: 0 0 10px -8px; }

/* Gesprek */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 4px 0 12px; }
.bubble { max-width: 88%; padding: 12px 16px; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble.claudius { align-self: flex-start; background: var(--card); border-radius: 20px 20px 20px 6px; box-shadow: 0 1px 2px rgba(58, 42, 51, .1); }
.bubble.verena { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-radius: 20px 20px 6px 20px; white-space: pre-wrap; }
.bubble.claudius p:last-child, .bubble.claudius ul:last-child, .bubble.claudius ol:last-child { margin-bottom: 0; }
.bubble.thinking { color: var(--muted); font-style: italic; }
.bubble.streaming { white-space: pre-wrap; }
.day { align-self: center; font-size: 14px; color: var(--muted); padding: 6px 0 2px; }
.helpcard { align-self: stretch; padding: 14px 16px; border-radius: 18px; background: var(--soft); font-size: 16px; display: flex; flex-direction: column; gap: 8px; }
.helpcard strong { font-size: 16px; }
.helpcard .row { display: flex; flex-wrap: wrap; gap: 8px; }
.helpcard a { text-decoration: none; }

.composer {
  position: sticky; bottom: calc(76px + var(--safe-bottom)); z-index: 4;
  display: flex; align-items: flex-end; gap: 10px; padding: 10px 0 12px; background: var(--ground);
}
.composer textarea {
  flex: 1; min-width: 0; min-height: 48px; max-height: 160px; resize: none;
  padding: 11px 18px; border: 1px solid var(--edge); border-radius: 24px; background: var(--card);
  font-size: 17px; line-height: 1.45;
}
.send {
  flex: none; width: 48px; height: 48px; border-radius: 24px; border: none; background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.send:disabled { opacity: .5; }

/* Dialogen */
dialog {
  border: none; border-radius: 24px; padding: 22px 20px; width: min(92vw, 420px);
  background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(58, 42, 51, .25);
}
dialog::backdrop { background: rgba(58, 42, 51, .35); }
dialog h2 { margin: 0 0 12px; font-family: var(--serif); font-weight: 600; font-size: 22px; }
dialog p { margin: 0 0 12px; }
.help-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help-list a {
  display: flex; flex-direction: column; padding: 12px 16px; border-radius: 16px; background: var(--soft);
  color: var(--ink); text-decoration: none;
}
.help-list a strong { font-size: 18px; }
.help-list a span { font-size: 15px; color: var(--muted); }
.menu-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.menu-list button { width: 100%; text-align: left; min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 17px; }

@media (min-width: 700px) {
  body { font-size: 19px; }
  .composer { bottom: 84px; }
}
