:root {
  color-scheme: dark;
  --night: #080b16;
  --night-soft: #101528;
  --ink: #f5f2ea;
  --ink-soft: rgba(235, 235, 244, 0.68);
  --line: rgba(255, 255, 255, 0.11);
  --tone: 130 158 226;
  --tone-bright: 184 202 255;
  --tone-deep: 51 70 126;
  --ease-drift: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.sleep-meditation-page {
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 12%, rgb(var(--tone-deep) / 0.34), transparent 38rem),
    linear-gradient(155deg, #0d1121 0%, var(--night) 48%, #050710 100%);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: background 1.8s var(--ease-drift);
}

.sleep-meditation-page[data-color="lavender"] {
  --tone: 169 140 215;
  --tone-bright: 219 197 255;
  --tone-deep: 82 53 116;
}

.sleep-meditation-page[data-color="forest"] {
  --tone: 82 154 133;
  --tone-bright: 166 218 195;
  --tone-deep: 29 81 70;
}

.sleep-meditation-page[data-color="amber"] {
  --tone: 207 149 88;
  --tone-bright: 255 211 155;
  --tone-deep: 115 64 30;
}

.meditation-skip {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #0a0d18;
  background: var(--ink);
  border-radius: 999px;
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

.meditation-skip:focus {
  transform: translateY(0);
}

.night-sky,
.color-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.night-sky {
  z-index: 0;
  overflow: hidden;
  opacity: 0.72;
}

.night-sky span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.74);
  box-shadow: 0 0 10px rgb(var(--tone-bright) / 0.48);
  animation: star-drift 8s ease-in-out infinite alternate;
}

.night-sky span:nth-child(1) { top: 9%; left: 8%; animation-delay: -1s; }
.night-sky span:nth-child(2) { top: 17%; left: 26%; width: 2px; height: 2px; animation-delay: -5s; }
.night-sky span:nth-child(3) { top: 8%; left: 72%; width: 2px; height: 2px; animation-delay: -3s; }
.night-sky span:nth-child(4) { top: 28%; left: 91%; animation-delay: -7s; }
.night-sky span:nth-child(5) { top: 48%; left: 7%; width: 2px; height: 2px; animation-delay: -4s; }
.night-sky span:nth-child(6) { top: 62%; left: 88%; width: 2px; height: 2px; animation-delay: -6s; }
.night-sky span:nth-child(7) { top: 78%; left: 16%; animation-delay: -2s; }
.night-sky span:nth-child(8) { top: 84%; left: 68%; width: 2px; height: 2px; animation-delay: -5s; }
.night-sky span:nth-child(9) { top: 41%; left: 58%; width: 2px; height: 2px; animation-delay: -8s; }
.night-sky span:nth-child(10) { top: 92%; left: 93%; animation-delay: -1s; }

.color-wash {
  z-index: 0;
  opacity: 0.7;
  background:
    radial-gradient(circle at 50% 55%, rgb(var(--tone) / 0.12), transparent 32rem),
    radial-gradient(circle at 86% 88%, rgb(var(--tone-deep) / 0.18), transparent 28rem);
  transition: background 1.8s var(--ease-drift), opacity 1.8s var(--ease-drift);
}

.meditation-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.meditation-topbar,
.meditation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.meditation-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 180ms ease;
}

.meditation-back:hover,
.meditation-back:focus-visible {
  color: var(--ink);
}

.meditation-mark,
.meditation-kicker,
.session-header p,
.meditation-footer {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.meditation-mark {
  color: rgb(var(--tone-bright) / 0.7);
}

.meditation-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(430px, 1.08fr);
  gap: clamp(56px, 8vw, 112px);
  align-items: start;
  padding: clamp(68px, 9vw, 124px) 0 clamp(76px, 10vw, 132px);
}

.meditation-intro__copy {
  position: sticky;
  top: 56px;
}

.meditation-kicker {
  margin: 0 0 22px;
  color: rgb(var(--tone-bright) / 0.76);
}

.meditation-intro h1,
.meditation-complete h2 {
  margin: 0;
  max-width: 9ch;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(4rem, 8vw, 7.7rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.075em;
  text-wrap: balance;
}

.meditation-lead {
  max-width: 31rem;
  margin: 36px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.08rem, 1.45vw, 1.28rem);
  line-height: 1.9;
}

.meditation-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 32px;
}

.meditation-facts span {
  padding: 9px 13px;
  color: rgba(245, 242, 234, 0.76);
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.meditation-setup {
  padding: clamp(26px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018)),
    rgb(9 12 24 / 0.62);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.color-choice {
  margin: 0;
  padding: 0 0 32px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.color-choice legend {
  display: flex;
  width: 100%;
  margin-bottom: 20px;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  font-size: 1rem;
  font-weight: 650;
}

.color-choice legend small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 450;
}

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

.color-chip {
  display: flex;
  min-width: 0;
  min-height: 68px;
  padding: 12px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    transform 200ms ease;
}

.color-chip:hover {
  transform: translateY(-2px);
}

.color-chip.is-selected {
  border-color: rgb(var(--tone-bright) / 0.52);
  background: rgb(var(--tone) / 0.12);
}

.color-chip__swatch {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 24px currentColor;
}

.color-chip__swatch--moon { color: #7f9ee7; background: #7897df; }
.color-chip__swatch--lavender { color: #aa85d7; background: #9f80ca; }
.color-chip__swatch--forest { color: #539a85; background: #4f927f; }
.color-chip__swatch--amber { color: #d09659; background: #c58a50; }

.color-chip b,
.color-chip small {
  display: block;
}

.color-chip b {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-chip small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.meditation-route {
  margin: 0;
  padding: 24px 0 10px;
  list-style: none;
}

.meditation-route li {
  display: grid;
  grid-template-columns: 34px minmax(90px, 0.45fr) 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.meditation-route li:last-child {
  border-bottom: 0;
}

.meditation-route span {
  color: rgb(var(--tone-bright) / 0.62);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.72rem;
}

.meditation-route b {
  color: var(--ink);
  font-size: 0.92rem;
}

.meditation-route small {
  line-height: 1.65;
}

.meditation-primary,
.session-control,
.session-quiet-exit {
  border: 0;
  cursor: pointer;
}

.meditation-primary {
  display: flex;
  width: 100%;
  min-height: 58px;
  margin-top: 24px;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  color: #0b0e1a;
  font-weight: 750;
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 14px 40px rgb(var(--tone) / 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.meditation-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgb(var(--tone) / 0.28);
}

.meditation-note {
  margin: 16px 4px 0;
  color: rgba(235, 235, 244, 0.46);
  font-size: 0.72rem;
  line-height: 1.7;
}

.meditation-session {
  min-height: calc(100vh - 90px);
  padding: 28px 0 54px;
}

.session-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.session-header p {
  margin: 0 0 7px;
  color: rgb(var(--tone-bright) / 0.72);
}

.session-header b {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.session-quiet-exit {
  min-height: 44px;
  padding: 0 15px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.session-progress {
  height: 2px;
  margin-top: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
}

.session-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: rgb(var(--tone-bright) / 0.84);
  box-shadow: 0 0 16px rgb(var(--tone-bright) / 0.55);
  transition: width 700ms linear;
}

.session-focus {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.1fr);
  gap: clamp(48px, 8vw, 118px);
  align-items: center;
  min-height: 62vh;
  padding: 48px 4vw 24px;
}

.breath-field {
  position: relative;
  display: grid;
  width: min(31vw, 360px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
}

.breath-orb,
.breath-ring {
  position: absolute;
  border-radius: 50%;
}

.breath-orb {
  width: 41%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 36% 32%, rgba(255, 255, 255, 0.9), transparent 20%),
    radial-gradient(circle, rgb(var(--tone-bright) / 0.88), rgb(var(--tone) / 0.72) 46%, rgb(var(--tone-deep) / 0.78));
  box-shadow:
    0 0 42px rgb(var(--tone-bright) / 0.34),
    0 0 120px rgb(var(--tone) / 0.35),
    inset -18px -22px 32px rgba(0, 0, 0, 0.22);
  transform: scale(0.86);
  transition:
    transform var(--breath-duration, 2.8s) var(--ease-drift),
    filter 1.5s ease,
    opacity 1.5s ease;
}

.breath-orb.is-inhale {
  transform: scale(1.34);
  filter: saturate(1.08) brightness(1.08);
}

.breath-orb.is-exhale {
  transform: scale(0.82);
  filter: saturate(0.84) brightness(0.86);
}

.breath-orb.is-resting {
  transform: scale(0.94);
}

.breath-ring {
  inset: 12%;
  border: 1px solid rgb(var(--tone-bright) / 0.12);
  animation: ring-float 10s ease-in-out infinite alternate;
}

.breath-ring--two {
  inset: 3%;
  animation-delay: -4s;
}

.breath-ring--three {
  inset: 22%;
  animation-delay: -7s;
}

.session-guidance {
  max-width: 37rem;
}

.session-guidance > p:first-child {
  margin: 0 0 20px;
  color: rgb(var(--tone-bright) / 0.72);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.session-guidance h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(2.8rem, 5vw, 5.7rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.session-guidance > p:last-child {
  max-width: 32rem;
  margin: 26px 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.85;
}

.session-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.session-control {
  display: inline-flex;
  min-width: 134px;
  min-height: 50px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.session-control--next {
  border-color: rgb(var(--tone-bright) / 0.28);
  background: rgb(var(--tone) / 0.12);
}

.session-control__icon {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.84rem;
}

.session-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 38px auto 0;
  padding: 0;
  max-width: 700px;
  color: rgba(235, 235, 244, 0.36);
  font-size: 0.72rem;
  list-style: none;
}

.session-steps li {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.session-steps span {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.session-steps li.is-current {
  color: var(--ink);
}

.session-steps li.is-complete {
  color: rgb(var(--tone-bright) / 0.58);
}

.meditation-complete {
  display: grid;
  min-height: calc(100vh - 92px);
  padding: 70px 0 90px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.meditation-complete[hidden] {
  display: none;
}

.complete-moon {
  width: 88px;
  height: 88px;
  margin-bottom: 38px;
  border-radius: 50%;
  background: rgb(var(--tone-bright) / 0.88);
  box-shadow: 0 0 80px rgb(var(--tone) / 0.45);
}

.meditation-complete h2 {
  max-width: 7ch;
  font-size: clamp(4.2rem, 8vw, 7.8rem);
}

.meditation-complete > p:not(.meditation-kicker) {
  max-width: 31rem;
  margin: 34px auto 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.9;
}

.complete-actions {
  display: grid;
  width: min(340px, 100%);
  gap: 18px;
  margin-top: 38px;
}

.complete-actions a {
  min-height: 44px;
  color: var(--ink-soft);
  line-height: 44px;
}

.meditation-availability {
  padding: 16px 18px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.8;
}

.meditation-reader-link {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  margin-top: 14px;
  color: rgb(var(--tone-bright));
  font-size: 0.88rem;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.meditation-reader {
  margin: 28px 0 64px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 28px;
}

.practice-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 40px;
}

.practice-intro h2 {
  margin: 14px 0;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.035em;
}

.practice-intro p:not(.meditation-kicker) {
  max-width: 40rem;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.9;
}

.practice-download {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 20px;
  min-width: 0;
  padding: 20px 24px;
  color: var(--ink);
  border: 1px solid rgb(var(--tone-bright) / 0.3);
  border-radius: 14px;
  background: rgb(var(--tone) / 0.055);
  text-decoration: none;
  line-height: 1.5;
}

.practice-download small { grid-column: 1 / -1; color: var(--ink-soft); font-size: 0.7rem; }
.practice-download:hover { border-color: rgb(var(--tone-bright) / 0.65); }
.practice-details { margin-top: 32px; border: 1px solid var(--line); border-radius: 14px; }
.practice-details > summary { padding: 22px 26px; color: var(--ink); cursor: pointer; line-height: 1.8; }
.practice-details > summary::marker { color: rgb(var(--tone-bright)); }
.practice-details > summary > span { margin-left: 16px; color: var(--ink-soft); font-size: 0.78rem; }
.practice-text { max-width: 820px; margin: 0 auto; padding: 8px 32px 32px; line-height: 1.9; overflow-wrap: anywhere; }
.practice-description, .practice-eyebrow, .practice-safety { color: var(--ink-soft); }
.practice-stages { margin: 28px 0; padding: 0; list-style: none; }
.practice-stages > li { padding: 28px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.practice-stage-heading { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: baseline; }
.practice-stage-heading > span { color: rgb(var(--tone-bright)); font: 0.73rem ui-monospace, monospace; }
.practice-stage-heading h3 { margin: 0; font-size: 1.15rem; font-weight: 500; }
.practice-stage-heading small { color: var(--ink-soft); font-size: 0.78rem; white-space: nowrap; }
.practice-eyebrow { margin: 10px 0 22px; font-size: 0.86rem; }
.practice-stages dl { display: grid; gap: 18px; margin: 0; }
.practice-stages dt { color: var(--ink); font-weight: 500; }
.practice-stages dd { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.practice-closing { padding-top: 24px; border-top: 1px solid var(--line); }
.practice-safety { margin-top: 24px; font-size: 0.8rem; }

@media (max-width: 700px) {
  .practice-intro { grid-template-columns: 1fr; gap: 22px; }
  .practice-download { justify-self: start; }
  .practice-details > summary { padding: 20px 18px; }
  .practice-details > summary > span { display: block; margin-left: 0; }
  .practice-text { padding: 6px 18px 24px; }
  .practice-stage-heading { gap: 12px; }
}

.meditation-share {
  margin-top: 18px;
  color: #18211c;
}

.meditation-share .wechat-share-entry__kicker {
  color: #4b6356;
}

.meditation-footer {
  margin-top: 36px;
  padding-top: 24px;
  color: rgba(235, 235, 244, 0.4);
  border-top: 1px solid var(--line);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid rgb(var(--tone-bright) / 0.9);
  outline-offset: 4px;
}

@keyframes star-drift {
  from { opacity: 0.24; transform: translateY(0) scale(0.8); }
  to { opacity: 0.95; transform: translateY(-6px) scale(1.2); }
}

@keyframes ring-float {
  from { opacity: 0.28; transform: scale(0.92); }
  to { opacity: 0.72; transform: scale(1.05); }
}

@media (max-width: 860px) {
  .meditation-intro {
    grid-template-columns: 1fr;
    gap: 52px;
    padding-top: 68px;
  }

  .meditation-intro__copy {
    position: static;
  }

  .session-focus {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: auto;
    padding: 56px 0 40px;
    text-align: center;
  }

  .breath-field {
    width: min(58vw, 320px);
  }

  .session-guidance {
    margin: 0 auto;
  }

  .session-guidance > p:last-child {
    margin-inline: auto;
  }
}

@media (max-width: 600px) {
  .meditation-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 14px;
  }

  .meditation-mark {
    font-size: 0.62rem;
  }

  .meditation-intro {
    gap: 38px;
    padding: 52px 0 72px;
  }

  .meditation-intro h1 {
    font-size: clamp(3.75rem, 19vw, 5.2rem);
  }

  .meditation-lead {
    margin-top: 26px;
    font-size: 1rem;
  }

  .meditation-setup {
    padding: 20px;
    border-radius: 24px;
  }

  .color-choice legend {
    display: block;
  }

  .color-choice legend small {
    display: block;
    margin-top: 7px;
  }

  .color-choice__grid {
    grid-template-columns: 1fr;
  }

  .meditation-route li {
    grid-template-columns: 30px 92px 1fr;
    gap: 10px;
  }

  .meditation-route small {
    font-size: 0.68rem;
  }

  .meditation-session {
    min-height: calc(100vh - 58px);
    padding-top: 20px;
  }

  .session-focus {
    padding-top: 34px;
  }

  .breath-field {
    width: min(72vw, 280px);
  }

  .session-guidance h2 {
    font-size: clamp(2.55rem, 13vw, 4rem);
  }

  .session-guidance > p:last-child {
    min-height: 5.5em;
    font-size: 0.94rem;
  }

  .session-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .session-control {
    min-width: 0;
    width: 100%;
  }

  .session-steps {
    gap: 5px;
    margin-top: 28px;
  }

  .session-steps li {
    display: grid;
    gap: 3px;
    text-align: center;
  }

  .meditation-complete {
    padding: 64px 12px 80px;
  }

  .meditation-complete h2 {
    font-size: clamp(3.8rem, 17vw, 5.6rem);
  }

  .meditation-footer {
    display: grid;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .breath-orb.is-inhale,
  .breath-orb.is-exhale,
  .breath-orb.is-resting {
    transform: scale(0.96);
  }
}
