/* LetterLezer web (base copied from Rekenclub web) — visual style matches tafelvierkant.be (bijleren.eu family):
   Fredoka for headings/buttons, Nunito for body, cream background with a faint
   gold hexagon pattern, white cards with a warm border, solid gold buttons. */

:root {
  --gold: #946B29;
  --gold-mid: #C79A4E;       /* active pill border */
  --gold-soft: #F3E9D6;      /* active pill / highlight fill */
  --gold-light: #FBF3E3;
  --cream: #FAF6EE;
  --surface: #FFFFFF;
  --surface-2: #FFFDF8;
  --text: #2F2A22;
  --muted: #756A58;
  --line: #E8DDC8;
  --success: #2E9E4F;
  --success-soft: #D6F0D6;
  --danger: #C0392B;
  --danger-soft: #F7D9D2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-btn: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --gold-grad: #946B29;
  --on-gold: #fff;
  --radius: 16px;
  --radius-lg: 16px;
  --display: Fredoka, Nunito, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Nunito, -apple-system, system-ui, sans-serif;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
.hex-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23946B29' stroke-width='1.5'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%23946B29' stroke-width='1.5'/%3E%3C/svg%3E");
}
h1, h2, h3, .display, dialog h2, .op-card b, .step-label b, .ws-items input, .ws-items .op, .review-list .res, .btn, .validate, .key, .typed, .question, .goal-pill, .top-chip, .done-card h2, .done-stats b, .op-card span, .tile b { font-family: var(--display); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold-mid); outline-offset: 2px; }
[hidden] { display: none !important; }

.ic { width: 1.1em; height: 1.1em; flex: none; }
svg.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; }

/* ---------- Top nav (as on tafelvierkant.be) ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 10; height: 66px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin-right: 4px; }
.brand img { height: 26px; width: auto; display: block; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; }
.nav-links { display: flex; gap: 8px; flex: 1; }
.nav-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.nav-pill:hover { background: var(--gold-light); }
.nav-pill.on { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-mid); }
@media (max-width: 640px) {
  .brand img { display: none; }
  .nav-pill span { display: none; }
  .site-nav { padding: 0 12px; }
}

/* ---------- Layout ---------- */
.screen { max-width: 1240px; margin: 0 auto; padding: 16px 16px 40px; min-height: calc(100vh - 66px); }
.screen.narrow { max-width: 720px; }
.screen.center { display: grid; place-items: center; }

.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 52px; margin-bottom: 8px; }
.top-center { display: flex; justify-content: center; min-width: 0; }
.top-right { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.screen-title { text-align: center; margin: 4px 0 18px; }
.screen-title h1 { font-size: clamp(28px, 4.5vw, 40px); font-weight: 700; margin: 0; }
.screen-title p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.circle-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted);
}
.circle-btn.small { width: 36px; height: 36px; box-shadow: none; }
.circle-btn .ic { width: 22px; height: 22px; }
.circle-btn.small .ic { width: 18px; height: 18px; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 15px;
}
.top-chip, .goal-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: #fff;
  border: 1px solid var(--line); font-weight: 600; font-size: 17px; white-space: nowrap;
}
.top-chip { border: 2px solid var(--accent, var(--line)); }
.goal-pill .ic { color: var(--success); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: var(--radius); border: 1px solid var(--line); font-weight: 600; font-size: 18px; text-decoration: none;
}
.btn.primary { background: var(--gold); color: #fff; border: none; box-shadow: var(--shadow-btn); }
.btn.primary:hover { background: #825D22; }
.btn.secondary { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.btn.secondary:hover { background: var(--gold-light); }
.btn.big { min-height: 56px; font-size: 18px; padding: 0 32px; }
.setup > .btn.big { width: 100%; margin-top: 8px; }
.row-actions { display: flex; gap: 10px; margin-top: 12px; }
.row-actions .btn { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-weight: 700; font-size: 15px; min-height: 40px;
}
.chip.on { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-mid); }
.op-sym { font-family: var(--display); font-weight: 600; font-size: 1.15em; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.warn { color: var(--danger); font-weight: 700; margin: 8px 0 0; }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--gold-light); border-top-color: var(--gold); animation: spin 0.9s linear infinite; margin: auto; }
.spinner.big { width: 52px; height: 52px; border-width: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: 0.25s;
  background: var(--text); color: var(--cream); padding: 12px 18px; border-radius: 14px; font-weight: 700; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.switch { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-weight: 700; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 28px; text-align: center; color: var(--muted); font-weight: 700; }
.empty .ic { width: 44px; height: 44px; color: var(--gold); }

/* ---------- Home ---------- */
.home-hero { text-align: center; margin: 28px auto 26px; max-width: 760px; }
.hero-logo { height: 62px; width: auto; }
.home-hero h1.display { font-size: clamp(44px, 8vw, 64px); font-weight: 700; margin: 10px 0 8px; letter-spacing: -0.01em; }
.tagline { font-size: clamp(17px, 2.2vw, 21px); color: var(--muted); margin: 0 auto; max-width: 600px; line-height: 1.4; }
.tagline strong { color: var(--gold); font-weight: 700; }
.range-card { max-width: 860px; margin: 0 auto 22px; padding: 20px; text-align: center; }
.range-card h2 { font-size: 24px; font-weight: 600; margin: 0 0 10px; }
.range-label { font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.range-chips { justify-content: center; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mode-card {
  display: flex; align-items: center; gap: 16px; padding: 20px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.mode-card:hover { transform: translateY(-2px); border-color: var(--gold-mid); box-shadow: var(--shadow-btn); }
.mode-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--gold-soft); color: var(--gold); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.mode-icon .ic { width: 30px; height: 30px; }
.mode-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.mode-text b { font-family: var(--display); font-size: 20px; font-weight: 600; }
.mode-text small { color: var(--muted); font-weight: 600; font-size: 15px; }
.mode-card .chev { color: var(--gold); }
.home-foot { text-align: center; color: var(--muted); font-weight: 600; margin-top: 28px; font-size: 14px; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: grid; place-items: center; padding: 16px; z-index: 20; }
.done-card { width: min(460px, 100%); padding: 26px; text-align: center; max-height: calc(100vh - 32px); overflow: auto; }
.done-badge { width: 72px; height: 72px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-mid); display: grid; place-items: center; margin: 0 auto; }
.done-badge .ic { width: 38px; height: 38px; }
.done-card h2 { font-size: 32px; font-weight: 700; margin: 12px 0; }
.done-stats { display: flex; justify-content: center; gap: 30px; margin-bottom: 12px; }
.done-stats div { display: grid; }
.done-stats b { font-size: 28px; font-weight: 600; }
.done-stats span { color: var(--muted); font-weight: 700; }
.done-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.done-list li { background: var(--success-soft); border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 15px; }
.done-actions { display: flex; gap: 10px; }
.done-actions .btn { flex: 1; }
@keyframes pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { opacity: 0.35; } }
