:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --paper-2: #e7efe8;
  --ink: #1c2420;
  --muted: #63706a;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(28, 36, 32, 0.13);
  --line-strong: rgba(28, 36, 32, 0.22);
  --teal: #1f8a78;
  --rose: #c76d5a;
  --honey: #c18a32;
  --violet: #6b67b8;
  --phase: var(--teal);
  --phase-light: #79cfc2;
  --phase-soft: rgba(31, 138, 120, 0.18);
  --scale: 0.74;
  --progress: 0%;
  --shadow: 0 28px 72px rgba(50, 62, 55, 0.17);
  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 {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 138, 120, 0.16), transparent 37%),
    linear-gradient(315deg, rgba(199, 109, 90, 0.15), transparent 42%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible {
  outline: 3px solid rgba(31, 138, 120, 0.28);
  outline-offset: 3px;
}

.app {
  display: grid;
  min-height: 100vh;
  padding: 20px;
  place-items: center;
}

.breather {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 430px;
  overflow: hidden;
  padding: 22px;
  position: relative;
  width: min(100%, 430px);
}

.breather::before {
  background:
    linear-gradient(90deg, var(--teal), var(--honey), var(--rose), var(--violet));
  content: "";
  height: 4px;
  inset: 0 0 auto;
  position: absolute;
}

.topbar {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-width: 0;
}

.eyebrow,
h1,
.readout p,
.readout strong,
.readout span {
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1 {
  font-size: 2.35rem;
  line-height: 0.94;
  margin: 0;
}

.cycle-pill {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  gap: 1px;
  justify-items: center;
  min-height: 52px;
  min-width: 62px;
  padding: 7px 10px;
  text-transform: uppercase;
}

.cycle-pill strong {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
}

.visual {
  aspect-ratio: 1;
  display: grid;
  margin: 4px auto 0;
  max-width: 280px;
  place-items: center;
  position: relative;
  width: min(76vw, 280px);
}

.halo,
.ring,
.core {
  border-radius: 999px;
  position: absolute;
}

.halo {
  background:
    radial-gradient(circle, var(--phase-soft) 0 46%, transparent 47%),
    conic-gradient(from -90deg, var(--phase) var(--progress), rgba(28, 36, 32, 0.1) 0);
  filter: blur(0.2px);
  inset: 0;
  opacity: 0.9;
  transition: background 160ms ease;
}

.ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 57%, transparent 58%),
    conic-gradient(from -90deg, var(--phase) var(--progress), rgba(28, 36, 32, 0.1) 0);
  box-shadow: inset 0 0 0 1px var(--line), 0 20px 48px rgba(31, 45, 40, 0.13);
  inset: 18px;
}

.core {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.3) 32%, transparent 33%),
    linear-gradient(145deg, var(--phase-light), var(--phase));
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.55),
    0 16px 42px var(--phase-soft);
  inset: 31%;
  transform: scale(var(--scale));
  transition: background 160ms ease, box-shadow 160ms ease, transform 120ms linear;
}

.mark {
  background: rgba(28, 36, 32, 0.24);
  border-radius: 4px;
  height: 8px;
  position: absolute;
  width: 8px;
}

.mark-n {
  left: calc(50% - 4px);
  top: 12px;
}

.mark-e {
  right: 12px;
  top: calc(50% - 4px);
}

.mark-s {
  bottom: 12px;
  left: calc(50% - 4px);
}

.mark-w {
  left: 12px;
  top: calc(50% - 4px);
}

.readout {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 118px;
  text-align: center;
}

.readout p {
  color: var(--phase);
  font-size: 1.34rem;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.readout strong {
  font-size: 4.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 0.94;
}

.readout span {
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 650;
  min-height: 1.2em;
}

.progress {
  background: rgba(28, 36, 32, 0.09);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress span {
  background: linear-gradient(90deg, var(--teal), var(--honey), var(--rose), var(--violet));
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 120ms linear;
}

.modes,
.controls {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.mode,
.controls button {
  min-height: 46px;
}

.mode {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.mode.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffaf0;
}

.controls button {
  background: #fffaf0;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 800;
}

.controls .primary {
  background: var(--phase);
  border-color: transparent;
  color: #fffaf0;
  transition: background 160ms ease;
}

@media (max-width: 420px) {
  .app {
    padding: 12px;
  }

  .breather {
    gap: 15px;
    padding: 18px;
  }

  h1 {
    font-size: 2rem;
  }

  .visual {
    max-width: 246px;
  }

  .readout strong {
    font-size: 3.7rem;
  }
}

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