:root {
  color-scheme: light;
  --ink: #202824;
  --muted: #68736f;
  --paper: #f4f7f2;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(32, 40, 36, 0.12);
  --focus: #167d6d;
  --focus-deep: #0e5f56;
  --stretch: #d95f49;
  --gold: #d7a12f;
  --blue: #426b91;
  --mint: #dcefe6;
  --peach: #ffe2d6;
  --shadow: 0 24px 65px rgba(35, 45, 40, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(66, 107, 145, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(22, 125, 109, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 226, 214, 0.78), rgba(220, 239, 230, 0.58)),
    var(--paper);
  background-size: 42px 42px, 42px 42px, auto;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(66, 107, 145, 0.36);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 980px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
}

.home-link,
.round-chip,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(35, 45, 40, 0.08);
}

.home-link,
.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.home-link svg,
.icon-button svg,
.primary svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.home-link:hover,
.icon-button:hover,
.preset:hover,
.primary:hover {
  transform: translateY(-1px);
}

.brand-copy {
  min-width: 0;
}

.brand-copy p,
.brand-copy h1,
.status-line {
  margin: 0;
}

.brand-copy p {
  color: var(--focus-deep);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin-top: 2px;
  font-size: 1.52rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.round-chip {
  min-width: 102px;
  padding: 12px 14px;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(286px, 0.82fr);
  gap: 14px;
  align-items: stretch;
}

.timer-panel,
.plan-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.timer-panel {
  min-height: 570px;
  padding: 24px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 18px;
}

.dial-wrap {
  position: relative;
  width: min(100%, 392px);
  aspect-ratio: 1;
  margin: auto;
  display: grid;
  place-items: center;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 12;
}

.ring-track {
  stroke: rgba(32, 40, 36, 0.09);
}

.ring-progress {
  stroke: var(--focus);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
  transform-origin: 120px 120px;
  transition:
    stroke 170ms ease,
    stroke-dashoffset 190ms linear;
}

.app-shell[data-phase="stretch"] .ring-progress {
  stroke: var(--stretch);
}

.ring-tick {
  fill: none;
  stroke: rgba(32, 40, 36, 0.24);
  stroke-linecap: round;
  stroke-width: 5;
}

.dial-core {
  position: relative;
  width: 72%;
  aspect-ratio: 1;
  border: 1px solid rgba(32, 40, 36, 0.09);
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 242, 0.78)),
    var(--mint);
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.45),
    0 24px 46px rgba(22, 125, 109, 0.13);
}

.app-shell[data-phase="stretch"] .dial-core {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 226, 214, 0.78)),
    var(--peach);
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.45),
    0 24px 46px rgba(217, 95, 73, 0.13);
}

.phase-pill {
  min-width: 86px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--focus);
  font-size: 0.82rem;
  font-weight: 900;
}

.app-shell[data-phase="stretch"] .phase-pill {
  background: var(--stretch);
}

.time {
  font-size: 4.75rem;
  line-height: 0.95;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.cue {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

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

.primary,
.icon-button,
.preset {
  min-height: 52px;
  border-radius: 8px;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #ffffff;
  background: var(--ink);
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(32, 40, 36, 0.18);
}

.icon-button {
  background: #edf2ec;
}

.has-tip {
  position: relative;
}

.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(2px);
  padding: 5px 8px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  white-space: nowrap;
}

.has-tip:hover::after,
.has-tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

.preset {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: #edf2ec;
  border: 1px solid transparent;
}

.preset span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.preset strong {
  font-size: 1.06rem;
  font-variant-numeric: tabular-nums;
}

.preset.is-active {
  background: #e5f3ec;
  border-color: rgba(22, 125, 109, 0.35);
  box-shadow: inset 0 0 0 1px rgba(22, 125, 109, 0.12);
}

.plan-panel {
  min-height: 570px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
}

.pose-stage {
  min-height: 174px;
  border: 1px solid rgba(32, 40, 36, 0.09);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(66, 107, 145, 0.12), rgba(215, 161, 47, 0.15)),
    #f7f6ed;
}

.pose {
  width: min(100%, 284px);
}

.floor {
  fill: rgba(32, 40, 36, 0.1);
}

.window {
  fill: rgba(66, 107, 145, 0.12);
  stroke: rgba(66, 107, 145, 0.48);
  stroke-width: 3;
}

.window-line {
  fill: none;
  stroke: rgba(66, 107, 145, 0.38);
  stroke-width: 3;
}

.head {
  fill: var(--gold);
  stroke: var(--ink);
  stroke-width: 5;
}

.torso,
.arm,
.leg {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 13;
  transition: transform 220ms ease;
}

.torso {
  stroke: var(--ink);
}

.arm-left {
  stroke: var(--stretch);
  transform-origin: 132px 78px;
}

.arm-right {
  stroke: var(--focus);
  transform-origin: 143px 78px;
}

.leg-left {
  stroke: var(--blue);
}

.leg-right {
  stroke: var(--gold);
}

.app-shell[data-phase="stretch"][data-pose="0"] .arm-left {
  transform: rotate(-14deg);
}

.app-shell[data-phase="stretch"][data-pose="1"] .arm-right {
  transform: rotate(14deg);
}

.app-shell[data-phase="stretch"][data-pose="2"] .torso {
  transform: translateX(4px) rotate(4deg);
}

.app-shell[data-phase="stretch"][data-pose="3"] .arm-left,
.app-shell[data-phase="stretch"][data-pose="3"] .arm-right {
  transform: translateY(-8px);
}

.settings {
  display: grid;
  gap: 12px;
}

.settings label {
  display: grid;
  grid-template-columns: auto auto;
  gap: 7px 12px;
  align-items: center;
  color: var(--ink);
  font-weight: 900;
}

.settings output {
  justify-self: end;
  color: var(--focus-deep);
  font-variant-numeric: tabular-nums;
}

.settings input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--focus);
}

.stretch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.stretch-list li {
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(32, 40, 36, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.stretch-list li.is-current {
  background: #fff3df;
  border-color: rgba(215, 161, 47, 0.58);
}

.stretch-list .count {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--ink);
  font-weight: 900;
}

.stretch-list strong,
.stretch-list span {
  display: block;
}

.stretch-list strong {
  font-size: 0.94rem;
}

.stretch-list span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.stretch-list .tag {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--focus-deep);
  background: var(--mint);
  font-size: 0.72rem;
  font-weight: 900;
}

.status-line {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

@media (max-width: 820px) {
  .app-shell {
    justify-content: flex-start;
    padding: 16px;
  }

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

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

  .dial-wrap {
    width: min(100%, 336px);
  }

  .time {
    font-size: 3.7rem;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: 44px 1fr;
  }

  .home-link {
    width: 44px;
    height: 44px;
  }

  .round-chip {
    grid-column: 1 / -1;
    width: 100%;
  }

  .timer-panel,
  .plan-panel {
    padding: 14px;
  }

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

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

  .time {
    font-size: 3rem;
  }

  .cue {
    font-size: 0.86rem;
  }

  .stretch-list li {
    grid-template-columns: 34px 1fr;
  }

  .stretch-list .tag {
    grid-column: 2;
    justify-self: start;
  }
}

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