/* Graph paper (graph.js). Loads after lab.css and tutor.css. */
.gr { display: block; width: 100%; height: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; font-family: var(--arial); user-select: none; -webkit-user-select: none; }
.gr.live { touch-action: none; cursor: crosshair; }
.gr .gs { stroke: #d5e7ea; stroke-width: .7; }
.gr .gb { stroke: #9cc5cb; stroke-width: 1.1; }
.gr .ax { stroke: #1c2430; stroke-width: 1.8; fill: none; }
.gr .tk { stroke: #1c2430; stroke-width: 1.2; }
.gr .tn { font-size: 14px; fill: #1c2430; }
.gr .lab { font-size: 15px; font-weight: 700; fill: #1c2430; }
.gr .cx { stroke: #1c2430; stroke-width: 1.9; stroke-linecap: round; fill: none; }
.gr .cx.sel { stroke: var(--accent); stroke-width: 2.6; }
.gr .cx.bad { stroke: var(--warn); }
.gr .selring { fill: rgba(31, 138, 138, .12); stroke: var(--accent); stroke-width: 1.2; }
.gr .fit { stroke: #2b3440; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gr .fit.thick { stroke-width: 5; opacity: .8; }
.gr .pen { stroke: #24508f; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gr .pen.bad { stroke: var(--warn); }
.gr .model { stroke: var(--accent); stroke-width: 2.2; fill: none; stroke-dasharray: 7 5; }
.gr .cons { stroke: #c9622b; stroke-width: 1.6; stroke-dasharray: 6 4; fill: none; }
.gr .cons.ok { stroke: var(--accent); }
.gr .true { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.gr .hdl { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.gr .hdl-hit { fill: transparent; }
.gr .mkr { fill: var(--warn); stroke: #fff; stroke-width: 1.5; }
.gr .note { font: 700 13px Figtree, sans-serif; fill: #9a4517; }
.gr .bad-t { fill: #9a4517; }
.gr .hl-bad { fill: none; stroke: var(--warn); stroke-width: 2.5; stroke-dasharray: 4 3; }

/* layouts: the graph beside its results table on wide screens */
.gr-two { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(200px, 1fr); gap: 16px; align-items: start; }
.gr-host { max-width: 640px; }
.gr-side { display: grid; gap: 10px; align-content: start; }
.gr-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gr-tools .btn { min-height: 44px; min-width: 44px; padding: 6px 10px; justify-content: center; }
.gr-tools .lbl { width: 100%; font: 600 12px Figtree, sans-serif; color: var(--muted); }
.gr-pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 4px; }
.gr-pad .btn { padding: 0; }
.gr-pad [data-d=up] { grid-column: 2; grid-row: 1; } .gr-pad [data-d=left] { grid-column: 1; grid-row: 2; }
.gr-pad [data-d=down] { grid-column: 2; grid-row: 2; } .gr-pad [data-d=right] { grid-column: 3; grid-row: 2; }
.gr-ans { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.gr-ans input { font: 700 17px var(--arial); width: 110px; min-height: 44px; text-align: center; border: 1px solid #b9c3ce; border-radius: 8px; padding: 4px 8px; }
.gr-ans input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.gr-ans input.ok { border-color: var(--accent); background: var(--accent-soft); }
.gr-ans input.bad { border-color: var(--warn); background: var(--warn-soft); }
.gr-q { font-size: 15px; line-height: 1.45; margin: 0; }

/* scale options: the numbers along the axis, as the student would write them */
.gs-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.gs-ticks { font: 700 16px var(--arial); letter-spacing: .01em; }
.gs-per { font: 500 13px Figtree, sans-serif; color: var(--muted); }
.gs-why { display: block; font: 600 12px Figtree, sans-serif; margin-top: 4px; }
.tu-opt.ok .gs-why { color: #14605f; } .tu-opt.bad .gs-why, .tu-opt .gs-why.no { color: #9a4517; }

/* axis-label builder: slots around a blank pair of axes */
.ax-build { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 8px 10px; align-items: center; max-width: 640px; }
.ax-build .ylab { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ax-build .xlab { grid-column: 2; grid-row: 2; display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.ax-build .axes { grid-column: 2; grid-row: 1; }
.ax-build .slash { font: 700 18px var(--arial); }
.ax-build .tag { font: 700 11px Figtree, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* best-graph choice: small graphs as options */
.tu-opts.graphs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tu-opts.graphs .tu-opt { min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; font: 700 13px Figtree, sans-serif; }
.tu-opts.graphs .gr { border-radius: 6px; }
.gr.mini .cx { stroke-width: 3; } .gr.mini .fit { stroke-width: 2.6; } .gr.mini .gs { stroke-width: .5; }

/* teach figures */
.gr-fig { margin: 0; }
.gr-fig figcaption { font: 700 13px Figtree, sans-serif; margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.gr-fig.ok figcaption { color: #14605f; } .gr-fig.no figcaption { color: #9a4517; }
.gr-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1000px) { .tu-opts.graphs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .gr-two { grid-template-columns: 1fr; gap: 10px; }
  .gr .tn { font-size: 16px; }
  .gr-figs { grid-template-columns: 1fr; }
  .ax-build { grid-template-columns: 1fr; }
  .ax-build .ylab { grid-column: 1; grid-row: 1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .ax-build .axes { grid-column: 1; grid-row: 2; }
  .ax-build .xlab { grid-column: 1; grid-row: 3; }
}

.gr-key-help { font-size: 12px; line-height: 1.4; color: var(--muted); margin: 6px 0; }
.gr.live:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.keyboard-cursor { pointer-events: none; }
