html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 1; }
#note {
  position: fixed; bottom: 10px; left: 10px; color: #888;
  font: 13px -apple-system, sans-serif; background: rgba(0,0,0,.55);
  padding: 6px 10px; border-radius: 6px; pointer-events: none; z-index: 2;
}
#panel {
  /* above the canvas and the #note credit line */
  z-index: 10;
  position: fixed; top: 10px; left: 10px; width: 230px;
  background: rgba(12, 14, 18, .82); color: #cfd4dc;
  font: 13px -apple-system, sans-serif;
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  user-select: none;
}
#panel header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 15px;
  border-radius: 8px;
}
#panel header:hover { background: rgba(255,255,255,.06); }
#panel header .chev {
  color: #dfe3ea; font: 600 13px -apple-system, sans-serif;
  padding: 6px 14px; cursor: pointer;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18); border-radius: 6px;
}
#panel .body {
  padding: 2px 12px 12px;
  /* never taller than the viewport (dvh tracks mobile browser chrome);
     the offset covers the panel's top inset, header, and body padding */
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
}
/* minimalist scrollbar: no track, no buttons — just a slim pill
   showing position, in the panel's text colour at low opacity.
   (iOS overlays its own transient indicator and ignores this.) */
#panel .body::-webkit-scrollbar { width: 4px; }
#panel .body::-webkit-scrollbar-track { background: transparent; }
#panel .body::-webkit-scrollbar-thumb {
  background: rgba(223,227,234,.28); border-radius: 2px;
}
#panel .body::-webkit-scrollbar-thumb:hover {
  background: rgba(223,227,234,.45);
}
/* Firefox path only — setting scrollbar-color in Chrome would disable
   the finer pseudo-element styling above */
@supports not selector(::-webkit-scrollbar) {
  #panel .body {
    scrollbar-width: thin;
    scrollbar-color: rgba(223,227,234,.28) transparent;
  }
}
#panel.min .body { display: none; }
/* collapsed: shrink to a lone semi-transparent hamburger button */
#panel.min {
  width: auto; background: transparent; border-color: transparent;
}
#panel.min header, #panel.min header:hover { padding: 0; background: transparent; }
#panel.min .title { display: none; }
#panel.min .chev {
  width: 40px; height: 40px; padding: 0;
  font-size: 18px; font-weight: 400; line-height: 40px; text-align: center;
  background: rgba(12, 14, 18, .45);
  border-color: rgba(255,255,255,.15);
  color: rgba(223, 227, 234, .85);
}
#panel label { display: block; margin: 10px 0 4px; color: #aeb6c4; }
#panel input[type=range] { width: 100%; }
#panel .seg { display: flex; gap: 6px; }
#panel .seg button { flex: 1; }
#panel .seg button.on {
  background: #2b62c9; border-color: #2b62c9; color: #fff;
}
#panel button {
  background: rgba(255,255,255,.12); color: #dfe3ea; cursor: pointer;
  border: 1px solid rgba(255,255,255,.18); border-radius: 4px;
  padding: 6px 12px; font: 12px -apple-system, sans-serif;
}
#camFlip { width: 100%; margin-top: 8px; }
#panel input[type=range] { accent-color: #2b62c9; }

/* generated "Adjust symptoms" section (controls.js, from the schema) */
/* tabs read as text, not buttons: chrome stripped, active = underline */
#panel .tabs { margin-bottom: 10px; gap: 14px; }
#panel .tabs button {
  flex: none; background: none; border: none; border-radius: 0;
  padding: 4px 0; font-weight: 600; color: #8f97a5;
  border-bottom: 2px solid transparent;
}
#panel .tabs button.on {
  background: none; color: #fff; border-bottom-color: #2b62c9;
}
#adv, #aid { margin-top: 4px; }
.gen .group { margin-bottom: 6px; }
#panel .ghead { margin: 10px 0 0; font-weight: 600; color: #8f97a5; }
#panel .hint { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: #8f97a5; }
/* ⓘ hover tooltip on generated faders (schema `hint`) */
#panel .tipdot { cursor: help; position: relative; }
#panel .tipdot:hover::after {
  content: attr(data-tip);
  position: absolute; left: 0; bottom: 130%;
  width: 210px; padding: 6px 8px;
  background: #14171c; border: 1px solid #2a2f38; border-radius: 6px;
  font-size: 11px; font-weight: 400; line-height: 1.4; color: #cfd6e2;
  z-index: 10; pointer-events: none;
}
/* quale row: name left, switch right */
.gen .qrow {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; font-weight: 600; color: #cfd4dc;
}
/* the switch: a pill track whose ::after is the sliding knob */
.gen .qtoggle {
  position: relative; width: 40px; height: 22px; padding: 0;
  border-radius: 11px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  transition: background .18s ease, border-color .18s ease;
}
.gen .qtoggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #dfe3ea;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
  transition: transform .18s ease, background .18s ease;
}
.gen .qtoggle.on { background: #2b62c9; border-color: #2b62c9; }
.gen .qtoggle.on::after { transform: translateX(18px); background: #fff; }

/* touch devices: bigger panel, 44px-class touch targets */
@media (pointer: coarse) {
  #panel { width: min(320px, calc(100vw - 24px)); font-size: 15px; }
  #panel.min { width: auto; }
  #panel header { padding: 14px 16px; }
  #panel header .chev { padding: 10px 16px; font-size: 14px; }
  #panel.min header { padding: 0; }
  #panel.min .chev { width: 48px; height: 48px; padding: 0; font-size: 20px; line-height: 48px; }
  #panel .body { padding: 4px 16px 16px; }
  #panel .body {
    max-height: calc(100vh - 130px);
    max-height: calc(100dvh - 130px);
  }
  #panel label { font-size: 14px; margin: 12px 0 6px; }
  #panel button { padding: 12px 14px; font-size: 15px; }
  #panel input[type=range] { height: 40px; }
  /* bigger switch; padding re-zeroed against the generic button rule */
  .gen .qtoggle { width: 50px; height: 28px; padding: 0; border-radius: 14px; }
  .gen .qtoggle::after { width: 22px; height: 22px; }
  .gen .qtoggle.on::after { transform: translateX(22px); }
}
