/* Aquifer Hunter: the groundwater survey (survey desk on the left; the cross-section, the AP calculations, the test
   button and the readout on the right). Scene by art.js, colors from the --ah-* properties below (light and dark). */
html {
  --ah-sky1: #8fc8f0; --ah-sky2: #d9eefb; --ah-hill1: #8fb67a; --ah-hill2: #5f8a52; --ah-win: #f4f1ea;
  --ah-ink: #17242c; --ah-panel1: #f5f8f9; --ah-panel2: #e3edf0; --ah-accent: #245b70; --ah-ok: #13704a; --ah-bad: #b3261e;
  --ah-chip: #ffffff; --ah-chip-on: #d3e9ef; --ah-warn: #7a3d00; --ah-warn-bg: #fff1d6; --ah-plate: rgba(255, 255, 255, .9);
  --ah-plate-ink: #1b2328; --ah-ghost: #10364a; --ah-cond: #ffffff; --ah-pop: #ffffff;
}
html[data-theme="dark"] {
  --ah-sky1: #142347; --ah-sky2: #34507a; --ah-hill1: #45603d; --ah-hill2: #2c4227; --ah-win: #ffd84a;
  --ah-ink: #e8eff3; --ah-panel1: #1b2a31; --ah-panel2: #132027; --ah-accent: #8fd0e3; --ah-ok: #4fd08c; --ah-bad: #ff8a80;
  --ah-chip: #172228; --ah-chip-on: #1d4251; --ah-warn: #ffc874; --ah-warn-bg: #3a2a10; --ah-plate: rgba(16, 24, 29, .88);
  --ah-plate-ink: #eef4f6; --ah-ghost: #e9f6ff; --ah-cond: #18252c; --ah-pop: #18252c;
}
.ah { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 10px; padding: 8px 10px; color: var(--tlg-text); font-size: 16px; }
.ah input, .ah button { font: inherit; }
.ah-controls { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; padding: 8px 12px;
  background: linear-gradient(var(--ah-panel1), var(--ah-panel2)); color: var(--ah-ink); border: 3px solid var(--ah-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.ah-right { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; overflow: auto; }
.ah-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ah-accent); }
.ah-step, .ah-step-b { display: grid; gap: 4px; }
.ah-step-h, .ah-calc-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; font-weight: 800; }
.ah-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ah-accent); color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .ah-n { color: #0d1a24; }
.ah-step.is-done .ah-n, .ah-calc.is-done .ah-n { background: var(--ah-ok); }
.ah-mark { margin-left: auto; font-weight: 800; white-space: nowrap; }
.ah-mark.is-ok, .ah-fmark.is-ok { color: var(--ah-ok); }
.ah-mark.is-bad, .ah-fmark.is-bad { color: var(--ah-bad); }
.ah-sub { margin: 2px 0 0; font-size: 16px; font-weight: 700; }

/* site chips */
.ah-sites { display: grid; gap: 2px; }
.ah-sites-l { font-weight: 700; }
.ah-sites-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.ah-site { min-height: 38px; border: 2px solid #9fb0bc; border-radius: 10px; background: var(--ah-chip); color: var(--ah-ink); font-size: 16px; font-weight: 700; cursor: pointer; }
.ah-site:hover:not(:disabled) { border-color: var(--ah-accent); }
.ah-site.is-on { border-color: var(--ah-accent); background: var(--ah-chip-on); box-shadow: inset 0 -4px 0 var(--ah-accent); }
.ah-site:disabled { cursor: default; }

/* dials */
.ah-dial { display: grid; gap: 0; }
.ah-dial-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.ah-dial-v { font-weight: 800; color: var(--ah-accent); white-space: nowrap; }
.ah-dial.is-unset .ah-dial-v { font-weight: 600; font-style: italic; color: var(--ah-ink); opacity: .8; }
.ah-dial-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 6px; }
.ah-dial input { width: 100%; min-height: 30px; margin: 0; font-size: 16px; accent-color: var(--ah-accent); cursor: pointer; }
.ah-dial.is-unset input { opacity: .55; }
.ah-step-btn { min-height: 36px; border-radius: 10px; border: 2px solid var(--ah-accent); background: var(--ah-chip); color: var(--ah-ink); font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; }
.ah-step-btn:disabled { opacity: .45; cursor: default; }
.ah input:focus-visible, .ah button:focus-visible, .ah summary:focus-visible, .ah-scene:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }

/* prediction chips */
.ah-chips { display: grid; gap: 4px; }
.ah-chips--units { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ah-chips--units .ah-chip { grid-column: span 2; padding-right: 9px; justify-content: center; text-align: center; }
.ah-chips--units .ah-chip:nth-child(n+4) { grid-column: span 3; }
.ah-chips--units .ah-chip-m { right: 4px; }
.ah-chip { position: relative; display: flex; align-items: center; min-height: 36px; padding: 3px 24px 3px 9px; border: 2px solid #9fb0bc; border-radius: 10px;
  background: var(--ah-chip); color: var(--ah-ink); font-size: 16px; line-height: 1.15; text-align: left; cursor: pointer; }
.ah-chip:hover:not(:disabled) { border-color: var(--ah-accent); }
.ah-chip.is-on { border-color: var(--ah-accent); background: var(--ah-chip-on); font-weight: 700; box-shadow: inset 4px 0 0 var(--ah-accent); }
.ah-chip:disabled { cursor: default; opacity: 1; }
.ah:not(.is-locked) .ah-chip:disabled:not(.is-on) { opacity: .6; }
.ah-chip-m { position: absolute; right: 8px; font-weight: 800; }
.ah-chip.is-key { border-color: var(--ah-ok); box-shadow: inset 4px 0 0 var(--ah-ok); }
.ah-chip.is-key .ah-chip-m { color: var(--ah-ok); }
.ah-chip.is-wrong { border-color: var(--ah-bad); border-style: dashed; }
.ah-chip.is-wrong .ah-chip-m { color: var(--ah-bad); }
.ah-seal { margin: 0; font-size: 16px; font-style: italic; color: var(--ah-warn); }

/* reference pop-overs (open over the section) */
.ah-refs { display: flex; flex-wrap: wrap; gap: 5px; margin-left: auto; }
.ah-pop > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 1px 10px; border: 2px solid var(--ah-accent); border-radius: 999px;
  background: var(--ah-chip); color: var(--ah-ink); font-weight: 700; cursor: pointer; }
.ah-pop > summary::-webkit-details-marker { display: none; }
.ah-pop > summary::before { content: '📖'; font-size: 16px; }
.ah-pop[open] > summary { background: var(--ah-accent); color: #fff; }
html[data-theme="dark"] .ah-pop[open] > summary { color: #0d1a24; }
.ah-pop-b { position: absolute; z-index: 6; left: 0; right: 0; top: 76px; max-height: calc(100% - 84px); overflow: auto; padding: 12px 16px;
  background: var(--ah-pop); color: var(--ah-ink); border: 3px solid var(--ah-accent); border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.3); font-size: 16px; line-height: 1.4; }
.ah-pop-b h4 { margin: 0 0 6px; font-size: 18px; }
.ah-pop-b p { margin: 0 0 8px; }
.ah-pop-b table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; }
.ah-pop-b caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.ah-pop-b th, .ah-pop-b td { padding: 4px 6px; border-bottom: 1px solid #7d8f98; text-align: left; }

/* right side */
.ah-conds { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.ah-cond { padding: 3px 10px; border-radius: 999px; background: var(--ah-cond); border: 2px solid #9fb0bc; color: var(--ah-ink); font-size: 16px; line-height: 1.25; }
.ah-cond.is-warn { border-color: #b26a1c; background: var(--ah-warn-bg); color: var(--ah-warn); border-style: dashed; }
.ah-scene { flex: none; position: relative; border: 3px solid #26313a; border-radius: 12px; overflow: hidden; background: #26313a; box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.ah-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.ah-svg text { font: 700 18px var(--tlg-font, system-ui, sans-serif); }
.ah-plate rect { fill: var(--ah-plate); stroke: rgba(0,0,0,.25); stroke-width: 1; }
.ah-plate text { fill: var(--ah-plate-ink); }
.ah-plate.is-wt text { fill: #1f5fae; }
.ah-plate.is-press text { fill: #8a5c00; }
html[data-theme="dark"] .ah-plate.is-wt text { fill: #8cc4ff; }
html[data-theme="dark"] .ah-plate.is-press text { fill: #ffd26a; }
.ah-plate.is-env text { fill: #7a3405; }
html[data-theme="dark"] .ah-plate.is-env text { fill: #ffb36b; }
.ah-tick { fill: #10181d; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 4px; }
.ah-ruler { fill: #f4f1ea; stroke: #26313a; stroke-width: 1.5; }
.ah-cap { fill: #10283a; }
html[data-theme="dark"] .ah-cap { fill: #dfeefb; }
.ah-note { fill: #f4f6f8; paint-order: stroke; stroke: #23272e; stroke-width: 4px; }
.ah-stake-t { fill: #10283a; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 4px; }
html[data-theme="dark"] .ah-stake-t { fill: #f2f7fa; stroke: rgba(10,20,30,.9); }
.ah-stake { cursor: pointer; }
.ah-stake.is-on { opacity: 0; }
.ah-win { fill: var(--ah-win); stroke: #2a2420; stroke-width: .8; }
.ah-hit { cursor: crosshair; }
.ah.is-locked .ah-hit { cursor: default; }
.ah-drop { fill: #2f86d6; stroke: #0b3d6e; stroke-width: 1; }
.ah-drop.is-tainted { fill: #8a5a2b; stroke: #3b2410; }
.ah-pipe { opacity: 1; }
.ah.is-revealed .ah-run { display: none; }

.ah-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.ah-calc { display: flex; align-items: flex-end; gap: 10px; flex: 1 1 auto; }
.ah-calc-h { flex-direction: column; gap: 2px; padding-bottom: 4px; }
.ah-num { display: grid; gap: 2px; flex: 1 1 150px; min-width: 0; }
.ah-num-l { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; white-space: nowrap; }
.ah-num-row { display: flex; align-items: center; gap: 6px; }
.ah-num input { flex: 1 1 auto; min-width: 0; width: 100%; font-size: 17px; min-height: 38px; padding: 3px 8px; border: 2px solid #8796a1; border-radius: 8px; background: #fff; color: #17242c; }
html[data-theme="dark"] .ah-num input { background: #10171c; color: #eef3f6; border-color: #5d6f7b; }
.ah-num input.is-sealed { border-style: dashed; opacity: .8; }
.ah-unit { font-weight: 700; white-space: nowrap; }
.ah-fmark { font-weight: 800; }
.ah-run { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 6px 18px; margin-left: auto; border: 0; border-radius: 12px;
  background: linear-gradient(#2f7591, #1d4a5c); color: #fff; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 #0f2f3b; }
.ah-run:hover:not(:disabled) { filter: brightness(1.08); }
.ah-run:disabled { cursor: default; opacity: .55; box-shadow: none; }
.ah-run.is-done { opacity: 1; background: linear-gradient(#5b6b74, #3d4a52); font-weight: 700; }
.ah-run-i { font-size: 18px; }
.ah-obs { margin: 0; padding: 6px 10px; border-radius: 10px; background: var(--ah-cond); border: 2px solid #9fb0bc; color: var(--ah-ink); line-height: 1.35; }
.ah-obs.is-result { border-color: var(--ah-accent); border-left-width: 6px; }
.ah-readout { padding: 6px 10px; border-radius: 10px; background: var(--ah-cond); border: 2px solid var(--ah-accent); color: var(--ah-ink); }
.ah-readout ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
.ah-readout li { line-height: 1.3; }
.ah-readout li > span { font-weight: 800; display: inline-block; width: 1.1em; }
.ah-readout li.is-ok > span { color: var(--ah-ok); }
.ah-readout li.is-bad > span { color: var(--ah-bad); }

/* Briefing example */
.ah-ex { max-width: 620px; }
.ah-exsvg { display: block; width: 100%; height: auto; border-radius: 10px; border: 2px solid #26313a; }
.ah-exsvg text { font: 700 17px var(--tlg-font, system-ui, sans-serif); }

@media (max-width: 900px) {
  .ah { position: static; grid-template-columns: 1fr; }
  .ah-controls, .ah-right { overflow: visible; }
  .ah-scene { overflow-x: auto; }
  .ah-svg { min-width: 740px; }
  .ah-pop-b { position: static; margin-top: 6px; max-height: none; }
  .ah-right { position: static; }
  .ah-refs { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .ah * { transition: none !important; animation: none !important; }
}
