:root {
    --ink: #1f2328;
    --muted: #5f6773;
    --line: #d8dee4;
    --surface: #f6f8fa;
    --primary: #0072b2;
    --accent: #d55e00;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: #fff;
    line-height: 1.55;
}

body { margin: 0; }

.chapter {
    max-width: 64rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.chapter-kicker { color: var(--muted); font-size: 0.95rem; margin: 0; }
.chapter h1 { margin: 0.25rem 0 1rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }

.attribution {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---- the embedded simulation ---- */

physics-sim { display: block; margin: 1.5rem 0; }

.physics-sim {
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
}

.sim-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #fff;
}

.sim-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.sim-start {
    position: absolute;
    inset: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;
    padding: 0.9rem 1.8rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
}

.sim-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.sim-play {
    min-width: 5.5rem;
    min-height: 2.75rem;          /* comfortable touch target */
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: #fff;
    cursor: pointer;
}

.sim-scrubber { flex: 1; min-height: 2.75rem; }
.sim-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 6.5rem; text-align: right; }

.sim-params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0.75rem 0.9rem 0.9rem;
    border: none;
    border-top: 1px solid var(--line);
}

.sim-params legend { float: left; width: 100%; padding: 0; font-weight: 600; margin-bottom: 0.25rem; }
.sim-param { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.95rem; }
.sim-param input { min-height: 2.25rem; }
.sim-param output { font-variant-numeric: tabular-nums; font-weight: 600; }

.sim-status { margin: 0; padding: 0 0.9rem 0.7rem; min-height: 1.4rem; color: var(--accent); font-size: 0.95rem; }
.sim-loading, .sim-error { margin: 0; padding: 2rem; text-align: center; }
.sim-error { color: #b42318; }

/* ---- Blazor's error bar ---- */

#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; }
