/* ============================================================
   Noosfeerique — Experience CSS
   Mystique sobre, premium, mobile-first
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-cosmic: #0B0E14;
  --sphere-white: #F5F5F2;
  --accent-gold: #C9A24D;
  --accent-cyan: #4EC9C6;
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.5);
  --text-tertiary: rgba(255, 255, 255, 0.25);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-cosmic);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Canvas ---- */
#sphere-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  cursor: pointer;
}

/* ---- Sphere photo overlay (appears at high |z|) ---- */
.sphere-photo-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease, transform 1.5s ease;
}

.sphere-photo-overlay img {
  border-radius: 50%;
  display: block;
}

/* ---- Recording indicator (minimized session) ---- */
.rec-indicator {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(11, 14, 20, 0.8);
  border: 1px solid rgba(255, 68, 68, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.rec-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF4444;
  animation: recPulse 1.5s ease infinite;
}

.rec-indicator-timer {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Hide header when any full-screen overlay is open */
body:has(.graph-overlay.open) .header,
body:has(.session-overlay.open) .header,
body:has(.sessions-list-overlay.open) .header,
body:has(.session-detail-overlay.open) .header {
  opacity: 0;
  pointer-events: none;
}

.header-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
  pointer-events: auto;
}

.header-icons {
  display: flex;
  gap: 16px;
  pointer-events: auto;
}

.header-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.header-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

/* ---- Z-Score Indicator (bottom, very discreet) ---- */
.z-indicator {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.5s ease;
}

.z-indicator:hover {
  opacity: 1;
}

.z-value {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color 0.5s ease;
}

.z-label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ---- Bottom controls (audio + graph btn) ---- */
.bottom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Shared base for round buttons */
.control-btn,
.audio-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-tertiary);
}

.control-btn svg,
.audio-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.control-btn {
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.control-btn.recording {
  background: #ffffff;
  border-color: #ffffff;
  color: #0B0E14;
}

.control-btn.recording svg {
  stroke: #0B0E14;
}

/* Audio indicator with floating volume slider */
.audio-indicator {
  position: relative;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color 0.3s ease;
}

.audio-indicator.active {
  color: #ffffff;
}

.audio-indicator.active .audio-btn {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.audio-slider {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 130px;
  background: rgba(11, 14, 20, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 80;
}

.audio-slider.visible {
  opacity: 1;
  pointer-events: auto;
}

.audio-slider input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 100px;
  background: transparent;
  cursor: pointer;
  margin: 10px 0;
}

.audio-slider input[type="range"]::-webkit-slider-runnable-track {
  width: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.audio-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: none;
  margin-left: -5.5px;
}

.audio-slider input[type="range"]::-moz-range-track {
  width: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.audio-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: none;
}

/* ---- Full-screen overlay base (graph, session, sessions list, session detail) ---- */
.graph-overlay,
.session-overlay,
.sessions-list-overlay,
.session-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow-y: auto;
}

.graph-overlay.open,
.session-overlay.open,
.sessions-list-overlay.open,
.session-detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Graph overlay uses opaque background; session overlays are semi-transparent */
.graph-overlay {
  background: var(--bg-cosmic);
}

.session-overlay {
  background: rgba(11, 14, 20, 0.55);
}

.sessions-list-overlay,
.session-detail-overlay {
  background: rgba(11, 14, 20, 0.92);
}

/* ---- Shared overlay header (graph + session) ---- */
.graph-header,
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
}

/* ---- Shared overlay title (graph + session) ---- */
.graph-title,
.session-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.graph-header-right,
.session-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.graph-toggle-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.graph-toggle-btn:hover {
  color: var(--text-primary);
}

.graph-toggle-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.3s ease;
}

.graph-toggles:not(.collapsed) ~ .graph-header .graph-toggle-btn svg,
.graph-toggle-btn.expanded svg {
  transform: rotate(180deg);
}

.graph-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.graph-close:hover {
  color: var(--text-primary);
}

.graph-close svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.graph-highlights {
  padding: 0 20px 16px;
  flex-shrink: 0;
}

.highlights-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.highlights-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.highlight-card {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.highlight-z {
  font-size: 18px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--accent-gold);
}

.highlight-time {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}

.highlight-duration {
  font-size: 10px;
  color: var(--text-secondary);
}

.highlight-peak {
  border-color: var(--accent-gold);
}

.highlight-peak .highlight-z {
  color: var(--accent-gold);
}

.highlight-source {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.highlight-empty {
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
}

.graph-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  flex-shrink: 0;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.graph-toggles.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.graph-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  font-size: 11px;
  color: var(--text-tertiary);
  transition: all 0.2s ease;
}

.graph-toggle.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.graph-toggle input {
  display: none;
}

.toggle-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.graph-toggle.active .toggle-swatch {
  opacity: 1;
}

/* ---- Live z-score in graph overlay ---- */
.graph-live-z {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 20px 12px;
  flex-shrink: 0;
}

.live-z-value {
  font-size: 32px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color 0.5s ease;
}

.live-z-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.live-z-sources {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}

.live-z-source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0.4;
}

.live-z-source-dot.active {
  opacity: 1;
}

.graph-container {
  height: 50vh;
  min-height: 180px;
  padding: 0 4px 12px;
  position: relative;
  margin-top: auto;
}

.session-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
  margin-top: auto;
  margin-bottom: auto;
}

.session-history-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.session-history-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.session-name-input {
  width: 100%;
  max-width: 320px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
}

.session-name-input::placeholder {
  color: var(--text-tertiary);
}

.session-name-input:focus {
  border-color: var(--accent-cyan);
}

.collective-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.collective-divider::before,
.collective-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.collective-btn {
  border-color: rgba(78, 201, 198, 0.3);
}

.collective-btn:hover {
  border-color: rgba(78, 201, 198, 0.5);
  background: rgba(78, 201, 198, 0.1);
}

.collective-join {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  align-items: center;
}

.collective-join .session-name-input {
  flex: 1;
  font-size: 13px;
  letter-spacing: 0.1em;
}

.collective-join .session-record-btn {
  padding: 12px 16px;
  white-space: nowrap;
}

.collective-status {
  font-size: 12px;
  color: var(--accent-cyan);
  text-align: center;
  padding: 8px;
}

.session-participants {
  font-size: 11px;
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(78, 201, 198, 0.1);
}

.session-record-btn,
.session-stop-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.session-record-btn svg,
.session-stop-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.session-record-btn:hover {
  border-color: rgba(255, 68, 68, 0.4);
  background: rgba(255, 68, 68, 0.1);
}

.session-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
}

.session-pause-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.session-pause-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: currentColor;
}

.session-pause-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.session-pause-btn.paused {
  border-color: rgba(78, 201, 198, 0.4);
  color: var(--accent-cyan);
}

.session-stop-btn {
  border-color: rgba(255, 68, 68, 0.3);
}

.session-stop-btn:hover {
  background: rgba(255, 68, 68, 0.15);
}

.session-recording {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.session-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 8px;
}

.session-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF4444;
  animation: recPulse 1.5s ease infinite;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.session-rec-name {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-audio-fixed {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 70;
}

.session-audio-fixed:hover {
  color: var(--text-primary);
}

.session-audio-fixed.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.session-audio-fixed svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.session-copy-code {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.session-audio-btn:hover,
.session-copy-code:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.session-audio-btn.active {
  color: var(--accent-cyan);
  border-color: rgba(78, 201, 198, 0.3);
}

.session-copy-code.copied {
  color: var(--accent-gold);
  border-color: rgba(201, 162, 77, 0.3);
}

.session-audio-btn svg,
.session-copy-code svg {
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.session-rec-timer {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

.session-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 16px 8px;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.session-toggles.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.session-center-z {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-height: 80px;
  cursor: pointer;
}

.session-center-z-value {
  font-size: 48px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color 0.5s ease;
}

.session-z-max {
  font-size: 11px;
  color: var(--accent-gold);
}

.session-chart-container {
  height: 40vh;
  min-height: 150px;
  margin-top: 0;
}

.hidden {
  display: none !important;
}

/* ---- Sessions list ---- */
.sessions-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.saved-session-card {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-session-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.saved-session-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-session-name-input {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.saved-session-name-input:focus {
  border-bottom-color: var(--accent-cyan);
}

.saved-session-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: none;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.saved-session-delete:hover {
  color: #FF4444;
  border-color: rgba(255, 68, 68, 0.3);
  background: rgba(255, 68, 68, 0.1);
}

.saved-session-delete svg {
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.saved-session-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
}

.saved-session-zmax {
  font-size: 12px;
  color: var(--accent-gold);
}

/* ---- Session detail ---- */
.session-detail-content {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.detail-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.detail-comment {
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
  outline: none;
}

.detail-comment:focus {
  border-color: var(--accent-cyan);
}

.detail-chart-container {
  height: 40vh;
  min-height: 180px;
  position: relative;
}

.detail-delete-btn {
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 68, 68, 0.3);
  background: none;
  color: rgba(255, 68, 68, 0.7);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s ease;
}

.detail-delete-btn:hover {
  background: rgba(255, 68, 68, 0.1);
  color: #FF4444;
}

/* ---- Sources status (bottom-left, very discreet) ---- */
.sources-status {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 10;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}

.source-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.5s ease;
}

.source-dot.active {
  background: var(--accent-cyan);
}

/* ---- Loading state ---- */
.loading-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  transition: opacity 1s ease;
}

.loading-text.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .header {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 13px;
  }

  .header-icons {
    gap: 10px;
  }

  .header-icon {
    width: 30px;
    height: 30px;
  }

  .z-value {
    font-size: 22px;
  }

  .z-indicator {
    bottom: 16px;
  }

  .bottom-controls {
    bottom: 16px;
    right: 16px;
    gap: 8px;
  }

  .control-btn, .audio-indicator {
    width: 28px;
    height: 28px;
  }

  .sources-status {
    bottom: 16px;
    left: 16px;
  }

  .sidebar, .settings-panel {
    width: 100%;
  }

  .graph-highlights {
    padding: 0 16px 12px;
  }

  .highlights-list {
    gap: 6px;
  }

  .highlight-card {
    padding: 6px 10px;
    min-width: 100px;
  }

  .graph-toggles {
    padding: 0 16px 10px;
    gap: 4px;
  }

  .graph-toggle {
    padding: 4px 8px;
    font-size: 10px;
  }

  .graph-container {
    height: 45vh;
    min-height: 150px;
    padding: 0 2px 8px;
  }

  .highlight-card {
    min-width: 90px;
  }

  .modal-glass {
    max-width: 100%;
    margin: 12px;
    padding: 24px;
    max-height: 90vh;
  }
}

@media (max-width: 360px) {
  .header-title {
    font-size: 12px;
    letter-spacing: 0.06em;
  }

  .header-icons {
    gap: 8px;
  }

  .header-icon {
    width: 28px;
    height: 28px;
  }
}

/* ---- Shared panel backdrop ---- */
.sidebar-backdrop,
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.sidebar-backdrop.open,
.settings-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Shared panel base ---- */
.sidebar,
.settings-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

/* ---- Sidebar (slides from left) ---- */
.sidebar {
  left: 0;
  width: 280px;
  border-right: 1px solid var(--glass-border);
  transform: translateX(-100%);
}

.sidebar.open {
  transform: translateX(0);
}

/* ---- Settings panel (slides from right) ---- */
.settings-panel {
  right: 0;
  width: 300px;
  border-left: 1px solid var(--glass-border);
  transform: translateX(100%);
  overflow-y: auto;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-section {
  padding: 20px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-section-subtitle {
  font-size: 10px;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.scale-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---- Scale options — same layout as .source-option ---- */
.scale-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.scale-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.scale-option.active {
  background: rgba(255, 255, 255, 0.06);
}

.scale-option input[type="radio"] {
  display: none;
}

/* Scale uses gold accent instead of cyan */
.scale-option.active .source-radio {
  border-color: var(--accent-gold);
}

.scale-option.active .source-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.scale-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scale-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.scale-desc {
  font-size: 10px;
  color: var(--text-tertiary);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.sidebar-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.sidebar-close:hover {
  color: var(--text-primary);
}

.sidebar-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.sidebar-sources {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.source-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.source-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.source-option.active {
  background: rgba(255, 255, 255, 0.06);
}

.source-option input[type="radio"] {
  display: none;
}

.source-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  flex-shrink: 0;
  transition: all 0.2s ease;
  position: relative;
}

.source-option.active .source-radio {
  border-color: var(--accent-cyan);
}

.source-option.active .source-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.source-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.source-option .source-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.source-option .source-origin {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.source-z {
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
}

.sidebar-link {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
}

.sidebar-link:hover {
  color: var(--accent-cyan);
}

/* ---- Help modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.modal-glass {
  position: relative;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  margin: 20px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-glass h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.modal-glass h3 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-top: 20px;
  margin-bottom: 10px;
}

.modal-glass p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.modal-glass ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.modal-glass li {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 4px 16px;
  position: relative;
}

.modal-glass li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  transform: translateY(-50%);
}

.modal-glass p.help-hint {
  color: var(--accent-gold);
  font-style: italic;
  font-size: 12px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
