/* Codekraker: tablet-first. Touch targets >= 44px, nothing depends on hover. System fonts only (no external fonts). */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6677;
    --border: #d9dde7;
    --primary: #2f5bd3;
    --primary-text: #ffffff;
    --good: #1f8a4c;
    --good-bg: #e3f5ea;
    --bad: #b3261e;
    --bad-bg: #fdecea;
    --warn-bg: #fff4d6;
    --lvl-none: #e6e8ee;
    --lvl-bezig: #ffd8a8;
    --lvl-bijna: #c9ecb4;
    --lvl-beheerst: #6cc28a;
    --radius: 12px;
    --tap: 48px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    line-height: 1.45;
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
h1:focus { outline: none; }
a { color: var(--primary); }

/* --- Layout --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: .5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--text); min-height: var(--tap); display: flex; align-items: center; }
.parent-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.parent-nav a, .parent-nav .link-button {
    min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 .75rem;
    border-radius: 8px; text-decoration: none; color: var(--text);
}
.parent-nav a.active { background: var(--bg); font-weight: 600; }
.parent-nav form { margin: 0; }

.page { max-width: 760px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-wide { max-width: 1100px; }

/* --- Buttons and inputs --- */
.btn, .link-button {
    font: inherit;
    cursor: pointer;
}
.btn {
    min-height: var(--tap);
    min-width: var(--tap);
    padding: .5rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    text-decoration: none;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-big { font-size: 1.2rem; padding: .75rem 2rem; min-height: 60px; }
.btn-good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.btn-bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

.input {
    font: inherit;
    font-size: 1.25rem;
    min-height: 56px;
    width: 100%;
    padding: .5rem .9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); }
textarea.input { font-size: 1rem; min-height: 80px; }
select.input { font-size: 1rem; }
label.field { display: block; margin: .75rem 0; }
label.field > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.muted { color: var(--muted); }
.error-text { color: var(--bad); }

/* --- Home: profile choice --- */
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.profile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
    min-height: 160px; padding: 1rem; text-decoration: none; color: var(--text);
    background: var(--surface); border: 2px solid var(--border); border-radius: 20px; font-size: 1.4rem; font-weight: 700;
}
.profile .avatar { font-size: 3rem; }
.profile small { font-size: .9rem; font-weight: 400; color: var(--muted); }

/* --- Mastery map --- */
.module { margin-bottom: 1.25rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.tile { border-radius: var(--radius); padding: .7rem .8rem; min-height: 84px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid rgba(0,0,0,.06); }
.tile .name { font-weight: 600; font-size: .95rem; }
.tile .level { font-size: .85rem; }
.lvl-NogNietGeoefend { background: var(--lvl-none); }
.lvl-Bezig { background: var(--lvl-bezig); }
.lvl-Bijna { background: var(--lvl-bijna); }
.lvl-Beheerst { background: var(--lvl-beheerst); }
.legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .85rem; margin: .5rem 0 1rem; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: .3rem; vertical-align: -2px; background: var(--swatch); }
.start-box { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; margin-bottom: 1.5rem; }

/* --- Session --- */
.session-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.progress { flex: 1; height: 14px; background: var(--lvl-none); border-radius: 7px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.progress-label { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.badge { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 6px; background: var(--warn-bg); }
.module-label { font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }
.tense-tag { margin-left: .5rem; color: var(--text); }
.prompt { font-size: 1.45rem; font-weight: 500; margin: .25rem 0 1rem; }
.blank { display: inline-block; min-width: 3.5em; border-bottom: 3px solid var(--primary); }
.answer-form { display: flex; gap: .75rem; }
.answer-form .input { flex: 1; }
.correct-banner { margin-top: 1rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--good-bg); color: var(--good); font-weight: 700; font-size: 1.2rem; }

.feedback { margin-top: 1rem; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--bad); padding: 1rem 1.1rem; }
.feedback .verdict { margin: 0 0 .75rem; }
.steps { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.step { padding: .55rem .8rem; border-radius: 10px; background: var(--bg); }
.step .step-title { font-weight: 700; display: block; font-size: .95rem; }
.step.wrong { background: var(--bad-bg); outline: 2px solid var(--bad); }
.step .wrong-label { font-size: .8rem; color: var(--bad); font-weight: 700; margin-left: .4rem; }
.retype-error { color: var(--bad); margin: .5rem 0 0; }

/* Item inputs (Components/Inputs) */
.instruction { font-size: 1.1rem; margin: .25rem 0 .5rem; }
.words { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.word {
    font: inherit; font-size: 1.25rem; min-height: var(--tap); min-width: var(--tap); padding: .3rem .8rem;
    border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.word.selected { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.label-buttons .btn { min-width: 120px; }
.label-buttons small, .choice small { display: block; font-weight: 400; font-size: .75rem; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.choice { font-size: 1.25rem; min-height: 60px; }
.choice.marked { border-color: var(--bad); background: var(--bad-bg); }

.step-inputs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; counter-reset: step; }
.step-inputs li { counter-increment: step; padding: .4rem .6rem; border-radius: 10px; }
.step-inputs li.wrong { background: var(--bad-bg); outline: 2px solid var(--bad); }
.step-inputs label { display: grid; grid-template-columns: 1fr minmax(90px, 160px); gap: .75rem; align-items: center; }
.step-inputs label > span::before { content: counter(step) ". "; font-weight: 700; }

.map { display: block; width: 100%; height: auto; max-height: 70vh; background: #dcecf7; border-radius: var(--radius); touch-action: manipulation; cursor: pointer; }
.map-region { fill: #f1ead2; stroke: #8a8370; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-point { fill: var(--text); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map .selected { fill: var(--primary); }
.map .highlight { fill: #ffd34d; stroke: #b07d00; stroke-width: 3; }
.map .marked { fill: var(--bad-bg); stroke: var(--bad); }
.map-point.marked { fill: var(--bad); }
.map-actions { margin-top: .75rem; }
.sample { margin-bottom: 1.5rem; }

/* End screen */
.faces { display: flex; flex-wrap: wrap; gap: .5rem; }
.face { font: inherit; display: flex; flex-direction: column; align-items: center; min-width: 72px; min-height: 72px; padding: .4rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.face span { font-size: 2rem; line-height: 1.1; }
.face small { font-size: .75rem; color: var(--muted); }
.face.chosen { border-color: var(--primary); background: #e8eefc; }

/* --- Parent --- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: .85rem; color: var(--muted); font-weight: 600; }
table.data td.num { text-align: right; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.stat .value { font-size: 1.5rem; font-weight: 700; }
.examples { margin: .25rem 0 0; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters .btn.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.review-list { display: grid; gap: .75rem; }
.review-sentence { font-size: 1.2rem; margin: .25rem 0 .5rem; }
.gz-word { background: #dfe7fb; border-radius: 4px; padding: 0 .15rem; font-weight: 600; }
.gz-pv { text-decoration: underline; text-decoration-thickness: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.meta .badge { background: var(--lvl-none); color: var(--text); }
.status-Approved { background: var(--good-bg) !important; color: var(--good) !important; }
.status-Rejected { background: var(--bad-bg) !important; color: var(--bad) !important; }

@media (max-width: 600px) {
    html, body { font-size: 17px; }
    .answer-form { flex-direction: column; }
    .prompt { font-size: 1.25rem; }
}

/* --- Blazor framework UI --- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary { background: var(--bad-bg); padding: 1rem; color: var(--bad); }
.blazor-error-boundary::after { content: "Er ging iets mis."; }
