/* Graph Doctor: the clipboard, graph paper, drop zones, hotspots and side-panel cards. The paper stays light in dark
 * mode (it's paper); the side panel follows the site tokens. */
.gd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 14px; height: 100%; padding: 10px 12px 10px 4px; box-sizing: border-box; }

/* clipboard */
.gd-board { position: relative; min-height: 0; display: flex; flex-direction: column; background: #a8743f; border-radius: 16px; padding: 22px 12px 12px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12), 0 6px 14px rgba(0, 0, 0, .16); }
.gd-clip { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 120px; height: 26px; border-radius: 8px; background: linear-gradient(#b9c1c9, #8d96a0); box-shadow: 0 2px 4px rgba(0, 0, 0, .25); z-index: 2; }
.gd-clip span { position: absolute; left: 30px; right: 30px; top: 8px; height: 8px; border-radius: 4px; background: #5f6873; }
.gd-paper:focus { outline: none; }
.gd-paper:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.gd-paper { position: relative; flex: 1; min-height: 0; background: #fdfaf1; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gd-svg { display: block; width: 100%; height: 100%; color: #26303b; }
.gd-svg text { user-select: none; -webkit-user-select: none; }

/* hotspots */
.gd-hot { fill: rgba(0, 0, 0, 0); stroke: transparent; stroke-width: 2.5; cursor: pointer; pointer-events: all; }
.gd-hot:hover { stroke: rgba(11, 110, 127, .7); stroke-dasharray: 6 5; }
.gd-hot:focus { outline: none; }
.gd-hot:focus-visible { stroke: #0b6e7f; stroke-width: 3.5; stroke-dasharray: 7 4; }
.gd-hot--pt:hover, .gd-hot--pt:focus-visible { fill: rgba(11, 110, 127, .14); }
.gd-hot.is-off { cursor: default; pointer-events: none; }

/* drop zones on the graph (variables) */
.gd-zone--x, .gd-zone--y { position: absolute; display: flex; align-items: center; justify-content: center; gap: 6px; border: 2.5px dashed #7d8b99; border-radius: 10px; background: rgba(255, 255, 255, .55); box-sizing: border-box; padding: 4px; }
.gd-zone--x { flex-wrap: wrap; }
.gd-zone--y { flex-direction: column; flex-wrap: wrap; }
.gd-zone-ph { color: #4a5360; font-size: var(--tlg-text-md); font-weight: 700; pointer-events: none; }
.gd-zone--y .gd-zone-ph { writing-mode: vertical-rl; transform: rotate(180deg); }
.gd-zone.has-token .gd-zone-ph { display: none; }
.gd-paper.is-plotted .gd-zone--x, .gd-paper.is-plotted .gd-zone--y { border-color: transparent; background: transparent; }

/* variable cards */
.gd-tray { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-height: 48px; align-items: stretch; }
.gd-tray .gd-token { width: 100%; }
.ps .gd-token { position: relative; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 2px solid #33414f; background: #fff8d6; color: #1c242c; font: 700 var(--tlg-text-md)/1.2 var(--tlg-font); text-align: left; box-shadow: 0 2px 0 #33414f; cursor: grab; }
.ps .gd-token:focus-visible { outline: var(--tlg-focus-width) solid var(--ps-accent); outline-offset: 2px; }
.gd-zone--y .gd-token { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 100%; padding: 12px 8px; box-shadow: none; }
.gd-zone--x .gd-token { max-width: 100%; }
.gd-token.is-ok, .gd-token.is-moved { cursor: default; }
.gd-token[data-mark]::after { content: attr(data-mark); position: absolute; top: -10px; right: -10px; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; line-height: 24px; text-align: center; color: #fff; writing-mode: horizontal-tb; }
.gd-token.is-ok::after { background: #2e7d32; }
.gd-zone--y .gd-token[data-mark]::after { transform: rotate(180deg); top: auto; bottom: -10px; right: -10px; }
.gd-token.is-moved { border-color: #b45309; border-style: dashed; }
.gd-token.is-moved::after { background: #b45309; }
.gd-zone--c { min-height: 92px; }
.gd-zone--c .gd-zone-slot { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; border: 2.5px dashed var(--tlg-border-strong); border-radius: 10px; padding: 6px; }
html.pdz-armed .gd-zone--c .gd-zone-slot { border-color: var(--ps-accent); }

/* side panel */
.gd-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 2px; }
.gd-card { background: var(--tlg-surface); border: var(--tlg-border-width) solid var(--tlg-border); border-radius: var(--tlg-radius-lg); padding: 10px 12px; }
.gd-card p { margin: 0; line-height: 1.4; }
.gd-h { margin: 0 0 6px; font-size: var(--tlg-text-md); }
.gd-story { font-size: var(--tlg-text-md); }
.gd-help { margin-top: 8px !important; font-size: var(--tlg-text-md); }
.gd-status p { font-size: var(--tlg-text-md); }
.gd-picked { display: block; margin-top: 2px; font-weight: 700; color: var(--ps-accent); min-height: 1.4em; }
.gd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gd-notes--table { padding: 8px; }
.gd-fixes .gd-picked { margin: -2px 0 6px; }
.gd-fixes .gd-opt { min-height: 44px; padding: 6px 12px; }
.gd-keypad .pn-key { min-height: 46px; }

/* data table */
.gd-table { border-collapse: collapse; width: 100%; font-size: var(--tlg-text-md); font-variant-numeric: tabular-nums; }
.gd-table th, .gd-table td { border: 1px solid var(--tlg-border); padding: 1px 6px; text-align: center; line-height: 1.35; }
.gd-table th { background: var(--tlg-bg-band); font-weight: 700; }
.gd-table--2 td:nth-child(3), .gd-table--2 th:nth-child(3) { border-left: 3px double var(--tlg-border-strong); }

/* option cards */
.gd-opts { display: flex; flex-direction: column; gap: 8px; }
.ps .gd-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); font: inherit; text-align: left; cursor: pointer; }
.ps .gd-opt:hover:not(:disabled) { border-color: var(--ps-accent); }
.ps .gd-opt:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.ps .gd-opt[aria-checked="true"] { border-color: var(--ps-accent); box-shadow: inset 0 0 0 2px var(--ps-accent); background: color-mix(in srgb, var(--ps-accent) 10%, var(--tlg-surface)); }
.ps .gd-opt:disabled { cursor: default; opacity: 1; }
.gd-opt-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--tlg-bg-band); font-weight: 700; font-size: var(--tlg-text-md); }
.gd-opt[aria-checked="true"] .gd-opt-n { background: var(--ps-accent); color: var(--ps-accent-ink, #fff); }
.gd-opt-ic { flex: none; width: 48px; height: 36px; color: var(--ps-accent); }
.gd-opt-ic svg { width: 100%; height: 100%; display: block; }
.gd-opt-t { display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.gd-opt-t small { font-size: var(--tlg-text-md); color: var(--tlg-text-muted); }
.gd-opt-mark { margin-left: auto; font-weight: 700; font-size: 20px; }
.gd-opt.is-right { border-color: #2e7d32 !important; }
.gd-opt.is-right .gd-opt-mark { color: #2e7d32; }
.gd-opt.is-wrong { border-color: #c62828 !important; border-style: dashed !important; }
.gd-opt.is-wrong .gd-opt-mark { color: #c62828; }

/* line or bar: the lab-notes sheet on the clipboard, replaced by the graph after Check */
.gd-paper--sheet { align-items: stretch; justify-content: stretch; }
.gd-sheet { position: absolute; inset: 0; padding: 18px 26px; overflow: auto; color: #1c242c; background: repeating-linear-gradient(#fdfaf1 0 27px, #cfe0ec 27px 28px); transition: opacity .35s ease; }
.gd-sheet-h { margin: 0 0 6px; font-size: var(--tlg-text-lg); }
.gd-sheet .gd-story { margin: 0 0 12px; line-height: 28px; }
.gd-sheet .gd-table { max-width: 420px; background: #fff; font-size: var(--tlg-text-md); }
.gd-sheet .gd-table th, .gd-sheet .gd-table td { border-color: #b8c4cf; color: #1c242c; }
.gd-sheet .gd-table th { background: #eef2f5; }
.gd-sheet.is-leaving { opacity: 0; pointer-events: none; }
.gd-svg.is-arriving { position: relative; z-index: 1; }

/* the Briefing's worked example: sick → healed */
.gd-ex { display: flex; align-items: center; gap: 10px; }
.gd-ex-fig { flex: 1; min-width: 0; margin: 0; background: #fdfaf1; border: 2px solid #a8743f; border-radius: 10px; padding: 4px; }
.gd-ex-fig .gd-svg { height: auto; aspect-ratio: 640 / 500; }
.gd-ex-fig figcaption { text-align: center; font-weight: 700; font-size: var(--tlg-text-sm); color: #1c242c; padding: 2px 0 4px; }
.gd-ex-arrow { flex: none; display: flex; flex-direction: column; align-items: center; font-size: 30px; font-weight: 700; color: var(--ps-accent); }
.gd-ex-arrow small { font-size: var(--tlg-text-sm); }
.gd-ex--drawer { flex-direction: column; }
.gd-ex--drawer .gd-ex-fig { width: 100%; }
.gd-ex--drawer .gd-ex-arrow { transform: rotate(90deg); }
.gd-ex--drawer .gd-ex-arrow small { transform: rotate(-90deg); }

/* narrow screens: stack */
@media (max-width: 900px) {
  .gd { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 1fr) auto; overflow: auto; }
  .gd-board { min-height: 320px; }
}

/* the assignment card (labgames-assignment.js) sits over the bottom-right corner while playing: keep that corner free */
@media (min-width: 901px) { html.ps-locked:has(.lga-card) .gd-side { padding-bottom: 104px; } html.ps-locked:has(.lga-card) .gd-traycard .gd-help { display: none; } }
