/* Self-hosted: Cormorant Garamond + Manrope */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/cormorant-garamond-cyrillic-300-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/cormorant-garamond-latin-300-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/cormorant-garamond-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-cyrillic-500-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/manrope-cyrillic-300-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/manrope-latin-300-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/manrope-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/manrope-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/manrope-cyrillic-500-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/manrope-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/manrope-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/manrope-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


:root {
  --bg-deep: #061418;
  --bg: #0a1f24;
  --surface: rgba(14, 42, 48, 0.72);
  --line: rgba(214, 196, 160, 0.22);
  --sand: #d6c4a0;
  --sand-soft: #b9a888;
  --foam: #e8f2f0;
  --mint: #7ec8b3;
  --ink: #9bb8b4;
  --danger: #c47a6a;
  --inhale: #7ec8b3;
  --exhale: #d6c4a0;
  --hold: #8aa4c8;
  --font-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  min-height: 100%;
  height: 100%;
}

body {
  background:
    radial-gradient(120% 80% at 10% -10%, #163a42 0%, transparent 55%),
    radial-gradient(90% 70% at 110% 20%, #1a4a3c 0%, transparent 50%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--foam);
  font-family: var(--font-body);
  font-weight: 400;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  left: -8%;
  top: 18%;
  background: #2a6b5c;
}

.orb-b {
  width: 36vw;
  height: 36vw;
  right: -10%;
  bottom: 8%;
  background: #3d5a48;
  animation-delay: -7s;
}

.mist {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(214, 196, 160, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 196, 160, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 75%);
  opacity: 0.5;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(4%, -3%, 0) scale(1.08);
  }
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100%;
  height: 100%;
  padding:
    calc(20px + var(--safe-top))
    20px
    calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

.screen[hidden] {
  display: none !important;
}

.brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.35rem, 8vw, 3rem);
  letter-spacing: 0.12em;
  color: var(--sand);
  line-height: 1;
}

.tagline {
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink);
}

.top {
  text-align: center;
  margin-bottom: 18px;
  animation: rise 0.7s ease both;
}

.gate {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.gate-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.75rem, 6.5vw, 2.35rem);
  color: var(--foam);
  letter-spacing: 0.02em;
}

.gate-copy {
  max-width: 280px;
  color: var(--ink);
  line-height: 1.5;
  font-weight: 300;
}

.btn {
  appearance: none;
  border: 1px solid var(--sand);
  background: transparent;
  color: var(--sand);
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

.btn.primary:hover,
.btn.primary:active {
  background: var(--sand);
  color: var(--bg-deep);
}

.btn.ghost {
  border-color: var(--line);
  color: var(--ink);
}

.modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  animation: rise 0.8s ease both 0.08s;
}

.mode {
  appearance: none;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--foam);
  border-radius: 0;
  padding: 10px 4px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

.mode:active {
  transform: scale(0.97);
}

.mode.active {
  border-color: var(--mint);
  background: rgba(126, 200, 179, 0.12);
}

.mode-icon {
  width: 36px;
  height: 36px;
  color: var(--sand-soft);
}

.mode.active .mode-icon {
  color: var(--mint);
}

.mode-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.mode-ratio {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: 300;
}

.stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  animation: rise 0.9s ease both 0.14s;
}

.ring-wrap {
  position: relative;
  width: min(78vw, 320px);
  aspect-ratio: 1;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.track {
  fill: none;
  stroke: rgba(232, 242, 240, 0.08);
  stroke-width: 18;
}

.session {
  fill: none;
  stroke: rgba(196, 122, 106, 0.85);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 502.4;
  stroke-dashoffset: 502.4;
  transition: stroke-dashoffset 1s linear;
}

#phase-arcs circle {
  fill: none;
  stroke-width: 18;
  stroke-linecap: butt;
  transition: stroke-dashoffset 1s linear, opacity 0.35s ease;
}

#phase-arcs circle.inhale {
  stroke: var(--inhale);
}
#phase-arcs circle.exhale {
  stroke: var(--exhale);
}
#phase-arcs circle.hold {
  stroke: var(--hold);
}
#phase-arcs circle.dim {
  opacity: 0.22;
}

.pulse {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 200, 179, 0.22), transparent 70%);
  transform: scale(0.86);
  transition: transform 1s linear, opacity 0.4s ease;
  opacity: 0.7;
  pointer-events: none;
}

.pulse.inhale {
  transform: scale(1.08);
}
.pulse.exhale {
  transform: scale(0.82);
}
.pulse.hold {
  transform: scale(1);
}

.center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.phase {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  color: var(--foam);
  letter-spacing: 0.06em;
  animation: softIn 0.45s ease both;
}

.count {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: clamp(3.2rem, 14vw, 4.5rem);
  font-weight: 300;
  line-height: 1;
  color: var(--sand);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  animation: rise 1s ease both 0.2s;
}

.icon-btn,
.play-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sand);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-btn {
  width: 56px;
  height: 56px;
  justify-self: start;
}

.play-btn {
  width: 76px;
  height: 76px;
  border-color: var(--sand);
  background: rgba(214, 196, 160, 0.12);
}

.play-btn .icon-play,
.play-btn .icon-pause {
  display: none;
}

.play-btn.is-idle .icon-play {
  display: block;
}

.play-btn.is-playing .icon-pause {
  display: block;
}

.session {
  opacity: 0;
}

.session.is-on {
  opacity: 1;
}

.play-btn:active,
.icon-btn:active {
  transform: scale(0.95);
}

.duration-chip {
  justify-self: end;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: lowercase;
}

.settings {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.settings h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.8rem;
}

.settings-copy {
  color: var(--ink);
  font-weight: 300;
}

.slider-wrap {
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--sand-soft);
}

.slider-wrap input[type="range"] {
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  outline: none;
}

.slider-wrap input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--mint);
  border: 0;
  cursor: pointer;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 380px) {
  .mode-ratio {
    display: none;
  }
  .mode-icon {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
