/* ════════════════════════════════════════════════════════════════════════════
   SHAME — isobars + multi-eye styles (self-contained, no IrisEye dependency)
   ════════════════════════════════════════════════════════════════════════════ */

#shame-svg {
  z-index: 5;
}

/* NOTE: `vector-effect: non-scaling-stroke` was removed from #shame-svg path.
   The SVG already matches the viewport 1:1 (viewBox sized to innerWidth ×
   innerHeight on every resize), so strokes never get visually scaled. Forcing
   the browser to recompute stroke geometry in screen-space every frame was a
   significant cost when stroke-dashoffset animates 28+ paths at 60 fps. */

/* Per-eye iris groups: promote to their own GPU layer so the per-frame
   transform updates don't force a repaint of the whole SVG. On wide screens
   the SVG is large and re-rasterizing it every frame is the main cost. */
#shame-deco-layer .shame-eye-iris {
  will-change: transform;
}

/* Isobar text — judgement phrases that flow along certain paths */
.shame-isobar-text {
  font-family: 'Inter', 'Helvetica Neue', monospace;
  font-weight: 500;
  letter-spacing: 0.15em;
  font-style: normal;
  paint-order: stroke fill;
  /* subtle dark outline so the text is readable even when crossing tiny eye
     features that might bleed close to the path */
  stroke: rgba(0,0,0,0.55);
  stroke-width: 0.6;
}

/* ── Settings menu ───────────────────────────────────────────────────────── */
#shame-menu-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  height: 30px;
  background: rgba(15,15,15,0.8);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.6);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0 16px;
  transition: color .15s, border-color .15s, background .15s;
}
#shame-menu-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.45);
  background: rgba(30,30,30,0.85);
}
#shame-menu-btn::before { content: 'EXPOSED'; }

#shame-menu-panel {
  position: fixed;
  top: 3.2rem;
  right: 1rem;
  width: min(560px, calc(100vw - 2rem));
  /* Cap height to viewport (minus a margin so it doesn't touch top/bottom)
     and scroll internally — the panel has many sections (mode, isobars,
     eyes, behaviour, text, visualization, topics legend, live + sources,
     audio, display) and easily overflows on small displays. */
  max-height: calc(100vh - 4.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;       /* don't bounce-scroll the body */
  background: rgba(8,8,8,0.94);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 3px;
  padding: 0.85rem 0.95rem 0.95rem;
  color: rgba(255,255,255,0.78);
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  /* Touch-friendly scrolling on TV panel */
  -webkit-overflow-scrolling: touch;
}
/* Scrollbar styling — slim, dark, matches the panel aesthetic */
#shame-menu-panel::-webkit-scrollbar {
  width: 6px;
}
#shame-menu-panel::-webkit-scrollbar-track {
  background: transparent;
}
#shame-menu-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
}
#shame-menu-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.32);
}
/* Firefox scrollbar */
#shame-menu-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
#shame-menu-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
#shame-menu-panel .shame-menu-title {
  margin: 0 0 0.9rem;
  font-size: 14px;
  font-weight: 200;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  padding-bottom: 0.6rem;
}
#shame-menu-panel .shame-cols {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
#shame-menu-panel .shame-col-main { flex: 1 1 0; min-width: 0; }
#shame-menu-panel .shame-col-about {
  flex: 0 0 240px;
  max-width: 240px;
  position: sticky;
  top: 0;
}
#shame-menu-panel .shame-col-about .shame-about { margin: 0; }
@media (max-width: 560px) {
  #shame-menu-panel .shame-cols { flex-direction: column; }
  #shame-menu-panel .shame-col-about { flex: none; max-width: none; width: 100%; position: static; }
}
#shame-menu-panel .shame-about {
  margin: 0 0 0.9rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
  padding: 0.55rem 0.7rem;
}
#shame-menu-panel .shame-about > summary {
  cursor: pointer;
  list-style: none;
  font-size: 8px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  user-select: none;
}
#shame-menu-panel .shame-about > summary::-webkit-details-marker { display: none; }
#shame-menu-panel .shame-about > summary::after { content: " ▸"; }
#shame-menu-panel .shame-about[open] > summary::after { content: " ▾"; }
#shame-menu-panel .shame-about p {
  margin: 0.55rem 0 0;
  font-size: 10.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.7);
  font-weight: 300;
}
#shame-menu-panel .shame-about p b { color: rgba(255,255,255,0.92); font-weight: 500; }
#shame-menu-panel .shame-src {
  margin: 0.4rem 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: rgba(255,255,255,0.6);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
#shame-menu-panel .shame-src-h {
  display: block;
  margin-top: 0.4rem;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  font-family: inherit;
}
#shame-menu-panel .shame-about-note {
  margin-top: 0.6rem !important;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55) !important;
  font-style: italic;
}
#shame-menu-panel h3 {
  margin: 0 0 0.4rem;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: rgba(255,255,255,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0.3rem;
  font-weight: normal;
}
#shame-menu-panel h3:not(:first-child) { margin-top: 0.9rem; }
#shame-menu-panel label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.22rem 0;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
#shame-menu-panel label:hover { color: #fff; }
#shame-menu-panel input[type="radio"],
#shame-menu-panel input[type="checkbox"] {
  cursor: pointer;
  accent-color: rgba(220,220,220,0.85);
  margin: 0;
}
#shame-camera-status {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  margin: 0.25rem 0 0 1.6rem;
  min-height: 11px;
  font-style: italic;
}

/* Exit button — destructive action, visually distinct from regular
   buttons so the curator doesn't tap it by accident while configuring. */
#shame-menu-panel .shame-exit-btn {
  background: rgba(80, 20, 20, 0.6);
  border-color: rgba(255, 85, 68, 0.55);
  color: rgba(255, 200, 200, 0.92);
  letter-spacing: 0.22em;
  margin-top: 0.4rem;
}
#shame-menu-panel .shame-exit-btn:hover {
  background: rgba(170, 30, 30, 0.85);
  border-color: rgba(255, 153, 112, 0.85);
  color: #fff;
}

/* Audio rows — checkbox + volume slider stacked tightly (also re-used for
   the eye-size slider, which has the same layout pattern). */
#shame-menu-panel .shame-audio-row {
  margin: 0.15rem 0 0.35rem;
}
#shame-menu-panel .shame-audio-row label {
  padding-bottom: 0;
}
/* For non-checkbox rows (slider only) — show label + inline value */
#shame-menu-panel .shame-slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  padding: 0.22rem 0 0;
  cursor: default;
}
#shame-menu-panel .shame-slider-label span {
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
#shame-menu-panel .shame-vol {
  display: block;
  width: calc(100% - 1.65rem);
  margin: 0.15rem 0 0 1.65rem;
  accent-color: rgba(220,220,220,0.85);
  cursor: pointer;
  height: 14px;
}
#shame-menu-panel .shame-hint {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  margin: 0.35rem 0 0;
  font-style: italic;
  text-align: center;
}

/* ── Topics legend — color swatch + name + count, one row per category ── */
#shame-menu-panel .shame-legend {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#shame-menu-panel .shame-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1px 0;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}
#shame-menu-panel .shame-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
#shame-menu-panel .shame-legend-name {
  flex: 1;
  color: rgba(255,255,255,0.78);
  text-transform: capitalize;
}
#shame-menu-panel .shame-legend-count {
  color: rgba(255,255,255,0.4);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}
#shame-menu-panel .shame-legend-live {
  color: #ff5544;
  margin-left: 0.3rem;
  font-size: 8px;
  animation: shame-live-pulse-text 1.6s ease-in-out infinite;
}
@keyframes shame-live-pulse-text {
  0%, 100% { color: #ff5544; }
  50%      { color: #ff9970; }
}

/* ── Source listing for the live feed ───────────────────────────────────── */
#shame-menu-panel .shame-source-group {
  margin-top: 0.45rem;
}
#shame-menu-panel .shame-source-name {
  font-size: 8px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 0.1rem;
}
#shame-menu-panel .shame-source-list {
  font-size: 9px;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
  margin-left: 0.1rem;
  word-spacing: 0;
}

/* ── Gallery mode ───────────────────────────────────────────────────────
   Toggled by adding .shame-gallery-mode to <body>. Used for the kiosk /
   TV install: no cursor, no settings UI, just the piece. ESC exits via
   the fullscreenchange listener in shame.js. */
body.shame-gallery-mode,
body.shame-gallery-mode * {
  cursor: none !important;
}
/* In gallery mode the menu button stays REACHABLE but goes almost
   invisible — the curator can still tap the corner to open the panel
   without breaking the immersion for a casual visitor. The hit area
   stays full-size so finger taps on a touch panel land easily; only
   the visual is dimmed. */
body.shame-gallery-mode #shame-menu-btn {
  opacity: 0.08;
  background: transparent !important;
  border-color: transparent !important;
}
body.shame-gallery-mode #shame-menu-btn:hover,
body.shame-gallery-mode #shame-menu-btn:active {
  opacity: 1;
  background: rgba(15,15,15,0.8) !important;
  border-color: rgba(255,255,255,0.35) !important;
}
/* The panel itself, when opened in gallery mode, gets a fully opaque
   background so it stays readable over the busy piece behind. */
body.shame-gallery-mode #shame-menu-panel.open {
  background: rgba(0,0,0,0.97);
}

/* ── Live feed phrases ──────────────────────────────────────────────────
   Tspans marked [data-live="1"] (real-time judgments scraped from Reddit
   + Mastodon) pulse in a vivid coral-red. The "● " prefix in the text
   content is the LED itself; this animation makes the whole live phrase
   throb gently so it reads as "broadcast / live" against the static
   curated corpus. */
@keyframes shame-live-pulse {
  0%, 100% { fill: #ff5544; }
  50%      { fill: #ff9970; }
}
#shame-svg tspan[data-live="1"] {
  animation: shame-live-pulse 1.8s ease-in-out infinite;
  /* Cancel the dark stroke inherited from .shame-isobar-text — that
     stroke is meant to outline white text on busy backgrounds, but on a
     red glyph against pure black it just eats luminance from the edges,
     making the phrase look darker than it is. */
  stroke: none !important;
}

/* Public floating "● LIVE" badge — sits bottom-left, NO count shown.
   Tells the audience the piece is connected / streaming. The full count
   lives inside the menu (#shame-live-status) so a network hiccup never
   reveals a zero to the audience. */
#shame-live-badge {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  font-family: 'Inter', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ff5544;
  background: rgba(15,15,15,0.7);
  border: 1px solid rgba(255,85,68,0.45);
  border-radius: 3px;
  padding: 0.35rem 0.7rem;
  pointer-events: none;
  z-index: 100;
  user-select: none;
  animation: shame-live-pulse-bg 1.8s ease-in-out infinite;
}
#shame-live-badge.fetching {
  animation-duration: 0.9s;       /* faster pulse while scraping */
}
@keyframes shame-live-pulse-bg {
  0%, 100% { color: #ff5544; border-color: rgba(255,85,68,0.45); }
  50%      { color: #ff9970; border-color: rgba(255,153,112,0.75); }
}
/* In gallery mode the badge hides — keeps the kiosk immersion clean.
   The menu-side count is still updating in the background. */
body.shame-gallery-mode #shame-live-badge {
  display: none !important;
}

/* Live feed status — lives INSIDE the menu (no number on the main canvas
   so the audience never sees "0 phrases" if the scraper had a hiccup).
   Only the curator opening the menu can see the actual count. */
#shame-menu-panel .shame-live-status-row {
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  margin: 0.15rem 0 0 1.65rem;     /* align with the checkbox label text */
  letter-spacing: 0.1em;
}
#shame-menu-panel #shame-live-status {
  color: #ff5544;
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 0.25rem;
}
#shame-menu-panel #shame-live-status.fetching {
  animation: shame-live-pulse-text 1.6s ease-in-out infinite;
}

.shame-btn {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: rgba(40,40,40,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background .15s, color .15s, border-color .15s;
}
.shame-btn:hover {
  background: rgba(70,70,70,0.85);
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}
.shame-btn:active { background: rgba(100,100,100,0.9); }

/* Performance preset row — 3 buttons side-by-side */
#shame-menu-panel .shame-preset-row {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
#shame-menu-panel .shame-preset-row .shame-preset-btn {
  flex: 1;
  margin-top: 0;
  padding: 0.4rem 0.2rem;
  font-size: 9px;
  letter-spacing: 0.10em;
}

/* Eye-count stepper */
.shame-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.25rem 0 0.4rem;
  gap: 0.5rem;
}
.shame-counter-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.6);
  flex: 1;
  text-transform: uppercase;
}
.shame-step-btn {
  width: 22px;
  height: 22px;
  background: rgba(40,40,40,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  font-family: monospace;
  font-size: 14px;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.shame-step-btn:hover {
  background: rgba(70,70,70,0.85);
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}
.shame-step-btn:active { background: rgba(100,100,100,0.9); }
#shame-eye-count-val {
  min-width: 24px;
  text-align: center;
  font-size: 12px;
  color: #fff;
  font-family: monospace;
}
