@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Mulish:wght@600;700;800;900;1000&display=swap");

:root {
  color-scheme: dark;
  --bg: #101114;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.2);
  --glass: rgba(255, 255, 255, 0.13);
  --glass-strong: rgba(255, 255, 255, 0.2);
  --down: #36c45d;
  --up: #178fe5;
  --stop: #e43a36;
  --rest: #626a7a;
  --prep: #d8aa24;
  --done: #7fcf39;
  --accent: var(--prep);
  --phase-bg: var(--prep);
  --phase-ink: #ffffff;
  --down-progress: 0;
  --up-progress: 0;
  --prep-opacity: 0;
  --stop-opacity: 0;
  --breathe-opacity: 0;
  --rest-progress: 0;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Mulish", "Muli", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(26px) saturate(145%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -20px 34px rgba(255, 255, 255, 0.035),
    0 14px 40px rgba(0, 0, 0, 0.22);
}

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

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  scroll-snap-type: y proximity;
}

.stage {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.12), transparent 26rem),
    linear-gradient(180deg, #24262d 0%, #111318 55%, #08090d 100%);
  scroll-snap-align: start;
}

.flow-layer {
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  will-change: opacity, transform;
}

.app.is-preparing-flow .flow-down,
.app.is-preparing-flow .flow-up,
.app.is-preparing-flow .flow-rest {
  transition: opacity 160ms ease;
}

.flow-prep {
  opacity: var(--prep-opacity);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.3), transparent 22rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 38%),
    var(--prep);
  transition: opacity 160ms ease;
}

.flow-down {
  opacity: 0;
  transform: scaleY(var(--down-progress));
  transform-origin: top;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 18%, rgba(0, 0, 0, 0.1)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.28), transparent 20rem),
    var(--down);
  transition: opacity 160ms ease, transform 70ms linear;
}

.flow-up {
  opacity: 0;
  transform: scaleY(var(--up-progress));
  transform-origin: bottom;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.28), transparent 18%, rgba(0, 0, 0, 0.1)),
    radial-gradient(circle at 50% 78%, rgba(255, 255, 255, 0.28), transparent 20rem),
    var(--up);
  transition: opacity 160ms ease, transform 70ms linear;
}

.flow-stop {
  opacity: var(--stop-opacity);
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.24), transparent 22rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%),
    var(--stop);
  transition: opacity 190ms ease;
}

.flow-breathe {
  opacity: var(--breathe-opacity);
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.2), transparent 24rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  transition: opacity 240ms ease;
}

.flow-rest {
  opacity: 0;
  transform: scaleY(var(--rest-progress));
  transform-origin: top;
  background: var(--rest);
  transition: opacity 160ms ease, transform 70ms linear;
}

.finish-party {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 240ms ease, transform 240ms ease;
}

.app[data-state="done"] .finish-party {
  opacity: 1;
  transform: scale(1);
}

.finish-emojis {
  position: absolute;
  inset: calc(var(--safe-top) + 48px) 28px calc(var(--safe-bottom) + 230px);
}

.finish-emojis span {
  position: absolute;
  font-size: clamp(2rem, 7vw, 4rem);
  text-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  animation: partyFloat 1800ms ease-in-out infinite alternate;
}

.finish-emojis span:nth-child(1) {
  top: 12%;
  left: 12%;
}

.finish-emojis span:nth-child(2) {
  top: 28%;
  right: 16%;
  animation-delay: 120ms;
}

.finish-emojis span:nth-child(3) {
  top: 52%;
  left: 15%;
  animation-delay: 260ms;
}

.finish-emojis span:nth-child(4) {
  top: 62%;
  right: 12%;
  animation-delay: 360ms;
}

.finish-emojis span:nth-child(5) {
  top: 6%;
  right: 35%;
  animation-delay: 480ms;
}

.finish-emojis span:nth-child(6) {
  top: 40%;
  left: 50%;
  animation-delay: 600ms;
}

@keyframes partyFloat {
  from {
    transform: translate3d(0, 0, 0) rotate(-4deg) scale(0.94);
  }

  to {
    transform: translate3d(0, -16px, 0) rotate(5deg) scale(1.08);
  }
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.34)),
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.12), transparent 30rem);
  pointer-events: none;
}

.stage::after {
  content: none;
}

.app[data-phase="prep"] {
  --phase-bg: var(--prep);
  --accent: var(--prep);
  --phase-ink: #ffffff;
}

.app[data-phase="down"] {
  --phase-bg: var(--down);
  --accent: var(--down);
  --phase-ink: #ffffff;
}

.app[data-phase="up"] {
  --phase-bg: var(--up);
  --accent: var(--up);
  --phase-ink: #ffffff;
}

.app[data-phase="bottom"],
.app[data-phase="top"] {
  --phase-bg: var(--stop);
  --accent: var(--stop);
  --phase-ink: #ffffff;
}

.app[data-phase="breathe"],
.app[data-phase="rest"] {
  --phase-bg: var(--rest);
  --accent: #9aa2b3;
  --phase-ink: #ffffff;
}

.app[data-state="done"] {
  --phase-bg: var(--done);
  --accent: var(--done);
}

.app[data-phase="prep"] .flow-prep,
.app[data-phase="down"] .flow-down,
.app[data-phase="up"] .flow-up,
.app[data-phase="rest"] .flow-rest {
  opacity: 1;
}

.app[data-phase="bottom"] .flow-stop,
.app[data-phase="top"] .flow-stop {
  opacity: var(--stop-opacity);
}

.app[data-phase="breathe"] .flow-breathe {
  opacity: var(--breathe-opacity);
}

.stage-actions {
  position: absolute;
  top: max(18px, calc(var(--safe-top) + 12px));
  left: 24px;
  right: 24px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.round-action {
  display: grid;
  place-items: center;
  width: 52px;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 7, 7, 0.86);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  pointer-events: auto;
  backdrop-filter: blur(14px);
}

.round-action span {
  display: grid;
  place-items: center;
  width: 1em;
  height: 1em;
  line-height: 1;
}

#shareBtn span {
  transform: translate(-1px, -1px);
}

.share-wrap {
  position: relative;
  pointer-events: auto;
}

.share-sheet {
  position: absolute;
  top: 62px;
  right: 0;
  z-index: 6;
  display: grid;
  gap: 14px;
  width: min(84vw, 340px);
  border: 0;
  border-radius: 24px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.045)),
    rgba(16, 16, 16, 0.72);
  padding: 16px;
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 32px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.share-sheet[hidden] {
  display: none;
}

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-head strong {
  font-size: 1rem;
}

.share-head button {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
}

.share-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.share-link input {
  min-height: 44px;
  border-radius: 14px;
  font-size: 0.82rem;
}

.share-link button,
.share-options button,
.share-options a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 1000;
  text-align: center;
  text-decoration: none;
}

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

.timer-face {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: calc(var(--safe-top) + 74px) 18px 16px;
}

.timer-copy {
  display: grid;
  place-items: center;
  gap: clamp(13px, 2.3vh, 26px);
  width: min(100%, 760px);
  color: var(--phase-ink);
  text-align: center;
}

.set-pill {
  min-width: 128px;
  border: 1px solid currentColor;
  border-radius: 999px;
  margin-bottom: 40px;
  padding: 9px 18px;
  color: currentColor;
  font-size: clamp(0.76rem, 2.6vw, 1rem);
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.last-rep-alert {
  display: none;
  margin-top: -30px;
  margin-bottom: 24px;
  color: #fff;
  font-size: clamp(0.86rem, 3.4vw, 1.25rem);
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(255, 120, 0, 0.42), 0 10px 28px rgba(0, 0, 0, 0.22);
}

.app.is-last-rep .last-rep-alert {
  display: block;
  animation: lastRepPulse 820ms ease-in-out infinite alternate;
}

.app.is-last-rep #phaseHint {
  animation: lastRepShake 520ms ease-in-out infinite;
}

@keyframes lastRepPulse {
  from {
    transform: scale(1);
    opacity: 0.82;
  }

  to {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes lastRepShake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  25% {
    transform: translate3d(-2px, 0, 0) rotate(-0.8deg);
  }

  75% {
    transform: translate3d(2px, 0, 0) rotate(0.8deg);
  }
}

#countdownLabel,
#phaseName,
#nextPhase {
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

#countdownLabel {
  display: none;
  font-size: clamp(0.9rem, 3.4vw, 1.45rem);
  font-weight: 1000;
  line-height: 1;
  margin-bottom: clamp(20px, 2.6vh, 34px);
}

#countdown {
  font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  font-size: clamp(11rem, 54vw, 31rem);
  font-weight: 400;
  line-height: 0.72;
  letter-spacing: 0.01em;
  color: currentColor;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 18px 50px rgba(0, 0, 0, 0.13);
}

.finish-gif {
  display: block;
  width: clamp(150px, 42vw, 260px);
  height: auto;
  border-radius: 22px;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
}

#phaseHint {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2rem, 8.8vw, 5.2rem);
  font-weight: 1000;
  line-height: 0.95;
  text-transform: uppercase;
}

#phaseName,
#nextPhase {
  min-height: 1.1em;
  font-size: clamp(0.66rem, 2.7vw, 0.95rem);
  font-weight: 1000;
}

.bottom-dock {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 16px;
  min-height: var(--dock-height, 220px);
  margin: 0 18px max(18px, var(--safe-bottom));
  padding: 0;
}

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

.controls button,
.panel,
.install-card {
  border: 0;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    rgba(16, 16, 16, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -16px 26px rgba(255, 255, 255, 0.025);
}

.metrics div {
  position: relative;
  min-width: 0;
  border-radius: 0;
  padding: 0 7px;
  text-align: center;
  background: transparent;
  box-shadow: none;
}

.metrics div + div::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 1px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  transform: translateY(-50%);
}

.metrics span,
label span,
.install-card p,
.preset-button small {
  color: var(--muted);
}

.metrics span,
label span {
  display: block;
  font-size: clamp(0.58rem, 1.9vw, 0.74rem);
  font-weight: 1000;
  text-transform: uppercase;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.25);
}

.metrics strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(1.08rem, 5.7vw, 2.25rem);
  font-weight: 1000;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.rep-track {
  display: grid;
  grid-template-columns: repeat(var(--rep-count, 10), minmax(3px, 1fr));
  gap: 8px;
  min-height: 8px;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}

.rep-pill {
  align-self: center;
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.rep-pill.is-done,
.rep-pill.is-current {
  background: rgba(255, 255, 255, 0.92);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.28fr 1fr;
  align-items: center;
  gap: 20px;
  justify-items: center;
}

.controls button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 92px;
  min-height: 92px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
  backdrop-filter: blur(20px) saturate(125%);
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.18), transparent 33%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)),
    rgba(235, 243, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -8px 14px rgba(255, 255, 255, 0.035),
    0 2px 8px rgba(0, 0, 0, 0.06);
}

.control-icon {
  display: block;
  width: 26px;
  height: 26px;
  background: currentColor;
  opacity: 0.96;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.controls button span:not([aria-hidden="true"]) {
  margin-top: 9px;
}

.icon-play {
  -webkit-mask-image: url("assets/icons/play.svg");
  mask-image: url("assets/icons/play.svg");
}

.icon-pause {
  -webkit-mask-image: url("assets/icons/pause.svg");
  mask-image: url("assets/icons/pause.svg");
}

.icon-stop {
  -webkit-mask-image: url("assets/icons/stop.svg");
  mask-image: url("assets/icons/stop.svg");
}

.icon-undo {
  -webkit-mask-image: url("assets/icons/undo.svg");
  mask-image: url("assets/icons/undo.svg");
}

.controls .primary {
  width: 112px;
  min-height: 112px;
  color: #fff;
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05)),
    rgba(235, 243, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -9px 16px rgba(255, 255, 255, 0.04),
    0 3px 10px rgba(0, 0, 0, 0.07);
}

.panel {
  margin: 0 auto;
  width: min(100%, 820px);
  border-radius: 0;
  background: #161616;
  padding: 22px 16px calc(24px + var(--safe-bottom));
  scroll-snap-align: start;
  box-shadow: none;
}

.panel-header,
.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 1000;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.settings-card-head {
  align-items: flex-start;
}

.settings-card-head p,
.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.settings-card-head p {
  max-width: 32ch;
  text-align: right;
}

.install-card {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  border-radius: 18px;
  padding: 14px;
}

.install-card[hidden] {
  display: none;
}

.install-card strong,
.install-card p {
  margin: 0;
}

.install-card button,
.save-preset {
  width: 100%;
  min-height: 52px;
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--accent);
  color: #111;
  font-weight: 1000;
}

.settings {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.settings-card {
  display: grid;
  gap: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

label {
  display: grid;
  gap: 7px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  padding: 0 13px;
}

textarea {
  min-height: 72px;
  padding: 12px 13px;
  resize: vertical;
}

select {
  appearance: none;
}

input.is-updated {
  animation: fieldFlash 900ms ease-out;
}

@keyframes fieldFlash {
  0% {
    background: color-mix(in srgb, var(--accent) 34%, rgba(255, 255, 255, 0.09));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 34%, transparent);
  }

  100% {
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 0 transparent;
  }
}

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

.tempo-grid {
  margin-top: 8px;
}

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

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch input {
  width: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}

.presets {
  display: grid;
  gap: 8px;
}

.preset-feedback {
  min-height: 1.3em;
  margin: -2px 0 0;
  color: color-mix(in srgb, var(--accent) 72%, #fff);
  font-size: 0.82rem;
  font-weight: 1000;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.preset-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.presets-card {
  margin-top: 12px;
}

.preset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.preset-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-height: 50px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.preset-button.is-active {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, transparent), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.11);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 48%, rgba(255, 255, 255, 0.16)),
    0 0 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.preset-button.is-active::after {
  content: "Aktywne";
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: color-mix(in srgb, var(--accent) 78%, #fff);
  font-size: 0.62rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.delete-preset {
  min-height: 50px;
  padding: 0 13px;
  color: #ffd4d4;
}

.preset-button strong,
.preset-button small,
.preset-button em {
  min-width: 0;
}

.preset-button strong {
  grid-column: 1;
}

.preset-button small {
  grid-column: 2;
  justify-self: end;
  white-space: nowrap;
}

.preset-button em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1.25;
}

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
    min-height: 100vh;
    min-height: 100dvh;
    scroll-snap-type: none;
  }

  .stage,
  .panel {
    height: 100vh;
    height: 100dvh;
  }

  .panel {
    overflow: auto;
    align-self: stretch;
  }
}

@media (max-width: 430px) {
  .stage {
    --dock-height: 260px;
  }

  .stage-actions {
    left: 18px;
    right: 18px;
  }

  .round-action {
    width: 48px;
    min-height: 48px;
    font-size: 1.32rem;
  }

  .timer-face {
    padding: calc(var(--safe-top) + 66px) 18px 12px;
  }

  .timer-copy {
    gap: 13px;
  }

  .set-pill {
    min-width: 118px;
    margin-bottom: 34px;
    padding: 8px 15px;
  }

  #countdown {
    font-size: clamp(9.2rem, 48vw, 12.8rem);
  }

  #phaseHint {
    font-size: clamp(1.75rem, 8.2vw, 2.35rem);
  }

  #phaseName,
  #nextPhase {
    font-size: clamp(0.64rem, 3vw, 0.86rem);
  }

  .bottom-dock {
    gap: 14px;
    margin: 0 18px max(14px, var(--safe-bottom));
  }

  .metrics {
    gap: 0;
  }

  .metrics div {
    padding: 0 6px;
  }

  .metrics strong {
    font-size: clamp(1rem, 5.8vw, 1.42rem);
  }

  .rep-track {
    gap: 7px;
  }

  .controls button {
    width: 78px;
    min-height: 78px;
    border-radius: 50%;
  }

  .controls .primary {
    width: 98px;
    min-height: 98px;
  }

  .settings-card-head,
  .preset-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings-card-head p {
    max-width: none;
    text-align: left;
  }

  .delete-preset {
    min-height: 42px;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  button,
  .controls button,
  .share-sheet {
    background: rgba(18, 18, 18, 0.86);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .stage {
    grid-template-columns: 1fr 350px;
    grid-template-rows: 1fr;
  }

  .timer-face {
    grid-column: 1;
  }

  .bottom-dock {
    grid-column: 2;
    min-height: auto;
    align-content: center;
  }
}
