:root {
  --paper: #f6f2e8;
  --ink: #1e2a2f;
  --muted: #6a7775;
  --line: #d8d0c2;
  --panel: #fffaf0;
  --teal: #1f8a83;
  --green: #78b46d;
  --coral: #e86f55;
  --gold: #d9a441;
  --shadow: 0 22px 70px rgba(30, 42, 47, 0.15);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(31, 138, 131, 0.11), transparent 38%),
    linear-gradient(315deg, rgba(232, 111, 85, 0.12), transparent 36%),
    var(--paper);
  display: grid;
  place-items: center;
  padding: 20px;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  letter-spacing: 0;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 138, 131, 0.55);
  box-shadow: 0 10px 24px rgba(30, 42, 47, 0.1);
}

button:focus-visible {
  outline: 3px solid rgba(232, 111, 85, 0.35);
  outline-offset: 3px;
}

.app {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 14px;
}

.timer-panel,
.settings {
  border: 1px solid rgba(30, 42, 47, 0.13);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
}

.timer-panel {
  min-height: 560px;
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.sound-toggle {
  flex: 0 0 auto;
  padding: 0 13px;
  color: var(--muted);
}

.sound-toggle[aria-pressed="false"] {
  color: var(--coral);
  background: #fff3ed;
}

.dial-wrap {
  display: grid;
  place-items: center;
  min-height: 300px;
}

.dial {
  --progress: 0deg;
  width: min(355px, 74vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  background:
    radial-gradient(circle at center, var(--panel) 0 62%, transparent 63%),
    conic-gradient(var(--teal) var(--progress), rgba(31, 138, 131, 0.13) 0),
    linear-gradient(145deg, rgba(120, 180, 109, 0.22), rgba(217, 164, 65, 0.2));
  box-shadow: inset 0 0 0 1px rgba(30, 42, 47, 0.12), 0 26px 60px rgba(31, 138, 131, 0.18);
}

.phase,
.move {
  max-width: 72%;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.phase {
  font-size: 0.78rem;
}

.move {
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
}

#timeDisplay {
  font-variant-numeric: tabular-nums;
  font-size: clamp(4.2rem, 14vw, 7.4rem);
  line-height: 0.9;
  letter-spacing: 0;
}

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

.controls button,
.presets button {
  width: 100%;
  padding: 0 12px;
}

.controls .primary,
.preset.active {
  color: white;
  border-color: transparent;
  background: var(--teal);
}

.controls .primary[data-running="true"] {
  background: var(--coral);
}

.settings {
  padding: clamp(16px, 2.8vw, 24px);
  display: grid;
  align-content: start;
  gap: 16px;
}

.sequence {
  display: grid;
  gap: 10px;
}

.step {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.step span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f2ebdf;
  font-size: 0.8rem;
  font-weight: 850;
}

.step b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
}

.step.active {
  border-color: rgba(31, 138, 131, 0.6);
  background: rgba(31, 138, 131, 0.08);
}

.step.active span {
  color: white;
  background: var(--green);
}

.done .dial {
  animation: settle 760ms ease both;
}

@keyframes settle {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.025);
  }
}

@media (max-width: 760px) {
  body {
    align-items: start;
    padding: 12px;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .timer-panel {
    min-height: auto;
  }

  .topbar {
    align-items: center;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 3.5rem);
  }

  .sound-toggle {
    min-width: 88px;
  }
}

@media (max-width: 420px) {
  .topbar {
    display: grid;
  }

  .sound-toggle {
    width: max-content;
  }

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

  .dial {
    width: min(300px, 82vw);
  }
}
