/* PV Diagram Engine: the Engine Test Bench inside the practice shell's stage (about 1066 x 628 at 1366 x 768). */
.pv { position: absolute; inset: 0; overflow: auto; display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 10px; padding: 10px 12px; font-size: 16px; line-height: 1.3;
  color: #1f2933; background: linear-gradient(#e7eef5, #d6e2ec);
  --pv-card: #ffffff; --pv-line: #a9b8c4; --pv-soft: #44525f; --pv-accent: #1f5fa8; --pv-head: #e3edf7; --pv-in: #ffffff;
  --pv-ok: #1f7a44; --pv-ok-bg: #e3f6e8; --pv-bad: #b42318; --pv-bad-bg: #fde7e4;
  --pv-plot: #fbfdff; --pv-grid: #dde5ec; --pv-ink: #1f2933; --pv-path: #1f5fa8; --pv-iso: #7d8ea0; --pv-neg: #f6b98a; --pv-pos: #9ad7a8; }
html[data-theme="dark"] .pv { color: #eef2f6; background: linear-gradient(#1a222c, #141b23);
  --pv-card: #222c38; --pv-line: #56657a; --pv-soft: #c9d3de; --pv-accent: #8cc0f5; --pv-head: #2a3a4c; --pv-in: #121820;
  --pv-ok: #7fdca0; --pv-ok-bg: #173d27; --pv-bad: #ffb4a8; --pv-bad-bg: #4a1e1a;
  --pv-plot: #18212b; --pv-grid: #2e3a47; --pv-ink: #eef2f6; --pv-path: #8cc0f5; --pv-iso: #9aa9ba; --pv-neg: #b9682f; --pv-pos: #3f8f55; }
.pv *, .pv *::before, .pv *::after { box-sizing: border-box; }
.pv p { margin: 0; }
.pv-left, .pv-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.pv-card { background: var(--pv-card); border: 1.5px solid var(--pv-line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.pv-k { font-weight: 800; color: var(--pv-accent); }

/* the gas */
.pv-gascard { display: flex; flex-direction: column; gap: 4px; }
.pv-gashead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.pv-states { display: flex; align-items: center; gap: 6px; }
.pv-states-l { color: var(--pv-soft); font-weight: 700; }
.pv .pv-statebtn { min-width: 44px; height: 44px; padding: 0 6px; font: inherit; font-weight: 800; font-size: 18px; color: inherit; background: var(--pv-in); border: 2px solid var(--pv-line); border-radius: 10px; cursor: pointer; }
.pv .pv-statebtn[aria-pressed="true"] { border: 3px solid #d9480f; background: var(--pv-head); }
.pv-cylhost svg { display: block; width: 100%; height: auto; max-height: 268px; margin: 0 auto; }
.pv-tablecard { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.pv-tablewrap { overflow: auto; min-height: 0; }
.pv-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.pv-table caption { text-align: left; font-weight: 800; color: var(--pv-accent); padding-bottom: 4px; }
.pv-table th, .pv-table td { border: 1.5px solid var(--pv-line); padding: 3px 8px; height: 32px; text-align: center; white-space: nowrap; }
.pv-table thead th { background: var(--pv-head); white-space: normal; line-height: 1.15; }
.pv-table td { font-weight: 700; }
.pv-note { color: var(--pv-soft); }

/* coach */
.pv-coachbar { display: flex; align-items: center; gap: 10px; background: var(--pv-card); border: 1.5px solid var(--pv-line); border-left: 6px solid var(--pv-accent); border-radius: 10px; padding: 6px 10px; min-height: 44px; }
.pv-coach-k { flex: none; font-weight: 800; color: var(--pv-accent); text-transform: uppercase; letter-spacing: .06em; }
.pv-coach { line-height: 1.25; }

/* graph */
.pv-graphcard { flex: 1 1 auto; min-height: 250px; display: flex; flex-direction: column; gap: 2px; }
.pv-graphhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.pv-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--pv-soft); }
.pv-legend .pv-lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pv-legend i { display: inline-block; width: 28px; height: 0; }
.pv-leg-path { border-top: 4px solid var(--pv-path); }
.pv-leg-iso { border-top: 2px dashed var(--pv-iso); }
.pv-legend i.pv-leg-area { height: 14px; border-radius: 3px; border: 1px solid var(--pv-line); }
.pv-leg-area--neg { background: repeating-linear-gradient(45deg, var(--pv-neg) 0 5px, transparent 5px 9px); }
.pv-leg-area--pos { background: repeating-linear-gradient(-45deg, var(--pv-pos) 0 5px, transparent 5px 9px); }
.pv-plothost { flex: 1 1 auto; min-height: 200px; position: relative; overflow: hidden; }
.pv-plothost svg { position: absolute; left: 0; top: 0; }
.pv-graph { display: block; }
.pv-g-bg { fill: var(--pv-plot, #fbfdff); }
.pv-g-grid { stroke: var(--pv-grid, #dde5ec); stroke-width: 1; }
.pv-g-axis { stroke: var(--pv-ink, #1f2933); }
.pv-g-t { font: 16px/1 system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--pv-ink, #1f2933); }
.pv-g-title { font-weight: 700; }
.pv-g-state { font-weight: 800; font-size: 18px; paint-order: stroke; stroke: var(--pv-plot, #fbfdff); stroke-width: 5px; stroke-linejoin: round; }
.pv-g-work { font-weight: 800; paint-order: stroke; stroke: var(--pv-plot, #fbfdff); stroke-width: 5px; stroke-linejoin: round; }
.pv-iso { stroke: var(--pv-iso, #7d8ea0); }
.pv-leg { stroke: var(--pv-path, #1f5fa8); }
.pv-arrow { fill: var(--pv-path, #1f5fa8); stroke: var(--pv-plot, #fff); stroke-width: 1.5; }
.pv-state { fill: var(--pv-plot, #fff); stroke: var(--pv-path, #1f5fa8); }
.pv-area--neg { fill: var(--pv-neg, #f6b98a); }
.pv-area--pos { fill: var(--pv-pos, #9ad7a8); }
html[data-theme="dark"] .pv-area { fill-opacity: .6; }

/* the cylinder (text sizes are in viewBox units: the drawing is shown at ~0.75-0.8x, so 21 units ≈ 16 px) */
.pv-c-t { font: 21px/1 system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--pv-ink, #1f2933); }
.pv-c-b { font-weight: 800; }
.pv-c-s { fill: var(--pv-soft, #44525f); }
.pv-c-q { fill: #b8430c; } .pv-c-q--out { fill: #1864ab; } .pv-c-w { fill: #237a37; }
html[data-theme="dark"] .pv-c-q { fill: #ffa070; } html[data-theme="dark"] .pv-c-q--out { fill: #8cc0f5; } html[data-theme="dark"] .pv-c-w { fill: #7fdca0; }
.pv-gas { fill: #d9e9f8; }
html[data-theme="dark"] .pv-gas { fill: #23384d; }
.pv-heat-head--in { fill: #d9480f; } .pv-heat-head--out { fill: #1971c2; }
.pv-work-head { fill: #2f9e44; }
html[data-theme="dark"] .pv-gauge { fill: #f4f4ee; }

/* answer sheet */
.pv-sheet { flex: none; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 6px 16px rgba(20, 35, 50, .12); }
.pv-eqs { margin: 0; padding: 0 0 6px; list-style: none; columns: 2; column-gap: 16px; border-bottom: 1px solid var(--pv-line); line-height: 1.25; }
.pv-eqs li { font-variant-numeric: tabular-nums; break-inside: avoid; }
.pv-eqs sub { font-size: .8em; line-height: 0; }
.pv-eqs li:first-child { font-weight: 800; }
.pv-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; }
.pv-cell { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pv-cell-l { line-height: 1.2; }
.pv-cell-l b { font-size: 18px; color: var(--pv-accent); }
.pv-cell-s { color: var(--pv-soft); line-height: 1.15; }
.pv-cell-row { display: flex; align-items: center; gap: 6px; }
.pv .pv-in { width: 120px; min-width: 0; height: 44px; padding: 0 8px; font: inherit; font-size: 18px; font-weight: 700; text-align: center; color: inherit; background: var(--pv-in); border: 2px solid var(--pv-accent); border-radius: 8px; }
.pv .pv-in:disabled { opacity: 1; -webkit-text-fill-color: currentColor; }
.pv .pv-in.is-ok { border-color: var(--pv-ok); background: var(--pv-ok-bg); }
.pv .pv-in.is-bad { border-color: var(--pv-bad); background: var(--pv-bad-bg); text-decoration: line-through; }
.pv .pv-sign { width: 44px; height: 44px; flex: none; font: inherit; font-size: 20px; font-weight: 800; color: inherit; background: var(--pv-head); border: 2px solid var(--pv-line); border-radius: 8px; cursor: pointer; }
.pv .pv-sign:disabled { opacity: .55; cursor: default; }
.pv-mark { font-weight: 800; white-space: nowrap; }
.pv-mark:empty { display: none; }
.pv-mark.is-ok { color: var(--pv-ok); } .pv-mark.is-bad { color: var(--pv-bad); }
.pv-unitrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.pv-unit-l { font-weight: 700; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pv .pv-chip { min-width: 64px; min-height: 44px; padding: 4px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; font: inherit; font-size: 18px; font-weight: 700; color: inherit; background: var(--pv-in); border: 2px solid var(--pv-line); border-radius: 12px; cursor: pointer; }
.pv .pv-chip[aria-checked="true"] { border: 3px solid var(--pv-accent); background: var(--pv-head); }
.pv .pv-chip[aria-checked="true"] .pv-chip-m:empty::before { content: "●"; color: var(--pv-accent); font-size: 14px; }
.pv .pv-chip:disabled { opacity: 1; cursor: default; }
.pv .pv-chip.is-right { border: 3px solid var(--pv-ok); background: var(--pv-ok-bg); }
.pv .pv-chip.is-wrong { border: 3px solid var(--pv-bad); background: var(--pv-bad-bg); }
.pv-chip.is-right .pv-chip-m { color: var(--pv-ok); } .pv-chip.is-wrong .pv-chip-m { color: var(--pv-bad); }
.pv-msg { color: var(--pv-bad); font-weight: 700; }
.pv-msg:empty { display: none; }
.pv .pv-in:focus-visible, .pv .pv-chip:focus-visible, .pv .pv-sign:focus-visible, .pv .pv-statebtn:focus-visible { outline: 3px solid var(--tlg-focus, #b84c00); outline-offset: 2px; }

/* Briefing example and Start art */
.pv-example { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: center; color: #1f2933; }
html[data-theme="dark"] .pv-example { color: #eef2f6; }
.pv-example figure { margin: 0; --pv-plot: transparent; }
.pv-example figcaption { font-weight: 700; margin-bottom: 4px; text-align: center; }
.pv-example .pv-graph { max-width: 100%; height: auto; }
.pv-example .pv-ex-cyl svg { width: 270px; height: auto; }
.pv-example--narrow { flex-direction: column; align-items: center; }
html[data-theme="dark"] .pv-example, html[data-theme="dark"] .pv-start { --pv-plot: #18212b; --pv-grid: #2e3a47; --pv-ink: #eef2f6; --pv-path: #8cc0f5; --pv-iso: #9aa9ba; --pv-neg: #b9682f; --pv-pos: #3f8f55; --pv-soft: #c9d3de; }
html[data-theme="dark"] .pv-example figure { --pv-plot: transparent; }
.pv-start { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--pv-plot, #fbfdff); }
.ps-brief-exstage .pv-graph { max-height: none; }

/* The assignment card sits at the foot of the left column, so it never covers the answer sheet. */
@media (min-width: 901px) { html.ps-locked .lga-card { right: auto !important; left: 12px; max-width: 276px; } }
/* The calculator opens over the customer column (left), not over the answers. */
@media (min-width: 901px) { .ps .ps-calc, .ps-calc { right: auto; left: 30px; bottom: 76px; } }

/* Narrower than a Chromebook (1024 wide and tablets): one column; the gas and the table side by side above the graph. */
@media (max-width: 1180px) {
  .pv { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .pv-left, .pv-right { min-height: auto; }   /* auto rows in a fixed-height grid would otherwise squeeze the cards */
  .pv-left { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .pv-graphcard { flex: none; min-height: 0; }
  .pv-plothost { flex: none; height: 330px; }
}
@media (max-width: 900px) { .pv { position: static; overflow: visible; } }
@media (max-width: 640px) {
  .pv { padding: 8px; }
  .pv-left { grid-template-columns: minmax(0, 1fr); }
  .pv-eqs { columns: 1; }
  .pv-cells { grid-template-columns: minmax(0, 1fr); }
  .pv-plothost { height: 300px; }
}
