/* SPDX-License-Identifier: MIT */
/* styles.css - dark theme, monospace metrics panel, inline sparkline canvases. */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #1a1a1a;
  color: #e8e8e8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}
h1 {
  font-size: 18px;
  font-weight: 500;
  margin: 4px 0 4px 0;
  letter-spacing: 0.3px;
  color: #f0f0f0;
}
.mode-nav {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 12px;
}
.mode-nav a {
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}
.mode-nav a:hover { color: #7FD8FF; }
.mode-nav-active {
  color: #00FF88;
  font-weight: 600;
}
.stage {
  position: relative;
  width: 100%;
  max-width: 1500px;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}
.stage > canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
  border: 1px solid rgba(127, 216, 255, 0.1);
  box-shadow: 0 0 40px rgba(127, 216, 255, 0.06);
}
@media (min-width: 900px) {
  .stage > canvas { max-height: 82vh; }
}
.fps {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: #00FF88;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.tracking-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.tracking-badge.tracking { color: #00FF88; }
.tracking-badge.lost { color: #ff6b6b; }
.controls {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
button {
  background: rgba(42, 42, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
button:hover:not(:disabled) { background: #333; }
button:active:not(:disabled) { background: #3a3a3a; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary {
  background: #00FF88;
  color: #0a0a0a;
  border-color: #00FF88;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #1aff97; }
button.toggle.on {
  background: rgba(10, 58, 34, 0.85);
  color: #00FF88;
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.12);
}
.status {
  margin-top: 10px;
  min-height: 20px;
  font-size: 13px;
  text-align: center;
  max-width: 520px;
}
.status.error { color: #ff6b6b; }
.panel {
  width: 100%;
  max-width: 1500px;
  margin-top: 12px;
  background: rgba(15, 15, 15, 0.72);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #cfcfcf;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.panel.hidden { display: none; }
.vitals {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 6px 10px; margin: 0 0 10px 0;
  background: rgba(5, 8, 16, 0.45);
  border: 1px solid rgba(127, 216, 255, 0.10);
  border-radius: 8px;
  font-size: 11px;
}
.vital { display: flex; gap: 6px; align-items: baseline; }
.vital .k { color: #7a7a7a; text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
.vital .v { color: #e8e8e8; }
.vital .v.good { color: #00FF88; }
.vital .v.warn { color: #ffb347; }
.vital .v.bad { color: #ff6b6b; }
.tab-bar {
  display: flex; gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 10px;
}
.tab-bar .tab {
  background: transparent;
  color: #888;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  font: 500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.04em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab-bar .tab:hover { color: #ccc; background: rgba(255,255,255,0.03); }
.tab-bar .tab.active {
  color: #7FD8FF;
  border-bottom-color: #7FD8FF;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.subtab-bar {
  display: flex; gap: 4px;
  margin: 0 0 10px 0;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  flex-wrap: wrap;
}
.subtab-bar .subtab {
  background: transparent;
  color: #888;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font: 500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.subtab-bar .subtab:hover { color: #ccc; background: rgba(255,255,255,0.04); }
.subtab-bar .subtab.active {
  color: #7FD8FF;
  background: rgba(127, 216, 255, 0.10);
  border-color: rgba(127, 216, 255, 0.25);
}
.subtab-pane { display: none; }
.subtab-pane.active { display: block; }
.tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
  flex: 0 0 auto;
  line-height: 1.3;
}
.tag-physio { background: rgba(0, 255, 136, 0.14); color: #00FF88; }
.tag-neuro  { background: rgba(192, 132, 252, 0.16); color: #C084FC; }
.tag-expr   { background: rgba(255, 170, 200, 0.14); color: #FFAAC8; }
.tag-sig    { background: rgba(127, 216, 255, 0.14); color: #7FD8FF; }
.tag-fun    { background: rgba(255, 179, 71, 0.14); color: #FFB347; }
.muted-hint { color: #666; font-size: 10px; margin-top: 10px; font-style: italic; }
.play-actions { margin-top: 10px; display: flex; gap: 8px; }
#fingerTapCanvas {
  background: rgba(5, 8, 16, 0.7);
  border: 1px solid rgba(127, 216, 255, 0.12);
  border-radius: 8px;
  display: block; max-width: 100%;
}
.panel .section-title {
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  margin: 0 0 6px 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.panel .section-title:hover { color: #aaa; }
.panel .section-title::before { content: '▾ '; font-size: 9px; }
.panel .section-title.collapsed::before { content: '▸ '; }
.panel .section-title:not(:first-child) { margin-top: 12px; }
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 18px;
}
.kv {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dotted #1f1f1f;
  white-space: nowrap;
}
.kv .k { color: #9a9a9a; flex: 0 0 auto; }
.kv .v { color: #e8e8e8; flex: 0 0 auto; min-width: 56px; text-align: right; margin-left: auto; }
.kv .v.good { color: #00FF88; }
.kv .v.warn { color: #ffb347; }
.kv .v.bad { color: #ff6b6b; }
.kv canvas.spark {
  display: inline-block;
  width: 70px;
  height: 14px;
  flex: 0 0 auto;
  margin-left: auto;
  vertical-align: middle;
  opacity: 0.9;
}
.kv canvas.spark + .v { margin-left: 6px; }
.neuro-disclaimer {
  font-size: 10px;
  color: #ff6b6b;
  background: rgba(42, 15, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  text-align: center;
}
.neuro-viz {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.viz-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.viz-block.viz-spec { flex: 1 1 320px; min-width: 280px; }
.viz-block.hidden { display: none; }
.viz-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
#neuroRadar, #tremorSpectrogram {
  background: rgba(5, 8, 16, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(127, 216, 255, 0.12);
  border-radius: 8px;
  display: block;
  max-width: 100%;
}
#tremorSpectrogram { width: 100%; height: auto; image-rendering: pixelated; }
.bs-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 3px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}
.bs-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.bs-label { color: #9a9a9a; flex: 0 0 120px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.bs-bar { flex: 1 1 auto; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.bs-fill { height: 100%; background: linear-gradient(90deg, #7FD8FF, #C084FC); transition: width 0.08s linear; }
.bs-val { color: #e8e8e8; flex: 0 0 38px; text-align: right; }
.gesture-widget {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  padding: 8px 16px; background: rgba(10,10,10,0.65);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(192,132,252,0.3); border-radius: 999px;
  color: #e8e8e8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  white-space: nowrap; pointer-events: none; box-shadow: 0 4px 20px rgba(192,132,252,0.15);
}
.gesture-widget .ghand { color: #C084FC; margin: 0 4px; font-weight: 600; }
.gesture-widget .gname { color: #00FF88; }
.gesture-widget .gscore { color: #888; margin-left: 4px; }
footer {
  margin-top: auto;
  padding-top: 16px;
  font-size: 11px;
  color: #888;
  text-align: center;
}
.placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 82vh;
  background: #0f0f0f;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #666;
  font-size: 13px;
  overflow: hidden;
}
.placeholder-skeleton {
  width: 100px;
  height: 200px;
  animation: skeleton-pulse 3s ease-in-out infinite;
}
.skeleton-svg {
  width: 100%;
  height: 100%;
  stroke: rgba(127, 216, 255, 0.3);
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}
.skeleton-svg circle[r="20"] { fill: none; stroke: rgba(127, 216, 255, 0.35); }
.skeleton-svg circle[r="4"] { fill: rgba(192, 132, 252, 0.3); stroke: rgba(192, 132, 252, 0.5); }
.skeleton-svg line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-line 2.5s ease-in-out infinite alternate;
}
.placeholder-text { color: #666; font-size: 13px; animation: text-pulse 3s ease-in-out infinite; }
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.97); filter: drop-shadow(0 0 6px rgba(127,216,255,0.1)); }
  50% { opacity: 1; transform: scale(1.0); filter: drop-shadow(0 0 16px rgba(127,216,255,0.3)); }
}
@keyframes text-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
