/* ThinkTank UI; base page/layout rules adapted from WebGL Aquarium.
   Copyright 2009 Google Inc. BSD-3-Clause; see vendor/aquarium/LICENSE.md. */

html, body {
  width: 100%;
  height: 100%;
  border: 0px;
  padding: 0px;
  margin: 0px;
  background-color: black;
  font-family: sans-serif;
  overflow: hidden;
  color: #fff;
}
a {
 color: #fff;
}
#info {
    font-size: small;
    position: absolute;
    top: 0px; width: 100%;
    padding: 5px;
    text-align: center;
    z-index: 2;
    display: none;
}
CANVAS {
  background-color: gray;
}
.fpsContainer {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: min(680px, calc(100% - 32px));
  box-sizing: border-box;
  color: white;
  background-color: rgba(0,0,0,0.5);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.fps {
  color: white;
  display: none;
}
#modeToggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 30;
  display: flex;
  padding: 3px;
  background: rgba(5,12,22,0.8);
  border: 1px solid rgba(190,225,245,0.3);
  border-radius: 6px;
}
#modeToggle button {
  min-width: 76px;
  min-height: 38px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: white;
  font: 14px sans-serif;
  cursor: pointer;
}
#modeToggle button[aria-pressed="true"] {
  background: rgba(190,225,245,0.25);
}
#modeToggle button:disabled { opacity: 0.45; cursor: default; }
#modeToggle button:enabled:hover { background: rgba(190,225,245,0.35); }
#modeToggle button:focus-visible { outline: 2px solid white; outline-offset: -2px; }
#labScreen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  box-sizing: border-box;
}
#labScreen[hidden] { display: none; }
#labPanel {
  width: min(720px, 100%);
  height: 100%;
  background: rgba(5,12,22,0.85);
  border: 1px solid rgba(190,225,245,0.25);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  box-sizing: border-box;
  padding: 24px;
  overflow-y: auto;
  color: white;
  font: 15px/1.5 sans-serif;
}
#labPanel h2 { font-size: 23px; margin: 0 0 18px; }
#labPanel [hidden] { display: none; }
#labRunning, #artifactView { min-height: 100%; display: flex; flex-direction: column; }
#labRunning .labActions, #artifactView .labActions { justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 20px; flex-wrap: wrap; }
.artifactGraphs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.artifactGraphs figure { margin: 0; min-width: 0; }
.artifactGraphs canvas { display: block; width: 100%; height: 200px; background: rgba(0,0,0,0.25); }
#artifactLive { margin: 0; }
#frequencyView { min-height: 100%; display: flex; flex-direction: column; }
#frequencyView .labActions { justify-content: space-between; margin-top: auto; padding-top: 16px; }
#frequencyCanvas { width: 100%; height: 200px; display: block; background: rgba(0,0,0,0.25); }
#frequencyBars { display: grid; gap: 6px; margin: 12px 0; }
#frequencyBars label { display: grid; grid-template-columns: 120px minmax(40px, 1fr) 70px; gap: 8px; align-items: center; }
#frequencyBars meter { width: 100%; }
#frequencyStatus { min-height: 24px; }
#frequencyExercise { min-height: 100%; display: flex; flex-direction: column; }
#frequencyExercise .labActions { justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 16px; }
#exerciseScore { font-size: 36px; text-align: center; min-height: 54px; margin: 8px 0; }
#exerciseScale { text-align: center; margin: 4px 0 0; color: #c9e3ec; font-size: 13px; }
#exerciseCanvas { display: block; width: 100%; height: 180px; flex-shrink: 0; }
#exerciseLegend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 8px 0 16px; font-size: 12px; }
.exerciseTrace { display: inline-flex; align-items: center; gap: 6px; }
.exerciseTrace::before { content: ""; width: 24px; border-top: 2px solid #8dd3ff; }
.restTrace::before { border-top: 2px dashed #a5efb3; }
#exerciseStatus { text-align: center; min-height: 24px; }
#exerciseDescription, #exerciseSummary { margin: 0 0 16px; }
#exerciseScore:empty, #exerciseStatus:empty { display: none; }
#exerciseStatus.countdown { font-size: 32px; font-weight: bold; line-height: 1.3; }
#signalCheck { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,0.25); }
#signalCheck[hidden] { display: none; }
#signalCheckPanel { width: min(620px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; padding: 18px; box-sizing: border-box; background: rgba(5,12,22,0.94); color: white; border-radius: 8px; font: 14px/1.4 sans-serif; }
#signalCheckContent { overflow-y: auto; min-height: 0; padding-bottom: 2px; flex: 0 1 auto; }
#signalCheckContent details p { margin: 8px 0; }
#signalCheckContent > p { margin: 8px 0; }
#signalProgress { height: 40px; box-sizing: border-box; display: flex; align-items: center; }
#signalWarning { min-height: 40px; font-size: 12px; }
#signalWarning[hidden] { display: block; visibility: hidden; }
#signalSkip[hidden] { display: block; visibility: hidden; }
#signalCheckPanel h2 { flex-shrink: 0; }
#signalTraceRows { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 8px; }
#signalCheckPanel h2 { margin: 0 0 6px; font-size: 22px; }
#signalCheckGraph { display: block; width: 100%; height: 192px; background: rgba(0,0,0,0.25); }
#signalChannels { list-style: none; padding: 0; margin: 0; font-size: 11px; }
#signalChannels li { height: 43px; display: flex; flex-direction: column; justify-content: center; box-sizing: border-box; }
#signalChannels [data-quality="good"] { color: #a5efb3; }
#signalChannels [data-quality="warn"] { color: #ffe49b; }
#signalCheckPanel .labActions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex-shrink: 0; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid #53626b; }
#signalCheckPanel .labActions button { padding: 8px 4px; min-height: 48px; font-size: 13px; }
@media (max-height: 650px) {
  #signalCheckPanel { padding: 12px; }
  #signalCheckPanel #signalCheckGraph { height: 152px; }
  #signalCheckPanel #signalChannels li { height: 33px; }
}
@media (max-width: 420px) {
  #signalCheckPanel { padding: 14px; }
  #signalTraceRows { grid-template-columns: 116px minmax(0, 1fr); gap: 4px; }
  #signalCheckPanel .labActions button { padding: 6px 8px; font-size: 12px; }
}
#signalCheckPanel button:disabled { opacity: 0.45; cursor: default; }
#exerciseCanvas { display: block; width: 100%; height: 180px; background: rgba(0,0,0,0.25); }
#artifactLiveCanvas { display: block; width: 100%; height: 200px; background: rgba(0,0,0,0.25); }
#artifactDescription, #artifactNote { margin: 0 0 16px; }
#artifactStatus { font-size: 22px; min-height: 34px; text-align: center; }
#artifactStatus:empty, #artifactNote:empty { display: none; }
@media (max-width: 600px) { .artifactGraphs { grid-template-columns: 1fr; } }
.labActions { display: flex; justify-content: flex-end; margin-top: 24px; }
.labMenuOptions { flex-direction: column; gap: 16px; width: min(300px, 100%); margin: 0 auto; }
#labMenu { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
#labPanel #labMenu h2 { font-size: 32px; margin: 0 0 12px; text-align: center; }
#labMenu p { max-width: 440px; margin: 0 auto 28px; text-align: center; }
#labIntro { min-height: 100%; display: flex; flex-direction: column; }
#labIntro .labActions { justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 24px; }
#labResults { min-height: 100%; display: flex; flex-direction: column; }
#labResults .labActions { justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 24px; }
.labActions button {
  padding: 8px 20px; color: white; background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.5); border-radius: 4px; cursor: pointer;
  font: inherit;
}
.labActions button:hover { background: rgba(255,255,255,0.25); }
#blinkCue {
  height: 76px; display: flex; align-items: center; justify-content: center;
}
#blinkCue span { color: #a0a0a0; font-size: 42px; font-weight: bold; display: inline-block; }
#blinkCue.pulse span { animation: blinkPrompt 650ms ease-out; }
#blinkCue.detected span { color: #ff5353 !important; }
@keyframes blinkPrompt {
  0%, 100% { color: #a0a0a0; transform: scale(1); }
  20%, 55% { color: #fff; transform: scale(1.12); }
}
#labEEG { display: block; width: 100%; height: 124px; margin-top: 12px; background: rgba(0,0,0,0.25); }
#labProgress { text-align: center; min-height: 23px; margin: 8px 0; }
.labCounts { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 8px; }
.labCounts span { white-space: nowrap; }
@media (max-width: 600px) {
  #labPanel { padding: 16px; }
  #labPanel h2 { font-size: 20px; }
}
#startScreen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(0,0,0,0.12);
}
.startPanel {
  position: relative;
  width: min(430px, 100%);
  box-sizing: border-box;
  padding: 42px 34px 38px;
  text-align: center;
  background: rgba(5,12,22,0.82);
  border: 1px solid rgba(190,225,245,0.25);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}
.startPanel h1 {
  margin: 0 0 32px;
  color: white;
  font-family: Georgia, serif;
  font-size: 36px;
  font-weight: normal;
}
#startPanel h1 {
  margin-bottom: 12px;
}
.startIntroduction {
  margin: 0 0 28px;
  color: #c9e3ec;
  font-size: 15px;
  line-height: 1.5;
}
#controlsPanel {
  display: none;
  text-align: left;
}
#introductionPanel {
  display: none;
  width: min(720px, 100%);
  text-align: left;
}
#controlsPanel h1,
#controlsPanel h2 {
  text-align: center;
}
#introductionPanel h1,
#introductionPanel h2 {
  text-align: center;
}
#controlsPanel h1 {
  margin-bottom: 10px;
}
#introductionPanel h1 {
  margin-bottom: 10px;
}
#controlsPanel h2 {
  margin: 0 0 28px;
  color: #b8dfff;
  font-size: 18px;
  font-weight: normal;
}
#introductionPanel h2 {
  margin: 0 0 28px;
  color: #b8dfff;
  font-size: 18px;
  font-weight: normal;
}
.controlInstructions {
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  line-height: 1.5;
}
.controlInstructions p {
  margin: 0 0 16px;
}
.controlInstructions p:last-child {
  margin-bottom: 0;
}
.introductionText {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  line-height: 1.55;
}
.introductionSlide {
  display: none;
}
.introductionSlide.active {
  display: block;
}
.introductionText h3 {
  margin: 0 0 12px;
  color: #b8dfff;
  font-size: 16px;
  font-weight: normal;
}
.introductionText p {
  margin: 0 0 16px;
}
.introductionText ul,
.introductionText ol {
  margin: 0;
  padding-left: 22px;
}
.introductionText li {
  margin-bottom: 10px;
}
.introductionText li:last-child {
  margin-bottom: 0;
}
.introductionText p:last-child {
  margin-bottom: 0;
}
.introductionNavigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}
.introductionNavigation button {
  min-width: 96px;
  min-height: 38px;
  padding: 6px 12px;
  color: white;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  font-family: sans-serif;
  font-size: 14px;
  cursor: pointer;
}
.introductionNavigation button:hover {
  background: rgba(255,255,255,0.2);
}
.introductionNavigation button:disabled {
  cursor: default;
  opacity: 0.35;
}
.introductionProgress {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
}
#backButton {
  position: absolute;
  top: 14px;
  left: 16px;
  padding: 4px 8px;
  color: rgba(255,255,255,0.8);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  font-family: sans-serif;
  font-size: 13px;
  cursor: pointer;
}
#introductionBackButton,
#eegBackButton {
  position: absolute;
  top: 14px;
  left: 16px;
  padding: 4px 8px;
  color: rgba(255,255,255,0.8);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  font-family: sans-serif;
  font-size: 13px;
  cursor: pointer;
}
#backButton:hover,
#introductionBackButton:hover,
#eegBackButton:hover {
  color: white;
  background: rgba(255,255,255,0.12);
}
.startButtons {
  display: grid;
  gap: 14px;
  justify-items: center;
}
#connectMuseButton,
#controlsButton,
#introductionButton {
  display: block;
  width: 220px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 6px 10px;
  color: white;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  font-family: sans-serif;
  font-size: 15px;
  cursor: pointer;
}
#connectMuseButton:hover,
#controlsButton:hover,
#introductionButton:hover {
  background: rgba(255,255,255,0.2);
}
#connectMuseButton:disabled {
  cursor: wait;
  opacity: 0.65;
}
#museStats {
  display: none;
  width: min(460px, calc(100% - 32px));
  font: 12px/1.5 sans-serif;
  font-variant-numeric: tabular-nums;
  padding: 8px;
}
body.tankIntroductionOpen #museStats,
body.tankIntroductionOpen #modeToggle,
body.tankIntroductionOpen #eegLivePanel { display: none !important; }
body:has(#labScreen:not([hidden])) #museStats { display: none !important; }
#museStatGrid { display: grid; grid-template-columns: 66px minmax(0, 1fr) 66px; gap: 16px; align-items: center; }
#blinkIndicator { color: #c9e3ec; display: grid; justify-items: center; gap: 1px; }
#blinkIndicator span { white-space: nowrap; }
#blinkIndicator .blinkArrow { line-height: 1; }
#blinkIndicator svg { width: 40px; height: 32px; }
#blinkIndicator .eyeClosed { display: none; }
#blinkIndicator.detected { color: #ff6464; }
#blinkIndicator.detected .eyeOpen { display: none; }
#blinkIndicator.detected .eyeClosed { display: block; }
#fishSpeedIndicator { min-width: 0; }
#museStats #museStatus { height: auto; min-height: 18px; margin-top: 0; }
.fishSpeedHeading { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
#statFishSpeed { flex: 0 0 3ch; text-align: right; }
#fishSpeedTrack { height: 8px; margin-top: 4px; background: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; }
#fishSpeedFill { display: block; height: 100%; width: 0; background: #60a5fa; transition: width 200ms linear, background-color 350ms ease, filter 350ms ease; }
#fishSpeedIndicator.held #fishSpeedFill { filter: grayscale(1) brightness(0.85); }
#batteryIndicator { display: grid; justify-items: center; gap: 4px; }
.batteryIcon { position: relative; width: 26px; height: 12px; border: 1px solid currentColor; padding: 2px; box-sizing: border-box; border-radius: 2px; }
.batteryIcon::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: currentColor; }
#batteryFill { display: block; width: 0; height: 100%; background: #a5efb3; }
#batteryIndicator.low #batteryFill { background: #ffbd70; }
#batteryIndicator.unknown .batteryIcon { border-style: dashed; }
@media (max-width: 1200px) { #museStats { top: 82px; } }
@media (max-width: 600px) {
  #museStatGrid { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; }
  #museStats { padding: 8px; }
}
#eegLivePanel {
  display: none;
  position: absolute;
  top: 28px;
  right: 20px;
  z-index: 3;
  width: 132px;
  box-sizing: border-box;
  padding: 8px 10px;
  color: rgba(255,255,255,0.9);
  background-color: rgba(0,0,0,0.5);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.35;
}
#eegLivePanel button { display: block; width: 100%; margin-top: 10px; padding: 6px; border: 1px solid rgba(255,255,255,0.4); border-radius: 4px; background: transparent; color: #b8dfff; font: inherit; cursor: pointer; }
#eegLivePanel button:first-child { margin-top: 0; }
#eegLivePanel button:hover { background: rgba(255,255,255,0.12); }
#eegLivePanel button:disabled { opacity: 0.45; cursor: default; }
#eegPanel { width: min(720px, 100%); }
#eegPanel, #controlsPanel { max-height: calc(100dvh - 40px); overflow-y: auto; padding-top: 56px; }
#eegGraph {
  display: block;
  background: rgba(0,0,0,0.25);
  width: 100%;
  height: auto;
  aspect-ratio: 640 / 280;
  margin-top: 4px;
}
#museStatus {
  margin: 3px 0 0;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #b8dfff;
  font-size: 12px;
  line-height: 1.45;
}
#uiContainer {
  z-index: 3;
  position: absolute;
  top: 10px;
  right: 20px;
  width: 250px;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: xx-small;
  border-radius: 10px;
  padding: 10px;
  display: none;
}
#ui {
}
#topUI {
  display: none;
}
.clickable {
  cursor: pointer;
}
#viewContainer {
  width: 100%;
  height: 100%;
}
#msgContainer {
  z-index: 10;
  position: absolute;
  bottom: 20px;
  left: 10px;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: xx-small;
  border-radius: 10px;
  padding: 10px;
}

/* Hide inherited controls even when upstream jQuery changes inline display. */
#topUI, #uiContainer { display: none !important; }
#startupStatus {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 100;
  color: white;
}

/* Center short Lab pages as a group; longer pages grow and scroll from the top. */
#labPanel > div:not(#labMenu):not([hidden]) {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#labPanel > div > * { flex-shrink: 0; }
#labPanel > div:not(#labMenu) > .labActions {
  margin-top: 24px;
  padding-top: 0;
}
#labPanel p { line-height: 1.6; }
