.relax-page {
  min-height: 100%;
  --relax-blue: #17519a;
  --relax-purple: #6546b8;
  --relax-green: #087b5c;
  --relax-ink: #0c121a;
  --relax-copy: #425466;
  --relax-line: #d7e1ec;
  --relax-blue-soft: #edf5ff;
  --relax-purple-soft: #f3efff;
  --relax-green-soft: #edf8f3;
  color: #fff;
  background: #02060d;
}

.relax-page .skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: 6px;
  background: #fff;
  color: #06111d;
  font-weight: 800;
  text-decoration: none;
}

.relax-page .skip-link:focus {
  transform: translateY(0);
}

.relax-stage {
  min-height: 100dvh;
  padding: 0 0 max(24px, env(safe-area-inset-bottom));
  overflow: clip;
  isolation: isolate;
}

.relax-stage::after {
  height: 36%;
  opacity: 0.72;
}

.relax-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.45;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 8% 17%, rgba(255, 255, 255, 0.62) 0 1px, transparent 1.4px),
    radial-gradient(circle at 31% 9%, rgba(105, 228, 200, 0.58) 0 1px, transparent 1.4px),
    radial-gradient(circle at 57% 15%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.4px),
    radial-gradient(circle at 76% 8%, rgba(255, 255, 255, 0.52) 0 1px, transparent 1.4px),
    radial-gradient(circle at 91% 24%, rgba(105, 228, 200, 0.48) 0 1px, transparent 1.4px);
  background-size: 310px 220px, 420px 290px, 370px 260px, 500px 340px, 460px 310px;
  animation: relaxSkyDrift 48s linear infinite;
}

.sleep-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  visibility: hidden;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.8);
  transition: opacity 900ms ease, visibility 900ms ease;
}

.sleep-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.76;
  background-image:
    radial-gradient(circle at 11% 14%, rgba(255, 255, 255, 0.86) 0 1px, transparent 1.3px),
    radial-gradient(circle at 29% 28%, rgba(186, 220, 255, 0.72) 0 1px, transparent 1.3px),
    radial-gradient(circle at 47% 9%, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.3px),
    radial-gradient(circle at 64% 24%, rgba(195, 255, 235, 0.72) 0 1px, transparent 1.3px),
    radial-gradient(circle at 83% 12%, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.3px),
    radial-gradient(circle at 94% 36%, rgba(186, 220, 255, 0.66) 0 1px, transparent 1.3px);
  background-size: 230px 190px, 330px 250px, 290px 230px, 410px 310px, 370px 280px, 470px 340px;
}

.sleep-atmosphere::after {
  content: "";
  position: absolute;
  top: -18%;
  left: -22%;
  width: 144%;
  height: 68%;
  opacity: 0.1;
  filter: blur(18px);
  transform: skewX(-8deg);
  background:
    linear-gradient(
      104deg,
      transparent 14%,
      rgba(62, 238, 194, 0.9) 28%,
      transparent 42%,
      rgba(76, 132, 255, 0.88) 56%,
      rgba(112, 255, 205, 0.76) 68%,
      transparent 84%
    );
  background-size: 170% 100%;
  animation: northernLightsDrift 26s ease-in-out infinite;
}

body.sleep-mode .sleep-atmosphere {
  visibility: visible;
  opacity: 1;
}

.relax-topbar,
.relax-layout,
.thinking-band,
.relax-footer {
  position: relative;
  z-index: 2;
}

.relax-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.relax-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.relax-brand img {
  width: 38px;
  height: 38px;
}

.relax-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.sleep-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  user-select: none;
}

.sleep-toggle input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sleep-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 180ms ease, background 180ms ease;
}

.sleep-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  transition: transform 180ms ease, background 180ms ease;
}

.sleep-toggle input:checked + .sleep-toggle-track {
  border-color: rgba(105, 228, 200, 0.46);
  background: rgba(105, 228, 200, 0.15);
}

.sleep-toggle input:checked + .sleep-toggle-track .sleep-toggle-thumb {
  transform: translateX(16px);
  background: #69e4c8;
}

.sleep-toggle input:focus-visible + .sleep-toggle-track {
  outline: 2px solid rgba(105, 228, 200, 0.7);
  outline-offset: 3px;
}

.cycle-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.cycle-mark-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #69e4c8;
  box-shadow: 0 0 18px rgba(105, 228, 200, 0.68);
}

body.sleep-mode .cycle-mark-dot {
  box-shadow: none;
}

body.sleep-mode .relax-topbar,
body.sleep-mode .relax-layout,
body.sleep-mode .thinking-band,
body.sleep-mode .relax-footer {
  transition: opacity 900ms ease, filter 900ms ease;
}

body.sleep-mode.is-sleep-idle .relax-topbar {
  opacity: 0.24;
}

body.sleep-mode.is-sleep-idle .relax-layout,
body.sleep-mode.is-sleep-idle .thinking-band,
body.sleep-mode.is-sleep-idle .relax-footer {
  opacity: 0.12;
  filter: saturate(0.45);
}

.relax-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  gap: clamp(42px, 7vw, 94px);
  align-items: center;
  min-height: 520px;
  padding-top: clamp(42px, 6vh, 72px);
  padding-bottom: 42px;
}

.relax-intro {
  min-width: 0;
}

.relax-kicker,
.control-label {
  color: #69e4c8;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.relax-intro h1 {
  max-width: 720px;
  margin: 12px 0 20px;
  color: #fff8ed;
  font-size: clamp(58px, 7vw, 102px);
  line-height: 0.91;
}

.relax-lede {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.4;
}

.ocean-horizon {
  position: relative;
  height: 86px;
  margin-top: 34px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.ocean-horizon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 1px;
  background: rgba(105, 228, 200, 0.3);
}

.ocean-line {
  position: absolute;
  left: -12%;
  width: 124%;
  height: 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  transform-origin: center;
}

.ocean-line-one {
  bottom: -8px;
  animation: oceanLineOne 9s ease-in-out infinite;
}

.ocean-line-two {
  bottom: -17px;
  opacity: 0.58;
  animation: oceanLineTwo 13s ease-in-out infinite;
}

.ocean-line-three {
  bottom: -25px;
  opacity: 0.34;
  animation: oceanLineThree 17s ease-in-out infinite;
}

.mix-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 650;
}

.mix-proof span {
  position: relative;
}

.mix-proof span + span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #69e4c8;
}

.ocean-console {
  min-width: 0;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--relax-line);
  border-top: 4px solid var(--relax-green);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(237, 245, 255, 0.8), rgba(243, 239, 255, 0.52)),
    #fff;
  box-shadow: 0 24px 70px rgba(4, 16, 29, 0.24);
  backdrop-filter: blur(16px);
}

.ocean-now {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.ocean-toggle {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid rgba(105, 228, 200, 0.52);
  border-radius: 50%;
  background: linear-gradient(135deg, #69e4c8, #4f99ff);
  color: #04101d;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(22, 149, 184, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ocean-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(22, 149, 184, 0.34);
}

.ocean-toggle:active {
  transform: translateY(0);
}

.ocean-toggle-icon {
  display: block;
  width: 28px;
  font-size: 26px;
  line-height: 1;
  text-align: center;
  transform: translateX(2px);
}

.ocean-toggle[aria-pressed="true"] .ocean-toggle-icon {
  transform: none;
}

.ocean-now-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ocean-now-copy strong {
  overflow: hidden;
  color: var(--relax-ink);
  font-size: 19px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ocean-now-copy > span {
  overflow: hidden;
  color: var(--relax-copy);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cycle-clock {
  display: grid;
  gap: 2px;
  text-align: right;
}

.cycle-clock span {
  color: var(--relax-copy);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.cycle-clock strong {
  color: var(--relax-purple);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 19px;
  letter-spacing: 0;
}

.console-divider {
  height: 1px;
  margin: 28px 0 24px;
  background: var(--relax-line);
}

.console-controls {
  display: grid;
  gap: 24px;
}

.sound-depth {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sound-depth legend {
  margin-bottom: 9px;
  color: #69e4c8;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.segmented-control,
.timer-presets {
  display: grid;
  gap: 6px;
}

.segmented-control {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control button,
.timer-presets button {
  min-height: 44px;
  border: 1px solid var(--relax-line);
  border-radius: 6px;
  background: #fff;
  color: var(--relax-copy);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.segmented-control button:hover,
.timer-presets button:hover {
  border-color: rgba(23, 81, 154, 0.42);
  color: var(--relax-blue);
}

.segmented-control button.is-selected,
.timer-presets button.is-selected {
  border-color: transparent;
  background: linear-gradient(135deg, var(--relax-blue), var(--relax-purple));
  color: #fff;
}

.volume-control {
  display: grid;
  gap: 9px;
}

.volume-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  color: var(--relax-copy);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.volume-row input {
  width: 100%;
  accent-color: #69e4c8;
  cursor: pointer;
}

.audio-message,
.timer-status,
.thought-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--relax-copy);
  font-size: 12px;
}

.thinking-band {
  display: grid;
  grid-template-columns: minmax(290px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(30px, 6vw, 82px);
  padding-top: 32px;
  padding-bottom: 34px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.focus-timer,
.thought-space {
  min-width: 0;
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--relax-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 54px rgba(4, 16, 29, 0.2);
}

.focus-timer {
  border-top: 4px solid var(--relax-blue);
}

.thought-space {
  border-top: 4px solid var(--relax-purple);
}

.focus-timer .control-label {
  color: var(--relax-blue);
}

.thought-space .control-label {
  color: var(--relax-purple);
}

.ocean-console .control-label,
.ocean-console .sound-depth legend {
  color: var(--relax-green);
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.thinking-band h2 {
  margin: 6px 0 0;
  color: var(--relax-ink);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.icon-command {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--relax-line);
  border-radius: 50%;
  background: var(--relax-blue-soft);
  color: var(--relax-blue);
  font-size: 20px;
  cursor: pointer;
}

.icon-command:hover {
  border-color: rgba(101, 70, 184, 0.42);
  color: var(--relax-purple);
}

.timer-presets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.relax-page .timer-start {
  width: 100%;
  margin-top: 10px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--relax-purple), var(--relax-blue));
  color: #fff;
}

.thought-space textarea {
  width: 100%;
  min-height: 136px;
  margin-top: 18px;
  resize: vertical;
  border: 1px solid var(--relax-line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--relax-ink);
  padding: 14px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 21px;
  line-height: 1.5;
}

.thought-space textarea::placeholder {
  color: #66788a;
}

.thought-space textarea:focus {
  border-color: var(--relax-purple);
  outline: 3px solid rgba(101, 70, 184, 0.14);
}

.relax-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.relax-footer details {
  max-width: 700px;
}

.relax-footer summary {
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-weight: 700;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  margin-top: 8px;
}

.source-links a {
  color: #8cefd9;
}

.relax-stage audio {
  display: none;
}

.relax-page.is-session-complete .focus-timer h2 {
  color: var(--relax-green);
}

body.sleep-mode .ocean-console,
body.sleep-mode .focus-timer,
body.sleep-mode .thought-space {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(2, 8, 17, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

body.sleep-mode .ocean-console {
  border-top-color: #69e4c8;
}

body.sleep-mode .focus-timer {
  border-top-color: #4f99ff;
}

body.sleep-mode .thought-space {
  border-top-color: #9b7cff;
}

body.sleep-mode .ocean-now-copy strong,
body.sleep-mode .cycle-clock strong,
body.sleep-mode .thinking-band h2 {
  color: #fff8ed;
}

body.sleep-mode .ocean-console .control-label,
body.sleep-mode .ocean-console .sound-depth legend {
  color: #69e4c8;
}

body.sleep-mode .ocean-now-copy > span,
body.sleep-mode .cycle-clock span,
body.sleep-mode .volume-row,
body.sleep-mode .audio-message,
body.sleep-mode .timer-status,
body.sleep-mode .thought-status {
  color: rgba(255, 255, 255, 0.68);
}

body.sleep-mode .console-divider {
  background: rgba(255, 255, 255, 0.12);
}

body.sleep-mode .segmented-control button,
body.sleep-mode .timer-presets button,
body.sleep-mode .icon-command {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
}

body.sleep-mode .segmented-control button.is-selected,
body.sleep-mode .timer-presets button.is-selected {
  border-color: transparent;
  background: linear-gradient(135deg, #17519a, #6546b8);
  color: #fff;
}

body.sleep-mode .thought-space textarea {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
}

body.sleep-mode .thought-space textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

@keyframes relaxSkyDrift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 26px 14px, -32px 20px, 18px -16px, -22px -12px, 30px 18px; }
}

@keyframes northernLightsDrift {
  0%,
  100% {
    background-position: 0% 0%;
    transform: translateX(-2%) skewX(-8deg) scaleY(0.92);
  }

  50% {
    background-position: 100% 0%;
    transform: translateX(3%) skewX(-4deg) scaleY(1.06);
  }
}

@keyframes oceanLineOne {
  0%, 100% { transform: translateX(-1.5%) scaleY(0.72); }
  50% { transform: translateX(1.5%) scaleY(1.08); }
}

@keyframes oceanLineTwo {
  0%, 100% { transform: translateX(2%) scaleY(1.1); }
  50% { transform: translateX(-2%) scaleY(0.72); }
}

@keyframes oceanLineThree {
  0%, 100% { transform: translateX(-2.5%) scaleY(0.82); }
  50% { transform: translateX(2.5%) scaleY(1.12); }
}

@media (max-width: 900px) {
  .relax-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .relax-intro {
    max-width: 720px;
  }

  .thinking-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .relax-page .wrap {
    width: min(100% - 28px, var(--max-wrap));
  }

  .relax-topbar {
    min-height: 68px;
  }

  .relax-brand span {
    display: none;
  }

  .relax-topbar-actions {
    gap: 10px;
  }

  .sleep-toggle-label {
    display: none;
  }

  .cycle-mark {
    font-size: 10px;
  }

  .relax-layout {
    min-height: auto;
    padding-top: 38px;
    padding-bottom: 34px;
  }

  .relax-intro h1 {
    font-size: clamp(48px, 16vw, 68px);
  }

  .relax-lede {
    font-size: 20px;
  }

  .ocean-horizon {
    height: 66px;
    margin-top: 24px;
  }

  .mix-proof {
    gap: 6px 17px;
    font-size: 10px;
  }

  .ocean-console {
    padding: 21px 18px;
  }

  .ocean-now {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 13px;
  }

  .ocean-toggle {
    width: 58px;
    height: 58px;
  }

  .ocean-toggle-icon {
    font-size: 21px;
  }

  .cycle-clock {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    text-align: left;
  }

  .console-divider {
    margin: 20px 0;
  }

  .thinking-band {
    gap: 38px;
    padding-top: 30px;
  }

  .timer-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thought-space textarea {
    font-size: 19px;
  }

  .relax-footer {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .relax-page *,
  .relax-page *::before,
  .relax-page *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
