:root {
  /* Allow --bg to be a color OR a full CSS gradient */
  --bg: radial-gradient(circle at center, #4a7c59 0%, #2d4d35 100%);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --text: #e5e7eb;
  --muted: rgba(229, 231, 235, 0.70);
  --primary: #7dd3fc;
  --accent: #a78bfa;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(26, 77, 46, 0.95);
  --topbar-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  /* Keep header (and mobile overlay menu) above page content/cards */
  z-index: 2000;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--topbar-border);
}

.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.brand-block {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  margin-right: 12px;
  min-width: 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #e8f5e9;
  font-size: 1.1rem;
  text-transform: uppercase;
  min-width: 0;
}

.tagline {
  font-size: 0.85rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
  z-index: 9999;
  margin-left: auto;
  position: relative;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
  align-items: center;
  touch-action: manipulation;
  pointer-events: auto !important;
}

.mobile-menu-toggle:active {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0.95);
}

.mobile-menu-toggle span {
  width: 100%;
  height: 4px;
  background: #ffffff;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
  display: block;
  min-height: 4px;
  pointer-events: none;
}

.mobile-menu-toggle:hover span,
.mobile-menu-toggle:focus span {
  background: var(--primary);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.main-nav {
  display: flex;
  gap: 8px;
  margin-left: 24px;
}

/* Mobile nav overlay - lives outside header to avoid stacking issues */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(26, 77, 46, 0.98);
  z-index: 999999;
  flex-direction: column;
  padding: 80px 24px 24px;
  gap: 16px;
  overflow-y: auto;
}

.mobile-nav-overlay.mobile-menu-open {
  display: flex;
}

.mobile-nav-overlay .nav-link {
  padding: 16px 20px;
  font-size: 1.2rem;
  text-align: center;
  border-radius: 8px;
  display: block;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-nav-overlay .nav-link:hover,
.mobile-nav-overlay .nav-link:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Hide desktop nav on mobile, hide mobile overlay on desktop */
@media (max-width: 768px) {
  .main-nav--desktop {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .mobile-nav-overlay {
    display: none !important;
  }

  .mobile-menu-backdrop {
    display: none !important;
  }
}

.nav-link {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.topbar__capsule-select {
  margin-left: auto;
}

@media (max-width: 768px) {
  .topbar {
    width: 100%;
    overflow-x: hidden;
  }

  .topbar__inner {
    /* 2-row mobile header:
       row 1: brand + hamburger
       row 2: topbar right controls (capsule select, etc.) */
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    padding: 8px 12px;
    gap: 8px 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand-block {
    grid-column: 1;
    grid-row: 1;
    margin-right: 0;
  }

  .brand {
    /* Let the domain show (wrap up to 2-ish lines) instead of collapsing to nothing */
    font-size: 0.85rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }

  /* Hide tagline on mobile to prevent the "smashed" look */
  .tagline {
    display: none;
  }

  .topbar__right {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: 0;
    justify-content: center;
    min-width: 0;
  }

  /* If the capsule dropdown is wide, keep it inside the viewport */
  .topbar__right select,
  .topbar__right .topbar__capsule-select,
  .topbar__right .pill {
    max-width: calc(100vw - 24px);
  }

  .topbar__capsule-select {
    margin-left: 0;
    order: unset;
  }

  .mobile-menu-toggle {
    display: flex !important;
    grid-column: 2;
    grid-row: 1;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .mobile-menu-toggle:active {
    background: rgba(255, 255, 255, 0.25);
  }

  /* Ensure hamburger is always above the menu overlay */
  .mobile-menu-toggle {
    position: relative;
    z-index: 9999999 !important;
  }
}

.mobile-menu-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    display: none;
  }

  .mobile-menu-backdrop.is-visible {
    display: block;
  }
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 44px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  /* Ensure page content doesn't compete with mobile menu z-index */
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 40px var(--shadow);
  padding: 16px;
  margin: 0 0 14px 0;
}

/* Generic utility classes */
.h1 {
  margin: 0 0 6px 0;
  font-size: 22px;
}

.h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: var(--text);
}

.muted {
  color: var(--muted);
  margin: 8px 0 0 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
}

.meta {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.meta .k {
  color: var(--muted);
  width: 90px;
  display: inline-block;
}

.meta .v {
  color: var(--text);
}

.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.row__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge--available {
  background: rgba(125, 211, 252, 0.2);
  color: var(--primary);
  border: 1px solid rgba(125, 211, 252, 0.3);
}

.badge--derivable,
.badge--missing {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge--not_generated {
  border-color: rgba(125, 211, 252, 0.65);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.input,
.select {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.input {
  flex: 1 1 260px;
}

.select {
  flex: 0 0 190px;
}

.input:focus,
.select:focus {
  border-color: rgba(125, 211, 252, 0.65);
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.10);
}

/* Meditation Room Grid and Cards */
.mr-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 720px) {
  .mr-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  .mr-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.mr-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  min-height: 210px;
  padding: 14px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}

.mr-card__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.02);
}

.mr-card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.55));
}

.mr-card__content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.mr-card__text {
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
  max-height: 7.2em;
  overflow: hidden;
}

.mr-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(229, 231, 235, 0.82);
  font-size: 12px;
}

.btn {
  border-radius: 12px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(125, 211, 252, 0.10);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(125, 211, 252, 0.16);
}

.btn--ghost {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn--small {
  padding: 8px 10px;
  font-size: 12px;
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  display: none;
}

.modal.is-open {
  display: block;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  max-width: 880px;
  margin: 60px auto 24px;
  background: rgba(11, 16, 32, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
}

.modal__header_left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal__title {
  font-weight: 700;
}

.modal__meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.modal__body {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.quote {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.5;
}

.audio audio {
  width: 100%;
}

.explain {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.explain__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.explain__label {
  font-weight: 650;
}

.explain__content {
  color: rgba(229, 231, 235, 0.92);
  line-height: 1.55;
}

.explain__content h2 {
  margin: 0.8em 0 0.3em;
  font-size: 15px;
}

.explain__content p {
  margin: 0.5em 0;
}

/* Grid and Tile styles */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
}

.tile--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.tile__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.tile__desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.tile__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge--available {
  background: rgba(125, 211, 252, 0.2);
  color: var(--primary);
  border: 1px solid rgba(125, 211, 252, 0.3);
}

.badge--derivable,
.badge--missing {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border: 1px solid var(--border);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.meta .k {
  color: var(--muted);
  font-size: 13px;
  margin-right: 6px;
}

.meta .v {
  color: var(--text);
  font-size: 13px;
}

.mono {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 12px;
}

.small {
  font-size: 13px;
}

/* --- Meditation Room (Random Quote) Styles --- */

.random-quote-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.random-quote-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.random-quote-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #e8f5e9;
}

#contentCard {
  width: 100%;
  margin-bottom: 1rem;
  background: #faf8f3;
  border: none;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Permanent play button styling */
.permanent-play-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  width: 50px;
  height: 50px;
  background-color: rgba(45, 134, 89, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  padding: 0;
  outline: none;
}

.permanent-play-btn:hover {
  transform: scale(1.1);
  background-color: rgba(45, 134, 89, 1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.permanent-play-btn.playing {
  background-color: #d9534f;
  border-color: #ffffff;
}

.card-with-background {
  background-size: cover;
  background-position: center;
  position: relative;
}

.card-with-background::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

.card-body {
  position: relative;
  z-index: 2;
}

#contentText {
  background-color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  color: #0f2d1a;
  font-size: 1.5rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 6s ease-in-out;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

#contentText.fade-in {
  opacity: 1;
}

/* Floating Controls - Always visible */
.controls-overlay {
  width: 100%;
  max-width: 550px;
  margin-top: 0.5rem;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.controls-content {
  background: linear-gradient(to top, rgba(26, 77, 46, 0.98), rgba(62, 107, 74, 0.95));
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.8rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-radius: 25px;
  color: #e8f5e9;
  text-align: center;
}

.controls-toggle-btn {
  display: none !important;
  /* Hide toggle button - action bar is always visible */
}

/* Modal and Cloud Styles */
.explanation-content {
  line-height: 1.7;
  color: #2c3e50;
}

.explanation-content h2 {
  color: #1a4d2e;
  margin-top: 1.5rem;
}

.word-cloud-word {
  transition: all 0.2s ease;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #1a4d2e;
}

.word-cloud-word:hover {
  background: rgba(45, 134, 89, 0.15);
  transform: scale(1.1);
}

/* D3 wordcloud (SVG) hover affordances */
#wordCloudSvg text {
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#wordCloudSvg text:hover {
  opacity: 0.8;
}

/* --- Theme-driven Word Cloud + Word Poem UI (no hardcoded Romans colors) --- */

.mr-cloud-stage {
  background: rgba(0, 0, 0, 0.55);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--bg) 86%, var(--primary) 14%),
      color-mix(in srgb, var(--bg) 88%, var(--accent) 12%));
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 10px 0;
  box-shadow: 0 14px 40px var(--shadow);
  overflow: visible;
}

.mr-cloud-stage__inner {
  width: 100%;
  overflow: visible;
  position: relative;
  pointer-events: none;
  /* Allow clicks to pass through to SVG text */
}

.mr-cloud-stage__inner .mr-cloud-svg {
  pointer-events: auto;
  /* Re-enable clicks on the SVG itself */
}

#wordCloudSvg text {
  pointer-events: auto;
  /* Ensure text elements are clickable */
}

.mr-cloud-svg {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  background: radial-gradient(circle at center, var(--surface), rgba(0, 0, 0, 0.20));
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  overflow: visible;
}

.mr-cloud-caption {
  color: var(--muted);
}

.mr-word-poem-loading {
  background: linear-gradient(135deg, #1a4d2e, #2d8659);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #e8f5e9;
}

.mr-word-poem-card {
  background: linear-gradient(135deg, #1a4d2e, #2d8659);
  background: linear-gradient(135deg, rgba(26, 77, 46, 0.95), rgba(45, 134, 89, 0.95));
  padding: 2rem;
  border-radius: 15px;
  color: #e8f5e9;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.mr-word-poem-kicker {
  color: rgba(232, 245, 233, 0.7) !important;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

.mr-word-poem-title {
  color: #ffffff !important;
  font-family: Georgia, serif;
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  font-size: 1.5rem;
}

.mr-word-poem-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mr-word-poem-body {
  font-family: Georgia, serif;
  font-size: 1.25em;
  line-height: 1.8;
  font-style: italic;
  color: #ffffff !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  font-weight: 400;
}

.mr-word-poem-source {
  color: rgba(232, 245, 233, 0.8) !important;
  font-size: 0.75rem;
}

.mr-word-poem-btn.btn {
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1) !important;
}

.mr-word-poem-btn.btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
}

/* Word Cloud Modal - Dark background for spiritual reflection */
#cloudModal .modal-body {
  background: #3e6b4a;
  padding: 1.5rem;
}

#cloudModal .modal-content {
  background: #3e6b4a;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#cloudModal .modal-header {
  background: rgba(26, 77, 46, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #e8f5e9;
}

#cloudModal .modal-title {
  color: #e8f5e9;
}

#cloudModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

#cloudLoading {
  background: rgba(26, 77, 46, 0.6);
  border-radius: 12px;
  padding: 2rem !important;
}

#cloudLoading p {
  color: #e8f5e9 !important;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
  .random-quote-container {
    padding: 0.5rem;
    justify-content: flex-start;
    padding-top: 1.5rem;
  }

  .random-quote-header h1 {
    font-size: 1.35rem;
  }

  #contentText {
    font-size: 1.15rem;
    padding: 1.25rem;
  }

  .controls-overlay {
    max-width: 95%;
  }

  .controls-content {
    padding: 0.6rem 1rem;
  }
}

/* Green button overrides for meditation room */
.random-quote-container .btn-primary {
  background-color: #4a9d6e !important;
  border-color: #2d8659 !important;
  color: white !important;
}

.random-quote-container .btn-outline-primary,
.random-quote-container .btn-outline-info {
  border-color: #4a9d6e !important;
  color: #e8f5e9 !important;
  background-color: transparent !important;
}

.random-quote-container .btn-outline-primary:hover,
.random-quote-container .btn-outline-info:hover {
  background-color: rgba(74, 157, 110, 0.2) !important;
}

/* Background Music Player - Artsy/Musical Edition - Global (Fixed Position) */
.bg-music-player {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  width: fit-content;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  min-height: 2.2rem;
  box-sizing: border-box;
}

.bg-music-player__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #ffffff;
  font-size: 0.8rem;
  margin-right: 0.25rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Add padding to page content when music player is visible */
body.music-player-visible .page {
  padding-top: 3.5rem;
}

.bg-music-player:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  /* Don't use transform on hover - it causes jumping */
}

.bg-music-player__controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.bg-music-player__btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  transition: all 0.2s ease;
  padding: 0;
  opacity: 0.8;
}

.bg-music-player__btn i {
  transition: transform 0.2s ease;
}

.bg-music-player__btn:hover {
  opacity: 1;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
}

.bg-music-player__btn:hover i {
  transform: scale(1.1);
  transform-origin: center;
}

#mrMusicPlay {
  width: 1.8rem;
  height: 1.8rem;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  opacity: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#mrMusicPlay:hover {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(125, 211, 252, 0.4);
}

.bg-music-player__volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.bg-music-player__volume-label {
  font-size: 0.65rem;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s;
}

.bg-music-player__volume-label:hover {
  opacity: 1;
}

.bg-music-player__volume-slider {
  width: 50px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background 0.2s;
  margin: 0;
  padding: 0;
}

.bg-music-player__volume-slider:hover {
  background: rgba(255, 255, 255, 0.2);
}

.bg-music-player__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 8px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

.bg-music-player__volume-slider::-webkit-slider-thumb:hover {
  background: var(--primary);
  transform: scale(1.3);
  transform-origin: center;
}

.bg-music-player__volume-slider::-moz-range-thumb {
  width: 8px;
  height: 8px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

@media (max-width: 767px) {
  .bg-music-player {
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    top: 80px;
  }

  .bg-music-player__volume-slider {
    width: 40px;
  }

  /* Adjust page padding on mobile when player is visible */
  body.music-player-visible .page {
    padding-top: 3rem;
  }
}

/* --- Focused Teachings (Shorts) Styles --- */

/* Summary Box */
.summary-box {
  margin-bottom: 1.5rem;
}

.summary-section {
  margin-bottom: 1.5rem;
}

.summary-section h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-content {
  color: var(--text);
  line-height: 1.7;
}

/* Play All Button */
.play-all-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.play-all-button:hover {
  background: color-mix(in srgb, var(--primary) 90%, white);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.play-all-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Audio Loading Indicator */
#audio-loading-indicator.loading {
  animation: audioLoadingBlink 1s infinite;
}

@keyframes audioLoadingBlink {

  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0.7;
  }
}

/* Summary Box (Topic Overview) */
.summary-box {
  margin-bottom: 24px;
}

.summary-section {
  margin-bottom: 24px;
}

.summary-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
}

.summary-content {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

/* Clip Cards */
.clips-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.clip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.clip-card.active-clip {
  border: 2px solid var(--primary);
  box-shadow: 0 8px 24px rgba(125, 211, 252, 0.15);
  background: color-mix(in srgb, var(--surface) 95%, var(--primary) 5%);
}

.clip-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 98%, var(--primary) 2%);
}

.clip-number {
  background: var(--primary);
  color: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.clip-title {
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 600;
  margin: 5px 0 0 0;
}

.clip-summary {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 12px 0 0 0;
  font-style: italic;
}

.clip-body {
  padding: 25px;
  display: flex;
  gap: 30px;
}

.clip-controls {
  flex: 0 0 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
}

.play-button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  border: none;
  box-shadow: 0 4px 10px rgba(125, 211, 252, 0.3);
}

.play-button:hover {
  transform: scale(1.1);
  background: color-mix(in srgb, var(--primary) 90%, white);
}

.play-button svg {
  width: 24px;
  height: 24px;
  margin-left: 4px;
  fill: currentColor;
}

.play-button.playing {
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(167, 139, 250, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
  }
}

.clip-content {
  flex: 1;
}

.clip-meta-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.transcript-toggle {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
}

.transcript-toggle:hover {
  text-decoration: underline;
}

.transcript-box {
  background: color-mix(in srgb, var(--surface) 98%, var(--primary) 2%);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 15px;
  display: none;
  line-height: 1.8;
}

.transcript-box.visible {
  display: block;
}

/* Word highlighting in transcript */
.transcript-box .word-transcript {
  display: inline;
  transition: all 0.2s ease;
  padding: 2px 1px;
  border-radius: 3px;
}

.transcript-box .sentence-transcript {
  display: inline;
  transition: all 0.2s ease;
  padding: 2px 1px;
  border-radius: 3px;
}

.transcript-box .sentence-transcript.active {
  background: var(--primary);
  color: var(--bg);
  font-weight: 700;
  padding: 3px 6px;
}

.transcript-box .sentence-transcript.past {
  color: var(--muted);
}

.transcript-box .word-transcript.active {
  background: var(--primary);
  color: var(--bg);
  font-weight: 600;
  padding: 2px 4px;
}

.transcript-box .word-transcript.past {
  color: var(--muted);
}

/* Real-time Word Display */
.word-display {
  margin-top: 20px;
  padding: 15px;
  background: color-mix(in srgb, var(--surface) 95%, var(--primary) 5%);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  width: 100%;
  box-sizing: border-box;
}

.word-display-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
  word-spacing: 0.2em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
  display: block;
  max-width: 100%;
  box-sizing: border-box;
}

.word-display-content .word {
  display: inline;
  margin-right: 0.3em;
  transition: all 0.2s ease;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: normal;
  max-width: 100%;
  word-break: break-word;
}

.word-display-content .word.active {
  background: var(--primary);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(125, 211, 252, 0.3);
}

.word-display-content .word.past {
  color: var(--muted);
}

/* Sticky Player Bar */
#audio-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--primary);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px 0;
  z-index: 3000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#audio-player-bar.visible {
  transform: translateY(0);
}

#audio-player-bar.minimized {
  transform: translateY(calc(100% - 50px));
}

#audio-player-bar.minimized .player-content {
  display: none;
}

.player-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 20px;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-title {
  font-weight: 700;
  color: var(--bg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.player-subtitle {
  font-size: 0.8rem;
  color: rgba(11, 16, 32, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.player-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bg);
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-btn:hover {
  opacity: 0.8;
}

.player-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.player-btn.main-play svg {
  width: 32px;
  height: 32px;
}

.player-progress {
  flex: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: rgba(11, 16, 32, 0.9);
  font-variant-numeric: tabular-nums;
}

.progress-bar-container {
  flex: 1;
  height: 6px;
  background-color: rgba(11, 16, 32, 0.3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--bg);
  border-radius: 3px;
  transition: width 0.1s linear;
}

.player-minimize-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--bg);
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.player-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.player-minimize-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.player-minimize-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
}

.player-minimize-handle-text {
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .clip-body {
    flex-direction: column;
    padding: 20px;
  }

  .clip-controls {
    flex-direction: row;
    justify-content: space-between;
    flex: auto;
    margin-bottom: 15px;
    width: 100%;
  }

  .play-button {
    width: 48px;
    height: 48px;
  }

  .player-content {
    flex-direction: column;
    padding-bottom: 15px;
  }

  .player-progress {
    width: 100%;
  }

  body {
    padding-bottom: 180px;
  }
}