/* Step Up Reading: light theme only, high contrast, large targets. */
:root {
    color-scheme: light;
    --surface: #ffffff;
    --page: #f4f5f7;
    --text: #0b0b0b;
    --text-secondary: #3f3f46;
    --muted: #595959;
    --border: #c9ccd3;
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --danger: #b42318;
    --focus: #f59e0b;
    --grid: #e3e5ea;

    /* Chart series (reference palette slots 1-4; slots 1-3 validated as a set) */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    line-height: 1.5;
}

a { color: var(--primary); }
h1, h2 { line-height: 1.25; margin: 0 0 0.75rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 0.75rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.error { color: var(--danger); font-weight: bold; }

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- buttons & forms ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0.5rem 1rem;
    border: 2px solid var(--primary); border-radius: 8px;
    background: var(--surface); color: var(--primary);
    font: inherit; font-weight: bold; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #eef2ff; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-quiet { border-color: var(--border); color: var(--text); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fef3f2; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-big { min-height: 64px; padding: 0.75rem 2rem; font-size: 1.3rem; }

.link-button {
    background: none; border: none; padding: 0.25rem; font: inherit;
    color: var(--primary); text-decoration: underline; cursor: pointer;
}

label { display: block; font-weight: bold; margin: 0.75rem 0 0.25rem; }
input, select {
    font: inherit; min-height: 44px; padding: 0.4rem 0.6rem; width: 100%;
    border: 2px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}

/* ---------- teacher layout ---------- */

.topbar {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem;
    padding: 0.75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: bold; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }

.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.card.narrow { max-width: 460px; margin: 3rem auto; }
.banner {
    background: #fff7e6; border: 2px solid #f0b429; border-radius: 8px;
    padding: 0.6rem 0.9rem; margin-bottom: 1rem; font-size: 0.95rem;
}
.banner-calm { background: #eef6ff; border-color: #b6d4fe; }
.banner .link-button { padding: 0; font-weight: bold; }
.file-input { padding: 0.5rem; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; }
.inline-form label { width: 100%; margin-bottom: 0; }
.inline-form input { width: 12rem; text-transform: uppercase; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th, .data-table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 0.9rem; color: var(--text-secondary); }
.data-table .code { font-weight: bold; font-size: 1.1rem; }
.data-table .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }

.student-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.student-head h1 { margin: 0; }
.controls { margin-bottom: 1rem; }
.controls label { margin: 0; }
.goal-input { width: 6rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }

/* ---------- chart ---------- */

.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 12px; }
.chart .goal-line { stroke: var(--text); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .goal-label { fill: var(--text); font-size: 12px; font-weight: bold; }
.chart .trend-line { fill: none; stroke: #9aa0aa; stroke-width: 2; }
.chart .dot { cursor: default; outline: none; }
.chart .dot:focus-visible > :first-child { stroke: var(--focus); stroke-width: 3; }
.chart-tip {
    position: absolute; transform: translate(-50%, calc(-100% - 14px));
    background: var(--text); color: #fff; padding: 0.4rem 0.6rem; border-radius: 6px;
    font-size: 0.85rem; line-height: 1.35; white-space: nowrap; pointer-events: none;
}

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-bottom: 0.5rem; font-size: 0.95rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-goal { display: inline-block; width: 24px; border-top: 2px dashed var(--text); }

.error-bars { list-style: none; padding: 0; margin: 0; }
.error-bars li { display: grid; grid-template-columns: 9rem 1fr 2rem; gap: 0.75rem; align-items: center; margin-bottom: 0.6rem; }
.bar-track { height: 14px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.error-count { text-align: right; font-weight: bold; }

.iep-sentence { background: var(--page); border-radius: 8px; padding: 0.75rem; }

.dialog { border: none; border-radius: 12px; padding: 1.5rem; width: min(460px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog .row { margin-top: 1.25rem; justify-content: flex-end; }

/* ---------- student screens: same layout at every level, no timers ---------- */

.student-screen { min-height: 100vh; background: var(--surface); }
.student-top {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1.25rem; border-bottom: 2px solid var(--border);
}
.skill-name { font-weight: bold; font-size: 1.2rem; }

.probe-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;
    max-width: 1300px; margin: 0 auto; padding: 1.5rem;
}
.passage { font-size: 1.35rem; line-height: 1.75; }
.passage h2 { font-size: 1.6rem; }
.question-pane .progress { font-weight: bold; color: var(--text-secondary); }
.question { font-size: 1.5rem; outline: none; }
.choices { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; }
.choice {
    display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 72px;
    padding: 0.75rem 1rem; text-align: left; font: inherit; font-size: 1.25rem; line-height: 1.4;
    color: var(--text); background: var(--surface); border: 3px solid var(--text); border-radius: 12px; cursor: pointer;
}
.choice:hover { background: #eef2ff; }
.choice[aria-pressed="true"] { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.choice-letter {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; border: 2px solid currentColor; border-radius: 50%; font-weight: bold;
}

.results { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem; font-size: 1.25rem; }
.results h1 { font-size: 2.25rem; }
.results .lead { font-size: 1.3rem; }
.review { border: 2px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.review h2 { font-size: 1.25rem; }
.review .why { background: #fff7e6; border-radius: 8px; padding: 0.6rem 0.8rem; }

@media (max-width: 800px) {
    .probe-layout { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
    .passage { font-size: 1.2rem; }
    .two-col { grid-template-columns: 1fr; }
    .error-bars li { grid-template-columns: 7.5rem 1fr 2rem; }
    .data-table .actions { justify-content: flex-start; }
}
