/* Stillpace Breathing App, Open Cloud Mint Flagship + 1-Tap Pitch-Black OLED */
:root {
  --bg: #EEF5F3;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --inset: #F3F8F6;
  --text: #16242A;
  --muted: #52666E;
  --state-accent: #1FB6A8;
  --inhale: #1FB6A8;
  --hold: #FF7F5C;
  --exhale: #4F6DF5;
  --rest: #8B74FF;
  --border: #CFE4DF;
}

body.oled-mode {
  --bg: #000000;
  --surface: #070B0E;
  --card: #080D11;
  --inset: #0E151B;
  --text: #F1F5F9;
  --muted: #8FA3B0;
  --inhale: #1C8074;
  --hold: #94600A;
  --exhale: #227296;
  --rest: #4E5496;
  --border: rgba(148, 163, 184, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100svh;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

/* Zen Focus Peripheral Dimming */
.app-topbar,
.duration-pills,
.bottom-nav,
.footer-note {
  transition: opacity 0.8s ease;
}

body.zen-active .app-topbar,
body.zen-active .duration-pills,
body.zen-active .bottom-nav,
body.zen-active .footer-note {
  opacity: 0.22;
}

/* Top Bar, ONLY center controls sit inside a pill border */
.app-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.home-btn {
  border: none;
  border-radius: 9999px;
  padding: 9px 15px;
  background-color: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 36, 42, 0.06);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.home-btn:hover {
  transform: translateY(-1px);
  background-color: #DDF6F2;
}

body.oled-mode .home-btn {
  box-shadow: none;
  border: 1px solid var(--border);
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-ctrl-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 4px 6px;
}

.icon-btn {
  border: none;
  border-radius: 9999px;
  padding: 7px 14px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.icon-btn:hover,
.icon-btn[aria-pressed="true"] {
  background-color: #DDF6F2;
  color: #16242A;
}

body.oled-mode .icon-btn:hover,
body.oled-mode .icon-btn[aria-pressed="true"] {
  background-color: rgba(45, 212, 191, 0.16);
  color: #F1F5F9;
}

.mindful-badge {
  border: none;
  padding: 8px 14px;
  border-radius: 9999px;
  background-color: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 36, 42, 0.05);
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.mindful-badge:hover {
  transform: translateY(-1px);
  background-color: #DDF6F2;
}

body.oled-mode .mindful-badge {
  box-shadow: none;
  border: 1px solid var(--border);
}

/* Vibrant State Switcher Strip */
.state-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
}

.state-tabs::-webkit-scrollbar {
  display: none;
}

.state-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.state-pill {
  border: none;
  border-radius: 9999px;
  min-height: 50px;
  padding: 8px 18px;
  background-color: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(22, 36, 42, 0.05);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, color 0.2s ease;
}

.state-pill--library,
.state-pill--custom {
  align-items: center;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.plan-badge {
  border: none;
  border-radius: 9999px;
  padding: 8px 14px;
  background-color: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 36, 42, 0.05);
  white-space: nowrap;
}

.plan-badge.is-pro {
  background-color: #16242A;
  color: #FFFFFF;
}

body.oled-mode .plan-badge {
  box-shadow: none;
  border: 1px solid var(--border);
}

.state-pill-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.78;
}

.state-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background-color: var(--pill-color, #1FB6A8);
}

.state-pill.active .state-pill-dot {
  background-color: #FFFFFF;
}

.state-pill:hover {
  transform: translateY(-2px);
}

.state-pill.active {
  background-color: var(--pill-color, #1FB6A8);
  color: #FFFFFF;
  box-shadow: 0 8px 22px rgba(22, 36, 42, 0.14);
}

.state-pill--custom {
  background-color: #FFF0EB;
  color: #E0523C;
}

body.oled-mode .state-pill {
  box-shadow: none;
  border: 1px solid var(--border);
}

body.oled-mode .state-pill--custom {
  background-color: #111921;
  color: #F59E0B;
}

/* Main Stage */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.pacer-stage {
  width: 100%;
  background-color: var(--card);
  border-radius: 34px;
  padding: 28px 32px;
  box-shadow: 0 22px 60px rgba(22, 36, 42, 0.07);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

body.oled-mode .pacer-stage {
  border: 1px solid var(--border);
  box-shadow: none;
}

.progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background-color: var(--inset);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--state-accent);
  border-radius: 0 9999px 9999px 0;
  transition: width 0.25s linear, background-color 0.3s ease;
}

.stage-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.stage-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.pill {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 9999px;
  background-color: #DDF6F2;
  color: #1F9D8E;
  font-size: 12px;
  font-weight: 800;
}

body.oled-mode .pill {
  background-color: rgba(28, 128, 116, 0.22);
  color: #2dd4bf;
}

.stage-title-group h1 {
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.pattern-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.stage-timer-group {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.cycle-pill {
  padding: 4px 11px;
  border-radius: 9999px;
  background-color: var(--inset);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.phase-countdown {
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 1;
}

/* Breezy + Phase Focal Row */
.pacer-hero-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.pacer-halo {
  width: 102px;
  height: 102px;
  border-radius: 28px;
  background-color: #DDF6F2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.4s ease;
}

body.oled-mode .pacer-halo {
  background-color: rgba(28, 128, 116, 0.14);
}

.pacer-breezy {
  transition: transform 0.1s linear;
  transform-origin: center;
}

.phase-readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phase-name {
  font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.next-phase-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

/* Seamless YouTube-Matched Wave Stage */
.wave-stage {
  width: 100%;
  border-radius: 24px;
  background-color: var(--inset);
  padding: 8px 4px;
  overflow: hidden;
}

#wave-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.somatic-prompt {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  min-height: 22px;
  transition: opacity 0.8s ease;
}

.somatic-prompt.faded {
  opacity: 0;
}

.complete-banner {
  border-radius: 22px;
  padding: 18px 20px;
  background-color: #DDF6F2;
  color: #16242A;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.feeling-checkin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.feeling-prompt {
  font-size: 13px;
  font-weight: 800;
}

.feeling-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.feeling-btn {
  border: none;
  border-radius: 9999px;
  padding: 8px 15px;
  background-color: #FFFFFF;
  color: #16242A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(22, 36, 42, 0.06);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.feeling-btn:hover,
.feeling-btn.active {
  background-color: #16242A;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.feeling-saved {
  font-size: 13px;
  font-weight: 800;
  color: #1F9D8E;
}

body.oled-mode .complete-banner {
  background-color: rgba(28, 128, 116, 0.22);
  color: #F1F5F9;
}

body.oled-mode .feeling-btn {
  background-color: #111921;
  color: #F1F5F9;
  border: 1px solid var(--border);
  box-shadow: none;
}

body.oled-mode .feeling-btn.active {
  background-color: #2dd4bf;
  color: #070B0E;
}

/* Bottom Dock */
.app-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.duration-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.dur-btn {
  border: none;
  border-radius: 9999px;
  padding: 9px 16px;
  background-color: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22, 36, 42, 0.05);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dur-btn:hover {
  transform: translateY(-1px);
}

.dur-btn.active {
  background-color: var(--state-accent);
  color: #FFFFFF;
}

body.oled-mode .dur-btn {
  box-shadow: none;
  border: 1px solid var(--border);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.primary-btn {
  border: none;
  border-radius: 9999px;
  padding: 16px 36px;
  background-color: #16242A;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(22, 36, 42, 0.16);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
}

.primary-btn:hover {
  background-color: #FF7F5C;
  transform: translateY(-2px);
}

body.oled-mode .primary-btn {
  background-color: #1FB6A8;
  color: #070B0E;
  box-shadow: none;
}

.secondary-btn {
  border: none;
  border-radius: 9999px;
  padding: 16px 26px;
  background-color: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(22, 36, 42, 0.06);
}

body.oled-mode .secondary-btn {
  box-shadow: none;
  border: 1px solid var(--border);
}

.full-width { width: 100%; }

.youtube-wrap a {
  color: #1F9D8E;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Presets & Custom Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#pro-modal {
  z-index: 60;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 36, 42, 0.45);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background-color: var(--card);
  border-radius: 30px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(22, 36, 42, 0.22);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 { font-size: 20px; font-weight: 800; }

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-item {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 14px 16px;
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.preset-item strong { display: block; font-size: 14px; font-weight: 800; }
.preset-item span { font-size: 12px; color: var(--muted); font-weight: 600; }

.custom-builder h3 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }

.custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.custom-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.custom-grid input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px 16px 96px;
    gap: 14px;
  }
  .pacer-stage {
    padding: 20px 18px;
    border-radius: 26px;
  }
  .pacer-halo {
    width: 78px;
    height: 78px;
    border-radius: 22px;
  }
  .pacer-halo svg {
    width: 62px;
    height: 62px;
  }
  .stage-timer-group {
    text-align: left;
    align-items: flex-start;
  }
  .controls {
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .library-grid {
    grid-template-columns: 1fr;
  }
}

/* Scalable Library & Free/Pro UI */
.state-pill--library {
  background-color: #16242A;
  color: #FFFFFF;
}

body.oled-mode .state-pill--library {
  background-color: #1FB6A8;
  color: #070B0E;
}

.modal-panel--wide {
  max-width: 740px;
}

.modal-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tier-switch-btn {
  border: none;
  border-radius: 9999px;
  padding: 7px 14px;
  background-color: #DDF6F2;
  color: #1F9D8E;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tier-switch-btn.is-pro {
  background-color: #16242A;
  color: #FFFFFF;
}

.library-search {
  width: 100%;
  flex-shrink: 0;
  padding: 12px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.library-search:focus {
  border-color: #2EC4B6;
  background-color: var(--card);
}

.library-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 2px 0;
}

.filter-pill {
  flex-shrink: 0;
  border: none;
  border-radius: 9999px;
  padding: 8px 14px;
  background-color: var(--inset);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.filter-pill.active {
  background-color: #16242A;
  color: #FFFFFF;
}

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

.lib-card {
  border-radius: 22px;
  padding: 16px;
  background-color: var(--inset);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease;
}

.lib-card:hover {
  transform: translateY(-2px);
}

.lib-card.is-active {
  border-color: #2EC4B6;
  background-color: var(--card);
}

.lib-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.lib-state-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.lib-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.lib-pin-btn {
  border: none;
  border-radius: 9999px;
  padding: 4px 10px;
  background-color: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lib-pin-btn.pinned {
  background-color: #FFF0EB;
  color: #E0523C;
}

.lib-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.lib-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

.lib-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.lib-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lib-chip {
  background-color: var(--card);
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.pro-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  background-color: #FFF0EB;
  color: #E0523C;
  font-size: 12px;
  font-weight: 800;
}

.pro-modal-panel {
  max-width: 430px;
  text-align: center;
  align-items: center;
}

.pro-hero-badge {
  width: 82px;
  height: 82px;
  border-radius: 26px;
  background-color: #DDF6F2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pro-perks {
  list-style: none;
  text-align: left;
  width: 100%;
  background-color: var(--inset);
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

/* 3 Pacer Styles */
.pacer-style-bar {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  background-color: var(--inset);
  border-radius: 9999px;
  padding: 4px;
  flex-shrink: 0;
}

.style-pill {
  border: none;
  border-radius: 9999px;
  padding: 7px 14px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.style-pill.active {
  background-color: var(--card);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(22, 36, 42, 0.08);
}

body.oled-mode .style-pill.active {
  background-color: #1FB6A8;
  color: #070B0E;
  box-shadow: none;
}

.pacer-style-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.focus-center-stage {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 12px 16px;
  min-height: 290px;
}

.focus-aura {
  width: 210px;
  height: 210px;
  border-radius: 9999px;
  background-color: #DDF6F2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.4s ease, transform 0.1s linear;
}

body.oled-mode .focus-aura {
  background-color: rgba(28, 128, 116, 0.16);
}

.ring-stage {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.minimal-ring-outer {
  position: absolute;
  width: 244px;
  height: 244px;
  border-radius: 9999px;
  background-color: rgba(31, 182, 168, 0.14);
  transition: transform 0.1s linear, background-color 0.4s ease;
}

.ring-progress-svg {
  position: absolute;
  width: 244px;
  height: 244px;
  transform: rotate(-90deg);
  z-index: 1;
}

.ring-track-circle {
  fill: none;
  stroke: rgba(22, 36, 42, 0.10);
  stroke-width: 10;
}

body.oled-mode .ring-track-circle {
  stroke: rgba(148, 163, 184, 0.16);
}

.ring-progress-arc {
  fill: none;
  stroke: #1FB6A8;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 578.05;
  stroke-dashoffset: 578.05;
  transition: stroke 0.3s ease;
}

.minimal-ring-core {
  position: relative;
  z-index: 2;
  width: 174px;
  height: 174px;
  border-radius: 9999px;
  background-color: var(--card);
  box-shadow: 0 12px 34px rgba(22, 36, 42, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  transition: transform 0.1s linear;
}

.ring-phase-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.ring-next-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* Saved Routines & Custom Studio */
.custom-meta-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.custom-meta-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.custom-meta-grid input,
.custom-meta-grid select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}

.custom-btn-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
}

.saved-routines-wrap {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.saved-head h3 {
  font-size: 15px;
  font-weight: 800;
}

.saved-del-btn {
  border: none;
  border-radius: 9999px;
  padding: 5px 10px;
  background-color: #FFF0EB;
  color: #E0523C;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 520px) {
  .custom-meta-grid,
  .custom-btn-row,
  .history-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.top-pill-btn {
  background-color: var(--card);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(22, 36, 42, 0.05);
}

body.oled-mode .top-pill-btn {
  box-shadow: none;
  border: 1px solid var(--border);
}

/* Stage Controls Row & Floating Bottom Nav (Option C) */
.stage-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stage-mini-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mini-action-pill {
  border: none;
  border-radius: 9999px;
  padding: 8px 14px;
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.mini-action-pill:hover {
  transform: translateY(-1px);
  background-color: #DDF6F2;
}

.mini-action-pill--coral {
  background-color: #FFF0EB;
  color: #E0523C;
}

body.oled-mode .mini-action-pill {
  border: 1px solid var(--border);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #FF7F5C;
  border: none;
  border-radius: 9999px;
  padding: 6px 8px;
  box-shadow: 0 16px 38px rgba(255, 127, 92, 0.30);
}

body.oled-mode .bottom-nav {
  background-color: #111921;
  border: 1px solid var(--border);
  box-shadow: none;
}

.bnav-btn {
  border: none;
  border-radius: 9999px;
  padding: 10px 18px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bnav-btn:hover {
  color: #FFFFFF;
}

.bnav-btn.active {
  background-color: #16242A;
  color: #FFFFFF;
}

body.oled-mode .bnav-btn.active {
  background-color: #1FB6A8;
  color: #070B0E;
}

/* 3 Pinned Techniques Strip Inside Card */
.pinned-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pinned-chip {
  border: none;
  border-radius: 9999px;
  padding: 7px 14px;
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.pinned-chip:hover {
  transform: translateY(-1px);
  background-color: #DDF6F2;
}

.pinned-chip.active {
  background-color: var(--pill-color, #1FB6A8);
  color: #FFFFFF;
}

.pinned-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background-color: var(--pill-color, #1FB6A8);
}

.pinned-chip.active .pinned-chip-dot {
  background-color: #FFFFFF;
}

.sound-toggle-row {
  background-color: var(--inset);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.sound-card {
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 13px 15px;
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sound-card strong { font-size: 14px; font-weight: 800; }
.sound-card span { font-size: 12px; color: var(--muted); font-weight: 600; }

.sound-card.active {
  border-color: #2EC4B6;
  background-color: var(--card);
}

.mood-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mood-card {
  border: none;
  border-radius: 18px;
  padding: 14px 16px;
  background-color: var(--inset);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.mood-card:hover {
  transform: translateY(-2px);
  background-color: #DDF6F2;
}

.mood-card strong { font-size: 15px; font-weight: 800; }
.mood-card span { font-size: 12px; color: var(--muted); font-weight: 600; }

@media (max-width: 520px) {
  .bnav-btn { padding: 8px 11px; font-size: 12px; }
  .sound-grid { grid-template-columns: 1fr; }
}
.history-gate {
  background-color: var(--inset);
  border-radius: 24px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.history-kpi-card {
  background-color: var(--inset);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.history-kpi-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.history-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-section h3 {
  font-size: 15px;
  font-weight: 800;
}

.history-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.week-day {
  background-color: var(--inset);
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.week-dot {
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  background-color: var(--border);
}

.week-day.done .week-dot {
  background-color: #2EC4B6;
  box-shadow: 0 0 0 4px #DDF6F2;
}

.state-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  background-color: var(--card);
  overflow: hidden;
  margin-top: 6px;
}

.state-bar-fill {
  height: 100%;
  border-radius: 9999px;
}

.pro-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 14px 0 8px;
}

.text-link-btn {
  background: none;
  border: none;
  color: #138A7F;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
  margin-bottom: 6px;
  text-decoration: underline;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.auth-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.auth-code-input {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.35em;
}

.auth-msg {
  padding: 10px 14px;
  border-radius: 12px;
  background-color: #E0F4F1;
  color: #138A7F;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  text-align: left;
}

.auth-msg.is-error {
  background-color: #FFF0EB;
  color: #C44525;
}

.auth-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background-color: var(--inset);
  border: 1px solid var(--border);
}

.auth-account-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.auth-user-email {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

.checkout-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background-color: #16242A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(22, 36, 42, 0.25);
  max-width: 90vw;
  text-align: center;
}

