/* The timer runner: dial, controls, round list, and fullscreen mode. */

.runner {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .runner {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    align-items: start;
  }
}

/* --- Dial ---------------------------------------------------------------- */

.dial {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
}

.dial__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dial__track {
  fill: none;
  stroke: var(--surface-sunken);
  stroke-width: 6;
}

.dial__progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 120ms linear, stroke var(--transition);
}

.dial__face {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  text-align: center;
  padding-inline: 2rem;
}

.dial__phase {
  font-size: clamp(0.9rem, 0.8rem + 0.6vw, 1.1rem);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.dial__time {
  font-size: clamp(3.4rem, 2rem + 9vw, 5.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dial__sets {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Last few seconds of a round. */
.runner[data-state="urgent"] .dial__progress { stroke: var(--danger); }
.runner[data-state="urgent"] .dial__time { color: var(--danger); }
.runner[data-state="done"] .dial__progress { stroke: var(--success); }
.runner[data-state="done"] .dial__time { color: var(--success); }

.dial__time--tick {
  animation: dial-pulse 1s ease-out;
}

@keyframes dial-pulse {
  0% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* --- Controls ------------------------------------------------------------ */

.runner__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.75rem;
}

.runner__hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.runner__hint kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-raised);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
}

/* --- Round list ---------------------------------------------------------- */

.round-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.round-list__item {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition), border-color var(--transition);
}

.round-list__item[data-active] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.round-list__item[data-complete] {
  opacity: 0.5;
}

.round-list__index {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.round-list__item[data-active] .round-list__index,
.round-list__item[data-active] .round-list__name {
  color: var(--accent);
}

.round-list__name {
  font-weight: 550;
  overflow-wrap: anywhere;
}

.round-list__duration {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Share link ---------------------------------------------------------- */

.share {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share input {
  font-size: 0.85rem;
  background: var(--surface-sunken);
}

/* --- Fullscreen ---------------------------------------------------------- */

.runner--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0;
  width: 100vw;
  height: 100dvh;
  padding: 2rem;
  background: var(--surface-inverse);
  grid-template-columns: minmax(0, 1fr);
}

.runner--fullscreen .runner__aside,
.runner--fullscreen .runner__hint {
  display: none;
}

.runner--fullscreen .dial {
  max-width: min(78vh, 620px);
}

.runner--fullscreen .dial__time {
  color: var(--text-inverse);
  font-size: min(22vw, 26vh);
}

.runner--fullscreen .dial__phase {
  color: color-mix(in srgb, var(--text-inverse) 65%, transparent);
  font-size: clamp(1rem, 2.5vh, 1.6rem);
}

.runner--fullscreen .dial__sets {
  color: color-mix(in srgb, var(--text-inverse) 55%, transparent);
  font-size: clamp(0.85rem, 2vh, 1.1rem);
}

.runner--fullscreen .dial__track {
  stroke: color-mix(in srgb, var(--text-inverse) 15%, transparent);
}

.runner--fullscreen .btn--secondary {
  background: color-mix(in srgb, var(--text-inverse) 12%, transparent);
  border-color: color-mix(in srgb, var(--text-inverse) 22%, transparent);
  color: var(--text-inverse);
}

.runner--fullscreen .btn--secondary:hover {
  background: color-mix(in srgb, var(--text-inverse) 22%, transparent);
  color: var(--text-inverse);
}

.runner--fullscreen[data-state="urgent"] .dial__time { color: var(--danger); }
.runner--fullscreen[data-state="done"] .dial__time { color: var(--success); }
