/* Hydraulic Harbor: the harbor fluid-systems desk. Scenes by art.js, colors from the --hh-* properties below (light and
   dark). Patterns (hatched, dotted) and text labels go with every color cue, so color is never the only signal. */
html {
  --hh-sky1: #e9f3f7; --hh-sky2: #d3e6ee; --hh-water1: #9fd0e2; --hh-water2: #2f7896; --hh-deep: #0d3a52; --hh-foam: #ffffff;
  --hh-oil1: #f6c26b; --hh-oil2: #c98317; --hh-steel1: #f2f5f7; --hh-steel2: #c3ced5; --hh-steel3: #7e909b;
  --hh-con1: #d9d4ca; --hh-con2: #a9a296; --hh-crate1: #e46b3a; --hh-crate2: #a8401b; --hh-hull: #3d5566;
  --hh-line: #233843; --hh-text: #142833; --hh-muted: #4a5f6b; --hh-chip: #ffffff; --hh-card: rgba(255, 255, 255, .88);
  --hh-air: #fdfbf2; --hh-ruler: #ffffff; --hh-probe: #f2c94c; --hh-dial: #fbfdfc; --hh-needle: #c0392b; --hh-piston: #5d6f7a;
  --hh-tracer: #ffffff; --hh-grid: rgba(36, 94, 118, .18); --hh-accent: #245e76;
  --hh-barP: #2f7896; --hh-barK: #d98a1c; --hh-barG: #5a8f3c;
  --hh-good: #1d7a3a; --hh-bad: #b3261e; --hh-stamp-bg: rgba(255, 255, 255, .92);
  --hh-panel1: #f7fbfc; --hh-panel2: #e9f2f4; --hh-border: #8eaab5; --hh-order1: #fffdf6; --hh-order2: #f6efdc; --hh-order-line: #c9b98f;
}
html[data-theme="dark"] {
  --hh-sky1: #13232c; --hh-sky2: #0e1a21; --hh-water1: #2a6f8a; --hh-water2: #0f3a4f; --hh-deep: #000; --hh-foam: #bfe6f3;
  --hh-oil1: #e7b35c; --hh-oil2: #a86c10; --hh-steel1: #5a6a73; --hh-steel2: #3a474f; --hh-steel3: #8ea2ad;
  --hh-con1: #5d5a54; --hh-con2: #3f3c37; --hh-crate1: #d7653a; --hh-crate2: #8e3a1a; --hh-hull: #6d8796;
  --hh-line: #a9c1cc; --hh-text: #e8f0f3; --hh-muted: #a9bcc6; --hh-chip: #1c2d36; --hh-card: rgba(18, 32, 40, .9);
  --hh-air: #2c3a40; --hh-ruler: #d9eef5; --hh-probe: #f2d36b; --hh-dial: #15242c; --hh-needle: #ff7a6b; --hh-piston: #9db0bb;
  --hh-tracer: #e8fbff; --hh-grid: rgba(150, 210, 230, .16); --hh-accent: #7fc4dc;
  --hh-barP: #4fb3d6; --hh-barK: #f0a64a; --hh-barG: #8cc66b;
  --hh-good: #6fd68f; --hh-bad: #ff8a80; --hh-stamp-bg: rgba(18, 32, 40, .92);
  --hh-panel1: #16242c; --hh-panel2: #1d2f3a; --hh-border: #4f7383; --hh-order1: #22282a; --hh-order2: #1b2124; --hh-order-line: #6b6250;
}

.core { height: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 16px; padding: 16px; overflow: auto; color: var(--hh-text); 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: 12px; }
.core-bench > * { flex-shrink: 0; }
.core-panel { padding: 14px 16px; background: linear-gradient(180deg, var(--hh-panel1), var(--hh-panel2)); border: 1px solid var(--hh-border); box-shadow: 0 2px 10px rgba(16, 43, 56, .12); }

/* Work order card */
.hh-order { position: relative; padding: 14px 18px 12px; border-radius: 14px; border: 1px solid var(--hh-order-line); background: linear-gradient(180deg, var(--hh-order1), var(--hh-order2)); box-shadow: 0 2px 8px rgba(16, 43, 56, .12); }
.hh-order::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 6px; border-radius: 0 4px 4px 0; background: repeating-linear-gradient(180deg, var(--hh-accent) 0 10px, transparent 10px 16px); }
.hh-order-head { display: flex; align-items: center; gap: 10px; }
.hh-order-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--hh-accent); color: #fff; font-size: 18px; font-weight: 800; }
html[data-theme="dark"] .hh-order-icon { color: #0e1a21; }
.core-kicker { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: 16px; color: var(--hh-muted); margin: 0; }
.core h2 { font-size: 24px; margin: 6px 0 6px; }
.hh-ticket, .hh-note, .hh-caption { font-size: 16px; line-height: 1.5; margin: 6px 0; }
.hh-target { font-weight: 700; padding: 6px 10px; border-radius: 8px; background: var(--hh-chip); border: 1px dashed var(--hh-order-line); }
.hh-fine { color: var(--hh-text); }

/* Scene */
.core-scene { flex: 0 0 auto; overflow: auto; border-radius: 14px; border: 2px solid var(--hh-line); background: var(--hh-sky2); 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%; min-width: 460px; height: auto; color: var(--hh-text); }
.core-scene svg text, .ps-start-art svg text { font-family: inherit; fill: var(--hh-text); font-size: 22px; pointer-events: none; }
.ps-start-art svg .hh-head, .ps-start-art svg .hh-strong, .ps-start-art svg .hh-small { font-weight: 800; }
.ps-start-art svg .hh-onwater, .ps-start-art svg .hh-oncrate { fill: #fff; font-weight: 800; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 3px; }
.core-scene svg .hh-head { font-size: 22px; font-weight: 800; }
.core-scene svg .hh-strong { font-weight: 800; }
.core-scene svg .hh-small { font-weight: 700; fill: var(--hh-muted); }
.core-scene svg .hh-read { font-weight: 800; font-variant-numeric: tabular-nums; }
.core-scene svg .hh-onwater, .core-scene svg .hh-oncrate { fill: #fff; font-weight: 800; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 3px; }
.core-scene svg .hh-stamp { font-size: 24px; font-weight: 900; letter-spacing: .06em; }
.core-scene svg .hh-good-ink { fill: var(--hh-good); }
.core-scene svg .hh-bad-ink { fill: var(--hh-bad); }
.hh-plot { touch-action: pan-x; cursor: ns-resize; }
.hh-example svg { min-width: 0; }

/* Motion: only after Test, and never with reduced motion. */
.hh-piston.hh-go { animation: hh-push 1.1s cubic-bezier(.3, .7, .3, 1) forwards; }
@keyframes hh-push { from { transform: translateX(0); } to { transform: translateX(var(--hh-dx)); } }
.hh-flow.hh-go { animation: hh-run 1s linear infinite; }
@keyframes hh-run { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -24; } }
.hh-needle { transform-origin: 526px 132px; transform: rotate(var(--hh-ang)); transition: transform .9s cubic-bezier(.3, .7, .3, 1); }
.hh-bubbles circle { fill: var(--hh-foam); opacity: .85; animation: hh-rise 1.6s ease-out infinite; }
.hh-bubbles circle:nth-child(2) { animation-delay: .4s; }
.hh-bubbles circle:nth-child(3) { animation-delay: .8s; }
@keyframes hh-rise { from { transform: translateY(0); opacity: .9; } to { transform: translateY(-30px); opacity: 0; } }
.hh-wave { animation: hh-sway 3s ease-in-out infinite alternate; }
@keyframes hh-sway { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) {
  .core *, .core-scene * { animation: none !important; transition: none !important; }
  .hh-piston.hh-go { transform: translateX(var(--hh-dx)); }
}

.core-observation { margin: 0; min-height: 3em; padding: 10px 14px; line-height: 1.5; font-weight: 600; border-left: 5px solid var(--hh-accent); background: var(--hh-panel1); border-radius: 0 10px 10px 0; }
.core-evidence { padding: 4px 14px; border-radius: 12px; background: var(--hh-panel1); border: 1px solid var(--hh-border); }
.core-about { padding: 0 14px; border-radius: 12px; border: 1px solid var(--hh-border); background: var(--hh-panel1); }
.core-about summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.core-about p { line-height: 1.5; }

/* Panel groups */
.core h3 { font-size: 20px; margin: 0 0 12px; }
.hh-group { border: 1px solid var(--hh-border); border-radius: 12px; padding: 8px 12px 4px; margin: 0 0 12px; background: var(--hh-chip); }
.hh-group legend { font-weight: 800; font-size: 17px; padding: 0 6px; display: flex; align-items: center; gap: 6px; }
.hh-step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--hh-accent); color: #fff; font-size: 16px; }
html[data-theme="dark"] .hh-step { color: #0e1a21; }
.hh-predict.is-sealed { background: repeating-linear-gradient(135deg, var(--hh-chip) 0 14px, var(--hh-panel2) 14px 16px); }
.hh-predict.is-sealed legend::after { content: "· sealed"; font-weight: 700; color: var(--hh-muted); }
.core-field { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 600; }
.core-field input, .core-field select, .core button { font: inherit; font-size: 16px; min-height: 44px; border-radius: 8px; border: 1px solid var(--hh-border); padding: 10px; background: var(--hh-panel1); color: inherit; max-width: 100%; width: 100%; }
.core-field input[type=range] { padding: 0; min-height: 44px; border: 0; background: transparent; accent-color: var(--hh-accent); }
.hh-ends { display: flex; justify-content: space-between; font-size: 16px; font-weight: 600; color: var(--hh-muted); margin-top: -8px; }
.hh-caption { font-weight: 400; margin: 0; }
.hh-caption:empty { display: none; }
.hh-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.hh-tools button { flex: 1; min-width: 140px; display: grid; gap: 2px; text-align: left; }
.hh-tools button span { font-weight: 500; color: var(--hh-muted); }
.hh-tools button[aria-pressed=true] { background: var(--hh-accent); color: #fff; border-color: var(--hh-accent); box-shadow: inset 0 0 0 2px #fff; }
.hh-tools button[aria-pressed=true]::before { content: "✓ selected"; font-size: 16px; font-weight: 800; }
.hh-tools button[aria-pressed=true] span { color: inherit; }
html[data-theme="dark"] .hh-tools button[aria-pressed=true] { color: #0e1a21; box-shadow: inset 0 0 0 2px #0e1a21; }
.core button { font-weight: 700; margin: 4px 0; cursor: pointer; }
.hh-testbar { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.core-run { background: var(--hh-accent) !important; color: #fff !important; border-color: var(--hh-accent) !important; }
html[data-theme="dark"] .core-run { color: #0e1a21 !important; }
.core button:disabled { opacity: .55; cursor: default; }
.core :focus-visible { outline: 3px solid #dd9823; outline-offset: 3px; }
.core-status { line-height: 1.45; color: var(--hh-muted); }
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; }
}
@media (max-width: 420px) { .hh-testbar { grid-template-columns: 1fr; } }
