:root {
  --meditation-cream: #f7f0df;
  --meditation-amber: #e7ad52;
  --meditation-copper: #a85f2a;
  --meditation-night: #0f1b17;
  --meditation-night-soft: #172a23;
}

.meditation-page {
  background:
    radial-gradient(circle at 75% 14%, rgba(212, 158, 74, 0.15), transparent 28rem),
    radial-gradient(circle at 12% 40%, rgba(255, 255, 255, 0.75), transparent 35rem),
    linear-gradient(145deg, #e9e3d6, #dcd5c7);
}

.meditation-main {
  width: min(1320px, calc(100% - 2rem));
  padding-top: clamp(1.5rem, 4vw, 3.6rem);
}

.meditation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  padding-inline: clamp(0rem, 2vw, 1.4rem);
}

.meditation-hero h1 {
  max-width: 790px;
  margin: 0;
  color: var(--forest);
  font-size: clamp(2.45rem, 6vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.hero-lead {
  max-width: 720px;
  margin: 1.15rem 0 0;
  color: #53605a;
  font-family: Arial, sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  line-height: 1.65;
}

.hero-seal {
  width: clamp(108px, 14vw, 164px);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  color: var(--forest);
  background: rgba(247, 240, 223, 0.68);
  border: 1px solid rgba(105, 79, 39, 0.26);
  border-radius: 50%;
  box-shadow: inset 0 0 0 9px rgba(178, 138, 73, 0.08);
  text-align: center;
}

.hero-seal span,
.hero-seal small {
  display: block;
}

.hero-seal span {
  color: #8e642d;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.9;
}

.hero-seal small {
  margin-top: 0.45rem;
  font-family: Arial, sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.intention-panel,
.ritual-stage,
.tradition-section {
  border: 1px solid rgba(68, 79, 72, 0.17);
  box-shadow: 0 24px 65px rgba(29, 38, 33, 0.12);
}

.intention-panel {
  padding: clamp(1.2rem, 3vw, 1.8rem);
  background: rgba(251, 248, 239, 0.9);
  border-radius: 0.8rem;
}

.panel-heading h2,
.stage-header h2,
.tradition-section h2 {
  margin: 0;
  color: var(--forest);
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  font-weight: 500;
}

.meditation-search {
  display: grid;
  gap: 0.4rem;
  margin-top: 1.25rem;
}

.meditation-search span {
  color: #59645f;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.meditation-search input {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.8rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font-family: Arial, sans-serif;
}

.selected-name-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.1rem;
  color: var(--meditation-cream);
  background:
    radial-gradient(circle at 90% 0%, rgba(221, 169, 83, 0.22), transparent 12rem),
    var(--forest);
  border-radius: 0.65rem;
}

.selected-number {
  color: var(--gold-soft);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.selected-name-card p {
  margin: 0;
}

#selected-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.selected-hebrew {
  margin: 0.4rem 0 0.5rem !important;
  color: #f3d69d;
  font-family: "Noto Serif Hebrew", serif;
  font-size: 2.05rem;
}

.selected-energy {
  color: #ced5d1;
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  line-height: 1.5;
}

.selector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.secondary-action,
.reset-button,
.start-button,
.sound-toggle,
.name-option {
  font-family: Arial, sans-serif;
}

.secondary-action,
.reset-button {
  min-height: 42px;
  color: var(--forest);
  background: transparent;
  border: 1px solid rgba(23, 37, 31, 0.28);
  border-radius: 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.secondary-action:hover,
.reset-button:hover:not(:disabled) {
  background: rgba(23, 37, 31, 0.06);
}

.names-browser {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.browser-summary {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
}

.names-grid {
  max-height: 380px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.name-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  text-align: left;
}

.name-option:hover,
.name-option[aria-selected="true"] {
  border-color: var(--gold);
  box-shadow: inset 3px 0 var(--gold);
}

.name-option span:first-child {
  color: #9a743a;
  font-size: 0.62rem;
  font-weight: 800;
}

.name-option strong,
.name-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-option strong {
  font-size: 0.76rem;
}

.name-option small {
  margin-top: 0.18rem;
  color: #8a6530;
  font-family: "Noto Serif Hebrew", serif;
  font-size: 1rem;
}

.ritual-stage {
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 50% 33%, rgba(224, 168, 75, 0.13), transparent 24rem),
    linear-gradient(150deg, #172921, #0e1a16 60%, #0b1411);
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.8rem;
}

.stage-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem clamp(1.2rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stage-header h2 {
  color: #fbf5e8;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.8rem;
  color: #e4dccd;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 0.72rem;
}

.sound-toggle[aria-pressed="false"] {
  color: #aaa79f;
  opacity: 0.78;
}

.focus-space {
  position: relative;
  min-height: 530px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1.7rem;
  padding: 3.3rem 1.2rem 2.4rem;
  overflow: hidden;
}

.focus-space::before,
.focus-space::after {
  content: "";
  position: absolute;
  width: 360px;
  aspect-ratio: 1;
  border: 1px solid rgba(230, 185, 104, 0.08);
  border-radius: 50%;
}

.focus-space::after {
  width: 500px;
  border-color: rgba(230, 185, 104, 0.04);
}

.sacred-mark {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  padding-top: 108px;
}

.flame {
  position: absolute;
  top: 0;
  left: 50%;
  width: 76px;
  height: 100px;
  margin-left: -38px;
  filter: drop-shadow(0 0 22px rgba(255, 171, 55, 0.65));
  transform-origin: 50% 100%;
  animation: flame-sway 2.6s ease-in-out infinite;
  transition: left 720ms cubic-bezier(0.4, 0, 0.2, 1);
}

.flame span {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  border-radius: 52% 48% 58% 42% / 62% 52% 48% 38%;
  transform: translateX(-50%) rotate(45deg);
  transform-origin: 50% 70%;
}

.flame-outer {
  width: 58px;
  height: 82px;
  background: linear-gradient(135deg, #d45b21 8%, #f6a23b 54%, #ffd979 88%);
  animation: flame-flicker 1.4s ease-in-out infinite alternate;
}

.flame-inner {
  width: 36px;
  height: 54px;
  background: linear-gradient(135deg, #ffca64, #fff2b8 68%);
  animation: flame-flicker 1.1s 0.15s ease-in-out infinite alternate-reverse;
}

.flame-core {
  width: 17px;
  height: 30px;
  background: #fff9dc;
  box-shadow: 0 0 12px rgba(255, 255, 223, 0.8);
}

.meditation-letters {
  min-height: 92px;
  display: flex;
  direction: rtl;
  justify-content: center;
  gap: clamp(0.32rem, 1.1vw, 0.75rem);
  color: #fff7de;
  font-family: "Noto Serif Hebrew", serif;
  font-size: clamp(3.8rem, 8vw, 6.8rem);
  line-height: 1;
  text-shadow: 0 0 18px rgba(229, 178, 86, 0.24);
}

.meditation-letters span {
  opacity: 0.78;
  transition: color 500ms ease, opacity 500ms ease, text-shadow 500ms ease, transform 500ms ease;
}

.meditation-letters span.is-lit {
  color: #ffd991;
  opacity: 1;
  text-shadow: 0 0 13px rgba(255, 205, 112, 0.72), 0 0 34px rgba(210, 113, 41, 0.42);
  transform: translateY(-3px);
}

.letter-glow {
  width: 240px;
  height: 2px;
  margin-top: 0.85rem;
  background: linear-gradient(90deg, transparent, rgba(250, 203, 117, 0.75), transparent);
  box-shadow: 0 0 18px rgba(232, 156, 50, 0.45);
}

.breath-orb {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 330px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 214, 137, 0.11);
  border-radius: 50%;
  transform: translate(-50%, -48%) scale(0.62);
  transition-property: transform, opacity, border-color;
  transition-timing-function: ease-in-out;
  opacity: 0.32;
}

.breath-orb span {
  position: absolute;
  inset: 18%;
  background: radial-gradient(circle, rgba(239, 190, 101, 0.13), transparent 68%);
  border: 1px solid rgba(255, 227, 172, 0.1);
  border-radius: 50%;
}

.focus-space[data-breath="inhale"] .breath-orb {
  transform: translate(-50%, -48%) scale(1);
  border-color: rgba(255, 214, 137, 0.25);
  opacity: 0.66;
}

.focus-space[data-breath="hold"] .breath-orb {
  transform: translate(-50%, -48%) scale(1);
  opacity: 0.8;
}

.focus-space[data-breath="exhale"] .breath-orb {
  transform: translate(-50%, -48%) scale(0.62);
  opacity: 0.3;
}

.guidance {
  position: relative;
  z-index: 3;
  width: min(620px, 92%);
  text-align: center;
}

.breath-cue {
  margin: 0;
  color: #e9b963;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.guidance-text {
  margin: 0.65rem 0 0;
  color: #e7e2d8;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  line-height: 1.55;
}

.session-controls {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1.2rem, 3vw, 2rem);
  background: rgba(0, 0, 0, 0.19);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.timer {
  min-width: 74px;
  color: #f4e4c5;
  font-family: Arial, sans-serif;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.session-progress {
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

.session-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ab6b2d, #f0bd65);
}

.control-buttons {
  display: flex;
  gap: 0.55rem;
}

.reset-button {
  padding-inline: 0.9rem;
  color: #eee7dc;
  border-color: rgba(255, 255, 255, 0.2);
}

.reset-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.start-button {
  min-height: 46px;
  padding: 0.7rem 1.15rem;
  color: #17231e;
  background: linear-gradient(135deg, #f3d79f, #d8a74f);
  border: 0;
  border-radius: 0.45rem;
  box-shadow: 0 8px 22px rgba(222, 157, 54, 0.17);
  font-size: 0.82rem;
  font-weight: 900;
}

.start-button:hover {
  filter: brightness(1.06);
}

.tradition-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 5rem);
  margin-top: 1rem;
  padding: clamp(1.5rem, 4vw, 3.3rem);
  background: rgba(251, 248, 239, 0.88);
  border-radius: 0.8rem;
}

.tradition-intro > p:last-child {
  margin: 1rem 0 0;
  color: #59645f;
  font-family: Arial, sans-serif;
  line-height: 1.7;
}

.practice-notes {
  display: grid;
}

.practice-notes article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.practice-notes article:first-child {
  padding-top: 0;
}

.practice-notes article:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.practice-notes article > span {
  color: #9a743a;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
}

.practice-notes h3,
.practice-notes p {
  margin: 0;
}

.practice-notes h3 {
  color: var(--forest);
  font-size: 1.1rem;
}

.practice-notes p {
  margin-top: 0.35rem;
  color: #65706a;
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  line-height: 1.55;
}

.wellbeing-note {
  margin: 1rem 0 0;
  color: #6b746f;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  text-align: center;
}

.meditation-toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 1.5rem;
  max-width: min(440px, calc(100% - 2rem));
  padding: 0.8rem 1rem;
  color: white;
  background: #111c17;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.45rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: 180ms ease;
}

.meditation-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes flame-flicker {
  0% { transform: translateX(-50%) rotate(43deg) scale(0.96, 1.02); }
  45% { transform: translateX(-50%) rotate(47deg) scale(1.04, 0.97); }
  100% { transform: translateX(-50%) rotate(44deg) scale(0.99, 1.05); }
}

@keyframes flame-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

@media (max-width: 940px) {
  .practice-layout,
  .tradition-section {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .meditation-topbar .current-reference,
  .meditation-topbar .top-actions a:first-child,
  .hero-seal {
    display: none;
  }

  .meditation-hero {
    grid-template-columns: 1fr;
  }

  .meditation-hero h1 {
    font-size: clamp(2.5rem, 14vw, 4.2rem);
  }

  .stage-header,
  .session-controls {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .stage-header {
    flex-direction: column;
  }

  .sound-toggle {
    width: fit-content;
  }

  .focus-space {
    min-height: 500px;
    padding-top: 2.5rem;
  }

  .session-progress {
    grid-row: 2;
  }

  .control-buttons {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
  }

  .names-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .flame,
  .flame span {
    animation: none !important;
  }
}
