:root {
  --graphite: #121416;
  --bone: #f5efe7;
  --chartreuse: #cbed46;
  --page-top: #faf7f1;
  --page-bottom: #f1eae1;
  --surface: #fffcf7;
  --media: #f3efe8;
  --secondary: #5d6061;
  --accent-soft: #eaf5c9;
  --outline: #b8b3aa;
  --outline-soft: #d8d2c8;
  --route-inactive: #d3cec5;
  --ready: #1b1e21;
  --ready-highlight: #262a2d;
  --ready-outline: #3c4144;
  --move-surface: #f0c7cc;
  --move-text: #681e27;
  --move-accent: #a42e3a;
  --move-track: #d9959e;
  --rest-surface: #cbe1f2;
  --rest-text: #194f77;
  --rest-accent: #2d6f9f;
  --rest-track: #98c5e3;
  --completion-top: #202427;
  --completion-bottom: #121416;
  --range-progress: 50%;
  color: var(--graphite);
  background: var(--bone);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

/* Feedback belongs to the exercise. The single frozen video follows the hand;
   direction hints live above it and never create a second media layer. */
body.feedback-input { touch-action: none; user-select: none; -webkit-user-select: none; }
.feedback-screen .phase-surface { background: var(--bone); }
.feedback-screen .phase-surface > * { background: var(--bone) !important; }
.feedback-screen .rest-panel { color: var(--graphite); min-height: 112px; }
.feedback-screen .rest-countdown { font-size: 17px; font-weight: 500; letter-spacing: -.15px; }
.feedback-screen .rest-playback-control { flex: 0 0 48px; min-height: 48px; }
.feedback-screen .rest-row { justify-content: space-between; gap: 16px; }
.feedback-screen .rest-track { height: 3px; background: var(--outline-soft); }
.feedback-screen .rest-track > span { background: var(--graphite); }
.exercise-media-area.feedback-stage { position: relative; overflow: visible; isolation: isolate; }
.feedback-stage .feedback-sheet {
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  transition: box-shadow 180ms; will-change: transform; z-index: 1;
  box-shadow: 0 8px 24px #1214161c; opacity: 1; scale: 1;
}
.feedback-stage.feedback-held .feedback-sheet { cursor: grabbing; box-shadow: 0 16px 36px #12141630; }
.feedback-stage.feedback-selected .feedback-sheet { cursor: default; }
.feedback-hints { position: fixed; inset: 0; pointer-events: none; z-index: 950; }
.feedback-hint {
  position: absolute; display: grid; place-items: center; color: var(--graphite);
  width: 300px; height: 300px; padding: 0;
  font-size: 248px; line-height: 1; opacity: 0; transform: translate(-50%, -50%) scale(.2);
  will-change: transform, opacity;
}
.feedback-hint { left: 50%; top: 50%; }
.feedback-footer { display: flex; align-items: center; justify-content: space-between; min-height: 52px; position: relative; }
.feedback-receipt { color: var(--graphite); font-size: 16px; }
.feedback-receipt.emoji { font-size: 48px; line-height: 1; }
.feedback-burst { position: fixed; inset: 0; z-index: 1000; overflow: hidden; touch-action: none; }
.feedback-burst > span { position: absolute; left: 50%; top: 50%; width: 300px; height: 300px;
  display: grid; place-items: center; font-size: 248px; line-height: 1; transform: translate(-50%, -50%);
  will-change: transform; z-index: 2; }
.feedback-impact { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.feedback-impact i { position: absolute; width: 24px; height: 5px; border-radius: 5px;
  background: var(--graphite); transform-origin: 0 50%; transform: rotate(var(--angle)) translateX(144px); }
.feedback-stamp-check { position: absolute; left: 50%; top: calc(50% + 156px); width: 26px; height: 26px; }
.feedback-stamp-check::after { content: ''; display: block; margin: 3px 8px; width: 7px; height: 15px;
  border: solid var(--graphite); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.stamp-confirming .rest-countdown, .stamp-confirming .rest-playback-control { visibility: hidden; }
.feedback-undo { color: var(--secondary); font: inherit; min-height: 48px; min-width: 80px; border: 0; background: transparent; font-size: 23px; }
.feedback-undo span { font-size: 14px; margin-left: 4px; }
.feedback-accessible-actions { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.feedback-accessible-actions:focus-within { position: fixed; z-index: 20; bottom: 16px; left: 16px; right: 16px; width: auto; height: auto; clip-path: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--surface); border-radius: 14px; }
.feedback-accessible-actions button { background: var(--surface); color: var(--graphite); border: 1px solid var(--outline); border-radius: 10px; padding: 12px; }
@media (prefers-reduced-motion: reduce) { .feedback-stage *, .feedback-footer * { transition: none !important; } }

.fitness-profile {
  position: relative;
  width: min(calc(100% - 16px), 520px);
  margin: 8px auto 24px;
  font-size: 0.75rem;
}

.fitness-profile svg { display: block; width: 100%; overflow: visible; }
.fitness-profile text { font: inherit; fill: var(--graphite); }
.fitness-profile .fitness-grid { fill: none; stroke: var(--graphite); stroke-opacity: 0.15; stroke-width: 1; }
.fitness-profile .fitness-area { fill: var(--graphite); }
.fitness-profile .fitness-inner-grid { fill: none; stroke: var(--chartreuse); stroke-opacity: 0.2; stroke-width: 1; }
.fitness-profile .fitness-shape { fill: none; stroke: var(--chartreuse); stroke-width: 2; stroke-linejoin: round; }
.fitness-profile .fitness-point { fill: var(--chartreuse); stroke: var(--graphite); stroke-width: 1.5; }
.fitness-axis-ray { stroke: var(--graphite); stroke-opacity: 0; stroke-width: 1; pointer-events: none; }
.fitness-axis-ray.is-unknown { stroke-opacity: 0.4; stroke-dasharray: 3 4; }
.fitness-axis-ray.is-highlighted { stroke-opacity: 0.8; stroke-width: 2; }
.fitness-unknown { fill: var(--bone); stroke: var(--graphite); stroke-opacity: 0.55; stroke-width: 1.5; pointer-events: none; }
.fitness-axis-hit { stroke: transparent; stroke-width: 28; stroke-linecap: round; cursor: pointer; }
.fitness-axis {
  position: absolute;
  transform: translateY(-50%);
  min-width: 48px;
  min-height: 48px;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--graphite);
  font: inherit;
  line-height: 1.25;
  cursor: pointer;
}
.fitness-axis.is-unknown { color: var(--secondary); }
.fitness-axis:hover, .fitness-axis:focus-visible { background: var(--chartreuse); }
.fitness-axis:focus-visible { outline: 2px solid var(--graphite); outline-offset: 2px; }
.fitness-stacked .fitness-axes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.fitness-stacked .fitness-axis { position: static; transform: none; overflow-wrap: anywhere; }
.fitness-details {
  width: min(440px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 1px solid #3c4144;
  border-radius: 20px;
  background: var(--graphite);
  color: var(--bone);
  overflow: auto;
  box-shadow: 0 20px 80px #12141655;
}
.fitness-details::backdrop { background: #12141666; }
.fitness-details-header { position: sticky; top: 0; z-index: 1; background: var(--graphite); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.fitness-details h2 { min-width: 0; margin: 0; font-size: 1.25rem; font-weight: 500; overflow-wrap: anywhere; }
.fitness-details-close { display: grid; place-items: center; flex: 0 0 48px; height: 48px; min-height: 48px; padding: 0; border: 0; border-radius: 50%; background: #262a2d; color: var(--bone); font-size: 28px; line-height: 1; cursor: pointer; }
.fitness-details button:focus-visible { outline: 2px solid var(--chartreuse); outline-offset: 3px; }
.fitness-details-summary { margin: 12px 0 4px; color: var(--chartreuse); font-size: 1.5rem; }
.fitness-details-note, .fitness-details-footnote { color: #c3c2bb; font-size: 0.875rem; line-height: 1.5; }
.fitness-details-note { margin: 0 0 16px; }
.fitness-details-footnote { margin: 16px 0 0; }
.fitness-contributions { list-style: none; margin: 0; padding: 0; }
.fitness-contribution { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid #3c4144; line-height: 1.4; }
.fitness-contribution > :first-child { overflow-wrap: anywhere; }
.fitness-contribution-level { display: grid; place-items: center; flex: 0 0 auto; min-width: 2.25em; max-width: 7em; min-height: 2.25em; padding: .4em .65em; border-radius: 1.5em; color: var(--chartreuse); background: #262a2d; font-variant-numeric: tabular-nums; text-align: center; }

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 280px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: linear-gradient(180deg, var(--page-top), var(--page-bottom));
}

button,
input,
output {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.app-screen {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--page-top), var(--page-bottom));
}

.duration-screen {
  display: flex;
  flex-direction: column;
}

.duration-screen[data-light-mode="on"]:not(.active-workout-setup) {
  background: linear-gradient(180deg, #d2b5f5, #e7d3fa 292px, var(--page-top) 407px, var(--page-bottom));
}

.duration-light-status {
  display: none;
}

.duration-screen[data-light-mode="on"]:not(.active-workout-setup) .duration-light-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 29px;
  margin-top: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #4b2673;
  color: #fff7ff;
  font-size: 13px;
  font-weight: 600;
}

.duration-light-status .light-mode-glyph {
  width: 17px;
  height: 17px;
}

.duration-screen[data-light-mode="on"]:not(.active-workout-setup) .duration-dial {
  margin-top: 12px;
}

.duration-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: none;
  scrollbar-width: none;
}

.duration-scroll::-webkit-scrollbar {
  display: none;
}

.duration-content {
  width: min(100%, 600px);
  min-height: 100%;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.duration-identity {
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nomadic-method-icon {
  display: block;
  width: 56px;
  height: 56px;
}

.duration-dial {
  width: 250px;
  height: auto;
  aspect-ratio: 1;
  min-width: min-content;
  min-height: min-content;
  padding: 24px;
  margin-top: 22px;
  border: 2px solid var(--chartreuse);
  border-radius: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bone);
  background:
    radial-gradient(circle at 35% 28%, rgb(255 255 255 / 4%), transparent 44%),
    linear-gradient(135deg, var(--completion-top), var(--completion-bottom));
  box-shadow: 0 8px 18px rgb(18 20 22 / 22%);
  transition: transform 160ms ease;
}

.duration-dial::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 50%;
}

.duration-value {
  z-index: 1;
  border: 0;
  color: var(--bone);
  font-size: clamp(56px, 20vw, 88px);
  font-weight: 500;
  line-height: 0.95;
  transition: opacity 160ms ease, transform 160ms ease;
}

.duration-unit {
  z-index: 1;
  margin-top: 3px;
  color: var(--chartreuse);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.duration-lock {
  width: 22px;
  height: 22px;
  position: absolute;
  bottom: 18px;
  z-index: 1;
  display: none;
  fill: none;
  stroke: var(--chartreuse);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.end-session { display: none; }
.active-workout-setup .end-session {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 13px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  background: var(--surface);
  color: var(--graphite);
  box-shadow: 0 2px 4px rgb(18 20 22 / 10%);
}
.end-session svg { width: 100%; fill: currentColor; }
.end-session-dialog {
  max-width: min(380px, calc(100vw - 40px));
  border: 1px solid var(--outline);
  border-radius: 24px;
  padding: 28px;
  background: var(--surface);
  color: var(--graphite);
  box-shadow: 0 16px 64px rgb(0 0 0 / 24%);
}
.end-session-dialog::backdrop { background: rgb(18 20 22 / 40%); }
.end-session-dialog h2 { margin: 0 0 12px; font-size: 22px; }
.end-session-dialog p { margin: 0 0 24px; line-height: 1.5; }
.end-session-dialog-actions { display: flex; gap: 12px; justify-content: flex-end; }
.end-session-dialog-actions button { min-height: 48px; padding: 0 22px; border-radius: 16px; }

.duration-screen.active-workout-setup .forward-arrow::before {
  width: 0;
  height: 0;
  top: 2px;
  left: 7px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid var(--graphite);
  border-radius: 2px;
  background: transparent;
}

.duration-screen.active-workout-setup .forward-arrow::after {
  display: none;
}

.duration-dial.pulse {
  animation: dial-pulse 160ms ease-out;
}

.duration-dial.pulse .duration-value {
  animation: value-pulse 160ms ease-out;
}

.duration-controls {
  width: 100%;
}

.duration-step-row {
  width: 100%;
  height: 64px;
  margin-top: 28px;
  display: flex;
  align-items: center;
}

.step-button,
.quiet-button {
  flex: 0 0 auto;
  border: 1px solid var(--outline);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(18 20 22 / 12%);
}

.step-button {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
}

.step-button:disabled {
  opacity: 0.42;
}

.minus-icon,
.plus-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}

.minus-icon::before,
.plus-icon::before,
.plus-icon::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--graphite);
  transform: translate(-50%, -50%);
}

.plus-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.duration-range {
  width: 100%;
  height: 48px;
  min-width: 0;
  margin: 0 10px;
  padding: 0 16px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.duration-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--graphite) 0 var(--range-progress),
    var(--route-inactive) var(--range-progress) 100%
  );
}

.duration-range::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--graphite) 0 var(--range-progress),
    var(--route-inactive) var(--range-progress) 100%
  );
}

.duration-range::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -11px;
  appearance: none;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: radial-gradient(circle, var(--chartreuse) 0 5px, var(--graphite) 5.5px);
  box-shadow: 0 1px 3px rgb(18 20 22 / 25%);
}

.duration-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: radial-gradient(circle, var(--chartreuse) 0 5px, var(--graphite) 5.5px);
  box-shadow: 0 1px 3px rgb(18 20 22 / 25%);
}

.duration-labels {
  margin: -8px 80px 0;
  display: grid;
  grid-template-columns: repeat(var(--duration-option-count, 10), 1fr);
  color: var(--secondary);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.duration-labels span {
  opacity: 0.72;
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.duration-labels span.selected {
  color: var(--graphite);
  opacity: 1;
  transform: scale(1.08);
}

.duration-modifiers {
  min-height: 56px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.modifier-personal-groups {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.modifier-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #9f978d;
  border-radius: 22px;
  background: #e8e0d6;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 35%),
    0 1px 3px rgb(18 20 22 / 12%);
}

.modifier-tile {
  position: relative;
  width: 56px;
  height: 56px;
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--graphite);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(18 20 22 / 12%);
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 80ms ease;
}

button.modifier-tile:not(:disabled):active {
  transform: scale(0.92);
}

.modifier-tile[aria-pressed="true"] {
  border: 2px solid var(--chartreuse);
  color: var(--chartreuse);
  background: var(--graphite);
  box-shadow:
    0 2px 6px rgb(18 20 22 / 22%),
    0 0 0 4px rgb(203 237 70 / 9%);
}

.modifier-tile:focus-visible {
  outline: 3px solid rgb(18 20 22 / 46%);
  outline-offset: 3px;
}

.modifier-icon {
  display: block;
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.no-clap-slash-cutout,
.no-clap-slash {
  fill: none;
  stroke-linecap: round;
}

.no-clap-slash-cutout {
  stroke: var(--surface);
  stroke-width: 34;
}

.modifier-tile[aria-pressed="true"] .no-clap-slash-cutout {
  stroke: var(--graphite);
}

.no-clap-slash {
  stroke: currentColor;
  stroke-width: 18;
}

.modifier-icon-stroke {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.elevation-icon .modifier-icon-stroke {
  stroke-width: 1.9;
}

.elevation-glyph {
  display: none;
}

[data-elevation-equipment="none"] .elevation-glyph-support,
[data-elevation-equipment="support"] .elevation-glyph-support,
[data-elevation-equipment="platform"] .elevation-glyph-platform {
  display: block;
}

.light-mode-glyph {
  background: currentColor;
  mask-image: url("./assets/ic_light_workout.3cdace9e7724.png");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("./assets/ic_light_workout.3cdace9e7724.png");
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.light-mode-countdown {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  padding-inline: 3px;
  height: 18px;
  border: 1px solid var(--graphite);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--graphite);
  background: var(--chartreuse);
  box-shadow: 0 1px 3px rgb(18 20 22 / 24%);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
}

.light-mode-countdown[hidden] {
  display: none;
}

.floor-glyph {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.floor-glyph-hard {
  mask-image: url("./assets/ic_hard_floor.80356a86c1a1.png");
  -webkit-mask-image: url("./assets/ic_hard_floor.80356a86c1a1.png");
}

.mirror-detail {
  stroke-width: 1.7;
}

.mirror-glyph {
  display: none;
}

.wall-glyph {
  display: none;
}

.wall-no-sole-mask {
  mask-image: url("./assets/ic_wall_no_sole.047ad1baea72.png");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("./assets/ic_wall_no_sole.047ad1baea72.png");
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.modifier-tile[data-wall-equipment="none"] .wall-glyph-soles-may-touch,
.modifier-tile[data-wall-equipment="soles-stay-off"] .wall-glyph-soles-stay-off,
.modifier-tile[data-wall-equipment="soles-may-touch"] .wall-glyph-soles-may-touch {
  display: inline;
}

.locomotion-icon .modifier-icon-stroke { stroke-width: 1.9; }
.floor-contact-icon .modifier-icon-stroke { stroke-width: 2.05; }
.floor-contact-icon .floor-contact-ground { stroke-width: 1.5; }
.floor-contact-glyph { display: inline; }
.locomotion-glyph { display: none; }
.modifier-tile[data-locomotion-space="none"] .locomotion-glyph-room,
.modifier-tile[data-locomotion-space="room"] .locomotion-glyph-room,
.modifier-tile[data-locomotion-space="field"] .locomotion-glyph-field { display: inline; }

.modifier-tile[data-mirror-equipment="none"] .mirror-glyph-tall,
.modifier-tile[data-mirror-equipment="compact"] .mirror-glyph-compact,
.modifier-tile[data-mirror-equipment="tall"] .mirror-glyph-tall {
  display: inline;
}

.modifier-feedback {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 15px 24px;
  border: 2px solid var(--chartreuse);
  border-radius: 18px;
  color: var(--chartreuse);
  background: var(--graphite);
  box-shadow: 0 10px 28px rgb(18 20 22 / 32%);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.modifier-feedback.show {
  animation: modifier-feedback-blink 2040ms ease-out both;
}

.modifier-feedback[data-detail]:not([data-detail=""])::after {
  content: attr(data-detail);
  display: block;
  margin-top: 5px;
  font-size: 0.65em;
  line-height: 1.4;
  white-space: normal;
}

.modifier-feedback[data-detail]:not([data-detail=""]).show {
  animation-duration: 3240ms;
}

@keyframes modifier-feedback-blink {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
  }

  7% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }

  11%,
  66% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

.duration-action-bar {
  flex: 0 0 auto;
  padding: 12px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--outline);
  background: var(--surface);
}

.active-workout-setup .duration-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.active-workout-setup .begin-workout { margin: 0; flex: 1; }

.primary-button,
.completion-button {
  min-height: 48px;
  border-radius: 20px;
  font-size: 20px;
  font-weight: 600;
  transition: opacity 120ms ease, transform 80ms ease, background-color 120ms ease;
}

.primary-button {
  border: 1px solid var(--graphite);
  background: var(--chartreuse);
  box-shadow: 0 3px 8px rgb(18 20 22 / 18%);
}

.primary-button:disabled {
  opacity: 0.5;
}

.begin-workout {
  width: min(100%, 552px);
  height: 68px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.forward-arrow {
  width: 30px;
  height: 20px;
  position: relative;
  display: block;
}

.forward-arrow::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 3px;
  width: 23px;
  height: 2px;
  border-radius: 1px;
  background: var(--graphite);
}

.forward-arrow::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--graphite);
  border-right: 2px solid var(--graphite);
  transform: rotate(45deg);
}

.workout-screen {
  overflow: hidden;
}

.phase-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.phase-surface.visible {
  opacity: 1;
}

.phase-half {
  width: 50%;
  height: 100%;
  background: var(--move-surface);
  transition: background-color 120ms ease;
}

.workout-content {
  position: relative;
  z-index: 1;
  width: min(100%, 1200px);
  height: 100dvh;
  margin: 0 auto;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.workout-header {
  flex: 0 0 auto;
  min-width: 0;
}

.workout-meta {
  min-height: 36px;
  display: flex;
  align-items: center;
}

.workout-progress-text {
  flex: 0 0 auto;
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.progress-track {
  overflow: hidden;
  border-radius: 3px;
}

.progress-track > span {
  width: 100%;
  height: 100%;
  display: block;
  transform: scaleX(0);
  transform-origin: left center;
}

.workout-progress {
  height: 5px;
  margin-top: 6px;
  background: var(--route-inactive);
}

.workout-progress > span {
  background: var(--chartreuse);
  transition: transform 160ms ease;
}

.exercise-name {
  max-height: 4.8em;
  margin: 8px 0 0;
  overflow: hidden;
  -webkit-touch-callout: none;
  color: var(--graphite);
  font-size: clamp(16px, 5vw, 23px);
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  user-select: none;
}

.execution-signifier {
  width: 42px;
  height: 52px;
  margin-left: auto;
  position: relative;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 4px rgb(18 20 22 / 16%));
}

.workout-setup-button {
  width: 40px;
  height: 40px;
  margin-left: 6px;
  padding: 8px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: var(--secondary);
  background: transparent;
}

.workout-setup-button:hover,
.workout-setup-button:focus-visible {
  color: var(--graphite);
  background: rgb(18 20 22 / 7%);
}

.workout-setup-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.execution-block-track {
  height: 32px;
  position: absolute;
  inset: 12px 0 auto;
  display: flex;
  gap: 5px;
}

.execution-set {
  height: 32px;
  min-width: 0;
  padding: 3px;
  position: relative;
  display: grid;
  flex: var(--execution-set-block-count) 1 0;
  grid-template-columns:
    repeat(var(--execution-set-block-count), minmax(0, 1fr));
  gap: 3px;
  border: 3px solid var(--graphite);
  border-radius: 11px;
  background: var(--surface);
}

.execution-work-block {
  min-width: 0;
  position: relative;
  border-radius: 4px;
}

.execution-work-block.blue {
  background: var(--rest-accent);
}

.execution-work-block.red {
  background: var(--move-accent);
}

.execution-work-block.neutral {
  background: var(--chartreuse);
}

.execution-work-block.current::before {
  content: "";
  width: 0;
  height: 0;
  position: absolute;
  z-index: 1;
  top: -16px;
  left: 50%;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 7px solid var(--graphite);
  transform: translateX(-50%);
}

.exercise-media-area {
  min-height: 72px;
  margin: 12px 0;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.exercise-media-card {
  width: min(68vw, 42dvh, 420px);
  aspect-ratio: 1;
  padding: 4px;
  position: relative;
  overflow: hidden;
  border: 4px solid var(--outline-soft);
  border-radius: 24px;
  background: var(--media);
  box-shadow: 0 5px 14px rgb(18 20 22 / 16%);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.workout-screen.phase-move .exercise-media-card {
  border-color: var(--move-accent);
  background: var(--move-surface);
  box-shadow:
    0 5px 14px rgb(18 20 22 / 18%),
    0 0 0 4px rgb(164 46 58 / 18%);
}

.workout-screen.phase-rest .exercise-media-card {
  border-color: var(--rest-accent);
  background: var(--rest-surface);
  box-shadow:
    0 5px 14px rgb(18 20 22 / 18%),
    0 0 0 4px rgb(45 111 159 / 18%);
}

.exercise-media-card.resting {
  opacity: 0.92;
  transform: scale(0.985);
}

.exercise-media-card video,
.hold-frame {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 20px;
  background: var(--media);
  object-fit: contain;
  transform: scaleX(var(--media-scale-x, 1));
}

.hold-frame {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
}

.hold-badge {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  padding: 5px 10px;
  border: 1px solid var(--chartreuse);
  border-radius: 10px;
  color: var(--rest-text);
  background: var(--rest-surface);
  box-shadow: 0 2px 5px rgb(18 20 22 / 15%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.reaction-cue {
  width: clamp(64px, 24%, 92px);
  aspect-ratio: 1;
  position: absolute;
  z-index: 5;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  border: 3px solid rgb(255 255 255 / 92%);
  border-radius: 50%;
  color: white;
  background: #257a49;
  box-shadow: 0 7px 24px rgb(18 20 22 / 38%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reaction-cue[hidden] {
  display: none;
}

.reaction-drill {
  position: absolute;
  inset: 4px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: var(--media);
  color: var(--graphite);
}
.reaction-drill-context { padding: 8px; text-align: center; font-size: 12px; font-weight: 600; }
.reaction-drill-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.reaction-drill-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.reaction-drill-stage video.show { opacity: 1; }
.reaction-drill-prompt { font-size: clamp(20px, 5vw, 32px); font-weight: 600; }
.reaction-drill-prompt.number { font-size: clamp(56px, 14vw, 96px); color: #257a49; }
.reaction-drill-prompt.stop { font-size: clamp(56px, 14vw, 96px); color: #202326; }
.reaction-drill-prompt[hidden] { display: none; }
.reaction-drill-cards { display: flex; gap: 5px; padding: 6px; justify-content: center; }
.reaction-drill-card { position: relative; flex: 1; min-width: 0; max-width: 110px; padding: 0; overflow: hidden; border: 1px solid rgb(20 20 20 / 16%); border-radius: 9px; background: #fff; }
.reaction-drill-card:disabled { opacity: 1; cursor: default; }
.reaction-drill-card:focus-visible { outline: 3px solid var(--graphite); outline-offset: -3px; }
.reaction-drill-card img { display: block; width: 100%; height: clamp(40px, 11vw, 75px); object-fit: contain; }
.reaction-drill-card span { display: block; padding: 3px 2px 5px; font-size: 11px; line-height: 1.15; text-align: center; color: #202326; overflow-wrap: anywhere; }
.reaction-drill-card .reaction-drill-number { position: absolute; top: 3px; left: 3px; display: grid; place-items: center; min-width: 20px; min-height: 20px; padding: 0 3px; border-radius: 6px; background: var(--graphite); color: #fff; font-size: 14px; font-weight: 700; }

@media (orientation: portrait) and (max-width: 600px) {
  .exercise-media-card:has(.reaction-drill) { width: min(calc(100vw - 40px), 45dvh, 380px); }
}

@media (orientation: landscape) and (max-width: 999px) {
  .exercise-media-card:has(.reaction-drill) { width: min(100%, calc(100dvh - 40px), 420px); }
}

.reaction-cue[data-state="freeze"] {
  background: #a42e3a;
}

.reaction-cue svg {
  width: 48%;
  height: 48%;
  fill: currentColor;
}

.reaction-cue-freeze,
.reaction-cue[data-state="freeze"] .reaction-cue-move {
  display: none;
}

.reaction-cue[data-state="freeze"] .reaction-cue-freeze {
  display: block;
}

.media-scrim,
.media-error {
  position: absolute;
  inset: 4px;
  z-index: 4;
  border-radius: 20px;
  background: var(--media);
}

.media-scrim {
  display: grid;
  place-items: center;
  opacity: 1;
  transition: opacity 160ms ease;
}

.media-scrim.revealed {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid var(--outline-soft);
  border-top-color: var(--graphite);
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

.media-error {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  text-align: center;
}

.quiet-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
}

.workout-action-host {
  height: 148px;
  min-height: 148px;
  flex: 0 0 148px;
  position: relative;
}

.workout-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.ready-panel {
  min-height: 120px;
  border: 1px solid var(--ready-outline);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--ready-highlight), var(--ready));
}

.ready-controls {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.action-button {
  min-width: 0;
  min-height: 68px;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
}

.shuffle-button {
  width: 68px;
  min-height: 68px;
  flex: 0 0 68px;
  padding: 20px;
  color: var(--chartreuse);
  border: 1px solid var(--chartreuse);
  border-radius: 20px;
  background: var(--ready-highlight);
  box-shadow: 0 2px 5px rgb(18 20 22 / 18%);
}

.shuffle-button svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.start-playback-icon {
  width: 34px;
  height: 34px;
  display: block;
  fill: currentColor;
}

.move-panel {
  padding: 8px 12px;
  color: var(--move-text);
}

.phase-row {
  min-height: 40px;
  display: flex;
  align-items: center;
}

.media-controls {
  min-height: 48px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.media-control {
  width: 48px;
  height: 48px;
  padding: 12px;
  color: currentColor;
  border: 1px solid var(--move-accent);
  border-radius: 14px;
  background: var(--move-track);
}

.media-control-primary {
  width: 56px;
}

.media-control svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.media-control[data-state="playing"] .playback-play-icon,
.media-control[data-state="paused"] .playback-pause-icon {
  display: none;
}

.media-control:disabled {
  opacity: 0.35;
}

.movement-time-row {
  min-height: 60px;
  position: relative;
  display: grid;
  place-items: center;
}

.movement-countdown {
  color: currentColor;
  font-size: clamp(32px, 14vw, 60px);
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.movement-track {
  height: 5px;
  margin-top: 8px;
  background: var(--move-track);
}

.movement-track > span {
  background: var(--move-accent);
  transform: scaleX(1);
}

.move-panel.change {
  color: var(--rest-text);
}

.move-panel.change .media-control {
  border-color: var(--rest-accent);
  background: var(--rest-track);
}

.move-panel.change .movement-track {
  background: var(--rest-track);
}

.move-panel.change .movement-track > span {
  background: var(--rest-accent);
}

.rest-panel {
  min-height: 148px;
  padding: 8px 12px;
  color: var(--rest-text);
}

.rest-row {
  min-height: 44px;
}

.rest-playback-control {
  flex: 1;
  display: flex;
  align-items: center;
  align-self: stretch;
  min-width: 48px;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.rest-playback-control svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.rest-playback-control[data-state="playing"] .rest-play-icon,
.rest-playback-control[data-state="paused"] .rest-pause-icon {
  display: none;
}

.rest-playback-control:focus-visible {
  outline: 3px solid var(--rest-accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.rest-countdown {
  font-size: clamp(28px, 10vw, 40px);
  font-weight: 600;
  line-height: 1;
}

.rest-track {
  height: 5px;
  margin-top: 4px;
  background: var(--rest-track);
}

.rest-track > span {
  background: var(--rest-accent);
  transform: scaleX(1);
}

.keep-button {
  width: 100%;
  min-height: 68px;
  margin-top: 10px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 18px;
  border-color: var(--rest-text);
  color: white;
  background: var(--rest-accent);
}

.keep-love-icon {
  width: 48px;
  height: 48px;
  display: block;
  fill: currentColor;
}

.completion-screen {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--completion-top), var(--completion-bottom));
}

.completion-hero {
  min-height: 0;
  min-width: 0;
  flex: 1;
  overflow-y: auto;
}

.completion-content {
  min-height: 100%;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
}

.completion-changes {
  width: min(100%, 26rem);
  container-type: inline-size;
  font-size: 1.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--bone);
}

.completion-changes li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3ch 1.2rem 3ch;
  align-items: baseline;
  column-gap: 8px;
  padding: 14px 0;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.completion-changes li + li { border-top: 1px solid rgb(245 239 231 / 10%); }
.completion-change-label { font-size: 1rem; overflow-wrap: anywhere; padding-right: 8px; }
.completion-change-before { color: #a7abad; text-align: right; }
.completion-change-arrow { color: #a7abad; font-size: 1rem; text-align: center; }
.completion-change-after { color: var(--chartreuse); font-weight: 500; text-align: right; }
.completion-changes:focus-visible { outline: 1px solid var(--chartreuse); outline-offset: 8px; border-radius: 4px; }

@container (max-width: 28ch) {
  .completion-changes li { row-gap: 6px; }
  .completion-change-label { grid-column: 1 / -1; padding-right: 0; }
  .completion-change-before { grid-column: 2; }
}

.has-profile-changes .completion-halo {
  width: 128px;
  padding: 8px;
  flex: 0 0 auto;
}
.has-profile-changes .completion-halo-inner { padding: 12px; }
.has-profile-changes .completion-mark span { border-width: 5px; }

.completion-halo {
  width: min(70vw, 34dvh, 280px);
  aspect-ratio: 1;
  padding: 18px;
  border: 2px solid rgb(203 237 70 / 32%);
  border-radius: 50%;
  background: rgb(255 255 255 / 3%);
  animation: completion-in 240ms ease-out both;
}

.completion-halo-inner {
  width: 100%;
  height: 100%;
  padding: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  background: rgb(255 255 255 / 3%);
}

.completion-mark {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid var(--chartreuse);
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(255 255 255 / 14%), rgb(255 255 255 / 8%));
}

.completion-mark span {
  width: 42%;
  height: 24%;
  margin-top: -7%;
  display: block;
  border-bottom: 8px solid var(--chartreuse);
  border-left: 8px solid var(--chartreuse);
  border-radius: 2px;
  transform: rotate(-45deg);
  animation: mark-in 200ms 40ms ease-out both;
}

.completion-action-bar {
  flex: 0 0 auto;
  padding:
    12px
    calc(24px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    calc(24px + env(safe-area-inset-left));
}

.completion-button {
  width: min(100%, 552px);
  height: 68px;
  margin: 0 auto;
  display: block;
  background: var(--surface);
  color: var(--completion-bottom);
  box-shadow: 0 3px 8px rgb(0 0 0 / 18%);
  animation: button-in 180ms 60ms ease-out both;
}

button:not(:disabled):active {
  transform: scale(0.985);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(61 113 155 / 75%);
  outline-offset: 3px;
}

.visually-hidden {
  width: 1px;
  height: 1px;
  padding: 0;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes dial-pulse {
  from { transform: scale(0.98); }
  to { transform: scale(1); }
}

@keyframes value-pulse {
  from { opacity: 0.62; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes completion-in {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes mark-in {
  from { opacity: 0; transform: rotate(-45deg) scale(0.8); }
  to { opacity: 1; transform: rotate(-45deg) scale(1); }
}

@keyframes button-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (orientation: landscape) {
  .duration-screen {
    flex-direction: row;
  }

  .duration-scroll {
    height: 100dvh;
  }

  .duration-content {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding:
      calc(10px + env(safe-area-inset-top))
      16px
      calc(10px + env(safe-area-inset-bottom))
      calc(16px + env(safe-area-inset-left));
    flex-direction: row;
    align-items: center;
  }

  .duration-identity {
    width: 216px;
    padding: 0;
    flex: 0 0 216px;
  }

  .nomadic-method-icon {
    width: 40px;
    height: 40px;
  }

  .duration-dial {
    width: 188px;
    margin-top: 8px;
  }

  .duration-value {
    font-size: clamp(44px, 9dvh, 78px);
  }

  .duration-controls {
    min-width: 0;
    margin-left: 12px;
    flex: 1;
  }

  .duration-step-row {
    height: 56px;
    margin-top: 0;
  }

  .step-button {
    width: 56px;
    height: 56px;
  }

  .duration-labels {
    margin-right: 68px;
    margin-left: 68px;
    font-size: 9px;
  }

  .duration-modifiers {
    width: 100%;
    max-width: 100%;
    min-height: 56px;
    margin-top: 16px;
    padding-block: 4px;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: safe center;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  .duration-modifiers::-webkit-scrollbar {
    display: none;
  }

  .duration-modifiers > .modifier-group,
  .duration-modifiers > .modifier-personal-groups {
    flex: 0 0 auto;
  }

  .modifier-tile {
    width: 56px;
    height: 56px;
    padding: 12px;
  }

  .duration-action-bar {
    width: calc(104px + env(safe-area-inset-right));
    height: 100dvh;
    padding:
      calc(16px + env(safe-area-inset-top))
      calc(16px + env(safe-area-inset-right))
      calc(16px + env(safe-area-inset-bottom))
      16px;
    display: grid;
    place-items: center;
    border-top: 0;
    border-left: 1px solid var(--outline);
  }

  .begin-workout {
    width: 68px;
    height: 68px;
    margin: 0;
  }

  .workout-content {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
  }

  .workout-header {
    flex: 0.92 1 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .exercise-name {
    max-height: 3.6em;
    font-size: clamp(11px, 2.4vw, 19px);
  }

  .exercise-media-area {
    min-width: 0;
    min-height: 0;
    margin: 0;
    flex: 1.28 1 0;
  }

  .exercise-media-card {
    width: min(100%, calc(100dvh - 40px), 420px);
  }

  .workout-action-host {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    flex: 0.96 1 0;
  }

  .ready-panel {
    min-height: 96px;
  }

  .completion-screen {
    flex-direction: row;
  }

  .completion-halo {
    width: min(50vw, 68dvh, 260px);
  }

  .completion-action-bar {
    width: calc(190px + env(safe-area-inset-right));
    padding:
      calc(16px + env(safe-area-inset-top))
      calc(16px + env(safe-area-inset-right))
      calc(16px + env(safe-area-inset-bottom))
      16px;
    display: grid;
    place-items: center;
  }

  .completion-button {
    width: 100%;
    margin: 0;
  }
}

@media (orientation: landscape) and (max-width: 639px) {
  .duration-content {
    padding:
      calc(6px + env(safe-area-inset-top))
      8px
      calc(6px + env(safe-area-inset-bottom))
      calc(8px + env(safe-area-inset-left));
  }

  .duration-identity {
    width: 160px;
    flex-basis: 160px;
  }

  .nomadic-method-icon {
    width: 32px;
    height: 32px;
  }

  .duration-dial {
    width: 140px;
    margin-top: 4px;
  }

  .duration-controls {
    margin-left: 8px;
  }

  .duration-step-row,
  .step-button {
    height: 48px;
  }

  .step-button {
    width: 48px;
  }

  .duration-labels {
    margin-right: 58px;
    margin-left: 58px;
    font-size: 8px;
  }

  .duration-modifiers {
    min-height: 48px;
    margin-top: 10px;
  }

  .modifier-tile {
    width: 48px;
    height: 48px;
    padding: 10px;
  }

  .duration-action-bar {
    width: calc(80px + env(safe-area-inset-right));
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      10px;
  }

  .begin-workout {
    width: 60px;
    height: 60px;
  }
}

@media (min-width: 1000px) {
  .duration-screen {
    padding: clamp(16px, 3dvh, 32px) clamp(24px, 4vw, 72px);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    overflow: hidden;
  }

  .duration-scroll {
    display: block;
    width: min(100%, 1240px);
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    overflow: auto;
  }

  .duration-content {
    order: 0;
    flex: 0 0 auto;
    width: min(100%, 1240px);
    height: auto;
    min-height: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .duration-identity {
    width: auto;
    padding: 0;
    flex: 0 0 auto;
  }

  .duration-action-bar { order: 1; }
  .fitness-profile { order: 2; flex: 0 0 auto; }

  .nomadic-method-icon {
    width: clamp(44px, 7dvh, 68px);
    height: clamp(44px, 7dvh, 68px);
  }

  .duration-dial {
    width: clamp(180px, min(20vw, 26dvh), 320px);
    margin-top: clamp(10px, 1.6dvh, 20px);
    border-width: 3px;
  }

  .duration-dial::after {
    inset: 14px;
  }

  .duration-value {
    font-size: clamp(64px, min(8vw, 11dvh), 120px);
  }

  .duration-unit {
    font-size: clamp(16px, 1vw, 20px);
  }

  .duration-controls {
    width: min(100%, clamp(760px, 58vw, 1120px));
    margin: clamp(16px, 2.5dvh, 32px) auto 0;
    flex: 0 0 auto;
  }

  .duration-step-row {
    height: clamp(56px, 8dvh, 76px);
  }

  .step-button {
    width: clamp(56px, 8dvh, 76px);
    height: clamp(56px, 8dvh, 76px);
    border-radius: 20px;
  }

  .duration-range {
    height: 64px;
    margin: 0 clamp(14px, 1.5vw, 24px);
    padding: 0 clamp(16px, 1.5vw, 24px);
  }

  .duration-range::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
  }

  .duration-range::-moz-range-track {
    height: 8px;
    border-radius: 4px;
  }

  .duration-range::-webkit-slider-thumb {
    width: 36px;
    height: 36px;
    margin-top: -14px;
    background: radial-gradient(circle, var(--chartreuse) 0 7px, var(--graphite) 7.5px);
  }

  .duration-range::-moz-range-thumb {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, var(--chartreuse) 0 7px, var(--graphite) 7.5px);
  }

  .duration-labels {
    margin-right: calc(clamp(56px, 8dvh, 76px) + clamp(34px, 2.4vw, 48px));
    margin-left: calc(clamp(56px, 8dvh, 76px) + clamp(34px, 2.4vw, 48px));
    font-size: clamp(11px, 0.75vw, 14px);
  }

  .duration-modifiers {
    min-height: 60px;
    margin-top: clamp(16px, 2.5dvh, 28px);
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .modifier-group {
    gap: 6px;
    padding: 6px;
    border-radius: 28px;
  }

  .modifier-tile {
    width: clamp(48px, 7dvh, 64px);
    height: clamp(48px, 7dvh, 64px);
    padding: clamp(10px, 1.5dvh, 14px);
    border-radius: 20px;
  }

  .modifier-icon {
    width: 100%;
    height: 100%;
  }

  .duration-action-bar {
    width: auto;
    height: auto;
    padding: 0;
    display: block;
    border: 0;
    background: transparent;
  }

  .begin-workout {
    width: clamp(68px, 10dvh, 96px);
    height: clamp(68px, 10dvh, 96px);
    margin: 0 auto;
    border-radius: 32px;
  }

  .forward-arrow {
    transform: scale(1.2);
  }

  .workout-screen {
    overflow: auto;
  }

  .workout-content {
    width: min(calc(100% - 64px), 1600px);
    height: 100dvh;
    min-height: 560px;
    padding: clamp(28px, 5dvh, 64px) 0;
    display: grid;
    grid-template-columns: minmax(360px, 500px) minmax(520px, 900px);
    grid-template-rows: auto auto;
    column-gap: clamp(48px, 5vw, 96px);
    row-gap: 24px;
    align-content: center;
    align-items: stretch;
    justify-content: center;
  }

  .workout-header {
    padding: clamp(24px, 2.5vw, 36px);
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    display: block;
    border: 1px solid rgb(18 20 22 / 12%);
    border-radius: 24px;
    background: rgb(255 252 247 / 74%);
    box-shadow: 0 12px 30px rgb(18 20 22 / 10%);
    backdrop-filter: blur(8px);
  }

  .workout-progress-text {
    min-height: 52px;
    font-size: clamp(15px, 1vw, 18px);
  }

  .workout-progress {
    height: 7px;
    margin-top: 10px;
  }

  .exercise-name {
    max-height: 4.8em;
    margin-top: 16px;
    font-size: clamp(32px, 2.5vw, 46px);
    line-height: 1.12;
  }

  .execution-signifier {
    min-height: 60px;
  }

  .exercise-media-area {
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    overflow: visible;
  }

  .exercise-media-card {
    width: min(100%, 78dvh, 900px);
    border-width: 2px;
    box-shadow: 0 18px 48px rgb(18 20 22 / 18%);
  }

  .workout-action-host {
    width: 100%;
    height: 300px;
    min-width: 0;
    min-height: 300px;
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    overflow: hidden;
    border: 1px solid rgb(18 20 22 / 12%);
    border-radius: 24px;
    background: rgb(255 252 247 / 74%);
    box-shadow: 0 12px 30px rgb(18 20 22 / 10%);
    backdrop-filter: blur(8px);
  }

  .workout-panel {
    padding: 30px;
  }

  .ready-panel {
    min-height: 300px;
    border: 0;
    border-radius: 23px;
  }

  .action-button {
    min-height: 88px;
  }

  .shuffle-button {
    width: 88px;
    min-height: 88px;
    flex-basis: 88px;
    padding: 27px;
  }

  .start-playback-icon {
    width: 44px;
    height: 44px;
  }

  .phase-row {
    min-height: 64px;
  }

  .media-controls {
    min-height: 64px;
    gap: 18px;
  }

  .media-control {
    width: 64px;
    height: 64px;
    padding: 16px;
    border-radius: 18px;
  }

  .media-control-primary {
    width: 72px;
  }

  .movement-time-row {
    min-height: 132px;
  }

  .movement-countdown {
    font-size: clamp(84px, 7vw, 132px);
  }

  .movement-track {
    height: 10px;
    margin-top: 18px;
  }

  .rest-panel {
    min-height: 0;
    padding: 24px 30px;
  }

  .rest-row {
    min-height: 72px;
  }

  .rest-playback-control svg {
    width: 44px;
    height: 44px;
  }

  .rest-countdown {
    font-size: 72px;
  }

  .rest-track {
    height: 10px;
    margin-top: 10px;
  }

  .keep-button {
    min-height: 80px;
    margin-top: 18px;
  }

  .keep-love-icon {
    width: 56px;
    height: 56px;
  }

  .completion-screen {
    padding: clamp(32px, 5vw, 72px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(40px, 5dvh, 64px);
    overflow: auto;
  }

  .completion-hero {
    min-height: auto;
    flex: 0 0 auto;
  }

  .completion-halo {
    width: clamp(340px, min(32vw, 50dvh), 540px);
    padding: clamp(20px, 2vw, 32px);
    border-width: 3px;
  }

  .completion-halo-inner {
    padding: clamp(30px, 3vw, 48px);
  }

  .completion-mark span {
    border-bottom-width: clamp(8px, 0.7vw, 12px);
    border-left-width: clamp(8px, 0.7vw, 12px);
  }

  .completion-action-bar {
    width: clamp(320px, 26vw, 500px);
    padding: 0;
    display: block;
  }

  .completion-button {
    width: 100%;
    height: clamp(76px, 6vw, 96px);
    margin: 0;
    font-size: clamp(22px, 2vw, 28px);
  }
}

@media (max-height: 650px) and (orientation: portrait) {
  .duration-content {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .nomadic-method-icon {
    width: 44px;
    height: 44px;
  }

  .duration-dial {
    width: 190px;
    margin-top: 10px;
  }

  .duration-step-row {
    margin-top: 12px;
  }

  .duration-modifiers {
    min-height: 56px;
    margin-top: 16px;
  }

  .modifier-tile {
    width: 56px;
    height: 56px;
    padding: 12px;
  }

  .exercise-media-card {
    width: min(58vw, 34dvh, 300px);
  }
}

@media (max-width: 360px) {
  .duration-content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .duration-action-bar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .step-button {
    width: 56px;
    height: 56px;
  }

  .duration-labels {
    margin-right: 68px;
    margin-left: 68px;
    font-size: 9px;
  }
}

@media (max-width: 340px) {
  .duration-modifiers {
    gap: 8px;
  }

  .modifier-group {
    gap: 4px;
  }

  .modifier-tile {
    width: 48px;
    height: 48px;
    padding: 10px;
  }
}

@media (orientation: landscape) and (max-width: 999px) {
  .active-workout-setup .duration-action-bar { flex-direction: column; gap: 24px; }
  .active-workout-setup .begin-workout { flex: 0 0 auto; }
}

@media (max-width: 300px) {
  .modifier-tile {
    width: 44px;
    height: 44px;
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modifier-feedback.show {
    opacity: 1;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.workout-screen.feedback-screen.phase-rest .exercise-media-card {
  border: 1px solid var(--outline-soft); padding: 0; background: var(--media);
  box-shadow: 0 10px 28px #12141620; opacity: 1; transform: none;
}
.feedback-stage .hold-frame { inset: 0; width: 100%; height: 100%; }

.feedback-sheet { display: contents; }
.feedback-caption { display: none; }
.feedback-screen .exercise-name { display: none; }
.feedback-stage .feedback-sheet {
  display: block; width: min(84vw, 54dvh, 480px); border-radius: 22px;
  overflow: hidden; background: var(--surface); border: 1px solid var(--outline-soft);
}
.feedback-stage .feedback-caption {
  display: flex; align-items: center; justify-content: center; min-height: 60px;
  padding: 12px 16px; text-align: center; font-size: 15px; line-height: 20px; color: var(--graphite);
}
.workout-screen.feedback-screen.phase-rest .exercise-media-card {
  width: 100%; border: 0; border-radius: 0; box-shadow: none; background: var(--media);
}
.feedback-stage .exercise-media-card video, .feedback-stage .hold-frame { border-radius: 0; }
@media (orientation: landscape) {
  .feedback-stage .feedback-sheet { width: min(40vw, 58dvh, 480px); }
  .feedback-stage .feedback-caption { min-height: 42px; padding: 8px 12px; font-size: 13px; line-height: 17px; }
}

/* A size container cannot derive its height from its children. Stretch it into the allocated media area, including the desktop grid. */
.exercise-media-area.feedback-stage { container-type: size; align-self: stretch; }
.feedback-stage .feedback-sheet { width: min(calc(100cqw - 16px), calc(100cqh - 88px), 480px); }

.fitness-contribution-feedback { display: block; margin-top: 0.35rem; font-size: 0.75rem; color: #c3c2bb; }
