/* ===================================================
   MEDITATION APP — style.css
   =================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --color-bg-1: #0d1f1a;
  --color-bg-2: #112318;
  --color-bg-3: #0a2b25;
  --color-bg-4: #1a3a30;

  --color-accent:  #80cbc4;
  --color-active:  #4db6ac;
  --color-active-hover: #6ecbc5;

  --color-text:       rgba(255, 255, 255, 0.92);
  --color-text-muted: rgba(220, 240, 235, 0.60);
  --color-text-dim:   rgba(220, 240, 235, 0.38);

  --glass-bg:     rgba(8, 28, 22, 0.50);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-blur:   blur(18px);

  --transition-std:  0.4s ease-in-out;
  --transition-slow: 0.6s ease-in-out;

  --font-primary: 'Roboto', sans-serif;

  --radius-pill: 999px;
  --radius-card: 24px;
  --radius-btn:  12px;

  --phase-duration: 4s;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Base / Background ---------- */
html, body {
  height: 100%;
  font-family: var(--font-primary);
  color: var(--color-text);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background-image: url('assets/landscape.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: #0d1f1a; /* fallback while image loads */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Subtle dark overlay to ensure text/UI contrast over the photo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(5, 18, 14, 0.42);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Particle Canvas ---------- */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ---------- App Wrapper & Card ---------- */
#app-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  min-height: 100vh;
}

#app-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: clamp(1.75rem, 4vw, 2.75rem) clamp(1.5rem, 4vw, 2.5rem);
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.55);
}

/* ---------- Header ---------- */
#app-header {
  text-align: center;
}

.app-title {
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--color-text);
  text-transform: uppercase;
}

.app-subtitle {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--color-text-muted);
  letter-spacing: 0.12em;
  margin-top: 0.25rem;
}

/* ---------- Notices ---------- */
#notices {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notice {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-accent);
  text-align: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(128, 203, 196, 0.25);
  border-radius: 8px;
  background: rgba(128, 203, 196, 0.06);
  line-height: 1.5;
}

.notice--action {
  border-color: rgba(77, 182, 172, 0.35);
  background: rgba(77, 182, 172, 0.08);
}

.notice-btn {
  background: none;
  border: none;
  color: var(--color-active);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  transition: color var(--transition-std);
}

.notice-btn:hover,
.notice-btn:focus-visible {
  color: var(--color-active-hover);
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
  border-radius: 4px;
  text-decoration: none;
}

/* ---------- Breathing Section ---------- */
#breathing-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

#breathing-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 182, 172, 0.18), rgba(77, 182, 172, 0.04));
  border: 2px solid rgba(77, 182, 172, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Completely static — no transitions, no shadow, no scaling ever */
}

/* Inner orb — this is what animates */
#breathing-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 182, 172, 0.55), rgba(77, 182, 172, 0.15));
  border: 1px solid rgba(77, 182, 172, 0.35);
  /* Resting: small */
  transform: scale(0.45);
  transition: transform 4s ease-in-out;
}

/* Inhale — inner orb expands smoothly */
#breathing-ring[data-breathe="in"] #breathing-inner {
  transform: scale(1.72);
}

/* Hold after inhale — stay expanded, instant */
#breathing-ring[data-breathe="hold-in"] #breathing-inner {
  transform: scale(1.72);
  transition-duration: 0s;
}

/* Exhale — inner orb contracts smoothly */
#breathing-ring[data-breathe="out"] #breathing-inner {
  transform: scale(0.45);
}

/* Hold after exhale / rest — inner orb stays contracted, instant */

#breathing-ring[data-breathe="hold-out"] #breathing-inner {
  transform: scale(0.45);
  transition-duration: 0s;
}

.breathing-label {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  transition: opacity var(--transition-std);
}

/* ---------- Timer ---------- */
#timer-display {
  font-family: 'Roboto Mono', monospace;
  font-size: clamp(2.8rem, 10vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--color-text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: opacity var(--transition-std);
}

/* ---------- On-Screen Cue ---------- */
.onscreen-cue {
  min-height: 1.4em;
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--color-accent);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.04em;
  line-height: 1.5;
  transition: opacity 0.5s ease-in-out;
}

/* ---------- Soundscape Selector ---------- */
#soundscape-nav-wrap {
  width: 100%;
}

.soundscape-container {
  width: 100%;
  background: rgba(8, 35, 28, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.35rem; /* extra breathing room before voice toggle */
}

.soundscape-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.soundscape-heading {
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--color-text-dim);
  text-transform: uppercase;
  margin: 0;
  flex: 1; /* push ⓘ to the right */
}

#soundscape-nav {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.soundscape-btn {
  flex: 1;
  border-radius: 8px;
  padding: 0.5rem 0;
  font-size: 1.35rem;
  line-height: 1;
  text-align: center;
  border: 1px solid var(--glass-border);
  background: transparent;
  cursor: pointer;
  transition:
    background var(--transition-std),
    border-color var(--transition-std),
    transform 0.15s ease;
}

.soundscape-btn:hover,
.soundscape-btn:focus-visible {
  background: rgba(77, 182, 172, 0.12);
  color: var(--color-text);
  border-color: rgba(77, 182, 172, 0.45);
  outline: none;
}

.soundscape-btn[aria-pressed="true"] {
  background: rgba(77, 182, 172, 0.18);
  border-color: var(--color-active);
  color: var(--color-active);
  font-weight: 500;
  box-shadow: 0 0 12px rgba(77, 182, 172, 0.25);
}

.soundscape-btn:active { transform: scale(0.95); }
.soundscape-btn:focus-visible { outline: 2px solid var(--color-active); outline-offset: 3px; }

/* ---------- Duration Picker ---------- */
#duration-picker-wrap {
  width: 100%;
}

#duration-picker {
  display: flex;
  flex-direction: column;
  align-items: stretch; /* fill full width */
  gap: 0.6rem;
  width: 100%;
}

.duration-picker-heading {
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--color-text-dim);
  text-transform: uppercase;
  text-align: center;
  margin: 0;
}

/* Outer wrapper: holds the fixed center-card + track */
.duration-picker-container {
  position: relative;
  width: 100%;
  background: rgba(8, 35, 28, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
}

/* Highlight card — fixed permanently at the center slot; JS never moves it */
.dur-center-card {
  position: absolute;
  left: 40%; /* center slot: index 2 of 5 = 40% */
  top: 8px;
  bottom: 8px;
  width: calc(100% / 5);
  background: rgba(77, 182, 172, 0.13);
  border: 1px solid rgba(77, 182, 172, 0.28);
  border-radius: 11px;
  pointer-events: none;
  z-index: 2;
}

/* Track: no scroll — JS drives everything via transforms */
.duration-picker-track {
  display: flex;
  align-items: center;
  overflow: visible;
  height: 108px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1;
  touch-action: pan-y; /* allow vertical scroll, intercept horizontal */
}

.duration-picker-track.is-dragging {
  cursor: grabbing;
}

/* Each duration item — fixed 20% width, full height */
.dur-item {
  flex: 0 0 calc(100% / 5);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  /* transform & opacity set entirely by JS; will-change for GPU compositing */
  will-change: transform, opacity;
}

.dur-item .dur-number {
  font-size: 2.8rem;
  font-weight: 300; /* JS sets 700 for selected */
  line-height: 1;
  color: var(--color-text);
  pointer-events: none;
}

.dur-item .dur-unit {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-top: 0.18rem;
  pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-btn);
  padding: 0.65rem 1.6rem;
  transition:
    background var(--transition-std),
    color var(--transition-std),
    transform 0.15s ease,
    box-shadow var(--transition-std);
}

.btn:focus-visible {
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: rgba(77, 182, 172, 0.22);
  color: var(--color-text);
  border: 1px solid rgba(77, 182, 172, 0.4);
}

.btn--primary:hover {
  background: rgba(77, 182, 172, 0.35);
  box-shadow: 0 4px 16px rgba(77, 182, 172, 0.2);
}

/* Start button — full-width, dark */
.btn--start {
  width: 100%;
  background: #0a0e0c;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.95rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.btn--start:hover {
  background: #161e1b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted);
  border: 1px solid var(--glass-border);
  font-size: 0.8rem;
  padding: 0.55rem 1.2rem;
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.btn--icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.btn--icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- Controls Row ---------- */
#controls {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
}



/* ---------- Guidance (Voice Breathing Guide) ---------- */
#breathing-voice-container {
  width: 100%;
}

.guidance-container {
  width: 100%;
  background: rgba(8, 35, 28, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.guidance-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.guidance-heading {
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--color-text-dim);
  text-transform: uppercase;
  margin: 0;
  flex: 1;
}

.guidance-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guidance-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.guidance-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.guidance-subtitle {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--color-text-muted);
  line-height: 1.3;
}

/* iOS-style toggle switch */
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.toggle-switch[aria-checked="true"] {
  background: var(--color-active);
  border-color: var(--color-active);
}

.toggle-switch-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.toggle-switch[aria-checked="true"] .toggle-switch-thumb {
  transform: translateX(20px) translateY(-50%);
}

.toggle-switch:focus-visible {
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
  border-radius: 13px;
}

/* ---------- Tagline ---------- */
#app-tagline {
  text-align: center;
  color: #e0e0e0;
  font-family: 'Roboto', sans-serif;
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}

/* ---------- Buy Me a Coffee ---------- */
#bmc-container {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 0.9cm;
  z-index: 10;
}

#bmc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.8rem;
  border-radius: 8px;
  border: 1px solid rgba(128, 203, 196, 0.25);
  background: rgba(128, 203, 196, 0.15);
  color: #ffffff;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 300;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background var(--transition-std), border-color var(--transition-std), color var(--transition-std);
}

#bmc-btn:hover {
  background: rgba(128, 203, 196, 0.28);
  border-color: rgba(128, 203, 196, 0.70);
  color: #ffffff;
}


/* ---------- Completion Screen ---------- */
#completion-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.completion-icon {
  font-size: 2.2rem;
  animation: fadeInUp 0.6s ease-in-out;
}

.completion-title {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--color-text);
}

.completion-subtitle {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 28ch;
}

/* ---------- Keyframe Animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ---------- State-Driven Visibility ----------
   html[data-state] drives which elements are shown.
   CSS display:none is applied here; JS adds/removes `hidden`
   as a belt-and-suspenders backup.
   ----------------------------------------------- */

/* === IDLE: show start + duration picker, hide everything session-specific === */
html[data-state="idle"] #pause-btn,
html[data-state="idle"] #resume-btn,
html[data-state="idle"] #end-btn,
html[data-state="idle"] #breathing-section,
html[data-state="idle"] #completion-screen,
html[data-state="idle"] #timer-display,
html[data-state="idle"] #onscreen-cue {
  display: none !important;
}

/* === ACTIVE: show pause + end, hide start + duration picker + completion === */
html[data-state="active"] #start-btn,
html[data-state="active"] #resume-btn,
html[data-state="active"] #duration-picker-wrap,
html[data-state="active"] #completion-screen,
html[data-state="active"] #app-tagline,
html[data-state="active"] #bmc-container {
  display: none !important;
}

html[data-state="active"] #breathing-section {
  display: flex;
  animation: fadeIn 0.6s ease-in-out;
}

/* === PAUSED: show resume + end, hide start/pause/duration picker/completion === */
html[data-state="paused"] #start-btn,
html[data-state="paused"] #pause-btn,
html[data-state="paused"] #duration-picker-wrap,
html[data-state="paused"] #completion-screen,
html[data-state="paused"] #app-tagline,
html[data-state="paused"] #bmc-container {
  display: none !important;
}

html[data-state="paused"] #breathing-section {
  display: flex;
  opacity: 0.45;
}

/* === COMPLETE: show completion screen only, hide controls/timer/breathing === */
html[data-state="complete"] #controls,
html[data-state="complete"] #duration-picker-wrap,
html[data-state="complete"] #breathing-section,
html[data-state="complete"] #timer-display,
html[data-state="complete"] #breathing-voice-container,
html[data-state="complete"] #soundscape-nav,
html[data-state="complete"] #soundscape-nav-wrap,
html[data-state="complete"] .onscreen-cue,
html[data-state="complete"] #app-tagline {
  display: none !important;
}

html[data-state="complete"] #completion-screen {
  display: flex !important;
  animation: fadeInUp 0.7s ease-in-out;
}

/* ---------- Scrollbar Styling ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(128, 203, 196, 0.3);
  border-radius: 3px;
}

/* ---------- Responsive ---------- */

/* Prevent text wrapping inside buttons at all sizes */
.soundscape-btn,
.duration-btn {
  white-space: nowrap;
}

@media (max-width: 480px) {
  /* Season buttons: always one row, fill width */
  #soundscape-nav {
    gap: 0.4rem;
  }
  .soundscape-btn {
    font-size: 1.2rem;
    padding: 0.45rem 0;
  }

  /* Reduce card gap */
  #app-card {
    gap: 1rem;
  }
}


/* ---------- Help Button ---------- */
#app-card {
  position: relative;
}

.help-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--color-text-muted);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-std), color var(--transition-std), border-color var(--transition-std);
  z-index: 5;
  padding: 0;
  line-height: 1;
}

.help-btn:hover,
.help-btn:focus-visible {
  background: rgba(77, 182, 172, 0.15);
  border-color: rgba(77, 182, 172, 0.5);
  color: var(--color-text);
  outline: none;
}

.help-btn:focus-visible {
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
}

/* ---------- Info Tooltip Icons ---------- */
.nav-with-info {
  position: relative;
  width: 100%;
}

.nav-with-info > nav {
  width: 100%;
}

/* Icon floats at right edge, out of flow — buttons center freely */
.nav-with-info > .tooltip-wrap {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Desktop: counterbalance approach — same as #breathing-voice-container.
   Icon is a flex sibling; ::before spacer of equal width on the left
   ensures buttons stay perfectly centered. */
@media (min-width: 481px) {
  .nav-with-info {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-with-info::before {
    content: '';
    width: 1.3rem;
    flex-shrink: 0;
  }

  .nav-with-info > nav {
    width: auto;
    flex: 0 1 auto;
  }


  .nav-with-info > .tooltip-wrap {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    margin-left: 10px;
    flex-shrink: 0;
  }
}


.info-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  line-height: 1;
  transition: color var(--transition-std);
}

.info-btn:hover,
.info-btn:focus-visible {
  color: var(--color-text-muted);
  outline: none;
}

.info-btn:focus-visible {
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
  border-radius: 4px;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  transform: none;
  background: rgba(10, 45, 35, 0.90);
  border: 1px solid rgba(128, 203, 196, 0.3);
  color: var(--color-text);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  width: max-content;
  max-width: min(360px, 92vw);
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tooltip-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 6px;
  border: 6px solid transparent;
  border-top-color: rgba(10, 45, 35, 0.90);
}

.tooltip-wrap:hover .tooltip-bubble,
.tooltip-bubble.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ---------- Help Panel Overlay ---------- */
#help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 25, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#help-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

#help-panel {
  background: rgba(8, 30, 22, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: 2rem 1.75rem 1.75rem;
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  transform: translateY(12px);
  transition: transform 0.3s ease;
}

#help-overlay.is-open #help-panel {
  transform: translateY(0);
}

#help-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--transition-std), color var(--transition-std);
}

#help-close-btn:hover {
  background: rgba(77, 182, 172, 0.15);
  color: var(--color-text);
}

#help-close-btn:focus-visible {
  outline: 2px solid var(--color-active);
  outline-offset: 3px;
}

.help-title {
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text);
  text-align: center;
  padding-right: 2rem;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.help-section-title {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.help-list li {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--color-text-muted);
  line-height: 1.5;
  padding-left: 0.85rem;
  position: relative;
}

.help-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--color-text-dim);
}

.help-list li strong {
  color: var(--color-text);
  font-weight: 500;
}

.help-emoji {
  font-style: normal;
}

.help-got-it {
  align-self: center;
  margin-top: 0.25rem;
}

/* ===================================================
   SESSION VIEW — active & paused states
   Same glass/teal theme as landing; layout simplified.
   =================================================== */

/* Breathing circle: hidden visually (JS still uses it for state) */
#breathing-section {
  display: none !important;
}

/* Hide idle-only boxes during session */
html[data-state="active"] #duration-picker-wrap,
html[data-state="active"] #soundscape-nav-wrap,
html[data-state="active"] #breathing-voice-container,
html[data-state="paused"]  #duration-picker-wrap,
html[data-state="paused"]  #soundscape-nav-wrap,
html[data-state="paused"]  #breathing-voice-container {
  display: none !important;
}

/* Swap header: hide MEDITATE/tagline, show "Meditating" */
html[data-state="active"] #app-header,
html[data-state="paused"]  #app-header {
  display: none !important;
}

#session-heading {
  display: none;
}

html[data-state="active"] #session-heading,
html[data-state="paused"]  #session-heading {
  display: block;
  width: 100%;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--color-text);
  text-align: center;
}

/* Separator line below "Meditating" */
html[data-state="active"] #session-heading::after,
html[data-state="paused"]  #session-heading::after {
  content: '';
  display: block;
  width: calc(100% - 2.5rem);
  height: 1px;
  background: rgba(77, 182, 172, 0.22);
  margin-top: 0.9rem;
  margin-left: 1.25rem;
}

/* Session box — hidden everywhere except active/paused.
   No inner background: content sits flat inside the card. */
#session-box {
  display: none;
  width: 100%;
}

html[data-state="active"] #session-box,
html[data-state="paused"] #session-box {
  /* CSS Grid: 5 rows — equal spacers above/below timer, fixed gap, controls at bottom */
  display: grid;
  grid-template-rows: 1fr auto 1fr 2.5rem auto;
  align-items: start;
  width: 100%;
  flex: 1;                /* still a flex child of app-card */
  min-height: 420px;
  margin-bottom: -1rem;   /* absorb card gap so controls reach the card bottom padding */
  animation: fadeIn 0.4s ease-in-out;
}

/* Timer section: placed in row 2, centered by equal 1fr rows above and below */
#session-timer-section {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* TIME REMAINING label */
#time-remaining-label {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--color-text-dim);
  text-transform: uppercase;
  text-align: center;
  margin: 0;
}

/* Timer: large, keep mono font */
html[data-state="active"] #timer-display,
html[data-state="paused"] #timer-display {
  font-size: clamp(3.2rem, 14vw, 4.8rem);
  font-weight: 300;
}

/* Progress bar */
#session-progress-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

#session-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-active);
  border-radius: 2px;
  transition: width 1s linear;
}

/* Controls row: pinned to grid row 5 (below explicit gap row) */
html[data-state="active"] #controls,
html[data-state="paused"] #controls {
  grid-row: 5;
  width: 100%;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

/* Pause / Resume — grow to fill row, override btn--start width:100% */
html[data-state="active"] #pause-btn,
html[data-state="paused"] #resume-btn {
  flex: 1;
  width: auto;
}

/* End button — auto width, sits beside primary */
html[data-state="active"] #end-btn,
html[data-state="paused"] #end-btn {
  flex-shrink: 0;
}

/* Collapse onscreen-cue phantom height — it still shows text if TTS fails */
html[data-state="active"] #onscreen-cue,
html[data-state="paused"] #onscreen-cue {
  min-height: 0;
}

/* Start button: hidden in complete (it's outside #controls now) */
html[data-state="complete"] #start-btn {
  display: none !important;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body {
    background-attachment: scroll;
  }
}
