/* Student grid styles are scoped so the same widget can sit on a board or in the calculator. */
.piero-graph{--pg-surface:#fff;--pg-ink:#172B24;--pg-muted:#4D5E56;--pg-line:#E3DBCC;--pg-grid:#e7ece8;--pg-axis:#a5b0a9;--pg-tick:#87938b;--pg-accent:#1E3D32;--pg-given:#7b837f;--pg-given-fill:#eff2ef;--pg-hover:#F4F0E7;--pg-field:#FCFBF8;--pg-error:#8C2633;color:var(--pg-ink);font-family:var(--f-ui,'IBM Plex Sans',-apple-system,BlinkMacSystemFont,sans-serif);background:var(--pg-surface);border:1px solid var(--pg-line);border-radius:10px;overflow:hidden;width:100%}
/* On the lesson board the grid is drawn in the board's own chalk colours. */
.piero-graph[data-theme=board]{--pg-surface:#25473b;--pg-ink:#f5f2ea;--pg-muted:#c5d3ca;--pg-line:#547465;--pg-grid:#a9c5b540;--pg-axis:#c5d3ca;--pg-tick:#c5d3ca;--pg-accent:#f5bd45;--pg-given:#c5d3ca;--pg-given-fill:#a9c5b526;--pg-hover:#2c4d40;--pg-field:#183027;--pg-error:#ff7b72;font-family:var(--font-ui,'IBM Plex Sans',system-ui,sans-serif);border-color:transparent;border-radius:0;background:transparent}
.piero-graph *{box-sizing:border-box}
.piero-graph [hidden]{display:none!important}
.piero-graph button,.piero-graph input{font:inherit}
.pg-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:6px 10px 6px 20px;min-height:48px}
.pg-hint{margin:0;font-size:15px;font-weight:500;line-height:1.4}
.pg-actions{display:flex;align-items:center;gap:2px;flex-shrink:0;margin-left:auto}
.piero-graph .pg-button{display:inline-flex;align-items:center;justify-content:center;min-width:36px;min-height:36px;padding:6px 10px;border:1px solid transparent;border-radius:7px;color:var(--pg-muted);background:transparent;cursor:pointer;white-space:nowrap;font-size:14px}
.piero-graph .pg-actions .pg-button:nth-child(-n+2){font:22px/1 Arial,'Apple Symbols',sans-serif}
.piero-graph .pg-button svg{width:20px;height:20px;display:block;fill:currentColor;pointer-events:none}
.piero-graph .pg-button:hover:not(:disabled){background:var(--pg-hover);color:var(--pg-ink)}
.piero-graph .pg-button:disabled{opacity:.3;cursor:default}
.piero-graph :focus-visible{outline:2px solid var(--pg-accent);outline-offset:3px}
/* Browsers ring a clicked drawing by default; the ring is kept only for keyboard use. */
.piero-graph .pg-svg:focus{outline:none}
.piero-graph .pg-svg:focus-visible{outline:1px dashed var(--pg-muted);outline-offset:-3px}
.pg-surface{display:flex;align-items:center;justify-content:center;padding:0 8px 8px;position:relative;min-width:0}
.piero-graph[data-mode=equation] .pg-surface{padding:0;height:100%}
.pg-svg{width:100%;max-height:clamp(340px,calc(100dvh - 250px),600px);aspect-ratio:1;display:block;touch-action:none;user-select:none;cursor:crosshair;overflow:visible}
.piero-graph[data-mode=equation]{height:100%;border:0;border-radius:0}
.piero-graph[data-mode=equation] .pg-svg{cursor:grab;width:100%;height:100%;max-height:none;aspect-ratio:auto}
.piero-graph[data-mode=equation] .pg-svg:active{cursor:grabbing}
.piero-graph[data-mode=equation] .pg-tick{font-size:12px}
.piero-graph[data-mode=equation] .pg-axis-label{font-size:14px}
.piero-graph[data-mode=equation] .pg-coordinate{font-size:13px}
.piero-graph[data-mode=equation] .pg-curve{stroke-width:2.4}
/* fit: the grid takes the height its host gives it instead of a share of the window. */
.piero-graph[data-fit]{height:100%;display:flex;flex-direction:column;max-width:100%}
.piero-graph[data-fit] .pg-surface{flex:1;min-height:0}
.piero-graph[data-fit] .pg-svg{width:auto;height:100%;max-width:100%;max-height:none}
.piero-graph[data-fit] .pg-tick{font-size:16px}
.piero-graph[data-fit] .pg-axis-label{font-size:17px}
.piero-graph[data-fit] .pg-point-label{font-size:19px}
.pg-zoom{position:absolute;top:10px;right:10px;display:flex;flex-direction:column;gap:2px;background:var(--pg-surface);border:1px solid var(--pg-line);border-radius:8px;padding:2px}
.pg-svg text{font-family:inherit;pointer-events:none;user-select:none}
.pg-background{fill:var(--pg-surface)}
/* The board's own surface shows through; --pg-surface only outlines numbers so lines do not cut them. */
.piero-graph[data-theme=board] .pg-background{fill:none}
.pg-grid-line{fill:none;stroke:var(--pg-grid);stroke-width:1}
.pg-axis{fill:none;stroke:var(--pg-axis);stroke-width:1.5}
.pg-curve,.pg-stroke{fill:none;stroke:var(--pg-accent);stroke-width:2.8;stroke-linejoin:round;stroke-linecap:round}
.pg-shape{fill:var(--pg-accent);fill-opacity:.08}
.pg-preview{fill:none;stroke:var(--pg-accent);stroke-opacity:.5;stroke-width:2;stroke-dasharray:5 5}
.pg-mirror{fill:none;stroke:var(--pg-given);stroke-width:2;stroke-dasharray:6 5}
.pg-given-shape{fill:var(--pg-given-fill);stroke:var(--pg-given);stroke-width:2;stroke-linejoin:round}
.pg-tick{font-size:13px;fill:var(--pg-tick);paint-order:stroke;stroke:var(--pg-surface);stroke-width:4px;stroke-linejoin:round}
.pg-axis-label{font-size:15px;fill:var(--pg-muted);font-style:italic;paint-order:stroke;stroke:var(--pg-surface);stroke-width:4px}
.pg-point-label{font-size:16px;font-weight:600;fill:var(--pg-accent);paint-order:stroke;stroke:var(--pg-surface);stroke-width:4px}
.pg-given .pg-point-label{fill:var(--pg-given)}
.pg-dot{fill:var(--pg-accent);stroke:var(--pg-accent);stroke-width:2}
.pg-given .pg-dot{fill:var(--pg-given);stroke:var(--pg-given)}
.pg-open .pg-dot,.pg-ghost .pg-dot{fill:var(--pg-surface)}
.pg-hit{fill:transparent}
.pg-halo{fill:var(--pg-accent);fill-opacity:.12;stroke:var(--pg-accent);stroke-opacity:.3}
.pg-point{cursor:grab;outline:none}
.pg-point:active{cursor:grabbing}
.pg-point:focus .pg-hit{stroke:var(--pg-accent);stroke-width:1.5;stroke-dasharray:3 3}
.pg-ghost{opacity:.6;pointer-events:none}
.pg-coordinate{font-size:14px;fill:var(--pg-ink);paint-order:stroke;stroke:var(--pg-surface);stroke-width:5px}
.pg-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:6px 20px 12px;font-size:14px}
.pg-point-editor{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.pg-point-editor strong{color:var(--pg-accent);font-size:15px;margin-right:4px}
.pg-point-editor label{display:flex;align-items:center;gap:5px;color:var(--pg-muted);font-style:italic}
.piero-graph .pg-point-editor input{background:var(--pg-field);border:1px solid var(--pg-line);border-radius:5px;padding:5px 7px;min-height:32px;width:62px;color:var(--pg-ink);font-style:normal;font-size:14px}
.pg-editor-error{width:100%;color:var(--pg-error);font-size:13px}
.pg-editor-error:empty{display:none}
.pg-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
/* A number line is drawn one unit per pixel across its host, so it keeps its own height instead of a square. */
.piero-graph[data-mode=numberline] .pg-svg{aspect-ratio:auto;height:auto;max-height:none}
.piero-graph[data-mode=numberline] .pg-tick{font-size:15px;fill:var(--pg-ink)}
.piero-graph[data-mode=numberline] .pg-axis-label{font-size:16px}
.piero-graph[data-mode=numberline] .pg-point-label{font-size:18px}
.pg-number-line{fill:none;stroke:var(--pg-muted);stroke-width:2;stroke-linecap:round}
.pg-number-line-end{fill:var(--pg-muted)}
.pg-shade{stroke-width:5}
.pg-shade-end{fill:var(--pg-accent)}
.piero-graph[data-mode=numberline] .pg-toolbar{flex-wrap:wrap;gap:4px 12px}
.piero-graph[data-mode=numberline] .pg-hint{flex:1 1 230px}
.piero-graph[data-mode=numberline] .pg-actions .pg-button{font:inherit;font-size:14px}
.pg-shade-target{fill:transparent;cursor:pointer}
.pg-shade-target:hover{fill:var(--pg-accent);fill-opacity:.06}
.pg-shade-target:focus-visible{outline:0;stroke:var(--pg-accent);stroke-dasharray:3 3}
@media(max-width:650px){.pg-toolbar{padding:6px 6px 6px 12px}.pg-surface{padding:0}.pg-footer{padding:6px 12px 10px}.pg-svg{max-height:none}.pg-point-editor{gap:6px}.pg-point-editor input{width:54px}.piero-graph .pg-button{padding:6px 8px}}
