/* PES Reader: the spectroscopy console. Scenes by art.js, colors from the --pr-* properties below (light and dark).
   Comparison sample B is dashed and hatched as well as a second colour, so colour is never the only cue. */
html {
  --pr-bezel1: #dfe6ea; --pr-bezel2: #c3cfd6; --pr-screen1: #fbfdfc; --pr-screen2: #eef5f3; --pr-grid: rgba(36, 94, 118, .07);
  --pr-line: #3b5260; --pr-ink: #142833; --pr-text: #142833; --pr-muted: #4a5f6b; --pr-chip: #ffffff;
  --pr-axis: #2a3f4b; --pr-gridline: rgba(36, 94, 118, .16);
  --pr-peak: #1f7a8c; --pr-peak-hi: #4fc3d6; --pr-b: #b8541a; --pr-b-hi: #f0a46a;
  --pr-photon: #8a4fc7; --pr-atom: #f2c94c; --pr-scan: #11a37f; --pr-lampbg: #f4f7f8; --pr-lamp-on: #18b26b; --pr-lamp-off: #9aa8b0;
  --pr-metal1: #eef2f4; --pr-metal2: #c9d3d9; --pr-metal3: #9aa9b2;
  --pr-model: #1d7a3a; --pr-model-bg: #e3f4e8; --pr-handle: #ffffff; --pr-handle-ink: #142833; --pr-handle-line: #1f7a8c;
  --pr-panel1: #f7fbfc; --pr-panel2: #e9f2f4; --pr-chipbg: #ffffff; --pr-chip-on: #d7ecf2; --pr-chip-line: #8eaab5; --pr-accent: #245e76;
  --pr-build: #9a4a12; --pr-predict: #245e76;
}
html[data-theme="dark"] {
  --pr-bezel1: #2a363e; --pr-bezel2: #1a232a; --pr-screen1: #0f1d24; --pr-screen2: #0b161c; --pr-grid: rgba(120, 220, 200, .06);
  --pr-line: #8fa9b6; --pr-ink: #e8f0f3; --pr-text: #e8f0f3; --pr-muted: #a9bcc6; --pr-chip: #1c2d36;
  --pr-axis: #b9cbd4; --pr-gridline: rgba(150, 210, 230, .14);
  --pr-peak: #4fd1e0; --pr-peak-hi: #a6f0f8; --pr-b: #ff9a52; --pr-b-hi: #ffd0a8;
  --pr-photon: #c39bff; --pr-atom: #f2d36b; --pr-scan: #3ee6b0; --pr-lampbg: #14232b; --pr-lamp-on: #3ee68e; --pr-lamp-off: #4d5d66;
  --pr-metal1: #3a474f; --pr-metal2: #2a353c; --pr-metal3: #1d262c;
  --pr-model: #6fd68f; --pr-model-bg: #183526; --pr-handle: #1c2d36; --pr-handle-ink: #e8f0f3; --pr-handle-line: #4fd1e0;
  --pr-panel1: #16242c; --pr-panel2: #1d2f3a; --pr-chipbg: #1f333f; --pr-chip-on: #24566a; --pr-chip-line: #4f7383; --pr-accent: #7fc4dc;
  --pr-build: #ffad70; --pr-predict: #7fc4dc;
}

.core { height: 100%; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 16px; padding: 16px; overflow: auto; color: var(--pr-ink); font-size: 16px; box-sizing: border-box; }
.core * { box-sizing: border-box; }
.core-bench, .core-panel { min-width: 0; border-radius: 16px; overflow: auto; }
.core-bench { display: flex; flex-direction: column; gap: 10px; }
.core-panel { padding: 14px 16px; background: linear-gradient(180deg, var(--pr-panel1), var(--pr-panel2)); border: 1px solid var(--pr-chip-line); box-shadow: 0 2px 10px rgba(16, 43, 56, .12); }
.core-scene { flex: 0 0 auto; overflow: auto; border-radius: 14px; border: 2px solid var(--pr-line); background: var(--pr-bezel2); box-shadow: 0 4px 14px rgba(16, 43, 56, .22); }
.core-scene:focus-visible { outline: 3px solid #dd9823; outline-offset: 3px; }
.core-scene svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.core.pr[data-kind="build"] .core-scene svg { touch-action: none; }
.core-scene svg text { font-family: inherit; fill: var(--pr-text); font-size: 20px; }
.core-scene svg .pr-head { font-size: 22px; font-weight: 800; }
.core-scene svg .pr-chiptext, .core-scene svg .pr-lamptext { font-size: 20px; font-weight: 700; }
.core-scene svg .pr-tick { font-variant-numeric: tabular-nums; }
.core-scene svg .pr-axislab { font-weight: 700; fill: var(--pr-muted); }
.core-scene svg .pr-tagtext { font-weight: 800; }
.core-scene svg .pr-muted { fill: var(--pr-muted); font-style: italic; }
.core-scene svg .pr-model { fill: var(--pr-model); font-weight: 800; }
.core-scene svg .pr-axis { fill: none; stroke: var(--pr-axis); stroke-width: 2.4; }
.core-scene svg .pr-minor { fill: none; stroke: var(--pr-axis); stroke-width: 1.4; }
.core-scene svg .pr-gridline { fill: none; stroke: var(--pr-gridline); stroke-width: 1.4; stroke-dasharray: 4 5; }
.pes-handle { fill: var(--pr-handle); stroke: var(--pr-handle-line); stroke-width: 3.4; cursor: grab; touch-action: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.pes-handle-hit { cursor: grab; touch-action: none; }
.core.dragging .pes-handle, .core.dragging .pes-handle-hit { cursor: grabbing; }
.pes-handle:hover { stroke-width: 4.4; }
.pes-handle:focus { outline: none; }
.pes-handle:focus-visible { stroke: #dd9823; stroke-width: 5; }
.pes-handle[aria-disabled="true"], .core.locked .pes-handle-hit { cursor: default; }
.pes-handle[aria-disabled="true"] { opacity: .75; filter: none; }
.core-observation { margin: 0; min-height: 3em; padding: 10px 14px; line-height: 1.45; font-weight: 600; border-left: 5px solid var(--pr-accent); background: var(--pr-panel1); border-radius: 0 10px 10px 0; }

.pr-case { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--pr-chipbg); border: 1px dashed var(--pr-chip-line); }
.pr-case p { margin: 6px 0; line-height: 1.45; }
.pr-case .pr-case-kicker { margin-top: 0; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--pr-predict); }
.pr-case .pr-source { color: var(--pr-muted); font-style: italic; }
.pr-table { border-collapse: collapse; margin: 6px 0; width: 100%; font-variant-numeric: tabular-nums; }
.pr-table th, .pr-table td { border: 1px solid var(--pr-chip-line); padding: 5px 8px; text-align: center; }
.pr-table tr:first-child th { background: var(--pr-panel2); }
.pr-table tr > th:first-child { text-align: left; }

.pr-step { margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--pr-chip-line); font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.pr-step-build { color: var(--pr-build); }
.pr-step-predict { color: var(--pr-predict); }
.pr-tools-note { margin: 0 0 8px; line-height: 1.4; }
.pr-builder { margin-bottom: 8px; }
.pr-build-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pr-build-sub { font-weight: 800; font-size: 18px; }
.pr-build-head { margin-bottom: 4px; font-weight: 700; color: var(--pr-muted); }
.pr-build-head span:last-child { text-align: center; }
.pr-stepper { display: flex; align-items: center; gap: 4px; }
.pr-stepper input { width: 56px; text-align: center; }
.core .pr-step-btn { font: inherit; font-size: 20px; font-weight: 800; width: 44px; min-height: 44px; border-radius: 10px; border: 2px solid var(--pr-chip-line); background: var(--pr-chipbg); color: inherit; cursor: pointer; }

.pr-field { display: grid; gap: 6px; margin: 0 0 12px; }
.pr-field-compact { grid-template-columns: minmax(0, 1fr); margin-bottom: 8px; }
.pr-label { font-weight: 700; line-height: 1.35; }
.pr-num { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pr-num input, .pr-stepper input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 18px; font-weight: 700; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--pr-chip-line); background: var(--pr-chipbg); color: inherit; font-variant-numeric: tabular-nums; }
.pr-stepper input { flex: 0 0 56px; }
.pr-unit { flex: 0 0 auto; font-weight: 600; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.core .pr-chip { font: inherit; font-size: 16px; font-weight: 700; min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 2px solid var(--pr-chip-line); background: var(--pr-chipbg); color: inherit; cursor: pointer; text-align: left; line-height: 1.3; }
.core .pr-chip.on { background: var(--pr-chip-on); border-color: var(--pr-accent); box-shadow: inset 0 0 0 1px var(--pr-accent); }
.core .pr-chip.on::before { content: "✓ "; }
.core .pr-chip:hover:not(:disabled), .core .pr-step-btn:hover:not(:disabled) { border-color: var(--pr-accent); }
.pr-elements { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.core .pr-elem { position: relative; display: grid; justify-items: center; align-content: center; gap: 0; min-height: 84px; padding: 24px 4px 6px; border-radius: 10px; text-align: center; }
.core .pr-elem.on::before { content: "✓"; position: absolute; right: 6px; top: 4px; }
.pr-elem-z { position: absolute; left: 7px; top: 4px; font-size: 16px; font-weight: 600; }
.pr-elem-sym { font-size: 26px; font-weight: 800; line-height: 1.05; }
.pr-elem-name { font-size: 16px; font-weight: 600; }
.pr-actions { display: flex; gap: 10px; margin-top: 8px; }
.core-run, .core-revise { font: inherit; font-size: 16px; font-weight: 800; min-height: 46px; border-radius: 12px; padding: 10px 16px; cursor: pointer; }
.core-run { flex: 1 1 auto; background: #245e76; color: #fff; border: 0; box-shadow: 0 3px 0 #163c4c; }
.core-revise { background: var(--pr-chipbg); color: inherit; border: 2px solid var(--pr-chip-line); }
.core button:disabled, .core input:disabled { opacity: .6; cursor: default; }
.core .pr-chip.on:disabled { opacity: .85; }
.core-run:disabled { box-shadow: none; }
.core :focus-visible { outline: 3px solid #dd9823; outline-offset: 2px; }
.core-status { margin: 8px 0 4px; line-height: 1.4; font-weight: 600; }
.pr-precision { margin: 0 0 6px; line-height: 1.4; }
.core-about summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.core-about p { line-height: 1.5; margin: 0 0 8px; }
.pr-example { margin: 8px 0; }

body .ps-kicker, body .ps-hint-note, body .ps-badge { font-size: 16px; }

@media (max-width: 900px) {
  .core { height: auto; grid-template-columns: 1fr; padding: 12px; }
  .core-bench, .core-panel { overflow: visible; }
  .core-panel { padding-bottom: 30px; }
  .core-scene svg { min-width: 760px; }
}
@media (prefers-reduced-motion: reduce) { .core * { animation: none !important; transition: none !important; } }
