/* hallmark: theme=custom (dashboard tokens) · app screen · genre modern-minimal
   critique: teaching tool, not a landing page — density is the point; canvas first */
:root {
    --dl-d: #2057d6;
    --dl-d2: #b45309;
    --dl-s: #25754b;
    --dl-s2: #7c3aed;
    --dl-ppc: #25754b;
    --dl-ctrl: #b91c1c;
    --dl-axis: #202521;
    --dl-guide: #9aa79e;
    --dl-ghost: #aab8ae;
    --dl-area-cs: rgba(32, 87, 214, 0.13);
    --dl-area-ps: rgba(37, 117, 75, 0.15);
    --dl-area-dwl: rgba(185, 28, 28, 0.18);
    --dl-area-wfg: rgba(180, 83, 9, 0.16);
    --dl-area-rev: rgba(120, 90, 20, 0.18);
    --dl-area-cost: rgba(120, 90, 20, 0.18);
    --dl-area-tr: rgba(37, 117, 75, 0.12);
    --dl-area-short: rgba(185, 28, 28, 0.22);
}

/* ---------- layout ---------- */
.dl-layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 18px;
    margin-top: 16px;
    align-items: start;
}

.dl-picker-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.dl-picker-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}
.dl-picker-head strong { font-size: 13px; font-weight: 750; }
.dl-picker-head span { font-size: 11px; color: var(--muted); font-family: 'Geist Mono', monospace; }
.dl-progress-track {
    height: 4px;
    border-radius: 4px;
    background: var(--soft);
    overflow: hidden;
    margin-bottom: 12px;
}
.dl-progress-bar {
    display: block;
    height: 100%;
    background: #25754b;
    border-radius: 4px;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 500ms var(--ease-out);
}
.dl-group + .dl-group { margin-top: 12px; }
.dl-group-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin: 0 0 5px 2px;
}
.dl-pick {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    transition: background 140ms ease, border-color 140ms ease;
}
.dl-pick:hover { background: var(--soft); }
.dl-pick.active { background: #ebf5ee; border-color: #cfe2d3; }
.dl-pick.dl-seen .dl-pick-title::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #25754b;
    margin-left: 7px;
    vertical-align: 2px;
}
.dl-pick-unit { font-size: 10px; color: var(--muted); font-family: 'Geist Mono', monospace; flex-shrink: 0; }
.dl-pick:focus-visible { outline: 2px solid #34704a; outline-offset: 1px; }
.dl-pick.dl-mastered .dl-pick-title::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #b45309;
    margin-left: 7px;
    vertical-align: 2px;
}

/* ---------- stage ---------- */
.dl-stage-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
}
.dl-stage-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.dl-stage-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -0.02em;
}
.dl-stage-unit {
    font-size: 11px;
    color: var(--muted);
    font-family: 'Geist Mono', monospace;
    margin-top: 2px;
}
.dl-stage-blurb {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--muted);
    max-width: 64ch;
}
.dl-stage-tools { display: flex; gap: 8px; align-items: center; }

.dl-canvas-wrap {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fcfdfb 0%, #f8faf7 100%);
    padding: 8px;
}
.dl-svg {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* svg internals */
.dl-axes, .dl-guides, .dl-points, .dl-labels, .dl-areas, .dl-ghost { pointer-events: none; }
.dl-axis { stroke: var(--dl-axis); stroke-width: 1.6; }
.dl-axis-name { font-size: 13px; font-weight: 700; fill: var(--ink); font-family: 'Manrope', sans-serif; }
.dl-axis-sub { font-size: 11px; fill: var(--muted); font-family: 'Manrope', sans-serif; }
.dl-axis-val { font-size: 11px; fill: var(--muted); font-family: 'Geist Mono', monospace; text-anchor: middle; }
.dl-val-r { text-anchor: end; }
.dl-curve { stroke-width: 2.6; stroke-linecap: round; }
.dl-c-d, .dl-c-mpb { stroke: var(--dl-d); }
.dl-c-d2, .dl-c-msb { stroke: var(--dl-d2); }
.dl-c-s, .dl-c-mpc { stroke: var(--dl-s); }
.dl-c-s2, .dl-c-msc { stroke: var(--dl-s2); }
.dl-c-ppc { stroke: var(--dl-ppc); }
.dl-c-ctrl { stroke: var(--dl-ctrl); }
.dl-c-p1 { stroke: var(--dl-ctrl); }
.dl-draggable { cursor: grab; }
.dl-dragging .dl-draggable { cursor: grabbing; }
.dl-hit { stroke: transparent; stroke-width: 26; pointer-events: stroke; }
.dl-ghost-curve { stroke: var(--dl-ghost); stroke-width: 2; stroke-dasharray: 5 5; }
.dl-label {
    font-size: 12.5px; font-weight: 750; fill: var(--ink); font-family: 'Manrope', sans-serif;
    paint-order: stroke; stroke: #fbfdf9; stroke-width: 4px; stroke-linejoin: round;
}
.dl-l-d, .dl-l-mpb { fill: var(--dl-d); }
.dl-l-d2, .dl-l-msb { fill: var(--dl-d2); }
.dl-l-s, .dl-l-mpc { fill: var(--dl-s); }
.dl-l-s2, .dl-l-msc { fill: var(--dl-s2); }
.dl-l-ctrl, .dl-l-p1 { fill: var(--dl-ctrl); }
.dl-ghost-label { fill: var(--dl-ghost); }
.dl-guide { stroke: var(--dl-guide); stroke-width: 1.2; stroke-dasharray: 4 4; }
.dl-eq-dot { fill: var(--ink); }
.dl-mark { fill: var(--ink); }
.dl-mark-a { fill: #25754b; }
.dl-mark-b { fill: #b91c1c; }
.dl-mark-c { fill: transparent; }
.dl-area { stroke: none; }
.dl-area-cs { fill: var(--dl-area-cs); }
.dl-area-ps { fill: var(--dl-area-ps); }
.dl-area-dwl { fill: var(--dl-area-dwl); }
.dl-area-wfg { fill: var(--dl-area-wfg); }
.dl-area-rev { fill: var(--dl-area-rev); }
.dl-area-cost { fill: var(--dl-area-cost); }
.dl-area-tr { fill: var(--dl-area-tr); }
.dl-area-shortage { fill: var(--dl-area-short); }
.dl-area-label { font-size: 11px; font-weight: 700; fill: #4a554d; font-family: 'Manrope', sans-serif; text-anchor: middle; }

/* ---------- scenario chips ---------- */
.dl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.dl-chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.dl-chip:hover { background: var(--soft); border-color: #cfdbd1; }
.dl-chip.active { background: #25754b; border-color: #25754b; color: #fff; }
.dl-chip:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }

/* ---------- readout ---------- */
.dl-readout {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-left: 3px solid #25754b;
    border-radius: 10px;
    background: #fbfdfa;
    padding: 14px 16px;
    display: grid;
    gap: 8px;
}
.dl-ro-title { font-size: 13px; font-weight: 750; color: var(--ink); margin: 0; }
.dl-ro-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.dl-ro-k { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.dl-ro-v { font-size: 13px; line-height: 1.55; color: var(--ink); margin: 0; }
.dl-ro-v.dl-ro-tip { color: #1f633c; font-weight: 600; }

/* ---------- misc ---------- */
.dl-reset {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    transition: background 140ms ease;
}
.dl-reset:hover { background: var(--soft); }
.dl-reset:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }

.dl-pick-toggle { display: none; }

/* ---------- learn mode ---------- */
.dl-mode-seg {
    display: inline-flex;
    gap: 2px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
}
.dl-seg {
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    transition: background 150ms ease, color 150ms ease;
}
.dl-seg.active { background: #25754b; color: #fff; }
.dl-seg:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }

.dl-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.dl-step {
    font-size: 11px; font-weight: 700; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
    background: #fff;
}
.dl-step.active { border-color: #25754b; color: #1f633c; background: #ebf5ee; }
.dl-step.done { color: #1f633c; border-color: #cfe2d3; }

.dl-lesson-card {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdfa;
    padding: 20px 22px;
    max-width: 70ch;
}
.dl-lesson-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 750; letter-spacing: -0.01em; }
.dl-lesson-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.65; color: #3d4741; }
.dl-lesson-card .dl-task { border-left: 3px solid #25754b; padding-left: 12px; color: var(--ink); }
.dl-lesson-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dl-btn-primary {
    border: 1px solid #1f633c;
    background: #25754b;
    color: #fff;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    transition: background 150ms ease;
}
.dl-btn-primary:hover { background: #1f633c; }
.dl-btn-primary:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }
.dl-btn-ghost {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    transition: background 150ms ease;
}
.dl-btn-ghost:hover { background: var(--soft); }
.dl-btn-ghost:disabled { opacity: 0.45; cursor: default; }
.dl-btn-ghost:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }

.dl-task-inline { font-size: 13px; color: var(--ink); margin: 12px 0 0; }

.dl-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-top: 10px; padding: 10px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.dl-tool {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line); background: #fff;
    border-radius: 8px; padding: 7px 12px;
    font-size: 12.5px; font-weight: 600; color: var(--ink);
    transition: background 140ms ease, border-color 140ms ease;
}
.dl-tool:hover { background: var(--soft); }
.dl-tool.active { border-color: #25754b; background: #ebf5ee; }
.dl-tool:focus-visible { outline: 2px solid #34704a; outline-offset: 2px; }
.dl-tool-swatch { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }
.dl-swatch-d { background: var(--dl-d); }
.dl-swatch-d2 { background: var(--dl-d2); }
.dl-swatch-s { background: var(--dl-s); }
.dl-swatch-s2 { background: var(--dl-s2); }
.dl-swatch-ctrl { background: var(--dl-ctrl); }
.dl-swatch-ctx { background: var(--dl-ghost); }
.dl-toolbar-sep { flex: 1; }
.dl-tool-util { color: var(--muted); }
.dl-tool-util:disabled { opacity: 0.4; cursor: default; }

.dl-draw-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) 300px;
    gap: 14px;
    margin-top: 12px;
    align-items: start;
}
.dl-draw-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dl-draw-tips { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.dl-draw-side .dl-toolbar { margin-top: 0; align-content: flex-start; }
.dl-draw-side .dl-check-bar { margin-top: 0; }
.dl-draw-side > * { flex-shrink: 0; }
.dl-draw-side .dl-feedback { margin-top: 0; }
.dl-draw-side .dl-hint-box { margin-top: 0; }

.dl-draw-inner { position: relative; }
.dl-draw-input {
    position: absolute;
    z-index: 5;
    width: 140px;
    border: 1px solid #25754b;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-family: 'Manrope', sans-serif;
    background: #fff;
    box-shadow: 0 4px 14px rgba(20, 32, 22, 0.12);
}
.dl-handle {
    fill: #fff;
    stroke: var(--ink);
    stroke-width: 2;
    cursor: grab;
}
.dl-auto-eq {
    fill: #fff;
    stroke: var(--dl-ghost);
    stroke-width: 1.6;
}
.dl-stu-label {
    font-size: 13px;
    font-weight: 750;
    fill: var(--ink);
    font-family: 'Manrope', sans-serif;
    cursor: move;
    paint-order: stroke;
    stroke: #fbfdf9;
    stroke-width: 3px;
}
.dl-stu-label.dl-selected { stroke: #25754b; stroke-width: 1px; }
.dl-stu-area {
    fill: rgba(32, 87, 214, 0.14);
    stroke: rgba(32, 87, 214, 0.45);
    stroke-width: 1.4;
    cursor: move;
}
.dl-stu-area.dl-selected { fill: rgba(32, 87, 214, 0.22); stroke: var(--dl-d); }
.dl-area-draft { stroke: var(--dl-d); stroke-width: 1.4; }
.dl-axis-editable { cursor: text; }

.dl-draw-wrap { margin-top: 0; background: #fffdf7; }
.dl-svg-student { cursor: crosshair; }
.dl-stu.dl-selected { stroke-width: 3.4; }
.dl-stu-point { stroke: #fff; stroke-width: 2; }
.dl-stu-point.dl-selected { stroke: var(--ink); }
.dl-cfill-d { fill: var(--dl-d); }
.dl-cfill-d2 { fill: var(--dl-d2); }
.dl-cfill-s { fill: var(--dl-s); }
.dl-cfill-s2 { fill: var(--dl-s2); }
.dl-cfill-ctrl { fill: var(--dl-ctrl); }
.dl-cfill-ctx { fill: var(--dl-ghost); }
.dl-reveal { stroke-width: 2.2; opacity: 0.85; }

.dl-check-bar {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    margin-top: 12px;
}
.dl-hint-box {
    margin-top: 10px;
    border: 1px solid #ead9b8;
    border-left: 3px solid #b45309;
    background: #fdf8ec;
    border-radius: 8px;
    padding: 10px 14px;
}
.dl-hint-box p { margin: 4px 0; font-size: 13px; line-height: 1.55; color: #5c4a26; }

.dl-feedback {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 14px 16px;
}
.dl-score { font-size: 14px; font-weight: 750; margin-bottom: 8px; }
.dl-score-pass { color: #1f633c; }
.dl-score-mixed { color: #8a5a1e; }
.dl-check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dl-check-list li { font-size: 13px; line-height: 1.5; }
.dl-check-list li.pass { color: #1f633c; }
.dl-check-list li.fail { color: #9b2c1c; }
.dl-scaffold { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
    .dl-chip, .dl-pick, .dl-reset, .dl-progress-bar { transition: none; }
}

@media (max-width: 900px) {
    .dl-draw-grid { grid-template-columns: minmax(0, 1fr); }
    .dl-layout { grid-template-columns: minmax(0, 1fr); }
    .dl-picker-card {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        z-index: 60;
        border-radius: 0;
        transform: translateX(-105%);
        transition: transform 240ms var(--ease-out);
        max-height: none;
        box-shadow: 0 8px 30px rgba(20, 32, 22, 0.12);
    }
    body.dl-picker-open .dl-picker-card { transform: translateX(0); }
    .dl-pick-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: 1px solid var(--line);
        background: #fff;
        border-radius: 8px;
        padding: 6px 12px;
        font-size: 12px;
        font-weight: 600;
    }
    .dl-ro-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---------- focus layout (Learn mode): canvas fills the screen ---------- */
body.dl-focus .workspace-heading,
body.dl-focus .dl-picker-card,
body.dl-focus .dl-stage-blurb,
body.dl-focus .app-footer { display: none; }
body.dl-focus .dl-layout { grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
body.dl-focus .dl-stage-card { padding: 12px 16px; }
body.dl-focus .dl-stage-head h2 { font-size: 17px; }
body.dl-focus .dl-stage-tools { display: none; }
body.dl-focus .dl-mode-head { margin-top: 8px !important; }
body.dl-focus .dl-steps { margin-top: 8px; }
body.dl-focus .dl-draw-grid { grid-template-columns: minmax(0, 1fr) 310px; margin-top: 8px; }
body.dl-focus .dl-draw-wrap { padding: 4px; }
body.dl-focus .dl-svg-student {
    max-height: calc(100vh - 235px);
    margin: 0 auto;
}
body.dl-focus .dl-draw-side { max-height: calc(100vh - 235px); overflow-y: auto; padding-right: 2px; }
.dl-svg-student .dl-axis-name { font-size: 15px; }
.dl-svg-student .dl-label, .dl-svg-student .dl-stu-label { font-size: 14.5px; }
.dl-svg-student .dl-axis-val { font-size: 12px; }
.dl-library-back { display: none; }
body.dl-focus .dl-library-back { display: inline-flex; }
@media (max-width: 900px) {
    body.dl-focus .dl-draw-grid { grid-template-columns: minmax(0, 1fr); }
    body.dl-focus .dl-svg-student { max-height: none; }
    body.dl-focus .dl-draw-side { max-height: none; }
}

.dl-scn-box { border: 1px solid var(--line); border-left: 3px solid #25754b; background: #fbfdfa; border-radius: 8px; padding: 8px 12px; }
.dl-scn-k { font-size: 11px; font-weight: 700; color: #1f633c; }
.dl-scn-box p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: #3d4741; }
.dl-draw-side .dl-task-inline { margin: 0; }
.dl-auto-eq { fill: #fff; stroke: var(--ink); stroke-width: 1.8; }
body.dl-focus .dl-layout { margin-top: -28px; }
