:root {
  --ink: #f1e8da;
  --glow: 255, 200, 140;
  --serif: "Cormorant Garamond", "EB Garamond", Garamond, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #120b08; color: var(--ink); }
body { font-family: var(--serif); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 1px solid rgba(var(--glow), .5); outline-offset: 4px; border-radius: 4px; }

#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }

.fadeable { transition: opacity 1.6s var(--ease); }
body.hidden .fadeable { opacity: 0; pointer-events: none; }
body.hidden, body.hidden * { cursor: none; }

/* ---------------------------------------------------------------- top bar */
#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(22px, env(safe-area-inset-top)) clamp(18px, 3vw, 40px) 0;
}
#top .brand { font-weight: 300; letter-spacing: .55em; font-size: 1.05rem; color: rgba(241, 232, 218, .55); }
#top nav { display: flex; gap: clamp(.9rem, 2.2vw, 2rem); align-items: center; }
#top button {
  font-size: .95rem; letter-spacing: .16em; color: rgba(241, 232, 218, .42);
  transition: color .6s ease, text-shadow .6s ease;
}
#top button:hover, #top button.on { color: var(--ink); text-shadow: 0 0 14px rgba(var(--glow), .5); }
#timer span, #bells span { font-variant-numeric: tabular-nums; margin-left: .2em; }

/* ---------------------------------------------------------------- the stage */
#stage {
  position: relative; z-index: 2;
  min-height: 100vh; width: min(980px, calc(100vw - 40px)); margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 96px 0 72px;
}

#transport { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: clamp(26px, 5vh, 52px); }
#play {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid rgba(241, 232, 218, .14);
  background: radial-gradient(circle, rgba(var(--glow), .07), transparent 70%);
  transition: border-color .8s ease, background .8s ease;
}
#play:hover { border-color: rgba(var(--glow), .45); }
#play .dot {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: #fff3e0;
  box-shadow: 0 0 10px 3px rgba(var(--glow), .55), 0 0 26px 8px rgba(var(--glow), .14);
  transform: scale(var(--b, 1)); opacity: var(--o, 1);
}
body:not(.started) #play .dot { animation: wait 10s ease-in-out infinite; }
@keyframes wait { 0%, 100% { transform: scale(.75); opacity: .55; } 50% { transform: scale(1.35); opacity: 1; } }
#status {
  margin: 0; font-style: italic; font-weight: 300; font-size: 1rem; letter-spacing: .18em;
  color: rgba(241, 232, 218, .45); min-height: 1.3em; transition: opacity 1.2s ease;
}

/* moods: the heart of it */
#moods { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px clamp(16px, 2.4vw, 34px); }
#moods button {
  position: relative; font-weight: 300; font-size: clamp(1.6rem, 2.75vw, 2.45rem); letter-spacing: .03em;
  color: rgba(241, 232, 218, .36); padding: 2px 0 8px;
  transition: color .9s var(--ease), text-shadow .9s var(--ease);
}
#moods button:hover { color: rgba(241, 232, 218, .78); }
#moods button.on { color: var(--ink); text-shadow: 0 0 26px rgba(var(--glow), .55); }
#moods button::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: rgb(var(--glow)); box-shadow: 0 0 10px 3px rgba(var(--glow), .55);
  opacity: 0; transform: scale(.3); transition: opacity .9s ease, transform .9s ease;
}
#moods button.on::after { opacity: 1; transform: none; }
/* moments: ready-made settings for a time of day or a practice */
#moments { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px clamp(14px, 2vw, 26px); margin-bottom: clamp(14px, 2.6vh, 26px); }
#moments button {
  position: relative; font-style: italic; font-weight: 300; font-size: 1.1rem; letter-spacing: .08em;
  color: rgba(241, 232, 218, .42); padding: 2px 0 6px; transition: color .7s var(--ease), text-shadow .7s var(--ease);
}
#moments button:hover { color: rgba(241, 232, 218, .85); }
#moments button.on { color: var(--ink); text-shadow: 0 0 16px rgba(var(--glow), .55); }
#moments button.on::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%;
  background: rgb(var(--glow)); box-shadow: 0 0 8px 2px rgba(var(--glow), .55);
}

.rule {
  width: min(640px, 80%); height: 1px; margin: clamp(22px, 4vh, 40px) 0;
  background: linear-gradient(90deg, transparent, rgba(241, 232, 218, .13), transparent);
}

/* word choices */
#choices { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.row { display: grid; grid-template-columns: 6.5em auto; align-items: baseline; column-gap: 18px; }
.row > label, .slider > label {
  font-size: .8rem; letter-spacing: .3em; color: rgba(241, 232, 218, .4); text-align: right; white-space: nowrap;
}
.opts { display: flex; flex-wrap: wrap; gap: 2px clamp(14px, 2vw, 24px); }
.opts button {
  position: relative; font-size: 1.22rem; letter-spacing: .03em; color: rgba(241, 232, 218, .4); padding: 2px 0 6px;
  transition: color .7s var(--ease), text-shadow .7s var(--ease);
}
.opts button:hover { color: rgba(241, 232, 218, .8); }
.opts button.on { color: var(--ink); text-shadow: 0 0 16px rgba(var(--glow), .6); }
.opts button::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%;
  background: rgb(var(--glow)); box-shadow: 0 0 8px 2px rgba(var(--glow), .55); opacity: 0; transition: opacity .7s ease;
}
.opts button.on::after { opacity: 1; }
.opts button.loading { animation: loading 1.4s ease-in-out infinite; }
@keyframes loading { 50% { opacity: .45; } }

/* sliders */
#sliders {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, auto); grid-auto-flow: column;
  column-gap: clamp(32px, 6vw, 80px); row-gap: 6px;
  width: min(880px, 100%);
}
.slider { display: grid; grid-template-columns: 6.5em 1fr 7.6em; align-items: center; column-gap: 18px; min-height: 40px; }
.slider output { font-style: italic; font-size: 1.08rem; color: rgba(241, 232, 218, .72); letter-spacing: .02em; white-space: nowrap; }
.slider output small { font-size: .8em; color: rgba(241, 232, 218, .32); margin-left: .45em; font-style: normal; letter-spacing: .06em; }
.slider.idle output, .slider.idle input { opacity: .35; }
.slider:hover > label { color: rgba(241, 232, 218, .7); }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; cursor: pointer;
  --fill: 50%; touch-action: pan-y;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--glow), .8) 0, rgba(var(--glow), .8) var(--fill), rgba(241, 232, 218, .14) var(--fill));
}
input[type=range]::-moz-range-track { height: 1px; background: rgba(241, 232, 218, .14); }
input[type=range]::-moz-range-progress { height: 1px; background: rgba(var(--glow), .8); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; margin-top: -6px;
  background: #fff4e2; box-shadow: 0 0 0 5px rgba(var(--glow), .08), 0 0 14px 3px rgba(var(--glow), .5);
  transition: transform .35s ease, box-shadow .35s ease;
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff4e2;
  box-shadow: 0 0 0 5px rgba(var(--glow), .08), 0 0 14px 3px rgba(var(--glow), .5);
}
input[type=range]:hover::-webkit-slider-thumb, input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.3); box-shadow: 0 0 0 7px rgba(var(--glow), .1), 0 0 22px 5px rgba(var(--glow), .65);
}
input[type=range]:focus { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px rgba(241, 232, 218, .6), 0 0 14px 3px rgba(var(--glow), .5); }

#keys {
  position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; z-index: 3;
  font-size: .76rem; letter-spacing: .22em; color: rgba(241, 232, 218, .22); pointer-events: none;
}
/* export */
#sheet {
  position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 5, 4, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: opacity .8s ease;
}
#sheet.open { opacity: 1; pointer-events: auto; }
#sheet .card {
  width: min(520px, calc(100vw - 32px)); padding: 34px 36px 28px; border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 245, 230, .06), rgba(255, 245, 230, .025));
  border: 1px solid rgba(255, 240, 220, .08); box-shadow: 0 30px 90px -30px rgba(0, 0, 0, .7);
}
#sheet .title { margin: 0; font-weight: 300; font-size: 1.7rem; letter-spacing: .03em; }
#sheet .sub { margin: 10px 0 22px; font-style: italic; font-size: 1.02rem; line-height: 1.45; color: rgba(241, 232, 218, .55); }
#sheet .opts { justify-content: center; }
#lengths button { font-size: 1.3rem; }
#progress { height: 0; overflow: hidden; opacity: 0; transition: opacity .6s ease; }
#sheet.busy #progress, #sheet.done #progress { height: auto; opacity: 1; margin-top: 18px; }
#progress .bar { height: 1px; background: rgba(241, 232, 218, .12); }
#progress .bar i { display: block; height: 100%; width: 0; background: rgb(var(--glow)); box-shadow: 0 0 10px rgba(var(--glow), .7); transition: width .4s linear; }
#progress p { margin: 10px 0 0; font-style: italic; color: rgba(241, 232, 218, .6); letter-spacing: .06em; }
#sheet .actions { display: flex; justify-content: center; gap: 30px; margin-top: 24px; }
#sheet .actions button { font-size: 1rem; letter-spacing: .22em; color: rgba(241, 232, 218, .5); transition: color .5s ease, text-shadow .5s ease; }
#sheet .actions button:hover { color: var(--ink); text-shadow: 0 0 14px rgba(var(--glow), .5); }
#sheet-go { color: var(--ink) !important; text-shadow: 0 0 14px rgba(var(--glow), .45); }
#sheet.busy #sheet-go, #sheet.busy #lengths { opacity: .3; pointer-events: none; }

#toast {
  position: fixed; z-index: 5; left: 50%; bottom: 52px; transform: translateX(-50%);
  font-style: italic; letter-spacing: .12em; font-size: 1.05rem; color: var(--ink); white-space: nowrap;
  opacity: 0; transition: opacity 1.2s ease; pointer-events: none; text-shadow: 0 0 20px rgba(0, 0, 0, .7);
}
#toast.on { opacity: .85; }

/* ---------------------------------------------------------------- smaller screens */
@media (max-height: 780px) { #keys { display: none; } }
@media (max-height: 820px) and (min-width: 821px) {
  #stage { padding: 76px 0 52px; }
  #transport { margin-bottom: 22px; }
  .rule { margin: 20px 0; }
  #choices { gap: 8px; }
  .slider { min-height: 36px; }
}
@media (max-width: 820px) {
  #top { position: absolute; justify-content: center; }
  #top .brand { display: none; }
  #top nav { gap: .85rem; flex-wrap: wrap; justify-content: center; }
  #top button { font-size: .85rem; letter-spacing: .08em; }
  #stage { justify-content: flex-start; padding-top: 92px; width: calc(100vw - 32px); }
  #moods { gap: 2px 18px; }
  #sliders { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .row { grid-template-columns: 1fr; row-gap: 4px; justify-items: center; }
  .row > label { text-align: center; }
  .opts { justify-content: center; }
  .slider { grid-template-columns: 5em 1fr 6.4em; column-gap: 12px; }
  .slider > label { text-align: left; font-size: .74rem; letter-spacing: .2em; }
  #keys { display: none; }
}
