:root {
  color-scheme: dark;
  --bg: #111513;
  --panel: rgba(246, 242, 226, 0.08);
  --panel-strong: rgba(246, 242, 226, 0.13);
  --line: rgba(246, 242, 226, 0.18);
  --text: #f7f2e4;
  --muted: #b9b19e;
  --mint: #79ddb7;
  --amber: #f2c76d;
  --rose: #ff8c76;
  --blue: #8ab7ff;
  --phase-color: var(--mint);
  --phase-soft: rgba(121, 221, 183, 0.2);
  --breath-scale: 0.72;
  --session-offset: 1;
  --phase-offset: 1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(145deg, rgba(121, 221, 183, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(255, 140, 118, 0.12), transparent 36%),
    linear-gradient(180deg, #20241f 0%, var(--bg) 58%, #090b0a 100%);
  color: var(--text);
  min-height: 100svh;
}

button,
output {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  min-height: 100svh;
  padding: 16px;
  place-items: center;
}

.timer {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 84px rgba(0, 0, 0, 0.4);
  display: grid;
  gap: 18px;
  max-width: 390px;
  overflow: hidden;
  padding: clamp(18px, 5vw, 26px);
  position: relative;
  width: min(100%, 390px);
}

.timer::before {
  background: linear-gradient(90deg, var(--mint), var(--amber), var(--rose), var(--blue));
  content: "";
  height: 3px;
  inset: 0 0 auto;
  position: absolute;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 12vw, 3.75rem);
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
}

.clock {
  background: rgba(246, 242, 226, 0.1);
  border: 1px solid rgba(246, 242, 226, 0.16);
  border-radius: 999px;
  color: var(--text);
  display: inline-grid;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  min-width: 74px;
  padding: 8px 12px;
  place-items: center;
}

.stage {
  aspect-ratio: 1;
  display: grid;
  isolation: isolate;
  justify-items: center;
  margin: 0 auto;
  place-items: center;
  position: relative;
  width: min(72vw, 286px);
}

.ring,
.breath-disc {
  grid-area: 1 / 1;
}

.ring {
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.3));
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
  width: 100%;
}

.track {
  fill: rgba(255, 255, 255, 0.025);
  stroke: rgba(246, 242, 226, 0.15);
  stroke-width: 8;
}

.session,
.phase {
  fill: none;
  stroke-linecap: round;
}

.session {
  stroke: var(--phase-color);
  stroke-dasharray: 1;
  stroke-dashoffset: var(--session-offset);
  stroke-width: 8;
}

.phase {
  opacity: 0.5;
  stroke: var(--amber);
  stroke-dasharray: 1;
  stroke-dashoffset: var(--phase-offset);
  stroke-width: 3;
}

.breath-disc {
  align-content: center;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.3), transparent 22%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.045)),
    var(--phase-soft);
  border: 1px solid rgba(246, 242, 226, 0.23);
  border-radius: 50%;
  box-shadow:
    0 0 0 15px rgba(246, 242, 226, 0.035),
    0 0 54px var(--phase-soft),
    inset 0 1px 16px rgba(255, 255, 255, 0.1);
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: 26px;
  text-align: center;
  transform: scale(var(--breath-scale));
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    transform 120ms linear;
  width: 70%;
  z-index: 1;
}

.breath-disc span,
.breath-disc small {
  color: rgba(247, 242, 228, 0.72);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.breath-disc strong {
  color: var(--text);
  font-size: clamp(3rem, 15vw, 4.5rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 0.9;
  margin: 9px 0;
}

.steps {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps li {
  background: rgba(246, 242, 226, 0.07);
  border: 1px solid rgba(246, 242, 226, 0.12);
  border-radius: 8px;
  color: rgba(247, 242, 228, 0.68);
  display: flex;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 11px;
}

.steps li.active {
  background: var(--phase-soft);
  border-color: var(--phase-color);
  color: var(--text);
}

.steps span {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.steps b {
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.controls button {
  background: rgba(246, 242, 226, 0.1);
  border: 1px solid rgba(246, 242, 226, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-weight: 850;
  min-height: 46px;
  padding: 0 18px;
}

.controls button:focus-visible {
  outline: 3px solid rgba(242, 199, 109, 0.64);
  outline-offset: 3px;
}

.controls .primary {
  background: linear-gradient(135deg, var(--mint), var(--amber));
  border: 0;
  color: #111513;
}

body[data-phase="hold"] {
  --phase-color: var(--amber);
  --phase-soft: rgba(242, 199, 109, 0.2);
}

body[data-phase="exhale"] {
  --phase-color: var(--rose);
  --phase-soft: rgba(255, 140, 118, 0.19);
}

body[data-phase="done"] {
  --phase-color: var(--blue);
  --phase-soft: rgba(138, 183, 255, 0.2);
}

@media (max-width: 360px) {
  .timer {
    gap: 14px;
    padding: 18px 14px;
  }

  .header {
    gap: 10px;
  }

  .steps li {
    padding: 9px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
