/* Photon Gun: an optics-bench photoelectron station. Scene by art.js, colors from the --pg-* properties (light and dark). */
html {
  --pg-wall1: #dfe7f1; --pg-wall2: #f3f6fa; --pg-bench1: #4a5560; --pg-bench2: #2f373f; --pg-hole: #1e252b; --pg-edge: #7d8a96;
  --pg-body1: #6c7b8a; --pg-body2: #3d4954; --pg-body3: #232b33; --pg-line: #141b21; --pg-dial: #f7f4ea; --pg-needle: #b3261e;
  --pg-glass1: rgba(214, 236, 248, .78); --pg-glass2: rgba(170, 205, 226, .55); --pg-tube: #5d7d93; --pg-wire: #8a5a1c;
  --pg-electron: #1f78d1; --pg-photon-w: 3.5; --pg-uv: #7a4dff; --pg-ir: #9b2a2a; --pg-idle: #4e5860; --pg-arrow: #172c3a;
  --pg-ink: #172c3a; --pg-tag-bg: rgba(255, 255, 255, .85); --pg-counter: #10161b; --pg-count: #7dff9a; --pg-level: #172c3a;
  --pg-card: #f6f8fc; --pg-card-line: #c4cede; --pg-seal: #efe9fb; --pg-accent: #5b3fa8; --pg-ok: #13704a; --pg-bad: #b3261e;
  --pg-phi: #c9d3df; --pg-k: #2f9e62; --pg-short: #f1c8c4;
}
html[data-theme="dark"] {
  --pg-wall1: #18212b; --pg-wall2: #222d38; --pg-bench1: #2c343c; --pg-bench2: #191f25; --pg-hole: #0b0f12; --pg-edge: #56636f;
  --pg-body1: #56636f; --pg-body2: #2f3a44; --pg-body3: #171d23; --pg-line: #05080a; --pg-dial: #e8e3d4; --pg-needle: #e0453a;
  --pg-glass1: rgba(120, 170, 200, .35); --pg-glass2: rgba(80, 120, 150, .3); --pg-tube: #8fb3c9; --pg-wire: #d19a4b;
  --pg-electron: #6cb8ff; --pg-uv: #a98bff; --pg-ir: #e06a6a; --pg-idle: #6c7680; --pg-arrow: #e8eef1;
  --pg-ink: #e8eef1; --pg-tag-bg: rgba(20, 28, 36, .85); --pg-level: #e8eef1;
  --pg-card: #1d2630; --pg-card-line: #3c4a58; --pg-seal: #2b2442; --pg-accent: #a98bff; --pg-ok: #5fd39a; --pg-bad: #ff8a80;
  --pg-phi: #4a5868; --pg-k: #2f8f5a; --pg-short: #6b3632;
}

.core { height: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 18px; padding: 18px; overflow: auto; color: var(--tlg-ink, #172c3a); font-size: 16px; box-sizing: border-box; }
.core * { box-sizing: border-box; }
.core-bench, .core-panel { min-width: 0; padding: 18px; background: var(--tlg-surface, #fff); border: 1px solid var(--tlg-border, #afc0c9); border-radius: 16px; overflow: auto; box-shadow: 0 2px 10px rgba(20, 30, 50, .08); }
.core-kicker { text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--pg-accent); margin: 0; }
.core h2 { font-size: 24px; margin: 6px 0 12px; }
.core h3 { font-size: 18px; margin: 0 0 12px; }
.core-scene { overflow: auto; border-radius: 12px; border: 1px solid var(--tlg-border, #afc0c9); }
.core-scene svg { display: block; width: 100%; min-width: 460px; color: var(--pg-ink); }
svg text.pg-t { font-size: 24px; fill: var(--pg-ink); font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
svg text.pg-onbench { fill: #f3f6fa; }
.core-observation { min-height: 3em; line-height: 1.5; font-weight: 600; }
.core-evidence { padding: 12px 14px; border-radius: 12px; background: var(--pg-card); border: 1px dashed var(--pg-card-line); }
.core-evidence p, .core-about p { line-height: 1.5; margin: 6px 0; }
.core-about { margin-top: 10px; }
.core-about summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }

/* SVG parts */
.pg-edge { stroke: var(--pg-edge); stroke-width: 2; }
.pg-stand { fill: var(--pg-body3); }
.pg-outline { stroke: var(--pg-line); stroke-width: 2; }
.pg-dial { fill: var(--pg-dial); stroke: var(--pg-line); stroke-width: 3; }
.pg-needle { stroke: var(--pg-needle); stroke-width: 4; stroke-linecap: round; }
.pg-hub { fill: var(--pg-line); }
.pg-meterbg { fill: var(--pg-body3); stroke: var(--pg-line); }
.pg-meterfill { fill: #ffd23f; }
.pg-lens { stroke: var(--pg-line); stroke-width: 2; }
.pg-aim { stroke: var(--pg-idle); stroke-width: 2; stroke-dasharray: 6 8; }
.pg-tube { stroke: var(--pg-tube); stroke-width: 3; }
.pg-shine { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 4; stroke-linecap: round; }
.pg-grid path { stroke: var(--pg-tube); stroke-width: 3; }
.pg-wire { fill: none; stroke: var(--pg-wire); stroke-width: 4; }
.pg-counter { fill: var(--pg-counter); stroke: var(--pg-line); stroke-width: 2; }
svg text.pg-t.pg-count { fill: var(--pg-count); font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
svg text.pg-t.pg-tag { font-size: 22px; font-style: italic; }
svg text.pg-t.pg-small { font-size: 22px; }
svg text.pg-t.pg-strong { font-weight: 700; }
.pg-photon { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.pg-electron { fill: var(--pg-electron); stroke: var(--pg-line); stroke-width: 1.5; }
.pg-minus { stroke: #fff; stroke-width: 2.5; }
.pg-level { stroke: var(--pg-level); stroke-width: 4; stroke-linecap: round; }
.pg-level-from { stroke-dasharray: none; stroke-width: 6; }
.pg-ghost { fill: none; stroke: var(--pg-electron); stroke-width: 3; stroke-dasharray: 5 5; }
.pg-arrow { stroke: var(--pg-arrow); stroke-width: 4; }
.pg-jump { stroke: var(--pg-accent); stroke-width: 3; stroke-dasharray: 4 6; }

/* Panel */
.pg-card { padding: 12px; border-radius: 14px; background: var(--pg-card); border: 1px solid var(--pg-card-line); margin-bottom: 12px; }
.pg-card h3 { margin-bottom: 8px; }
.pg-predict.pg-sealed { background: var(--pg-seal); border-color: var(--pg-accent); }
.pg-seal { margin: -4px 0 10px; font-weight: 700; color: var(--pg-accent); }
.core-field { display: grid; gap: 4px; margin: 0 0 10px; font-weight: 600; }
.core-field:last-child { margin-bottom: 0; }
.core-field input, .core-field select, .core button { font: inherit; font-size: 16px; min-height: 44px; border-radius: 8px; border: 1px solid var(--tlg-border, #afc0c9); padding: 10px; background: var(--tlg-surface, #fff); color: inherit; max-width: 100%; width: 100%; }
.pg-slide { display: grid; grid-template-columns: minmax(0, 1fr) 9.5em; gap: 10px; align-items: center; }
.core-field input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--pg-accent); min-height: 44px; }
.pg-band { font-weight: 500; font-size: 16px; }
.pg-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.core button { font-weight: 700; margin: 0; cursor: pointer; }
.core-run { background: var(--pg-accent) !important; color: #fff !important; border-color: transparent !important; }
html[data-theme="dark"] .core-run { color: #160d33 !important; }
.core button:disabled { opacity: .55; cursor: default; }
.core :focus-visible { outline: 3px solid #dd9823; outline-offset: 3px; }
.core-status { line-height: 1.4; }

/* Reveal (practice only, after Check) */
.pg-reveal { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--pg-ok); animation: pg-in .35s ease-out; }
.pg-reveal.pg-bad { border-color: var(--pg-bad); }
.pg-reveal p { margin: 6px 0; line-height: 1.45; }
.pg-stamp { font-weight: 800; font-size: 18px; color: var(--pg-ok); }
.pg-bad .pg-stamp { color: var(--pg-bad); }
.pg-ledger { display: flex; gap: 2px; min-height: 44px; border-radius: 8px; overflow: hidden; margin: 8px 0; }
.pg-ledger span { display: flex; align-items: center; justify-content: center; padding: 4px 8px; font-weight: 700; font-size: 16px; white-space: nowrap; min-width: max-content; }
.pg-phi { background: var(--pg-phi); }
.pg-k { background: var(--pg-k); color: #fff; }
.pg-short { background: var(--pg-short); background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0, 0, 0, .12) 6px 12px); }
@keyframes pg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

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; padding: 14px; }
  .core-panel { padding-bottom: 30px; }
  .pg-ledger { flex-wrap: wrap; }
}
@media (max-width: 420px) { .pg-slide { grid-template-columns: 1fr; } .pg-buttons { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .core * { animation: none !important; transition: none !important; } }
