@import url(https://fonts.bunny.net/css?family=caprasimo:400|fira-code:400,500|source-sans-3:400,400i,500,500i,700,700i);

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sage: #87A878;
  --sage-light: #B5C9AC;
  --sage-pale: #E8F0E5;
  --sage-dark: #5C7A52;
  --cream: #F7F5F0;
  --text: #2E3A2B;
  --text-muted: #7A8F76;
  --white: #FFFFFF;
  --font-main: "Source Sans 3", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-secondary: "Caprasimo", serif;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background: var(--cream);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}
.a1 { width: 520px; height: 520px; background: var(--sage-light); top: -120px; left: -120px; animation: d1 20s ease-in-out infinite alternate; }
.a2 { width: 420px; height: 420px; background: #C8D8B8; bottom: -100px; right: -100px; animation: d2 25s ease-in-out infinite alternate; }
.a3 { width: 300px; height: 300px; background: #D5E5CC; top: 50%; left: 50%; transform: translate(-50%,-50%); animation: d3 30s ease-in-out infinite alternate; }
@keyframes d1 { to { transform: translate(70px, 50px); } }
@keyframes d2 { to { transform: translate(-50px, -70px); } }
@keyframes d3 { to { transform: translate(-40%, -60%); } }

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  padding: 1.5rem 1.5rem 1rem;
  gap: 1rem;
}

.app-header { text-align: center; flex-shrink: 0; }
.app-header h1 {
  font-family: var(--font-secondary);
  font-size: 2rem;
  font-weight: 400;
  color: var(--sage-dark);
  line-height: 1;
  margin-bottom: 0.15rem;
}
.app-header p {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-style: italic;
}

.tabs {
  display: flex;
  background: var(--sage-pale);
  border-radius: 50px;
  padding: 3px;
  flex-shrink: 0;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 0.45rem 1.6rem;
  border-radius: 50px;
  font-family: var(--font-main);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
}
.tab-btn.active {
  background: var(--white);
  color: var(--sage-dark);
  box-shadow: 0 2px 10px rgba(92,122,82,0.12);
}

.panels-wrap {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
}

.panel {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.panel.active { display: flex; }

/* Shared */
.session-row { display: flex; gap: 0.5rem; justify-content: center; flex-shrink: 0; }
.sess-btn {
  background: var(--white);
  border: 1.5px solid var(--sage-light);
  color: var(--text-muted);
  padding: 0.35rem 0.9rem;
  border-radius: 50px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.25s;
  font-family: var(--font-main);
}
.sess-btn:hover, .sess-btn.active { background: var(--sage); border-color: var(--sage); color: var(--white); }

.progress-wrap { width: 100%; max-width: 260px; flex-shrink: 0; }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.progress-bar { height: 2px; background: var(--sage-pale); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(to right, var(--sage-light), var(--sage-dark)); border-radius: 10px; width: 0%; transition: width 1s linear; }

.controls { display: flex; gap: 0.7rem; align-items: center; flex-shrink: 0; }
.btn {
  background: var(--white);
  border: 1.5px solid var(--sage-light);
  border-radius: 50px;
  padding: 0.5rem 1.4rem;
  font-family: var(--font-main);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--text);
  transition: all 0.25s;
}
.btn:hover { background: var(--sage-pale); }
.btn-primary { background: var(--sage); border-color: var(--sage); color: var(--white); }
.btn-primary:hover { background: var(--sage-dark); border-color: var(--sage-dark); }

.divider { width: 30px; height: 1px; background: var(--sage-light); opacity: 0.5; flex-shrink: 0; }

/* BREATHE */
#panel-breathe { justify-content: space-evenly; }

.circle-wrap {
  position: relative;
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--sage-light);
  animation: ring-pulse 4s ease-in-out infinite;
}
.ring-1 { width: 100%; height: 100%; opacity: 0.25; }
.ring-2 { width: 80%; height: 80%; opacity: 0.45; animation-delay: 0.6s; }
@keyframes ring-pulse {
  0%,100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.07); opacity: 0.55; }
}
.breath-circle {
  width: 140px; height: 140px;
  background: radial-gradient(circle at 38% 33%, var(--sage-light), var(--sage-dark));
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 36px rgba(92,122,82,0.28);
  position: relative; z-index: 2;
  transition: box-shadow 0.3s;
}
.breath-circle:hover { box-shadow: 0 12px 48px rgba(92,122,82,0.38); }
.breath-circle.inhale { animation: expand 4s ease-in-out forwards; }
.breath-circle.exhale { animation: contract 6s ease-in-out forwards; }
@keyframes expand   { from { transform: scale(1); } to { transform: scale(1.18); } }
@keyframes contract { from { transform: scale(1.18); } to { transform: scale(1); } }

.c-label { font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.75); }
.c-timer { font-size: 1.9rem; color: var(--white); font-weight: 300; line-height: 1; margin: 0.15rem 0; }
.c-phase { font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.6); }

.affirmation {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 260px;
  line-height: 1.65;
  text-align: center;
  transition: opacity 0.8s ease;
  flex-shrink: 0;
}

.complete-msg { display: none; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; flex-shrink: 0; }
.complete-msg h2 { font-size: 1.1rem; font-weight: 400; color: var(--sage-dark); letter-spacing: 0.15em; }
.complete-msg p { color: var(--text-muted); font-size: 0.75rem; font-style: italic; }

/* MEDITATE */
#panel-meditate { justify-content: space-evenly; }

.timer-block { text-align: center; flex-shrink: 0; }
.big-timer {
  font-size: clamp(3rem, 13vw, 4.5rem);
  font-weight: 300;
  color: var(--sage-dark);
  letter-spacing: 0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.timer-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.sound-section { width: 100%; flex-shrink: 0; }
.sound-title, .bell-title {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  text-align: center;
}

/* 6 sound buttons in a single row */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
}
.sound-btn {
  background: var(--white);
  border: 1.5px solid var(--sage-light);
  border-radius: 10px;
  padding: 0.5rem 0.2rem 0.4rem;
  font-family: var(--font-main);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.sound-btn:hover { background: var(--sage-pale); }
.sound-btn.active { background: var(--sage-pale); border-color: var(--sage); color: var(--sage-dark); }
.sound-btn.playing { background: var(--sage); border-color: var(--sage); color: var(--white); }
.sound-icon { font-size: 1.1rem; line-height: 1; }

/* Bell + Volume on one row */
.bell-volume-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 1.5rem;
  flex-shrink: 0;
}

.bell-section { flex: 1; min-width: 0; }
.bell-title { text-align: left; }
.bell-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.bell-btn {
  background: var(--white);
  border: 1.5px solid var(--sage-light);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: 50px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s;
  font-family: var(--font-main);
  white-space: nowrap;
}
.bell-btn:hover { background: var(--sage-pale); }
.bell-btn.active { background: var(--sage); border-color: var(--sage); color: var(--white); }

.volume-section { flex-shrink: 0; }
.vol-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.6rem;
  text-align: right;
}
.volume-row { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
input[type=range] {
  width: 80px;
  -webkit-appearance: none;
  height: 2px;
  background: var(--sage-pale);
  border-radius: 10px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--sage);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}
input[type=range]::-webkit-slider-thumb:hover { background: var(--sage-dark); }

.med-complete { display: none; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; flex-shrink: 0; }
.med-complete h2 { font-size: 1.1rem; font-weight: 400; color: var(--sage-dark); letter-spacing: 0.15em; }
.med-complete p { color: var(--text-muted); font-size: 0.75rem; font-style: italic; }