:root {

  --page-bg: #ffffff;

  --page-fg: #111111;

}



@media (prefers-color-scheme: dark) {

  :root {

    --page-bg: #0b1120;

    --page-fg: #e2e8f0;

  }

}



body, .site-footer {

  background: var(--page-bg);

  color: var(--page-fg);

}



.site-footer a {

  color: inherit;

}



html, body {

  min-height: 100%;

  height: auto;

  margin: 0;

  background: var(--page-bg);

  color: var(--page-fg);

  overflow-x: hidden;

  overflow-y: auto;

  transition: background 200ms ease, color 200ms ease;

}



#app {

  display: grid;

  grid-template-columns: minmax(340px, 34rem) 1fr;

  grid-template-rows: 1fr;

  width: 100%;

  min-height: 100vh;

}

#panel {

  box-sizing: border-box;

  padding: 12px;

  border-right: 1px solid #ddd;

  font-family: system-ui, sans-serif;

  background: #f5f5f7;

  overflow-y: auto;

  overflow-x: hidden;

}

#panel .row { display:flex; align-items:center; gap:8px; margin:8px 0; }

#panel label { width: 175px; font-size: 14px; color: #111; }

#panel input[type="range"]{ flex:1 }

#panel input[type="number"],

#panel select,

#panel button { background: #fff; color: #111; border: 1px solid #ddd; padding: 4px 6px; }

fieldset { border:1px solid #ddd; padding:8px; margin:10px 0; background: transparent; }

legend { padding:0 6px; font-size:12px; color: #666 }

#badge { margin-top:10px; font-size:12px; padding:6px 8px; background: rgba(0,0,0,0.06); border-radius:6px; display:inline-block }

#infoBox {

  margin-top: 14px;

  border: 1px solid #d0d4dc;

  border-radius: 8px;

  background: rgba(0,0,0,0.05);

  font-size: 12px;

  color: #222;

  line-height: 1.45;

  overflow: hidden;

}

#infoBox summary {

  cursor: pointer;

  font-weight: 600;

  padding: 10px 12px;

  margin: 0;

}

#infoBox summary:focus-visible {
  outline: 2px solid #4c9ffe;
  outline-offset: 2px;
}

#infoBox[open] summary {

  border-bottom: 1px solid #d0d4dc;

}

#infoBox .info-body {

  padding: 10px 12px 12px;

}

#infoBox .info-body p {

  margin: 0 0 8px;

}

#infoBox .info-buttons {

  display: flex;

  flex-wrap: wrap;

  gap: 8px;

}
#infoBox .info-footnote {
  margin: 6px 0 0;
}


#infoBox .info-btn {

  text-decoration: none;

  font-size: 12px;

}



#c { width: 100%; height: 100%; display:block; background:#ffffff; }

@media (max-width: 900px){

  #app {

    grid-template-columns: 1fr;

    grid-template-rows: auto auto;

  }

  #panel label { width: 140px; }

}

canvas#c{display:block;width:100%;height:100%;}

/* Tactile button feedback */

button, .btn {

  appearance: none;

  border: 1px solid #ccc;

  background: linear-gradient(#fff, #f2f2f2);

  padding: 6px 10px;

  border-radius: 6px;

  box-shadow: 0 1px 0 rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.08);

  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;

  cursor: pointer;

}

button:hover, .btn:hover {

  transform: translateY(-1px);

  box-shadow: 0 2px 0 rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.08);

  background: linear-gradient(#fff, #eaeaea);

}

button:active, .btn:active {

  transform: translateY(0);

  box-shadow: 0 1px 0 rgba(0,0,0,0.12), inset 0 1px 2px rgba(0,0,0,0.15);

  background: linear-gradient(#f0f0f0, #e0e0e0);

}

button:focus-visible, .btn:focus-visible {

  outline: 2px solid #4c9ffe;

  outline-offset: 2px;

}

/* Legend overlay */

#legend {

  position: absolute;

  top: clamp(12px, 1.8vw, 28px);

  right: clamp(12px, 1.8vw, 28px);

  display: none;

  padding: clamp(10px, 1.4vw, 18px) clamp(12px, 1.6vw, 22px);

  border-radius: 12px;

  background: rgba(255,255,255,0.94);

  border: 1px solid rgba(15,23,42,0.12);

  box-shadow: 0 18px 30px -16px rgba(15,23,42,0.4);

  color: #111;

  font: clamp(12px, 0.95vw, 16px)/1.35 system-ui, sans-serif;

  pointer-events: none;

  max-width: min(28vw, 260px);

  backdrop-filter: blur(6px);

  gap: clamp(6px, 0.6vw, 10px);

  flex-direction: column;

  align-items: flex-start;

}

#legend.legend--visible {

  display: flex;

}

.legend-row {

  display: flex;

  align-items: center;

  gap: clamp(6px, 0.6vw, 12px);

}

.legend-dot {

  display: inline-block;

  width: clamp(12px, 0.9vw, 16px);

  height: clamp(12px, 0.9vw, 16px);

  border-radius: 999px;

  box-shadow: 0 0 0 1px rgba(15,23,42,0.15);

  flex-shrink: 0;

}

#axesHud {

  z-index: 20;

  position: absolute;

  bottom: clamp(18px, 2.2vh, 40px);

  left: clamp(12px, 1.4vw, 24px);

  width: clamp(64px, 9vw, 96px);

  height: clamp(64px, 9vw, 96px);

  pointer-events: none;

}

/* Sidebar width + horizontal safety */

#controls, #sidebar, #controlPanel, #left, #panel {

  min-height: 100vh;

  overflow: auto;

  overflow-x: auto;

  -webkit-overflow-scrolling: touch;

  padding-right: 12px;

  padding-bottom: 12px;

  box-sizing: border-box;

}

#canvasWrap { position: relative; width:100%; height: calc(100vh - 64px); min-height: 520px; overflow:hidden; padding: clamp(12px, 1.4vw, 24px); box-sizing: border-box; }

#controls input[type="range"]{ width:100%; box-sizing:border-box; }

#controls input[type="number"], #controls select { max-width:100%; box-sizing:border-box; }

#controls .val { margin-left:8px; white-space:nowrap; }

/* Demo-only rows toggle (default visible; JS can hide/show) */

.row.demo-only { display:flex; }

