:root {
  color-scheme: dark;
  --ink: #ecf8f7;
  --muted: #a7bfbd;
  --line: rgba(132, 255, 239, 0.2);
  --paper: #071012;
  --panel: rgba(15, 31, 34, 0.86);
  --panel-strong: rgba(20, 45, 49, 0.96);
  --teal: #75f7e6;
  --coral: #ff7d73;
  --gold: #ffbd61;
  --blue: #a9fff4;
  --dark: #061011;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(117, 247, 230, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(255, 189, 97, 0.12), transparent 24rem),
    linear-gradient(135deg, #071012 0%, #0d1d21 55%, #132529 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  background-image:
    linear-gradient(rgba(117, 247, 230, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 247, 230, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  opacity: 0.28;
  pointer-events: none;
  position: fixed;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(117, 247, 230, 0.18), rgba(255, 189, 97, 0.12)),
    linear-gradient(135deg, rgba(20, 45, 49, 0.96), rgba(7, 16, 18, 0.92));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  margin: 32px auto 24px;
  max-width: 1680px;
  padding: 24px clamp(20px, 4vw, 34px);
  position: relative;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  background:
    radial-gradient(circle at 64% 38%, var(--gold) 0 16%, transparent 17%),
    linear-gradient(135deg, var(--teal), #18464d);
  border-radius: 50%;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  flex: 0 0 auto;
  height: 42px;
  width: 42px;
}

button.brand-mark,
.brand-mark.voice-circle-btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease,
              background 0.3s ease;
}

button.brand-mark:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

button.brand-mark:active {
  transform: scale(0.92);
}

.brand-mark .voice-mic-icon {
  width: 19px;
  height: 19px;
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Voice Working / Listening State */
.brand-mark.is-listening {
  background:
    radial-gradient(circle at 64% 38%, #ffffff 0 20%, transparent 22%),
    linear-gradient(135deg, #ff3b30, #ff9500);
  box-shadow: 0 0 22px rgba(255, 59, 48, 0.8), 0 0 44px rgba(255, 149, 0, 0.5);
  animation: voicePulse 1.2s ease-in-out infinite alternate;
}

.brand-mark.is-listening::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 75, 43, 0.7);
  animation: voiceRipple 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
  pointer-events: none;
}

.brand-mark.is-listening::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 149, 0, 0.45);
  animation: voiceRipple 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) 0.6s infinite;
  pointer-events: none;
}

/* Voice Receiving State (active speech / audio detected) */
.brand-mark.is-receiving-voice {
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 24%, transparent 26%),
    linear-gradient(135deg, #ff0844, #ffb199);
  box-shadow: 0 0 32px rgba(255, 8, 68, 0.95), 0 0 64px rgba(255, 177, 153, 0.7);
  animation: voiceActiveBeat 0.35s ease-in-out infinite alternate;
}

.brand-mark.is-receiving-voice .voice-mic-icon {
  transform: scale(1.18);
  color: #ffffff;
}

@keyframes voicePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 16px rgba(255, 59, 48, 0.6), 0 0 32px rgba(255, 149, 0, 0.35);
  }
  100% {
    transform: scale(1.14);
    box-shadow: 0 0 28px rgba(255, 59, 48, 0.9), 0 0 54px rgba(255, 149, 0, 0.65);
  }
}

@keyframes voiceActiveBeat {
  0% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1.24);
  }
}

@keyframes voiceRipple {
  0% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.85);
    opacity: 0;
  }
}

.brand-mark.is-speaking {
  background: radial-gradient(circle at 50% 50%, #ffffff 0 20%, transparent 22%), linear-gradient(135deg, #00c6ff, #0072ff) !important;
  box-shadow: 0 0 28px rgba(0, 198, 255, 0.85), 0 0 54px rgba(0, 114, 255, 0.55) !important;
  animation: voiceSpeakingBeat 0.55s ease-in-out infinite alternate !important;
}

@keyframes voiceSpeakingBeat {
  0% { transform: scale(1.02); }
  100% { transform: scale(1.15); }
}

.universal-voice-toggle {
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 999px !important;
  color: #fff !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  padding: 6px 12px !important;
  min-height: 44px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
}

.brand h1 {
  font-size: 1.12rem;
  line-height: 1.1;
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 4px 0 0;
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.site-nav {
  flex: 1 1 100%;
  justify-content: flex-start;
  max-width: 100%;
}

.text-link {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 800;
  height: 42px;
  padding: 0 16px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.text-link:hover,
.text-link.active {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(117, 247, 230, 0.22);
  color: var(--dark);
}

.artifact-factory-link[hidden] {
  display: none;
}

.icon-button {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 1.2rem;
  height: 42px;
  justify-content: center;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  width: 42px;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.icon-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

.related-artifacts {
  background: rgba(117, 247, 230, 0.055);
  border: 2px solid rgba(117, 247, 230, 0.34);
  border-radius: 16px;
  margin: 0 0 14px;
  padding: 12px;
}

.related-artifacts h3 {
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.related-artifact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.family-sibling-links {
  background: rgba(117, 247, 230, .045);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 12px;
  padding: 12px;
}

.family-sibling-label {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  grid-column: 1 / -1;
  text-transform: uppercase;
}

.family-sibling-link {
  align-items: center;
  background: rgba(117, 247, 230, .08);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--teal);
  display: flex;
  font-size: .84rem;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  padding: 9px 12px;
  text-align: center;
  text-decoration: none;
}

.family-sibling-link:hover,
.family-sibling-link:focus-visible {
  background: var(--teal);
  color: var(--dark);
  outline: none;
}

.family-sibling-link.is-current {
  background: var(--teal);
  color: var(--dark);
}

.family-sibling-link.is-unavailable {
  border-style: dashed;
  color: var(--muted);
  cursor: not-allowed;
  opacity: .72;
}

.related-artifact-link {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 6px;
  height: auto;
  min-height: 36px;
  padding: 7px 12px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.related-artifact-link:hover {
  background: var(--teal);
  box-shadow: 0 4px 16px rgba(117, 247, 230, 0.22);
  color: var(--dark);
}

/* Startpoint & Expandable Node Navigator */
.mindmap-startpoint-card {
  background: linear-gradient(135deg, rgba(117, 247, 230, 0.08), rgba(255, 189, 97, 0.06));
  border: 1.5px solid rgba(117, 247, 230, 0.35);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.mindmap-startpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mindmap-startpoint-badge {
  background: rgba(255, 189, 97, 0.18);
  color: var(--gold, #ffbd61);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.mindmap-res-badge {
  background: rgba(117, 247, 230, 0.12);
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(117, 247, 230, 0.25);
}
.mindmap-startpoint-title {
  font-size: 1.05rem;
  font-weight: 850;
  color: #ffffff;
  margin: 0 0 6px;
  line-height: 1.35;
}
.mindmap-startpoint-desc {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0 0 10px;
}
.mindmap-live-expand-btn,
[data-owner-only="true"] {
  display: none !important;
}

html[data-auth-mode="authenticated"] .mindmap-live-expand-btn,
html[data-auth-mode="authenticated"] [data-owner-only="true"] {
  display: inline-flex !important;
}

.mindmap-live-expand-btn {
  align-items: center;
  gap: 8px;
  background: var(--teal);
  color: var(--dark);
  font-size: 0.84rem;
  font-weight: 850;
  padding: 9px 14px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(117, 247, 230, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  margin-bottom: 10px;
}
.mindmap-live-expand-btn:hover, .mindmap-live-expand-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(117, 247, 230, 0.45);
  color: var(--dark);
  outline: none;
}
.mindmap-node-tree {
  margin-top: 12px;
  border-top: 1px solid rgba(117, 247, 230, 0.16);
  padding-top: 10px;
}
.mindmap-node-tree-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.mindmap-tree-branch {
  border: 1px solid rgba(117, 247, 230, 0.16);
  border-radius: 10px;
  margin-bottom: 7px;
  background: rgba(0, 0, 0, 0.24);
  overflow: hidden;
}
.mindmap-tree-summary {
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink, #ffffff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}
.mindmap-tree-summary::-webkit-details-marker {
  display: none;
}
.mindmap-tree-summary:hover {
  background: rgba(117, 247, 230, 0.06);
  color: var(--teal);
}
.mindmap-branch-count {
  font-size: 0.7rem;
  color: var(--teal);
  background: rgba(117, 247, 230, 0.1);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
}
.mindmap-tree-content {
  padding: 8px 10px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(117, 247, 230, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mindmap-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.mindmap-node-row .mindmap-node-link {
  flex: 1 1 auto;
}
.mindmap-node-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid rgba(117, 247, 230, 0.18);
  font-weight: 750;
  font-size: 0.78rem;
  line-height: 1.25;
  transition: all 0.15s ease;
}
.mindmap-node-link:hover, .mindmap-node-link:focus-visible {
  background: var(--teal);
  color: var(--dark);
  outline: none;
}
.mindmap-node-link.is-current {
  background: var(--teal);
  color: var(--dark);
  font-weight: 850;
}
.mindmap-node-download {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  text-decoration: none;
  width: 28px;
  flex: 0 0 28px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mindmap-node-download:hover, .mindmap-node-download:focus-visible {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--dark);
  outline: none;
}

.content-side-toggle {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 9px 11px 10px;
}

.content-side-toggle legend {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 0 5px;
  text-transform: uppercase;
}

.content-side-toggle label {
  align-items: center;
  background: rgba(117, 247, 230, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 850;
  gap: 7px;
  min-height: 38px;
  padding: 6px 12px;
}

.content-side-toggle label:has(input:checked) {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--dark);
}

.content-side-toggle input {
  accent-color: var(--dark);
  height: 17px;
  margin: 0;
  width: 17px;
}

.content-side-toggle label:focus-within {
  outline: 3px solid rgba(117, 247, 230, 0.28);
  outline-offset: 2px;
}

.content-side-toggle p {
  color: var(--muted);
  flex-basis: 100%;
  font-size: 0.68rem;
  margin: 0;
}

.shell {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.72fr);
  align-items: start;
  margin: 0 auto;
  max-width: 1680px;
  padding: 8px 20px 72px;
  position: relative;
}

.now-playing {
  align-self: stretch;
  align-items: stretch;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  min-width: 0;
}

.player-frame {
  background: #111;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  min-height: 300px;
  overflow: hidden;
  position: sticky;
  scroll-margin-top: max(8px, env(safe-area-inset-top));
  top: 20px;
  z-index: 5;
}

.video-stage {
  aspect-ratio: 16 / 9;
  background: #111;
  max-height: 72vh;
  position: relative;
  width: 100%;
}

video {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.fullscreen-button {
  align-items: center;
  backdrop-filter: blur(8px);
  background: rgba(6, 16, 17, 0.9);
  border: 1px solid rgba(236, 248, 247, 0.5);
  border-radius: 999px;
  bottom: 12px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  position: absolute;
  right: 12px;
  z-index: 4;
}

.fullscreen-button:hover,
.fullscreen-button:focus-visible {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--dark);
  outline: 3px solid rgba(117, 247, 230, 0.25);
}

.fullscreen-button[hidden] {
  display: none;
}

.fullscreen-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.video-stage:fullscreen,
.video-stage:-webkit-full-screen {
  align-items: center;
  background: #000;
  display: flex;
  height: 100%;
  max-height: none;
  width: 100%;
}

.video-stage:fullscreen video,
.video-stage:-webkit-full-screen video {
  max-height: 100%;
}

.video-stage:fullscreen .fullscreen-button,
.video-stage:-webkit-full-screen .fullscreen-button {
  bottom: max(18px, env(safe-area-inset-bottom));
  right: max(18px, env(safe-area-inset-right));
}

.media-controls {
  background: rgba(6, 16, 17, 0.94);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.media-controls[hidden] {
  display: none;
}

.media-buttons {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.media-button {
  border: 0;
  border-radius: 999px;
  color: var(--dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 44px;
  padding: 0 14px;
  transition: filter 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}

.media-button:hover {
  filter: brightness(1.1);
}

.media-button:active {
  transform: scale(0.97);
}

.media-button:focus-visible {
  outline: 3px solid rgba(117, 247, 230, 0.45);
  outline-offset: 3px;
}

.play-media {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 6px 20px rgba(117, 247, 230, 0.26);
}

.resume-media {
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  color: var(--teal);
}

.stop-media {
  background: linear-gradient(135deg, var(--gold), var(--coral));
  box-shadow: 0 6px 18px rgba(255, 189, 97, 0.2);
}

.media-slider {
  accent-color: var(--teal);
  cursor: pointer;
  width: 100%;
}

.media-time {
  color: var(--muted);
  display: flex;
  font-size: 0.84rem;
  font-weight: 800;
  justify-content: space-between;
  gap: 12px;
}

.episode-panel {
  align-content: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
}

.eyebrow {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.episode-panel h2 {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1.02;
  margin: 0;
}

.summary {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
}

.companion-row {
  margin: 0.85rem 0 1rem;
}

.companion-row .text-link {
  display: inline-block;
  font-weight: 700;
}

.meta-grid {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding-top: 4px;
}

.meta-grid div {
  border-bottom: 1px solid var(--line);
  min-width: 0;
  padding: 14px 8px 12px 0;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

dd {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.library-band {
  display: grid;
  gap: 16px;
  grid-template-rows: auto auto;
  min-height: 0;
  overflow: visible;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.section-heading h2 {
  font-size: 1.35rem;
  margin: 0;
}

.section-heading p {
  color: var(--muted);
  margin: 5px 0 0;
}

.library-view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.library-controls {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  width: min(100%, 620px);
}

.video-search {
  color: var(--muted);
  display: grid;
  font-size: 0.68rem;
  font-weight: 900;
  gap: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.video-search input {
  appearance: none;
  background: rgba(236, 248, 247, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: normal;
  min-height: 42px;
  padding: 0 13px;
  text-transform: none;
  width: 100%;
}

.video-search input:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(117, 247, 230, 0.16);
  outline: none;
}

.video-search input::placeholder {
  color: #7e9a97;
}

.artifact-type-filter {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 0;
  min-width: 0;
  padding: 9px 10px 8px;
  width: 100%;
}

.artifact-type-filter legend {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 0 5px;
  text-transform: uppercase;
}

.artifact-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.artifact-type-option {
  align-items: center;
  background: rgba(117, 247, 230, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 750;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
}

.artifact-type-option:has(input:checked) {
  background: rgba(117, 247, 230, 0.18);
  border-color: var(--teal);
}

.artifact-type-option input {
  accent-color: var(--teal);
  height: 16px;
  margin: 0;
  width: 16px;
}

.artifact-type-status {
  color: var(--muted);
  font-size: 0.68rem;
  margin: 7px 2px 0;
}

.organization-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.library-pickers {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: min(100%, 330px);
  width: 100%;
}

.library-picker {
  color: var(--muted);
  display: grid;
  font-size: 0.68rem;
  font-weight: 800;
  gap: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.library-picker select,
.library-picker input[type="date"] {
  appearance: none;
  background-color: var(--panel);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%),
    linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: normal;
  min-height: 38px;
  padding: 0 28px 0 9px;
  text-transform: none;
  width: 100%;
}

.library-date-row {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.library-picker input[type="date"] {
  background-image: none;
  padding-right: 9px;
}

.library-date-row button {
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  min-height: 38px;
  padding: 0 9px;
}

.library-date-row button:disabled {
  cursor: default;
  opacity: 0.42;
}

.library-picker select:focus-visible,
.library-picker input[type="date"]:focus-visible,
.library-date-row button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(117, 247, 230, 0.16);
  outline: none;
}

.library-picker select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.library-view-switch .text-link[aria-pressed="true"],
.organization-switch .text-link[aria-pressed="true"] {
  background: rgba(117, 247, 230, 0.12);
  border-color: var(--teal);
  color: var(--teal);
}

.episode-list {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: visible;
  padding: 3px 3px 18px;
}

.episode-group {
  display: grid;
  gap: 8px;
  scroll-margin-top: 12px;
}

.episode-group.rolodex-active {
  animation: rolodex-focus 0.72s ease-out;
}

@keyframes rolodex-focus {
  0% {
    opacity: 0.35;
    transform: perspective(700px) rotateX(-24deg) translateY(14px);
  }
  55% {
    opacity: 1;
    transform: perspective(700px) rotateX(5deg) translateY(-2px);
  }
  100% {
    transform: perspective(700px) rotateX(0) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .episode-group.rolodex-active {
    animation: none;
  }
}

.episode-group + .episode-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.episode-group-heading {
  color: var(--teal);
  font-size: 0.82rem;
  letter-spacing: 0.045em;
  margin: 0;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.episode-group-list {
  display: grid;
  gap: 14px;
}

.video-notebook-family {
  background: linear-gradient(145deg, rgba(3, 15, 16, 0.98), rgba(8, 27, 29, 0.96));
  grid-column: 1 / -1;
  border: 2px solid rgba(117, 247, 230, 0.62);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(117, 247, 230, 0.08), 0 14px 34px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.video-notebook-banner {
  margin: 0;
  padding: 12px 15px;
  background: rgba(117, 247, 230, 0.1);
  border-bottom: 1px solid rgba(117, 247, 230, 0.28);
  color: var(--teal);
  font-size: 0.9rem;
  letter-spacing: 0.025em;
}

.video-notebook-family-body {
  padding: 11px;
}

.video-notebook-family-list {
  background: rgba(117, 247, 230, 0.035);
  border: 1px solid rgba(117, 247, 230, 0.18);
  border-radius: 13px;
  min-width: 0;
  padding: 8px;
}

.library-columns {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

.library-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.library-column-heading {
  border-bottom: 2px solid var(--teal);
  color: var(--text);
  font-size: 0.95rem;
  margin: 0;
  padding: 0 0 8px;
}

.library-column[data-library-column="other-stuff"] .library-column-heading {
  border-bottom-color: var(--gold);
}

.library-column .episode-card {
  align-items: start;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr);
  padding: 10px;
}

.library-column .episode-thumb {
  display: none;
}

.library-column .episode-card h3 {
  font-size: 0.8rem;
  line-height: 1.25;
}

.library-column .episode-card p {
  font-size: 0.68rem;
  line-height: 1.3;
}

.library-column .pill,
.library-column .retention-pill {
  grid-column: 1;
  justify-self: start;
}

.episode-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  display: grid;
  gap: 18px;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  padding: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.episode-card:hover {
  border-color: rgba(117, 247, 230, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.episode-card[aria-current="true"] {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(117, 247, 230, 0.16);
}

.episode-card.waiting {
  border-color: rgba(255, 189, 97, 0.32);
}

.episode-card.waiting .episode-thumb {
  background: linear-gradient(135deg, rgba(255, 189, 97, 0.9), rgba(255, 125, 115, 0.82));
}

.episode-card.viewed .episode-thumb {
  background: linear-gradient(135deg, #82919b, #35454f);
}

.episode-thumb {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--teal), #18464d 58%, var(--gold));
  border-radius: 14px;
  color: var(--dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.episode-number {
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.episode-thumb-label {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  margin-left: 0.18em;
  margin-top: 7px;
  opacity: 0.72;
}

.episode-card h3 {
  font-size: 1rem;
  margin: 0;
}

.episode-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 5px 0 0;
}

.pill {
  background: rgba(255, 189, 97, 0.08);
  border: 1px solid rgba(255, 189, 97, 0.28);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}

.retention-pill {
  align-items: center;
  background: rgba(255, 189, 97, 0.1);
  border: 1px solid rgba(255, 189, 97, 0.28);
  border-radius: 999px;
  color: var(--gold);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 900;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  white-space: nowrap;
}

.episode-card-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episode-download-button {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
  white-space: nowrap;
}

.episode-download-button:hover {
  background: rgba(117, 247, 230, 0.18);
  border-color: var(--teal);
  box-shadow: 0 2px 10px rgba(117, 247, 230, 0.2);
  transform: translateY(-1px);
}

.episode-download-button:active {
  transform: scale(0.96);
}

html.generator-page,
html:has(.generator-shell),
html:has(.suggestion-shell),
body.generator-page,
body:has(.generator-shell),
body:has(.suggestion-shell) {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

body.generator-page,
body:has(.generator-shell),
body:has(.suggestion-shell) {
  display: flex;
  flex-direction: column;
}

.generator-shell {
  box-sizing: border-box;
  display: grid;
  flex: 1 0 auto;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 360px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 8px 20px 96px;
  position: relative;
  width: 100%;
}

.suggestion-shell {
  align-items: start;
}

.suggestion-honeypot {
  left: -10000px;
  position: absolute;
  top: auto;
  width: 1px;
}

.suggestion-explainer ol {
  color: var(--muted);
  display: grid;
  gap: 14px;
  line-height: 1.55;
  margin: 0;
  padding-left: 22px;
}

.suggestion-receipt {
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-top: 18px;
  padding: 18px;
}

.suggestion-receipt h3,
.suggestion-receipt p {
  overflow-wrap: anywhere;
}

.public-topic-status {
  display: grid;
  gap: 10px;
}

.public-topic-card {
  background: rgba(236, 248, 247, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 7px;
  padding: 14px;
}

.public-topic-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.public-topic-card[data-state="being_worked"] span {
  color: var(--gold);
}

.public-topic-card strong {
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.topic-identity {
  display: grid;
  gap: 9px;
  margin: 0;
}

.topic-identity div {
  display: grid;
  gap: 3px;
}

.topic-identity dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topic-identity dd {
  color: var(--ink);
  font-weight: 780;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.topic-workflow-stage,
.topic-block-state {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 0;
}

.public-topic-card[data-blocked="true"] .topic-block-state {
  color: var(--gold);
}

.public-topic-totals {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.public-topic-totals div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.public-topic-totals dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.public-topic-totals dd {
  color: var(--teal);
  font-size: 1.45rem;
  font-weight: 900;
  margin: 4px 0 0;
}

.form-panel,
.status-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 22px;
  padding: clamp(20px, 3vw, 32px);
}

.status-panel {
  align-self: start;
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 22px;
}

.status-panel .notice,
.status-panel a {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.voice-pill-btn {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.voice-pill-btn:hover {
  background: rgba(117, 247, 230, 0.16);
  border-color: var(--teal);
}

.voice-pill-dot {
  background: var(--teal);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
  transition: background 0.2s, transform 0.2s;
}

.voice-pill-btn.is-listening {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.6);
  color: #ff5f50;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.3);
}

.voice-pill-btn.is-listening .voice-pill-dot {
  background: #ff3b30;
  animation: voiceDotPulse 0.7s infinite alternate;
}

@keyframes voiceDotPulse {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.3); opacity: 1; }
}

[hidden],
.voice-feedback-banner[hidden] {
  display: none !important;
}

.voice-feedback-banner {
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.14), rgba(255, 149, 0, 0.12));
  border: 1px solid rgba(255, 59, 48, 0.45);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
  margin-bottom: 8px;
  padding: 12px 16px;
  animation: bannerFadeIn 0.3s ease;
}

@keyframes bannerFadeIn {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.voice-feedback-status {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.voice-feedback-dot {
  background: #ff3b30;
  border-radius: 50%;
  flex: 0 0 10px;
  height: 10px;
  width: 10px;
  animation: voiceDotPulse 0.7s infinite alternate;
}

.voice-feedback-text {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-feedback-done {
  background: #ff3b30;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 8px 18px;
  min-height: 44px;
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.2s ease;
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.voice-feedback-done:active {
  transform: scale(0.92);
  opacity: 0.82;
}

.field label,
.group-label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

.field textarea,
.field input,
.field select {
  background: #f8fbfa;
  background: rgba(236, 248, 247, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 12px 13px;
  width: 100%;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.segmented {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented.length {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented input,
.checks input {
  height: 1px;
  left: -9999px;
  min-height: 0;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}

.segmented label,
.checks label {
  align-items: center;
  background: #f8fbfa;
  background: rgba(236, 248, 247, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 10px;
  text-align: center;
}

.segmented input:checked + label,
.checks input:checked + label {
  background: rgba(15, 118, 110, 0.1);
  border-color: var(--teal);
  color: var(--teal);
}

.checks {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.primary-button {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border: 0;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(117, 247, 230, 0.28);
  color: var(--dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 48px;
  padding: 0 18px;
  transition: filter 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}

.primary-button:hover {
  box-shadow: 0 10px 30px rgba(117, 247, 230, 0.38);
  filter: brightness(1.08);
}

.primary-button:active {
  transform: scale(0.97);
}

.primary-button:focus-visible {
  outline: 3px solid rgba(117, 247, 230, 0.45);
  outline-offset: 3px;
}

.primary-button:disabled {
  cursor: wait;
  filter: grayscale(0.35) brightness(0.82);
}

.form-message {
  color: var(--teal);
  font-weight: 800;
  line-height: 1.4;
  margin: 0;
  min-height: 1.4em;
}

.form-message[data-type="error"] {
  color: var(--coral);
}

.status-card {
  background: rgba(236, 248, 247, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  position: relative;
}

.status-card h3 {
  font-size: 0.82rem;
  line-height: 1.25;
  margin: 0;
}

.status-card p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  margin: 0;
}

.status-card .job-latest {
  color: var(--gold);
  font-size: 0.68rem;
}

.prompt-record {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 4px;
}

.prompt-record summary {
  color: var(--seafoam);
  cursor: pointer;
  font-weight: 800;
}

.prompt-record pre {
  background: rgba(4, 10, 16, 0.42);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  margin: 7px 0 2px;
  max-height: 220px;
  overflow: auto;
  padding: 9px;
  white-space: pre-wrap;
}

.status-card::after {
  background: rgba(13, 22, 30, 0.98);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 0.68rem;
  left: 8px;
  line-height: 1.35;
  opacity: 0;
  padding: 10px 11px;
  pointer-events: none;
  position: absolute;
  right: 8px;
  top: calc(100% + 8px);
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: pre-line;
  z-index: 10;
}

.status-card:hover::after,
.status-card:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.notice {
  background: rgba(255, 189, 97, 0.08);
  border: 1px solid rgba(255, 189, 97, 0.28);
  border-radius: 14px;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
  padding: 12px;
}

.dialogue-editor {
  background: transparent;
  border: 0;
  color: var(--ink);
  max-height: 92vh;
  max-width: min(920px, 94vw);
  padding: 0;
  width: 100%;
}

.dialogue-editor::backdrop {
  background: rgba(4, 10, 16, 0.82);
  backdrop-filter: blur(5px);
}

.dialogue-editor-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: clamp(20px, 3vw, 30px);
}

.dialogue-editor textarea {
  background: rgba(236, 248, 247, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  min-height: min(54vh, 540px);
  padding: 14px;
  resize: vertical;
  width: 100%;
}

.dialogue-editor-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.status-card .dialogue-button {
  justify-self: start;
  margin-top: 5px;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  border: 0;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

@media (min-width: 1101px) {
  html,
  body {
    height: 100%;
  }

  body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  html.generator-page,
  html:has(.generator-shell),
  html:has(.suggestion-shell),
  body.generator-page,
  body:has(.generator-shell),
  body:has(.suggestion-shell) {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.generator-page,
  body:has(.generator-shell),
  body:has(.suggestion-shell) {
    display: flex !important;
    flex-direction: column !important;
  }

  .topbar {
    align-items: center;
    flex-wrap: nowrap;
    gap: 16px;
    margin-bottom: 10px;
    margin-top: 10px;
    padding: 10px 24px;
    z-index: 20;
  }

  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    gap: 6px;
  }

  .shell {
    align-items: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 12px;
  }

  .now-playing {
    gap: 12px;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .player-frame {
    min-height: 0;
    position: relative;
    top: auto;
  }

  .video-stage {
    max-height: min(43vh, 520px);
  }

  .episode-panel {
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  .library-band {
    height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1100px) {
  .topbar {
    align-items: center;
    border-radius: 20px;
    gap: 12px;
    margin: 10px auto 12px;
    padding: 12px 16px;
  }

  .site-nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
  }

  .shell {
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  .now-playing {
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: visible;
    padding-right: 2px;
    position: relative;
  }

  .player-frame {
    min-height: 0;
    position: relative;
    top: auto;
    z-index: 5;
  }

  .video-stage {
    max-height: none;
  }

  .library-band {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    position: static;
  }

  .episode-list {
    max-height: none;
    overflow: visible;
    padding-right: 3px;
  }

  .section-heading {
    align-items: stretch;
    display: grid;
    gap: 8px;
  }

  .section-heading h2 {
    font-size: 1rem;
  }

  .section-heading p {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .library-view-switch {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-controls {
    align-items: stretch;
    display: grid;
    gap: 6px;
  }

  .organization-switch {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-pickers {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .library-picker select,
  .library-picker input[type="date"],
  .library-date-row button {
    font-size: 0.66rem;
    min-height: 34px;
  }

  .library-view-switch .text-link,
  .organization-switch .text-link {
    font-size: 0.66rem;
    height: auto;
    justify-content: center;
    line-height: 1.15;
    min-height: 34px;
    padding: 0 8px;
    text-align: center;
    white-space: normal;
  }

  .episode-group-heading {
    font-size: 0.66rem;
  }

  .library-columns {
    grid-template-columns: 1fr;
  }

  .library-column-heading {
    font-size: 0.76rem;
  }

  .episode-card {
    gap: 8px;
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 8px;
  }

  .episode-card h3 {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .episode-card p {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .episode-number {
    font-size: 1.1rem;
  }

  .episode-thumb-label {
    font-size: 0.46rem;
    margin-top: 4px;
  }

  .pill {
    font-size: 0.66rem;
    grid-column: 1 / -1;
    justify-self: start;
    padding: 5px 7px;
  }

  .media-controls {
    gap: 8px;
    padding: 8px;
  }

  .media-buttons {
    gap: 5px;
  }

  .media-button {
    font-size: 0.7rem;
    min-height: 34px;
    padding: 0 5px;
  }

  .media-time {
    font-size: 0.68rem;
  }

  .episode-panel {
    gap: 10px;
    padding: 12px;
  }

  .episode-panel h2 {
    font-size: 1.15rem;
  }

  .summary,
  .episode-panel dd {
    font-size: 0.78rem;
  }

  .fullscreen-button {
    bottom: 7px;
    font-size: 0.68rem;
    min-height: 36px;
    padding: 0 9px;
    right: 7px;
  }

  .generator-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .family-sibling-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    align-items: flex-start;
    border-radius: 20px;
    gap: 14px;
    margin: 10px 8px 12px;
    padding: 16px 12px;
  }

  .site-nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin: 0 -4px;
    overflow-x: auto;
    padding: 2px 4px 8px;
    scrollbar-width: thin;
  }

  .site-nav .text-link {
    flex: 0 0 auto;
    font-size: 0.75rem;
    height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .site-nav .icon-button {
    flex: 0 0 38px;
    height: 38px;
    width: 38px;
  }

  .player-frame {
    position: relative;
    top: auto;
  }

  .video-stage {
    max-height: 52svh;
  }

  .artifact-type-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .artifact-type-option {
    justify-content: center;
    padding-inline: 6px;
  }

  .brand p {
    display: none;
  }

  .episode-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .segmented,
  .segmented.length,
  .checks {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .text-link,
  .icon-button,
  .media-button,
  .episode-card,
  .primary-button,
  .family-sibling-link {
    transition: none;
  }
  .episode-card:hover,
  .primary-button:active,
  .media-button:active {
    transform: none;
  }
}

/* Pan/Zoom Toolbar for Mind Maps, Infographics & Reports */
.mindmap-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(3, 15, 17, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(117, 247, 230, 0.32);
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  z-index: 25;
  flex-wrap: wrap;
}

/* Dedicated Toolbar Directly Above Video Stage */
.video-toolbar,
#videoToolbar {
  position: relative;
  top: auto;
  right: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  background: rgba(3, 15, 17, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: none;
  border-bottom: 1px solid rgba(117, 247, 230, 0.2);
  border-radius: 20px 20px 0 0;
  padding: 8px 12px;
  box-shadow: none;
  z-index: 10;
  flex-wrap: wrap;
}
.video-tool-btn, .mindmap-tool-btn {
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid rgba(117, 247, 230, 0.22);
  color: var(--teal);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  line-height: 1;
}
.video-tool-btn:hover, .mindmap-tool-btn:hover {
  background: rgba(117, 247, 230, 0.2);
  border-color: var(--teal);
  box-shadow: 0 0 10px rgba(117, 247, 230, 0.35);
  transform: translateY(-1px);
}

/* Branch Quick Navigation Pills Group */
.mindmap-branch-pills-group {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid rgba(117, 247, 230, 0.22);
  padding-left: 6px;
  margin-left: 2px;
  flex-wrap: wrap;
}
.mindmap-branch-pill-btn {
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid rgba(117, 247, 230, 0.24);
  color: var(--teal);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 5px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}
.mindmap-branch-pill-btn:hover {
  background: rgba(117, 247, 230, 0.2);
  border-color: var(--teal);
  box-shadow: 0 0 10px rgba(117, 247, 230, 0.3);
}
.mindmap-branch-pill-btn.is-active {
  background: var(--teal);
  color: #041416;
  border-color: var(--teal);
  box-shadow: 0 0 12px rgba(117, 247, 230, 0.5);
}
.mindmap-branch-pill-btn .pill-count {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 0.68rem;
}
.mindmap-branch-pill-btn.is-active .pill-count {
  background: rgba(0, 0, 0, 0.18);
  color: #041416;
}

/* Video Branch Stage Overlay */
.video-branch-stage, .mindmap-branch-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: linear-gradient(155deg, #06171a 0%, #030e10 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: auto;
  box-sizing: border-box;
}
.video-branch-stage[hidden], .mindmap-branch-stage[hidden] {
  display: none !important;
}
.mindmap-branch-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(3, 15, 17, 0.95);
  border-bottom: 1px solid rgba(117, 247, 230, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2;
}
.mindmap-branch-stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mindmap-branch-stage-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.mindmap-branch-stage-title {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.01em;
}
.mindmap-branch-stage-count {
  background: rgba(117, 247, 230, 0.12);
  border: 1px solid rgba(117, 247, 230, 0.3);
  color: var(--teal);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 9px;
}
.mindmap-branch-stage-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mindmap-branch-switcher-btn {
  background: rgba(117, 247, 230, 0.06);
  border: 1px solid rgba(117, 247, 230, 0.18);
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.mindmap-branch-switcher-btn:hover {
  background: rgba(117, 247, 230, 0.15);
  color: var(--ink);
  border-color: var(--teal);
}
.mindmap-branch-switcher-btn.is-active {
  background: var(--teal);
  color: #031113;
  border-color: var(--teal);
  font-weight: 850;
}
.mindmap-branch-switcher-btn .switcher-count {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  padding: 0 4px;
  font-size: 0.68rem;
}
.mindmap-branch-close-btn {
  background: rgba(255, 100, 100, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.35);
  color: #ff9e9e;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.mindmap-branch-close-btn:hover {
  background: #ff5252;
  color: #fff;
  border-color: #ff5252;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.4);
}
.mindmap-branch-stage-grid {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  align-content: start;
  scrollbar-gutter: stable;
}
.mindmap-branch-stage-card {
  background: rgba(6, 26, 29, 0.75);
  border: 1px solid rgba(117, 247, 230, 0.22);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.mindmap-branch-stage-card:hover {
  border-color: var(--teal);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}
.mindmap-branch-stage-card.is-current {
  border-color: var(--teal);
  background: rgba(117, 247, 230, 0.08);
}
.mindmap-branch-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mindmap-branch-card-badge {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mindmap-branch-current-badge {
  background: var(--teal);
  color: #031113;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  padding: 2px 7px;
}
.mindmap-branch-card-title {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.35;
  margin: 0;
}
.mindmap-branch-card-meta {
  color: var(--muted);
  font-size: 0.76rem;
  margin: 0;
  line-height: 1.3;
}
.mindmap-branch-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}
.mindmap-branch-btn-view {
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  background: rgba(117, 247, 230, 0.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.mindmap-branch-btn-view:hover {
  background: var(--teal);
  color: #031113;
  border-color: var(--teal);
}
.mindmap-branch-btn-download {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 800;
  gap: 4px;
  min-height: 32px;
  padding: 6px 10px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.mindmap-branch-btn-download:hover {
  background: rgba(117, 247, 230, 0.22);
  border-color: var(--teal);
}

/* Aside Right-Column Fuzzy Concept Search */
.aside-search-wrap {
  margin: 14px 0 16px;
  position: relative;
  width: 100%;
  z-index: 20;
  scroll-margin-top: calc(84px + env(safe-area-inset-top, 0px));
}
#asideConceptSearch {
  scroll-margin-top: calc(84px + env(safe-area-inset-top, 0px));
}
.aside-search-box {
  align-items: center;
  background: rgba(15, 31, 34, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  display: flex;
  padding: 3px 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.aside-search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(117, 247, 230, 0.25), 0 8px 24px rgba(0, 0, 0, 0.4);
}
.aside-search-box .topic-search-icon {
  color: var(--teal);
  font-size: 0.95rem;
  margin-right: 8px;
  user-select: none;
}
.aside-search-box .topic-search-input {
  background: transparent;
  border: 0;
  color: var(--text);
  flex: 1;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  padding: 8px 0;
  min-width: 0;
}
.aside-search-box .topic-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.aside-search-box .topic-search-clear {
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
  transition: color 0.15s;
}
.aside-search-box .topic-search-clear:hover {
  color: var(--text);
}
.aside-search-results {
  background: rgba(10, 22, 25, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-top: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 12px;
  text-align: left;
  scrollbar-gutter: stable;
}
.aside-search-results .topic-results-count {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.aside-results-grid {
  display: grid;
  gap: 10px;
}
.aside-results-grid .topic-result-card {
  background: rgba(117, 247, 230, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.aside-results-grid .topic-result-card:hover {
  background: rgba(117, 247, 230, 0.06);
  border-color: var(--teal);
}
.aside-results-grid .topic-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.aside-results-grid .topic-badge-group {
  background: rgba(117, 247, 230, 0.12);
  border-radius: 4px;
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  text-transform: uppercase;
}
.aside-results-grid .topic-badge-reason {
  background: rgba(255, 189, 97, 0.14);
  border-radius: 4px;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
}
.aside-results-grid .topic-result-title {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 8px;
}
.aside-results-grid .topic-result-summary {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0 0 8px;
}
.aside-results-grid .topic-artifact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.aside-results-grid .topic-action-btn {
  align-items: center;
  background: rgba(117, 247, 230, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 800;
  gap: 4px;
  min-height: 30px;
  padding: 4px 10px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.aside-results-grid .topic-action-btn:hover,
.aside-results-grid .topic-action-btn:focus-visible {
  background: var(--teal);
  color: #031113;
  outline: none;
  transform: translateY(-1px);
}
.aside-search-results .topic-no-results {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 10px 4px;
}
.aside-search-results .topic-no-results p {
  margin: 0;
  line-height: 1.4;
}
.aside-search-results .topic-no-results strong {
  color: var(--text);
}
.aside-search-results .topic-no-results em {
  color: var(--teal);
  font-style: normal;
}

