:root {
  --me: #4f7cff;
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1d2233;
  --muted: #6b7288;
  --line: #e3e6ef;
  --ok: #16a37f;
  --ok-bg: #e5f6f0;
  --bad: #d64545;
  --bad-bg: #fcebeb;
  --warn: #c27c0e;
  --soft: color-mix(in srgb, var(--me) 12%, var(--card));
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --card: #1c1f2a;
    --text: #e8eaf2;
    --muted: #9aa1b5;
    --line: #2d3140;
    --ok-bg: #133229;
    --bad-bg: #3a1c1f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; }
h1 { font-size: 1.6rem; margin: 8px 0 12px; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 24px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
a { color: var(--me); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.warn { color: var(--warn); font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.gap, .col.gap { gap: 10px; }
.col { display: flex; flex-direction: column; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between h1, .row-between h2 { margin-bottom: 8px; }

/* header */
header.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
header nav { display: flex; gap: 4px; overflow-x: auto; }
header nav a {
  text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 99px;
  white-space: nowrap; font-size: .95rem;
}
header nav a.on { background: var(--soft); color: var(--me); font-weight: 600; }
@media (max-width: 480px) { .brand { font-size: 0; } .brand::first-letter { font-size: 1.3rem; } }

/* cards & buttons */
.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin: 10px 0;
  color: inherit; text-decoration: none;
}
a.card:hover { border-color: var(--me); }
.card.empty { color: var(--muted); }
.card.highlight { background: var(--soft); border-color: var(--me); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--me); }
.btn.primary { background: var(--me); border-color: var(--me); color: #fff; }
.btn.primary:disabled { opacity: .5; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.symbols { margin: 6px 0 10px; }
.tip { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--muted); font-weight: 700; cursor: help; user-select: none; }
.tip-bubble { display: none; position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%); width: max-content; max-width: min(300px, 80vw);
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-weight: 400; font-size: .9rem; line-height: 1.5;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); z-index: 10; }
.tip-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--line); }
.tip:hover .tip-bubble, .symbols:has([data-sym]:hover) .tip-bubble, .tip:focus .tip-bubble, .tip:focus-within .tip-bubble { display: block; }
.btn.wide { width: 100%; }
.btn.link { background: none; border: none; color: var(--me); padding: 6px; }
.btn.danger { color: var(--bad); }
.big-btn { padding: 16px; font-size: 1.05rem; }
.icon-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px; }
.back { display: inline-block; margin: 4px 0; text-decoration: none; font-size: .95rem; }
.danger-zone { margin-top: 32px; text-align: center; }
.flash {
  background: #fff6dd; color: #6b4b00; border: 1px solid #f0d58a;
  padding: 10px 14px; border-radius: 10px; margin: 8px 0;
}
@media (prefers-color-scheme: dark) { .flash { background: #3a3014; color: #f3dc9a; border-color: #5d4c1c; } }

.tag {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px;
  border-radius: 99px; background: var(--soft); color: var(--me); vertical-align: middle;
}
.tag.late { background: #fff1d6; color: var(--warn); }
.tag.huiswerk { background: #ece6fb; color: #7048c9; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .8rem; }
.pill { font-size: .8rem; padding: 2px 10px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: #fff1d6; color: var(--warn); }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
.form label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--bg); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type=checkbox], input[type=radio], input[type=range] { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--me); outline-offset: -1px; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details textarea { margin-top: 8px; }
.add summary { color: var(--me); }
.add[open] summary { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; border: 1px solid var(--line); }
.seg label { flex: 1; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.seg input:checked + span { background: var(--card); color: var(--me); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* login */
.login { max-width: 400px; margin: 10vh auto 0; text-align: center; }
.login .card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.who { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.who-btn input { display: none; }
.who-btn span {
  display: block; padding: 12px 20px; border-radius: 12px; border: 2px solid var(--line);
  font-weight: 700; cursor: pointer; min-width: 100px;
}
.who-btn input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }

/* home */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hello h1 { margin-bottom: 0; }
.hello p { margin: 4px 0 0; }
.streak {
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; font-size: 1.1rem;
}
.streak b { font-size: 1.5rem; }
.streak small { color: var(--muted); font-size: .75rem; }
.small-streak { flex-direction: row; gap: 6px; padding: 4px 10px; font-size: .9rem; }
.week { display: flex; gap: 6px; margin: 14px 0; }
.week .day {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: .75rem; color: var(--muted);
}
.week .day i { width: 100%; max-width: 40px; height: 8px; border-radius: 99px; background: var(--line); }
.week .day.active i { background: var(--me); }
.week .day.today span { font-weight: 700; color: var(--text); }
.parent-week .day i { height: calc(6px + var(--h) * 0.8px); background: var(--line); border-radius: 6px; }
.parent-week .day.active i { background: var(--c); }
.parent-week .day small { min-height: 1em; }

.tasks { list-style: none; padding: 0; margin: 0; }
.task {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 8px 0;
}
.task.is-today { border-color: var(--me); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task.done .task-method { display: none; }
.task-title { font-weight: 600; }
.task-method { font-size: .92rem; margin: 2px 0; }
.check input { display: none; }
.check span {
  display: block; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line);
  cursor: pointer; margin-top: 2px; transition: .15s;
}
.check input:checked + span { background: var(--ok); border-color: var(--ok); }
.check input:checked + span::after { content: "✓"; color: #fff; display: block; text-align: center; font-weight: 800; line-height: 24px; }
.check input:disabled + span { cursor: default; }
.cheer {
  position: absolute; right: 12px; top: -10px; background: var(--ok); color: #fff;
  padding: 3px 10px; border-radius: 99px; font-size: .85rem; font-weight: 700;
  animation: pop 1.6s ease forwards;
}
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 15% { transform: scale(1.05); opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0; transform: translateY(-10px) } }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 6px; text-decoration: none; color: var(--text); font: inherit; font-weight: 600;
  font-size: .9rem; cursor: pointer;
}
.action span { font-size: 1.6rem; }
.action:hover { border-color: var(--me); }

.test-row { display: flex; align-items: center; gap: 14px; }
.test-row.past { opacity: .85; }
.when {
  display: flex; flex-direction: column; align-items: center; min-width: 46px;
  background: var(--soft); border-radius: 10px; padding: 4px; line-height: 1.1;
}
.when b { font-size: 1.3rem; color: var(--me); }
.when small { font-size: .7rem; color: var(--muted); }
.grade { font-size: 1.2rem; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; background: var(--me); border-radius: 99px; transition: width .3s; }
.bar.big { height: 12px; }
.leertip { background: var(--soft); border-color: transparent; }
.tip-label { font-size: .8rem; font-weight: 700; color: var(--me); text-transform: uppercase; letter-spacing: .04em; }
.leertip p { margin: 4px 0 0; }
.tip-inline { background: var(--soft); padding: 10px 12px; border-radius: 10px; }

/* photos */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* page / reader */
.summary ul { margin: 0; padding-left: 20px; }
.summary h2 { margin-top: 0; }
.text p { margin: 0 0 12px; font-size: 1.05rem; line-height: 1.65; }
.text p.reading { background: color-mix(in srgb, #ffd54a 35%, transparent); border-radius: 6px; box-shadow: 0 0 0 6px color-mix(in srgb, #ffd54a 35%, transparent); }
.reader-bar { position: sticky; top: 60px; z-index: 4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* quiz */
.quiz { padding: 18px; }
.quiz-title { font-size: 1.2rem; }
.quiz-progress { display: flex; align-items: center; gap: 10px; }
.quiz-progress .bar { flex: 1; }
.q-head { display: flex; gap: 8px; align-items: flex-start; }
.q-text { flex: 1; font-size: 1.15rem; font-weight: 600; margin: 0 0 14px; }
.q-body { display: flex; flex-direction: column; gap: 8px; }
.choice {
  font: inherit; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--me); }
.choice.right { border-color: var(--ok); background: var(--ok-bg); }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.q-feedback { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--soft); }
.q-feedback.ok { background: var(--ok-bg); }
.q-feedback.bad { background: var(--bad-bg); }
.q-feedback p { margin: 6px 0 0; }
.q-foot { margin-top: 14px; }
.retry-note { font-size: .85rem; color: var(--warn); font-weight: 600; margin-bottom: 8px; }

.score-ring {
  --p: 0; width: 110px; height: 110px; margin: 8px auto; border-radius: 50%;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center;
}
.score-ring b {
  width: 86px; height: 86px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; font-size: 1.4rem;
}
.feedback ul { padding-left: 20px; margin: 4px 0; }
.how ol { padding-left: 20px; }

/* parent */
.kids { display: grid; gap: 14px; }
.kid { border-top: 5px solid var(--c); }
.kid h2 { margin: 0; }
.kid h3 { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.stats b { font-size: 1.3rem; }
.stats small { color: var(--muted); font-size: .75rem; line-height: 1.2; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.test-mini { text-decoration: none; color: inherit; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.acc { font-size: .9rem; margin: 4px 0; }
.acc-label { width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .bar { margin: 0; }
.acc .bar i { background: var(--c); }
.activity { list-style: none; padding: 0; margin: 6px 0; font-size: .9rem; }
.activity li { padding: 3px 0; }

/* busy overlay */
#busy {
  position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px;
}
#busy[hidden] { display: none; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%; border: 5px solid var(--line);
  border-top-color: var(--me); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
header nav { scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
@media (max-width: 480px) {
  header.top { padding: 8px 10px; }
  header nav a { padding: 6px 8px; }
}
.when.now b { font-size: .95rem; }
[hidden] { display: none !important; }

/* streak extras */
.streak-box { display: flex; align-items: center; gap: 8px; }
.streak-extras { display: flex; flex-direction: column; gap: 2px; font-size: .9rem; white-space: nowrap; }
.streak-extras small { color: var(--muted); }
.confidence { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.task.done .task-title a { color: var(--muted); }
.review-row { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.form .weekday-picks label { flex-direction: row; align-items: center; font-weight: 400; gap: 4px; }

/* rekensolitaire */
.game-locked { padding: 28px 20px; }
.big-emoji { font-size: 3rem; line-height: 1.2; }
.game {
  --felt: #2f8a52; --card-h: 84px; --pick: #ffd54a;
  position: relative; background: var(--felt); border-radius: var(--radius); padding: 12px 10px 16px; color: #fff;
}
@media (prefers-color-scheme: dark) { .game { --felt: #1f5e39; } }
.game-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; white-space: nowrap; }
.game-bar .pill { background: rgba(0,0,0,.25); color: #fff; }
#g-undo { margin-left: auto; min-width: 40px; }
#g-undo:disabled { opacity: .45; cursor: default; }
.game .how { color: var(--text); margin-top: 14px; }
.game .how ul { padding-left: 20px; margin: 6px 0 0; }
.g-top { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: center; }
.g-level { grid-column: 3 / 6; text-align: right; opacity: .85; }
.g-slot { position: relative; height: var(--card-h); cursor: pointer; }
.g-card {
  position: absolute; left: 0; right: 0; height: var(--card-h); border-radius: 8px;
  background: #fff; color: #1d2233; border: 1px solid rgba(0,0,0,.18); box-shadow: 0 1px 3px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; padding: 6px 3px 0; text-align: center;
  font-weight: 800; font-size: 1.05rem; line-height: 1.15; cursor: pointer; user-select: none; overflow: hidden;
}
.g-card.top { justify-content: center; padding-top: 0; }
.g-card.top .g-ask { position: absolute; bottom: 0; }
.g-card.mid { font-size: .9rem; }
.g-card.long { font-size: .78rem; }
.g-card.xl { font-size: .68rem; }
.g-expr { overflow-wrap: anywhere; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; line-height: 1; font-size: .9em; }
.fr span:first-child { border-bottom: 2px solid currentColor; padding: 0 1px 1px; }
.fr span:last-child { padding-top: 1px; }
.g-ask { margin-top: auto; padding-bottom: 6px; font-size: .7rem; color: #7048c9; }
.g-card.back {
  background: repeating-linear-gradient(45deg, #5b8def 0 8px, #6d9cf5 8px 16px); border-color: #fff; cursor: default;
}
.g-slot .g-card.back { cursor: pointer; }
.g-card.empty { background: rgba(0,0,0,.15); border: 2px dashed rgba(255,255,255,.4); box-shadow: none;
  color: #fff; font-size: 1.6rem; justify-content: center; padding: 0; }
.g-card.sel { outline: 3px solid var(--pick); outline-offset: 1px; transform: translateY(-3px); }
.g-foundations { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.g-found {
  font: inherit; height: 70px; border-radius: 10px; border: 2px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.g-found b { font-size: 1.6rem; line-height: 1; }
.g-count { font-size: .75rem; font-weight: 700; background: rgba(0,0,0,.25); border-radius: 99px; padding: 0 8px; }
.g-found.target { border-color: var(--pick); background: rgba(255,213,74,.18); }
.g-found.open { border-style: dashed; background: rgba(0,0,0,.12); opacity: .85; }
.g-found.open.target { opacity: 1; }
.g-card.goal { justify-content: center; padding: 0; color: #7048c9; border: 2px solid #b59cf0; }
.g-card.goal b { font-size: 1.7em; line-height: 1; }
.g-need { font-size: .62rem; font-weight: 700; margin-top: 4px; }
.g-card.goal:not(.top) { justify-content: flex-start; padding-top: 4px; }
.g-card.goal:not(.top) b { font-size: 1.1em; }
.g-next { margin: 6px 0 10px; text-align: center; opacity: .85; min-height: 1.3em; }
.g-columns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: start; }
.g-col { position: relative; min-height: var(--card-h); border-radius: 8px; background: rgba(0,0,0,.1); }
.g-col.target { box-shadow: inset 0 0 0 2px rgba(255,213,74,.6); cursor: pointer; }
.g-msg { min-height: 1.5em; margin: 12px 0 0; text-align: center; font-weight: 700; }
.g-msg.bad { color: #ffe0e0; }
.g-msg.ok { color: var(--pick); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px) } 50% { transform: translateX(6px) } 75% { transform: translateX(-3px) } }
.g-over { position: absolute; inset: 0; z-index: 3; background: rgba(0,0,0,.45); border-radius: var(--radius);
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; }
.g-over .card { color: var(--text); max-width: 340px; width: 100%; }
.g-stars { font-size: 2rem; margin: 4px 0; }
@media (min-width: 560px) { .game { --card-h: 100px; } .g-card { font-size: 1.3rem; } .g-card.mid { font-size: 1.1rem; }
  .g-card.long { font-size: .95rem; } .g-card.xl { font-size: .82rem; } }

/* toetskaart: two cards on one A4, to cut in half */
.cards { display: grid; gap: 14px; }
.toetskaart { border: 2px solid var(--text); border-radius: 12px; padding: 16px 20px; background: var(--card); }
.toetskaart h2 { margin: 0 0 10px; font-size: 1.3rem; }
.toetskaart ol { margin: 0; padding-left: 24px; }
.toetskaart li { margin: 0 0 10px; }
.toetskaart .words { font-size: .9rem; color: var(--muted); }
@media print {
  @page { size: A4; margin: 12mm; }
  :root { --text: #000; --muted: #333; --card: #fff; --bg: #fff; color-scheme: light; }
  header.top, .no-print, #busy { display: none !important; }
  main { max-width: none; padding: 0; }
  .cards { gap: 16mm; }
  .toetskaart { break-inside: avoid; min-height: 118mm; font-size: 14pt; }
}
