@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/fredoka-latin-500-normal.woff2) format("woff2");
}

@font-face {
  font-family: Quicksand;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/quicksand-latin-400-normal.woff2) format("woff2");
}

@font-face {
  font-family: Comfortaa;
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/fonts/comfortaa-latin-300-normal.woff2) format("woff2");
}

/* Layout: one full-screen galaxy. The title sits low in the frame, then gives way to a single
   slim bar that fades out when nobody is touching anything. */
:root {
  --ink: #07060d;
  --teal: #8ce6dc;
  --lilac: #c9b6f2;
  --blush: #f6c9e8;
  --violet: #7e6bd6;
  --mist: #e9e3fb;
  --soft: #bdb3d8;
  --panel: rgba(20, 17, 34, 0.74);
  --panel-solid: rgba(20, 17, 34, 0.96);
  --panel-hover: rgba(62, 53, 92, 0.9);
  --line: rgba(201, 182, 242, 0.3);
  --hover: rgba(201, 182, 242, 0.16);
  --font-word: Comfortaa, "Trebuchet MS", sans-serif;
  --font-ui: Fredoka, "Trebuchet MS", sans-serif;
  --font-text: Quicksand, "Trebuchet MS", sans-serif;
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--mist);
  font: 400 15px / 1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.defs {
  position: absolute;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(126, 107, 214, 0.3), transparent 70%),
    var(--ink);
}

.stage[data-idle="true"] {
  cursor: none;
}

.sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Title and resting screens */

.card {
  gap: 14px;
  padding-bottom: max(clamp(28px, 8vh, 92px), env(safe-area-inset-bottom, 0px));
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 1100ms ease, transform 1400ms ease, visibility 0s linear 1400ms;
}

.stage[data-mode="intro"] .intro,
.stage[data-mode="rest"] .rest {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 1600ms ease, transform 1600ms ease, visibility 0s;
}

.stage[data-mode="rest"] .rest {
  transition-delay: 2200ms, 2200ms, 0s;
}

.card::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: min(440px, 64%);
  background: linear-gradient(to top, rgba(7, 6, 13, 0.82), rgba(7, 6, 13, 0.5) 50%, transparent);
  pointer-events: none;
}

.card > * {
  position: relative;
}

.word {
  margin: 0;
  font: 300 clamp(76px, 14vmin, 148px) / 1 var(--font-word);
  letter-spacing: 0.01em;
}

.word .teal {
  color: var(--teal);
}

.word .lilac {
  color: var(--lilac);
}

.lead {
  max-width: 30ch;
  margin: 0 0 8px;
  color: var(--mist);
  font-size: 17px;
  text-wrap: balance;
}

.note {
  max-width: 38ch;
  margin: 2px 0 0;
  color: var(--soft);
  font-size: 14px;
  text-wrap: balance;
}

.rest-heart {
  width: 30px;
  height: 30px;
  fill: var(--lilac);
}

.rest h2 {
  margin: 0;
  font: 300 clamp(34px, 6vmin, 52px) / 1.1 var(--font-word);
  color: var(--mist);
}

/* Breathing words */

.breath {
  position: absolute;
  top: var(--breath-top, 72%);
  left: 0;
  right: 0;
  height: 32px;
  margin: 0;
  text-align: center;
  font: 300 22px / 32px var(--font-word);
  color: var(--mist);
  text-shadow: 0 0 14px rgba(7, 6, 13, 0.95), 0 0 4px rgba(7, 6, 13, 0.9);
  pointer-events: none;
  transition: opacity 400ms ease;
}

.stage[data-panel="open"] .breath {
  opacity: 0;
}

.breath span {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 900ms ease;
}

.breath[data-phase="in"] .breathe-in,
.breath[data-phase="out"] .breathe-out {
  opacity: 1;
}

/* Controls */

.hud {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 700ms ease, visibility 0s linear 700ms;
}

.stage[data-mode="soak"] .hud {
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms ease, visibility 0s;
}

.stage[data-mode="soak"][data-idle="true"] .hud {
  opacity: 0;
  transition: opacity 1600ms ease;
}

.dock {
  position: relative;
  max-width: 100%;
  pointer-events: auto;
}

.stage[data-idle="true"] .dock,
.stage[data-armed="false"] .dock {
  pointer-events: none;
}

.bar {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.control {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lilac);
  font: 500 15px / 1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 240ms ease, color 240ms ease;
}

.control:hover,
.control[aria-expanded="true"] {
  background: var(--hover);
  color: var(--mist);
}

.control[aria-pressed="true"],
.control[data-on="true"] {
  color: var(--teal);
}

.control svg,
.begin svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control .chevron {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.play .icon-play,
.play[data-playing="true"] .icon-pause {
  display: inline;
}

.play .icon-pause,
.play[data-playing="true"] .icon-play {
  display: none;
}

.song {
  min-width: 0;
  flex: 0 1 auto;
  color: var(--mist);
}

.song-name {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--a, #8ce6dc), var(--b, #c9b6f2));
}

.begin {
  min-height: 48px;
  padding: 0 28px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: var(--ink);
  font: 500 17px / 1 var(--font-ui);
  cursor: pointer;
  transition: background-color 240ms ease, border-color 240ms ease;
}

.begin:hover {
  border-color: var(--mist);
  background: var(--mist);
}

.panel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-solid);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity 200ms ease, transform 260ms ease, visibility 0s linear 260ms;
}

.panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 240ms ease, transform 260ms ease, visibility 0s;
}

.panel h3 {
  margin: 6px 10px 10px;
  font: 500 15px / 1.3 var(--font-ui);
  color: var(--mist);
}

.panel p {
  margin: 10px 10px 6px;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.45;
}

.pick {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 200ms ease;
}

.pick:hover,
.pick[aria-pressed="true"] {
  background: var(--hover);
}

.pick .swatch {
  width: 22px;
  height: 22px;
}

.pick-name {
  display: block;
  font: 500 15px / 1.3 var(--font-ui);
  color: var(--mist);
}

.pick-mood {
  display: block;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.3;
}

.pick-heart {
  width: 16px;
  height: 16px;
  fill: var(--teal);
  opacity: 0;
  transition: opacity 240ms ease;
}

.pick[aria-pressed="true"] .pick-heart {
  opacity: 1;
}

.times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 4px;
}

.time {
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--lilac);
  font: 500 15px / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.time:hover {
  background: var(--hover);
  color: var(--mist);
}

.time[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--ink);
}

.volume {
  display: block;
  width: calc(100% - 20px);
  height: 32px;
  margin: 0 10px;
  accent-color: var(--teal);
  cursor: pointer;
}

.notice {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-solid);
  color: var(--mist);
  font-size: 14px;
  text-align: center;
  transform: translateX(-50%);
}

.pick-text {
  min-width: 0;
}

.pick-name,
.pick-mood {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-name {
  max-width: 20ch;
  white-space: nowrap;
}

.own-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  padding: 0 10px;
}

.own-form label {
  grid-column: 1 / -1;
  color: var(--soft);
  font-size: 14px;
}

.own-link {
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 6, 13, 0.6);
  color: var(--mist);
  font: 400 15px / 1 var(--font-text);
}

.own-link::placeholder {
  color: var(--soft);
  opacity: 0.7;
}

.own-play {
  padding: 0 18px;
  border-color: var(--teal);
  background: var(--teal);
  color: var(--ink);
}

.own-play:hover {
  border-color: var(--mist);
  background: var(--mist);
  color: var(--ink);
}

.panel a {
  color: var(--teal);
}

.panel a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.panel .own-status {
  min-height: 1.45em;
  color: var(--blush);
}

.panel .own-status:empty {
  display: none;
}

@media (max-width: 620px) {
  .control .label {
    display: none;
  }

  .control.timer[data-on="true"] .label {
    display: inline;
  }
}

@media (max-width: 400px) {
  .control {
    padding: 0 10px;
  }

  .control.timer[data-on="true"] {
    gap: 5px;
    padding: 0 8px;
    font-size: 14px;
  }

  .song .chevron,
  .song .swatch,
  .control.timer[data-on="true"] svg {
    display: none;
  }
}

@media (max-height: 480px) {
  .card {
    gap: 8px;
    padding-bottom: 16px;
  }

  .word {
    font-size: 64px;
  }

  .lead {
    max-width: none;
    margin-bottom: 2px;
  }

  .note {
    max-width: none;
  }
}

/* Motion off: things still fade gently, but nothing moves. */
@media (prefers-reduced-motion: reduce) {
  .card,
  .panel,
  .stage[data-mode] .card {
    transition-property: opacity, visibility;
  }

  .card {
    transform: none;
  }

  .panel {
    transform: translate(-50%, 0);
  }
}
