:root {
  --ink: #24323a;
  --muted: #5d6a70;
  --paper: #f3f6f5;
  --card: #ffffff;
  --line: #cbd6d3;
  --accent: #33b5e5;
  --accent-dark: #1598c8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

.header {
  padding: 15px 22px 13px;
  color: white;
  text-align: center;
  background: var(--accent);
  box-shadow: 0 2px 5px #0003;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw, 2.35rem);
}

.header p {
  margin: 4px 0 0;
  font-size: 1rem;
}

.row {
  display: grid;
  grid-template-columns: minmax(320px, 385px) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  max-width: 1900px;
  margin: 12px auto;
  padding: 0 12px;
}

.hh-controls,
.hh-visuals { min-width: 0; }

.hh-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-card,
.hh-howto {
  margin: 0;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.control-card {
  line-height: 1.75;
  overflow: visible;
}

.control-card > strong {
  display: inline-block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.hh-controls label,
.hh-controls output {
  font-size: .94rem;
  font-weight: normal;
}

.hh-controls label b,
.hh-controls label i { font-size: inherit; }
.hh-controls label b { font-weight: normal; }

.range-field {
  display: block;
  margin-bottom: 4px;
}

input[type=number] {
  float: right;
  width: 92px;
  min-width: 0;
  height: 34px;
  margin: 0 0 4px 8px;
  padding: 3px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #9cafaa;
  border-radius: 6px;
  font: inherit;
}

input[type=number]:focus {
  outline: 2px solid rgba(51, 181, 229, .5);
  outline-offset: 1px;
}

input[type=range] {
  width: 100%;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  color-scheme: light;
}

.control-card br {
  display: block;
  clear: both;
  content: "";
}

input[type=checkbox] {
  width: 18px;
  height: 18px;
  margin: 0 3px;
  vertical-align: middle;
  accent-color: var(--accent);
}

#ptoptop > input[type=checkbox],
#ptop1 > input[type=checkbox],
#ptop2 > input[type=checkbox] {
  float: right;
  margin-top: 5px;
}

input[type=button],
input[type=reset],
input[type=submit] {
  min-width: 0;
  min-height: 34px;
  padding: 8px 11px;
  color: white;
  background: var(--accent-dark);
  border: 0;
  border-radius: 6px;
  font: bold .94rem Arial, Helvetica, sans-serif;
  cursor: pointer;
}

input[type=button]:hover,
input[type=reset]:hover,
input[type=submit]:hover { filter: brightness(1.08); }

.button-row {
  display: flex;
  gap: 7px;
  margin-top: 8px;
}

.button-row input { flex: 1 1 0; }

.paired-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  clear: both;
  margin: 3px 0 5px;
}

.inline-control label { display: block; }
.inline-control input[type=number] {
  float: none;
  width: 100%;
  margin: 0;
}

.graph-animation-controls {
  display: grid;
  grid-template-columns: minmax(92px, 135px) 92px auto minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
}

.graph-animation-controls input[type=button] { width: 100%; }
.graph-animation-controls input[type=number] {
  float: none;
  width: 92px;
  margin: 0;
}
.graph-animation-controls span { font-size: .9rem; }

.disabled-card {
  color: #8d989c;
  background: #eef1f0;
}

.disabled-control { color: #8d989c; }

.clamp-switch { width: 100%; }
.clamp-switch input { width: 100%; }

.hidden { display: none; }
.shown { display: block; }

.wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  background: transparent;
}

.plots {
  width: 100%;
  height: 345px;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.dendrite-geometry-card {
  height: 205px;
  padding: 0;
}

.dendrite-geometry-plot {
  width: 100%;
  height: 165px;
}

.dendrite-input-slider {
  padding: 0 calc(28px + 2.8%) 8px calc(58px + var(--hh-axis-font-size, 22px) + 2.8%);
}

.dendrite-input-slider input[type=range] {
  display: block;
  width: 100%;
}

.hh-howto {
  margin-top: 12px;
  padding: 0;
  overflow: hidden;
}

.hh-howto summary {
  padding: 11px 13px;
  font-weight: bold;
  cursor: pointer;
}

.hh-howto-content {
  padding: 0 18px 14px;
  line-height: 1.48;
}

.hh-howto-content h3 { margin: 13px 0 5px; }
.hh-howto-content p { margin: 5px 0 10px; }
.hh-howto-content a { color: #075f74; }

.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip .tooltiptext {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: 220px;
  padding: 8px 10px;
  visibility: hidden;
  opacity: 0;
  color: white;
  background: #304047;
  border-radius: 6px;
  box-shadow: 0 3px 10px #0003;
  font-size: .84rem;
  line-height: 1.32;
  text-align: left;
  pointer-events: none;
  transition: opacity .15s ease-in-out;
}

.tooltip .tooltiptext::after {
  position: absolute;
  bottom: 100%;
  left: 22px;
  content: "";
  border: 6px solid transparent;
  border-bottom-color: #304047;
}

.tooltip:hover .tooltiptext,
.tooltip:focus-within .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: 12px;
  padding: 12px 18px;
  color: white;
  background: var(--accent);
  font-size: 14px;
}

.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.footer a { color: inherit; text-underline-offset: 3px; }
.footer a:focus-visible { outline: 2px solid white; outline-offset: 4px; }

@media (max-width: 950px) {
  .row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .footer { justify-content: center; }
}
