/* Sonar Seafloor Mapper: the survey bridge of a seafloor-mapping ship. Scene drawn by art.js (colors from the --ssm-* properties below). */
html {
  --ssm-sky1: #bfe3f2; --ssm-sky2: #eaf6fa; --ssm-cloud: #ffffff;
  --ssm-sea1: #5fb3d3; --ssm-sea2: #23739c; --ssm-sea3: #0b2a47;
  --ssm-ruler: #0d2238; --ssm-ruler-ink: #dbe9f2; --ssm-grid: #bfe0ee;
  --ssm-hull1: #f6f3ec; --ssm-hull2: #cfc8b8; --ssm-stripe: #c8462f; --ssm-cabin: #f0eee8; --ssm-window: #2b5d78; --ssm-crane: #e2a21b;
  --ssm-line: #1d2b38; --ssm-buoy: #f08a24; --ssm-flag: #ffd23f;
  --ssm-beam: #ffe58a; --ssm-pick: #ffd23f; --ssm-ping: #fff2a8;
  --ssm-rock1: #93704f; --ssm-rock2: #3f2b1e; --ssm-sed1: #d8bd88; --ssm-sed2: #a88a55;
  --ssm-ok: #13704a; --ssm-bad: #b3261e; --ssm-ok-on-sea: #6ee7a7; --ssm-bad-on-sea: #ff9b8f;
  --ssm-accent: #1d5a7a; --ssm-ink: #142a36;
  --ssm-panel-bg1: #f4f9fb; --ssm-panel-bg2: #e2eef3; --ssm-panel-ink: #142a36;
  --ssm-btn: #ffffff; --ssm-btn-line: #8aa6b3; --ssm-on: #1d5a7a;
  --ssm-log: #fffdf3; --ssm-log-ink: #2a2414; --ssm-log-line: #b59a5e;
  --ssm-icon-sea: #cfe8f3; --ssm-icon-rock: #a7835e;
}
html[data-theme="dark"] {
  --ssm-sky1: #0f2234; --ssm-sky2: #1e3a52; --ssm-cloud: #3c566c;
  --ssm-sea1: #1f5f7d; --ssm-sea2: #12405c; --ssm-sea3: #061626;
  --ssm-ruler: #050f1a; --ssm-ruler-ink: #cfe0ea; --ssm-grid: #6f9ab0;
  --ssm-hull1: #d9d4c8; --ssm-hull2: #9c9585; --ssm-cabin: #c9c6bd; --ssm-window: #1b3d52;
  --ssm-line: #0a131b;
  --ssm-accent: #7cc6e0; --ssm-ink: #e6f2f7; --ssm-ok: #4fd08c; --ssm-bad: #ff8a80;
  --ssm-panel-bg1: #182730; --ssm-panel-bg2: #121e25; --ssm-panel-ink: #e6f2f7;
  --ssm-btn: #0e181e; --ssm-btn-line: #4d6b78; --ssm-on: #7cc6e0;
  --ssm-log: #2b281f; --ssm-log-ink: #f4efe3; --ssm-log-line: #9c845a;
  --ssm-icon-sea: #1f4a60; --ssm-icon-rock: #8a6a4b;
}

/* ── layout ── */
.ssm { position: absolute; inset: 0; display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.ssm input, .ssm button { font: inherit; }
.ssm-controls { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; padding: 8px 12px;
  background: linear-gradient(var(--ssm-panel-bg1), var(--ssm-panel-bg2)); color: var(--ssm-panel-ink); border: 3px solid var(--ssm-accent);
  border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.ssm-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.ssm-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ssm-accent); }
.ssm-dim { opacity: .82; font-weight: 400; }

/* survey log */
.ssm-log { display: grid; gap: 2px; padding: 6px 10px; border-radius: 10px; background: var(--ssm-log); color: var(--ssm-log-ink);
  border: 2px dashed var(--ssm-log-line); box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.ssm-log p { margin: 0; line-height: 1.3; }
.ssm-log-l { font-size: 16px; font-weight: 700; }
.ssm-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ssm-time { display: grid; justify-items: center; padding: 1px 2px; line-height: 1.15; border-radius: 8px; background: rgba(0,0,0,.05); border: 1px solid var(--ssm-log-line); }
html[data-theme="dark"] .ssm-time { background: rgba(255,255,255,.06); }
.ssm-time-k { font-size: 16px; font-weight: 600; opacity: .85; }
.ssm-time-v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; }
.ssm-speed, .ssm-site { font-size: 16px; }

/* steps */
.ssm-step { display: grid; gap: 4px; }
.ssm-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.ssm-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ssm-accent);
  color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .ssm-n { color: #0b1c22; }
.ssm-step-h.is-done .ssm-n { background: var(--ssm-ok); }

/* radio cards */
.ssm-card { display: flex; align-items: center; gap: 8px; text-align: left; min-height: 44px; padding: 4px 6px; border-radius: 10px;
  border: 2px solid var(--ssm-btn-line); background: var(--ssm-btn); color: var(--ssm-panel-ink); font-size: 16px; line-height: 1.15;
  cursor: pointer; position: relative; touch-action: manipulation; }
.ssm-card:hover:not(:disabled) { border-color: var(--ssm-on); }
.ssm-card.is-on { border-color: var(--ssm-on); box-shadow: inset 0 0 0 2px var(--ssm-on); font-weight: 700; }
.ssm-card.is-on::after { content: '✓'; position: absolute; left: 1px; top: -1px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%;
  font-size: 16px; font-weight: 800; color: #fff; background: var(--ssm-on); line-height: 1; }
html[data-theme="dark"] .ssm-card.is-on::after { color: #0b1c22; }
.ssm-card:disabled { cursor: default; opacity: 1; }
.ssm-card:focus-visible, .ssm-num:focus-visible, .ssm-range:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.ssm-icon { flex: none; width: 40px; height: 26px; border-radius: 4px; }
.ssm-bicon { color: var(--ssm-accent); }
.ssm-card-l { min-width: 0; overflow-wrap: anywhere; }
.ssm-card-s { display: block; font-size: 16px; font-weight: 400; opacity: .85; }
.ssm-feat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px; }
.ssm-feat .ssm-card:last-child { grid-column: 1 / -1; }
.ssm-bnd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px; }
.ssm-bnd .ssm-card { padding-top: 3px; padding-bottom: 3px; }

/* AP calibration */
.ssm-bias { display: grid; gap: 3px; }
.ssm-bias p { margin: 0; font-size: 16px; line-height: 1.25; }
.ssm-bias-f { display: flex; align-items: center; gap: 8px; }
.ssm-bias-u { font-size: 18px; font-weight: 700; }
.ssm-num { width: 150px; min-height: 44px; font-size: 20px; font-weight: 700; padding: 4px 10px; border: 2px solid var(--ssm-btn-line); border-radius: 8px;
  background: var(--ssm-btn); color: var(--ssm-panel-ink); }
.ssm-num:disabled { opacity: 1; }

/* scene */
.ssm-scene { flex: 1 1 auto; min-height: 160px; display: flex; }
.ssm-svg { display: block; width: 100%; height: 100%; border-radius: 14px; border: 3px solid var(--ssm-line);
  box-shadow: 0 3px 8px rgba(0,0,0,.16); font-family: var(--tlg-font, Arial, sans-serif); background: var(--ssm-sea3); touch-action: none; cursor: ns-resize; }
.is-locked .ssm-svg { cursor: default; }
.ssm-t { font-size: 17px; font-weight: 700; }
.ssm-ruler-t, .ssm-ruler-h { fill: var(--ssm-ruler-ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.ssm-unit { fill: var(--ssm-ink); font-size: 17px; }
.ssm-grid { stroke: var(--ssm-grid); stroke-opacity: .22; stroke-width: 1; stroke-dasharray: 3 6; }
.ssm-grid.is-major { stroke-opacity: .38; stroke-dasharray: 6 5; }
.ssm-unmapped { fill: #dbe9f2; opacity: .55; font-size: 18px; font-style: italic; }
.ssm-unmapped[opacity="0"] { display: none; }
.ssm-beam-line { stroke: var(--ssm-beam); stroke-opacity: .45; stroke-width: 1.5; stroke-dasharray: 4 6; }
.ssm-flag-t { fill: var(--ssm-line); font-size: 17px; font-weight: 800; }
.ssm-pick-tick { stroke: var(--ssm-pick); stroke-width: 3; }
.ssm-pick-dot { fill: var(--ssm-pick); stroke: var(--ssm-line); stroke-width: 2.5; }
.ssm-pick-t { fill: #fff; font-size: 17px; paint-order: stroke; stroke: var(--ssm-line); stroke-width: 4px; stroke-linejoin: round; }
.ssm-pick.is-ok .ssm-pick-dot { fill: var(--ssm-ok-on-sea); }
.ssm-pick.is-bad .ssm-pick-dot { fill: var(--ssm-bad-on-sea); }
.ssm-mk { fill: none; stroke: var(--ssm-line); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ssm-profile { stroke: var(--ssm-pick); stroke-width: 3.5; stroke-dasharray: 9 6; stroke-linejoin: round; }
.ssm-ship-g { transition: transform .45s ease; }
.ssm-ping path { fill: none; stroke: var(--ssm-ping); stroke-width: 3; stroke-linecap: round; }
.ssm-echo { stroke: var(--ssm-ping); stroke-width: 4; stroke-linecap: round; }
.ssm-floor-line { stroke: var(--ssm-line); stroke-width: 2; }
.ssm-motion { fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ssm-true circle { fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 4 3; }
.ssm-true-t, .ssm-est-t { fill: #fff; font-size: 17px; paint-order: stroke; stroke: var(--ssm-line); stroke-width: 4px; stroke-linejoin: round; }
.ssm-est path { stroke: #fff; stroke-width: 2.5; stroke-dasharray: 5 4; }
.ssm-stamp rect { fill: var(--ssm-panel-bg1); stroke: var(--ssm-line); stroke-width: 2.5; }
.ssm-stamp text { fill: var(--ssm-panel-ink); font-size: 17px; }
.ssm-stamp.is-ok rect { stroke: var(--ssm-ok); stroke-width: 3.5; }
.ssm-stamp.is-bad rect { stroke: var(--ssm-bad); stroke-width: 3.5; }

/* console */
.ssm-console { display: grid; gap: 4px; padding: 6px 12px 8px; border-radius: 12px; background: linear-gradient(var(--ssm-panel-bg1), var(--ssm-panel-bg2));
  color: var(--ssm-panel-ink); border: 2px solid var(--ssm-btn-line); }
.ssm-console-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ssm-console-n { font-size: 16px; opacity: .82; }
.ssm-dials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ssm-dial { display: grid; gap: 0; }
.ssm-dial-h { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.ssm-dial-k { font-size: 16px; font-weight: 700; }
.ssm-dial-v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ssm-range { width: 100%; min-height: 36px; margin: 0; accent-color: var(--ssm-accent); cursor: pointer; }
.ssm-readout { margin: 0; font-size: 16px; font-weight: 700; }
.ssm-model { margin: 0; font-size: 16px; font-style: italic; opacity: .85; line-height: 1.3; }
.is-assess .ssm-readout { font-weight: 600; }

/* worked-example table in the Briefing */
.ssm-ex { border-collapse: collapse; font-size: 16px; }
.ssm-ex caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.ssm-ex th, .ssm-ex td { padding: 4px 8px; border-bottom: 1px solid var(--tlg-border, #ccd); text-align: left; vertical-align: middle; }

/* narrow screens: stack */
@media (max-width: 900px) {
  .ssm { position: static; grid-template-columns: 1fr; }
  .ssm-controls { overflow: visible; }
  .ssm-scene { min-height: 0; }
  .ssm-svg { height: auto; }
}
@media (max-width: 520px) {
  .ssm-dials { grid-template-columns: 1fr; gap: 4px; }
  .ssm-feat, .ssm-bnd { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ssm-ship-g { transition: none; }
}

/* AP calibration: the bias entry sits in the console beside the three depth sliders */
.ssm-dials.has-bias { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 150px); }
.ssm-bias .ssm-step-h { font-size: 16px; gap: 6px; }
.ssm-bias .ssm-n { width: 24px; height: 24px; }
.ssm-bias .ssm-num { width: 100%; min-width: 0; min-height: 40px; font-size: 18px; }
.ssm-cal { font-size: 16px; }
@media (max-width: 520px) { .ssm-dials.has-bias { grid-template-columns: 1fr; } }
