:root {
  --page: #e9eef4;
  --page-2: #f7f8f5;
  --panel: #ffffff;
  --ink: #16201d;
  --muted: #65716c;
  --line: #d9e1df;
  --track: #e7ece9;
  --accent: #0f766e;
  --accent-soft: #d8efeb;
  --phase-color: #0f766e;
  --phase-angle: 0deg;
  --breath-scale: 0.74;
  --shadow: 0 24px 70px rgba(24, 35, 32, 0.16);
  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(145deg, rgba(15, 118, 110, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(212, 92, 67, 0.13), transparent 34%),
    linear-gradient(180deg, var(--page), var(--page-2));
  color: var(--ink);
}

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

button:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.35);
  outline-offset: 3px;
}

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

.timer-card {
  width: min(100%, 520px);
  padding: 28px;
  border: 1px solid rgba(22, 32, 29, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.header {
  display: grid;
  gap: 8px;
  text-align: center;
}

.eyebrow,
.pattern,
.footer,
.status-row,
.phase-list strong {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.pattern {
  margin: 0;
  font-size: 0.94rem;
}

.timer-face {
  position: relative;
  width: min(78vw, 314px);
  aspect-ratio: 1;
  margin: 30px auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 54%, transparent 55%),
    conic-gradient(var(--phase-color) var(--phase-angle), var(--track) 0);
  box-shadow:
    inset 0 0 0 1px rgba(22, 32, 29, 0.06),
    0 18px 44px rgba(15, 118, 110, 0.13);
  transition: background 120ms linear;
}

.timer-face::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(22, 32, 29, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.breath-core {
  position: absolute;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.22)),
    var(--accent-soft);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 16px 36px rgba(15, 118, 110, 0.2);
  transform: scale(var(--breath-scale));
  transition: transform 140ms linear, background 160ms linear;
}

.readout {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.phase {
  min-height: 1.35em;
  color: var(--phase-color);
  font-size: 1rem;
  font-weight: 800;
}

.seconds {
  font-variant-numeric: tabular-nums;
  font-size: 4rem;
  line-height: 1;
  font-weight: 850;
}

.cue {
  min-height: 1.35em;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-row,
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.cycle-track {
  height: 10px;
  margin: 10px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.cycle-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #4f46e5, #d45c43, #b7791f);
  transition: width 120ms linear;
}

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

.phase-list li {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 0.86rem;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.phase-list li.is-active {
  border-color: color-mix(in srgb, var(--phase-color) 55%, white);
  background: color-mix(in srgb, var(--phase-color) 12%, white);
  color: var(--phase-color);
}

.phase-list span,
.phase-list strong {
  overflow-wrap: anywhere;
}

.phase-list strong {
  font-size: 0.74rem;
}

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

.controls button {
  min-height: 46px;
  border: 1px solid var(--line);
  background: #f7f9f8;
  color: var(--ink);
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.controls button:hover {
  border-color: #b9c7c2;
  background: #eef4f1;
}

.controls button:active {
  transform: translateY(1px);
}

.controls .primary {
  border-color: transparent;
  background: var(--ink);
  color: white;
}

.controls .primary:hover {
  background: #24312d;
}

.footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 480px) {
  .app-shell {
    align-items: start;
    padding: 14px;
  }

  .timer-card {
    padding: 20px;
  }

  h1 {
    font-size: 1.38rem;
  }

  .seconds {
    font-size: 3.25rem;
  }

  .phase-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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