:root {
  color-scheme: dark;
  --white: #f7f7ec;
  --secondary: #e1e8df;
  --edge: clamp(1.5rem, 5.55vw, 6rem);
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  background: #263630;
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #fffbd7; outline-offset: 5px; }
[hidden] { display: none !important; }

.landscape, .shade { position: fixed; inset: 0; pointer-events: none; }
.landscape { overflow: hidden; }
.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 61% center;
  opacity: 0;
  transition: opacity 1.25s ease-in-out;
}
.backdrop.is-visible { opacity: 1; }
.shade {
  background:
    linear-gradient(0deg, rgb(10 22 19 / 79%), rgb(10 22 19 / 19%) 32%, transparent 54%),
    linear-gradient(90deg, rgb(18 30 27 / 70%), rgb(18 30 27 / 46%) 35%, transparent 73%),
    linear-gradient(180deg, rgb(18 30 27 / 32%), transparent 20%);
  transition: opacity .65s ease;
}

.room {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: max(2rem, env(safe-area-inset-top)) max(2.45rem, env(safe-area-inset-bottom));
  padding-inline: max(var(--edge), env(safe-area-inset-left)) max(var(--edge), env(safe-area-inset-right));
}
.topbar, .lower { display: flex; justify-content: space-between; gap: 1.5rem; }
.topbar { align-items: center; min-height: 2.75rem; }
.top-actions { display: flex; align-items: center; gap: .45rem; }
.signature {
  display: flex;
  align-items: center;
  gap: .85rem;
  font: 600 1.42rem var(--serif);
  letter-spacing: .22em;
  white-space: nowrap;
}
.ripple, .breath-icon {
  position: relative;
  display: block;
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.ripple::before, .ripple::after, .breath-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid currentColor;
  border-radius: inherit;
  opacity: .7;
}
.ripple::after { inset: 8px; opacity: .5; }
.utility, .start, .scene, .text-button {
  border: 1px solid transparent;
  transition: background-color .22s ease, border-color .22s ease, color .22s ease;
}
.utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 2.75rem;
  padding: .57rem .85rem;
  border-color: rgb(247 247 236 / 27%);
  border-radius: 2rem;
  background: rgb(26 40 35 / 35%);
  font-size: .875rem;
  letter-spacing: .09em;
  white-space: nowrap;
}
.utility:hover { background: rgb(26 40 35 / 66%); border-color: rgb(247 247 236 / 61%); }
.arcade-entry { color: inherit; text-decoration: none; }
.arcade-entry:focus-visible { outline: 2px solid #fffbd7; outline-offset: 5px; }
.arcade-icon {
  display: block;
  width: .85rem;
  height: .85rem;
  background: currentColor;
  clip-path: polygon(32% 0, 68% 0, 68% 32%, 100% 32%, 100% 68%, 68% 68%, 68% 100%, 32% 100%, 32% 68%, 0 68%, 0 32%, 32% 32%);
}
.sound-icon { width: 1.05rem; height: 1rem; display: flex; align-items: center; gap: 2px; }
.sound-icon i { width: 1px; height: 5px; background: currentColor; border-radius: 1px; }
.sound-icon i:nth-child(2) { height: 10px; }
.sound-icon i:nth-child(3) { height: 13px; }
.sound-icon i:nth-child(4) { height: 7px; }
#sound[aria-pressed="false"] .sound-icon i { height: 2px; }

.middle { display: grid; align-items: center; padding: 3.25rem 0; min-width: 0; }
.welcome { justify-self: start; }
.scene-name {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 0 0 1.05rem;
  color: var(--secondary);
  font-size: .875rem;
  letter-spacing: .33em;
}
.scene-name span:first-child { width: 1.5rem; height: 1px; background: currentColor; opacity: .66; }
h1 {
  margin: 0;
  font: 500 clamp(3.1rem, 6.9vw, 7rem)/1.16 var(--serif);
  letter-spacing: .035em;
  text-shadow: 0 2px 22px rgb(14 28 21 / 34%);
}
.caption {
  margin: 1.3rem 0 1.9rem;
  color: var(--secondary);
  font-size: clamp(1rem, 1.15vw, 1.14rem);
  line-height: 1.8;
  letter-spacing: .075em;
}
.start {
  display: inline-flex;
  align-items: center;
  min-height: 3.15rem;
  gap: .65rem;
  padding: .55rem 1.3rem;
  border-radius: 2rem;
  background: #e9ecdd;
  color: #243730;
  font-size: .94rem;
  letter-spacing: .08em;
}
.start:hover { background: #fffdf4; }
.breath-icon { width: 1.04rem; height: 1.04rem; }
.breath-icon::before { inset: 3px; background: currentColor; opacity: .4; }

.lower {
  align-items: end;
  border-top: 1px solid rgb(247 247 236 / 23%);
  padding-top: 1.15rem;
}
.landscape-picker h2 {
  margin: 0 0 .8rem;
  color: var(--secondary);
  font-size: .875rem;
  font-weight: 400;
  letter-spacing: .19em;
}
.scenes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; }
.scene {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .42rem .8rem .42rem .42rem;
  border-color: rgb(247 247 236 / 23%);
  border-radius: .75rem;
  text-align: left;
  background: rgb(16 32 27 / 42%);
  min-width: 0;
}
.scene[aria-pressed="true"] {
  border-color: rgb(242 246 228 / 77%);
  background: rgb(213 225 209 / 24%);
}
.scene:hover { border-color: rgb(242 246 228 / 75%); background: rgb(213 225 209 / 30%); }
.scene img { width: 3.15rem; height: 2.6rem; object-fit: cover; border-radius: .39rem; }
.scene strong, .scene small { display: block; white-space: nowrap; font-weight: 400; }
.scene strong { font-size: .94rem; letter-spacing: .11em; }
.scene small { margin-top: .23rem; font-size: .75rem; color: var(--secondary); }
.viewing { margin-bottom: .15rem; }
.view-icon {
  display: block;
  width: .88rem;
  height: .88rem;
  border-radius: .18rem;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) 0 0 / 1px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 1px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 1px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 1px 4px no-repeat;
}
body.scenery .shade { opacity: 0; }
body.scenery .room > :is(.topbar, .middle), body.scenery .landscape-picker { visibility: hidden; }
body.scenery .lower { border-color: transparent; }
body.scenery .viewing { margin-left: auto; background: rgb(16 29 25 / 82%); }

.practice { justify-self: center; text-align: center; }
.breath-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(10.5rem, 21vw, 16rem);
  aspect-ratio: 1;
  isolation: isolate;
}
.breath-visual > span {
  font: 600 clamp(1.3rem, 2.5vw, 1.85rem) var(--serif);
  letter-spacing: .12em;
  text-shadow: 0 2px 10px #153027;
}
.breath-orb {
  position: absolute;
  z-index: -1;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgb(247 247 236 / 62%);
  box-shadow: 0 0 0 .6rem rgb(233 241 218 / 11%), 0 0 0 1.25rem rgb(233 241 218 / 7%);
  background: radial-gradient(circle, rgb(31 54 45 / 70%), rgb(205 228 207 / 16%));
  backdrop-filter: blur(5px);
  transform: scale(.83);
}
.breath-visual.is-inhaling .breath-orb { transform: scale(1.09); transition: transform 4s ease-in-out; }
.breath-visual.is-exhaling .breath-orb { transform: scale(.83); transition: transform 6s ease-in-out; }
.practice-detail { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: 1.65rem; }
.timer { font-variant-numeric: tabular-nums; letter-spacing: .1em; color: var(--secondary); }
.practice-divider { width: 1px; height: .85rem; background: rgb(247 247 236 / 42%); }
.text-button {
  min-height: 2.75rem;
  padding: .35rem .65rem;
  border-radius: .4rem;
  background: rgb(16 32 27 / 50%);
  font-size: .875rem;
}
.text-button:hover { background: rgb(16 32 27 / 80%); }
.listening { max-width: min(100%, 31rem); }
.listen-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.play-icon {
  width: .85rem;
  height: .85rem;
  flex: none;
  background: currentColor;
  clip-path: polygon(22% 4%, 92% 50%, 22% 96%);
}
.is-playing .play-icon {
  clip-path: none;
  background: linear-gradient(90deg, transparent 13%, currentColor 13% 38%, transparent 38% 62%, currentColor 62% 87%, transparent 87%);
}
.track-loop { margin-inline-start: .2rem; font-size: .875rem; color: var(--secondary); }
.track-progress {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: min(100%, 19rem);
  margin-top: .45rem;
  color: var(--secondary);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
.track-progress input {
  flex: 1;
  min-width: 0;
  margin: 0;
  height: 2.75rem;
  accent-color: #e9ecdd;
  cursor: pointer;
}
.track-progress input:focus-visible { outline: 2px solid #fffbd7; outline-offset: 2px; border-radius: .4rem; }
.track-progress input:disabled { opacity: .55; cursor: default; }
.track-progress span { min-width: 2.3rem; text-align: center; }
.track-status { margin: 0; color: var(--white); font-size: .875rem; }
.track-status:not(:empty) { margin-top: .6rem; }
body.breathing .viewing { visibility: hidden; }
body.breathing .shade { background-color: rgb(12 28 23 / 23%); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 920px) {
  .lower { flex-wrap: wrap; gap: .7rem; }
  .viewing { margin-inline-start: auto; }
}

@media (max-width: 680px) {
  .room { padding-block: max(1.25rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-bottom)); }
  .middle { padding: 2.5rem 0; }
  h1 { font-size: clamp(3rem, 12vw, 4.8rem); }
  .caption { letter-spacing: .035em; }
  .shade {
    background:
      linear-gradient(0deg, rgb(10 22 19 / 87%), rgb(10 22 19 / 17%) 38%, transparent 58%),
      linear-gradient(90deg, rgb(18 30 27 / 67%), rgb(18 30 27 / 31%) 66%, transparent),
      linear-gradient(180deg, rgb(18 30 27 / 32%), transparent 22%);
  }
  .lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; padding-top: .85rem; }
  .landscape-picker h2 { margin-bottom: .58rem; }
  .scenes { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
  .scene { display: block; grid-column: span 2; padding: .3rem .3rem .42rem; }
  .scene img { display: block; width: 100%; height: clamp(2.3rem, 10vw, 3.25rem); margin-bottom: .36rem; }
  .scene > span { padding-left: .14rem; display: block; }
  .scene small { display: none; }
  .scene--audio { display: flex; gap: .35rem; grid-column: span 3; min-height: 2.75rem; padding: .3rem; }
  .scene--audio img { flex: none; width: clamp(2.1rem, 10vw, 3rem); height: 1.9rem; margin: 0; }
  .scene--audio strong { letter-spacing: .06em; }
  .backdrop[data-image="bowl"] { object-position: 69% center; }
  .viewing { justify-self: end; margin: 0; }
  body.scenery .viewing { grid-column: 1; }
  body.breathing .lower { row-gap: 0; }
  body.breathing .viewing { display: none; }
}

@media (max-width: 680px) and (max-height: 710px) {
  .middle { padding: 1rem 0; }
  h1 { font-size: clamp(2.7rem, 10vw, 4rem); }
  .caption { margin: .95rem 0 1.2rem; }
}

@media (max-width: 430px) {
  .topbar { gap: .4rem; }
  .topbar .signature { gap: .4rem; font-size: 1.25rem; }
  .topbar .ripple { width: 1.4rem; height: 1.4rem; }
  .top-actions .utility { gap: .35rem; padding-inline: .58rem; letter-spacing: 0; }
}

@media (max-width: 680px) and (max-height: 620px) {
  .middle { padding: .75rem 0; }
  .scene-name { margin-bottom: .72rem; }
  .caption { margin: .75rem 0 .95rem; }
  .lower { gap: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .breath-visual.is-inhaling .breath-orb { transform: scale(.83); }
}

#sound-status:not(.sr-only) {
  position: absolute;
  z-index: 1;
  top: 5.25rem;
  right: var(--edge);
  max-width: calc(100% - 2 * var(--edge));
  margin: 0;
  padding: .55rem .75rem;
  border-radius: .5rem;
  background: #23372f;
  font-size: .875rem;
}
