:root {
  --panel-w: 318px;
  --pond-edge: #263c41;
  --s-color: #ffd073;
  --j-color: #79d9ff;
}
#stage {
  display: grid;
  grid-template-rows: auto minmax(95px, .82fr) minmax(220px, 2fr) auto;
  gap: 12px;
  padding: 14px clamp(14px, 2.4vw, 40px);
  background: radial-gradient(ellipse at 50% 0, #0e1c21 0, #05070d 62%);
  overflow-y: auto;
}
.lab-head, .graph-head, .panel-head, .panel-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lab-head h1 { font-size: 18px; margin: 0; }
#app button, .transport .learn-fab { cursor: pointer; }
#app button:focus-visible, #app a:focus-visible, #app input:focus-visible {
  outline: 2px solid #bce9ff;
  outline-offset: 2px;
}
.lab-head .seg button { min-height: 42px; padding: 4px 13px; background: #101921; color: #b4c0ce; }
.lab-head .seg button.on { background: #3a2e1c; border-color: #a78245; color: #ffe0a4; }
.habitat { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--pond-edge); border-radius: 13px; }
.habitat canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pond-labels { position: absolute; inset: 0; display: flex; pointer-events: none; }
.pond-label { flex: 1; min-width: 0; padding: 9px 13px; }
.pond-label span { display: block; font-size: 12px; color: inherit; }
.pond-label strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; color: #f0f6f5; }
.s-type { color: var(--s-color); }
.j-type { color: var(--j-color); }
#pondKey {
  position: absolute; right: 8px; bottom: 6px; margin: 0;
  font-size: 11px; color: #c4d4d6; background: #071319ee; border-radius: 4px; padding: 1px 6px;
}
.graphs { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; min-height: 0; }
.graph { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; background: #090f18; border: 1px solid #26313f; border-radius: 10px; }
.graph-head { min-height: 29px; padding: 2px 10px 0; }
.graph-head h2 { margin: 0; font-size: 13px; white-space: nowrap; }
.graph-head small { color: #a8b8cb; font-size: 11px; font-weight: 400; }
.graph-readings { display: flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.graph-readings strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.graph-j { color: var(--j-color); font-size: 11px; white-space: nowrap; }
.graph canvas { width: 100%; height: 100%; min-height: 0; cursor: crosshair; touch-action: none; }
.graph canvas:active { cursor: ew-resize; }
.transport { background: #0d141d; border: 1px solid #26313f; border-radius: 10px; padding: 4px 9px 6px; }
.time-row { display: flex; align-items: center; gap: 10px; }
.time-row label, .time-row span { flex: none; color: #a8b8cb; font-size: 12px; }
#tVal { display: inline-block; min-width: 38px; text-align: left; color: #fff0d4; }
#t { flex: 1; min-width: 30px; margin: 0; height: 34px; }
.actions { display: flex; gap: 6px; }
.actions button, .actions #panelToggle, .transport .learn-fab, #panel button {
  position: static; transform: none; display: inline-flex; justify-content: center; align-items: center;
  min-height: 44px; border-radius: 7px; padding: 3px 11px; border: 1px solid #334353; font: inherit;
  font-size: 12px; white-space: nowrap; color: #cdd9e5; background: #141f2a; text-decoration: none;
}
.actions button:hover, .transport .learn-fab:hover, #panel button:hover { border-color: #a78245; color: #ffe0a4; }
#play { min-width: 77px; background: #ffd073; border-color: #ffd073; color: #19130a; font-weight: 700; }
#peak { color: #ffda8d; }
#peak:disabled { opacity: .46; cursor: default; border-color: #334353; }
.transport .learn-fab { margin-left: auto; }
.actions #panelToggle, #panel #panelClose { display: none; }
#panel { background: #101722; padding: 16px 16px 24px; }
#panel h2 { font-size: 14px; margin: 0; color: #e9eff6; }
#panel .note { color: #a0afc2; }
.parameters { padding: 12px 0; }
.parameters label { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; }
.parameters output { color: var(--s-color); font-size: 14px; }
.parameters input { display: block; height: 36px; margin: 0 0 4px; }
#panel .observation { padding: 10px 11px; border: 1px solid #57462d; background: #251e16; border-radius: 9px; margin: 0 0 13px; }
#panel .observation h2 { color: var(--s-color); }
.observation p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; }
.metrics { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 5px; }
.metrics td, .metrics th { text-align: right; font-size: 12px; padding: 6px 0 6px 5px; border-bottom: 1px solid #253141; }
.metrics th:first-child { text-align: left; padding-left: 0; font-weight: 400; }
.metrics small { display: block; font-size: 11px; color: #a0afc2; }
.panel-links .learn-link { margin: 0; }
#shareStatus { overflow-wrap: anywhere; }
#app [hidden] { display: none; }
@media (max-width: 760px) {
  #stage { gap: 7px; padding: 5px 9px 7px; }
  .lab-head { align-items: stretch; flex-direction: column; gap: 3px; }
  .lab-head h1 { font-size: 16px; padding-inline: 2px; }
  .lab-head .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
  .lab-head .seg button { padding: 3px 2px; }
  .pond-label { padding: 6px 9px; }
  .pond-label strong { font-size: 16px; }
  .graph-head { min-height: 25px; padding-inline: 7px; }
  .graph-head h2 { font-size: 12px; }
  .transport { padding: 0 5px 4px; }
  .time-row { gap: 6px; }
  .actions { gap: 4px; }
  .actions button, .actions #panelToggle, .transport .learn-fab { min-width: 0; padding-inline: 6px; flex: 1; }
  .transport .learn-fab { margin: 0; }
  .actions #panelToggle, #panel #panelClose { display: inline-flex; }
  #panel { bottom: 0; max-height: min(65%, 470px); z-index: 10; transition: none; }
  #panel.collapsed { visibility: hidden; }
}

@media (max-width: 360px) {
  .graph-head small { font-size: 10px; }
  .graph-readings { gap: 4px; }
  .graph-readings strong, .graph-j { font-size: 10px; }
}

:lang(en) .related a::after { content: "Open →"; }
