:root {
  color-scheme: light;
  --canvas: #f7f6f1;
  --surface: #ffffff;
  --ink: #122e2b;
  --muted: #667773;
  --line: #dce4df;
  --teal: #08796b;
  --teal-dark: #055c53;
  --mint: #dff1ea;
  --coral: #f1725b;
  --lemon: #f4d96b;
  --navy: #183d55;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #e8ece9;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

button:focus-visible,
.slides:focus-visible {
  outline: 3px solid rgba(241, 114, 91, 0.45);
  outline-offset: 2px;
}

.app {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: var(--canvas);
}

.topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top, 0px) + 67px);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247, 246, 241, 0.9);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 520ms var(--ease-out), transform 520ms var(--ease-out);
}

.app.ready .topbar {
  opacity: 1;
  transform: translateY(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 10px;
  height: 32px;
  background: var(--coral);
  border-radius: 2px;
  box-shadow: 0 0 0 rgba(241, 114, 91, 0);
  animation: brandPulse 3.4s ease-in-out infinite;
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--teal);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.brand h1 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1;
}

.counter {
  display: flex;
  align-items: baseline;
  color: var(--ink);
  font-size: 23px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

#current {
  display: inline-block;
}

#current.tick {
  animation: counterTick 320ms var(--ease-out);
}

.counter-total {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.progress {
  position: absolute;
  z-index: 21;
  top: calc(env(safe-area-inset-top, 0px) + 66px);
  left: 18px;
  right: 18px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: #d9dfda;
  opacity: 0;
  transform: scaleX(0.92);
  transform-origin: left;
  transition: opacity 500ms var(--ease-out) 100ms, transform 500ms var(--ease-out) 100ms;
}

.app.ready .progress {
  opacity: 1;
  transform: scaleX(1);
}

#progressFill {
  width: 5.26%;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  position: relative;
  box-shadow: 0 0 14px rgba(241, 114, 91, 0.38);
  transition: width 420ms var(--ease-out);
}

#progressFill::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--coral), 0 0 12px rgba(241, 114, 91, 0.7);
  transform: translateY(-50%);
}

.slides {
  display: flex;
  width: 100%;
  height: 100svh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.slides::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100svh;
  padding:
    calc(env(safe-area-inset-top, 0px) + 82px)
    14px
    calc(var(--safe-bottom) + 82px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.exercise {
  width: min(100%, 440px);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 13px;
  perspective: 1000px;
}

.visual {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #cfe1da;
  border-radius: 8px;
  background: var(--mint);
  box-shadow: 0 16px 40px rgba(38, 66, 57, 0.11);
  opacity: 0.24;
  transform: translateY(16px) scale(0.975);
  transition:
    opacity 360ms var(--ease-smooth),
    transform 620ms var(--ease-out),
    box-shadow 620ms var(--ease-out);
  will-change: transform, opacity;
  isolation: isolate;
}

.visual::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -8%;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 0 16px rgba(8, 121, 107, 0.22);
  opacity: 0;
  pointer-events: none;
}

.visual::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 6px solid rgba(255, 255, 255, 0.42);
  border-radius: 7px;
  pointer-events: none;
}

.visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
  transform: scale(1.035);
  transition:
    transform 900ms var(--ease-out),
    filter 500ms var(--ease-smooth),
    opacity 320ms var(--ease-smooth);
  will-change: transform, opacity;
}

.exercise-media {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #0d1b19;
  opacity: 0;
  transform: scale(1.015);
  pointer-events: none;
  transition: opacity 320ms var(--ease-smooth), transform 480ms var(--ease-out);
}

.media-launch,
.media-fullscreen,
.media-close {
  position: absolute;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: rgba(5, 92, 83, 0.92);
  backdrop-filter: blur(10px);
  transition:
    opacity 220ms var(--ease-smooth),
    transform 220ms var(--ease-out),
    background-color 180ms var(--ease-smooth),
    box-shadow 220ms var(--ease-out);
}

.media-launch {
  left: 50%;
  bottom: 14%;
  width: 56px;
  height: 56px;
  -webkit-appearance: none;
  appearance: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  border-radius: 50%;
  box-shadow:
    0 14px 30px rgba(5, 52, 47, 0.28),
    0 0 0 6px rgba(255, 255, 255, 0.68);
  transform: translateX(-50%);
}

.media-launch::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(8, 121, 107, 0.28);
  border-radius: 50%;
  animation: playRing 2.4s ease-out infinite;
}

.media-launch span {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid currentColor;
}

.media-fullscreen {
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  font-size: 22px;
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(5, 52, 47, 0.24);
}

.media-close {
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  font-size: 28px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(5, 52, 47, 0.24);
}

.visual.media-active .poster-image {
  opacity: 0;
}

.visual.media-active .exercise-media {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.visual.media-active .media-launch {
  opacity: 0;
  transform: translateX(-50%) translateY(8px) scale(0.76);
  pointer-events: none;
}

.visual.media-active .media-fullscreen,
.visual.media-active .media-close {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.visual.media-active .exercise-tag {
  opacity: 0;
  pointer-events: none;
}

.visual.media-error .media-launch {
  opacity: 1;
  pointer-events: auto;
  background: var(--coral);
}

.visual.media-error .media-launch::after {
  animation: none;
}

.slide.active .visual {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 20px 48px rgba(38, 66, 57, 0.16);
}

.slide.active .visual img {
  transform: scale(1);
}

.slide.active .visual::before {
  animation: scanLine 900ms var(--ease-out) 160ms both;
}

.exercise-tag {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  min-width: 43px;
  height: 32px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 6px 14px rgba(24, 61, 85, 0.18);
  transform: translateY(-6px) scale(0.92);
  opacity: 0;
  transition: opacity 360ms var(--ease-out) 130ms, transform 520ms var(--ease-out) 130ms;
}

.slide.active .exercise-tag {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.content {
  display: grid;
  gap: 9px;
}

.content > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 360ms var(--ease-smooth), transform 520ms var(--ease-out);
}

.slide.active .content > * {
  opacity: 1;
  transform: translateY(0);
}

.slide.active .content > :nth-child(1) {
  transition-delay: 90ms;
}

.slide.active .content > :nth-child(2) {
  transition-delay: 140ms;
}

.slide.active .content > :nth-child(3) {
  transition-delay: 190ms;
}

.slide.active .content > :nth-child(4) {
  transition-delay: 240ms;
}

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

.category {
  margin: 0;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.dose {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #dfc44e;
  border-radius: 5px;
  background: var(--lemon);
  color: #4c421d;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 5px 12px rgba(112, 91, 18, 0.09);
}

.title {
  margin: 0;
  max-width: 370px;
  font-size: clamp(23px, 6.7vw, 29px);
  line-height: 1.05;
}

.cue {
  margin: 0;
  padding: 11px 12px 11px 14px;
  border-left: 4px solid var(--coral);
  background: var(--surface);
  color: #314643;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.28;
  box-shadow: 0 8px 22px rgba(38, 66, 57, 0.06);
}

.safety {
  margin: 0;
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.safety::before {
  content: "!";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f9ded8;
  color: #a84735;
  font-size: 11px;
  font-weight: 900;
}

.controls {
  position: absolute;
  z-index: 24;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: calc(var(--safe-bottom) + 70px);
  padding: 8px 14px calc(var(--safe-bottom) + 8px);
  display: grid;
  grid-template-columns: 48px 1fr 1.15fr;
  gap: 8px;
  background: rgba(247, 246, 241, 0.93);
  border-top: 1px solid rgba(205, 216, 210, 0.8);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 520ms var(--ease-out) 160ms, transform 520ms var(--ease-out) 160ms;
}

.app.ready .controls {
  opacity: 1;
  transform: translateY(0);
}

.icon-btn,
.details-btn,
.next-btn,
.close-btn {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  font-weight: 820;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition:
    color 180ms var(--ease-smooth),
    background-color 180ms var(--ease-smooth),
    border-color 180ms var(--ease-smooth),
    box-shadow 220ms var(--ease-out),
    transform 150ms var(--ease-out);
}

.icon-btn {
  background: #e6ece8;
  color: var(--ink);
  font-size: 23px;
}

.details-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

.list-icon {
  font-size: 20px;
  line-height: 1;
  transform: rotate(180deg);
  transition: transform 260ms var(--ease-out);
}

.next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 9px 20px rgba(8, 121, 107, 0.2);
}

.next-btn span:last-child {
  display: inline-block;
  transition: transform 220ms var(--ease-out);
}

.icon-btn.is-pressed,
.details-btn.is-pressed,
.next-btn.is-pressed,
.close-btn.is-pressed,
.media-fullscreen.is-pressed,
.media-close.is-pressed {
  transform: scale(0.94);
}

.next-btn.is-pressed {
  box-shadow: 0 4px 10px rgba(8, 121, 107, 0.18);
}

.media-launch.is-pressed {
  transform: translateX(-50%) scale(0.9);
}

.next-btn:disabled,
.icon-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.sheet-backdrop {
  position: absolute;
  z-index: 29;
  inset: 0;
  background: rgba(11, 35, 32, 0.36);
  opacity: 0;
  backdrop-filter: blur(0);
  transition: opacity 360ms var(--ease-smooth), backdrop-filter 420ms var(--ease-smooth);
}

.technique-sheet {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 76svh;
  padding: 9px 18px calc(var(--safe-bottom) + 18px);
  overflow-y: auto;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 55px rgba(12, 39, 35, 0.2);
  transform: translateY(calc(100% + 28px));
  opacity: 0;
  transition: transform 520ms var(--ease-out), opacity 300ms var(--ease-smooth);
  will-change: transform, opacity;
}

.sheet-backdrop.open {
  opacity: 1;
  backdrop-filter: blur(3px);
}

.technique-sheet.open {
  transform: translateY(0);
  opacity: 1;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 13px;
  border-radius: 2px;
  background: #ccd6d1;
}

.sheet-head {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 12px;
  align-items: start;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 300ms var(--ease-smooth) 90ms, transform 420ms var(--ease-out) 90ms;
}

.technique-sheet.open .sheet-head {
  opacity: 1;
  transform: translateY(0);
}

.sheet-head p,
.sheet-head h2 {
  margin: 0;
}

.sheet-head p {
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.sheet-head h2 {
  margin-top: 5px;
  font-size: 22px;
  line-height: 1.1;
}

.close-btn {
  min-height: 42px;
  background: #edf1ef;
  color: var(--ink);
  font-size: 25px;
}

.sheet-steps {
  margin: 20px 0 14px;
  padding: 0;
  display: grid;
  gap: 12px;
  list-style: none;
  counter-reset: steps;
}

.sheet-steps li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
  align-items: start;
  color: #2e4440;
  font-size: 15px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 300ms var(--ease-smooth), transform 420ms var(--ease-out);
}

.technique-sheet.open .sheet-steps li {
  opacity: 1;
  transform: translateY(0);
}

.technique-sheet.open .sheet-steps li:nth-child(1) {
  transition-delay: 150ms;
}

.technique-sheet.open .sheet-steps li:nth-child(2) {
  transition-delay: 205ms;
}

.technique-sheet.open .sheet-steps li:nth-child(3) {
  transition-delay: 260ms;
}

.sheet-steps li::before {
  content: counter(steps);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 900;
}

.sheet-focus {
  padding: 13px 14px;
  border: 1px solid #f0c8bf;
  border-radius: 7px;
  background: #fff3ef;
  color: #6a3b31;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms var(--ease-smooth) 300ms, transform 420ms var(--ease-out) 300ms;
}

.technique-sheet.open .sheet-focus {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover,
  .details-btn:hover,
  .close-btn:hover {
    background: #dce9e4;
    border-color: #b8d0c7;
    color: var(--teal-dark);
    box-shadow: 0 8px 20px rgba(26, 72, 62, 0.13);
    transform: translateY(-2px);
  }

  .details-btn:hover .list-icon {
    transform: rotate(0);
  }

  .next-btn:hover {
    background: var(--teal-dark);
    box-shadow: 0 12px 26px rgba(8, 121, 107, 0.28), 0 0 0 3px rgba(8, 121, 107, 0.1);
    transform: translateY(-2px);
  }

  .next-btn:hover span:last-child {
    transform: translateX(4px);
  }

  .media-launch:hover {
    background: var(--coral);
    box-shadow:
      0 17px 36px rgba(124, 54, 41, 0.3),
      0 0 0 9px rgba(255, 255, 255, 0.72);
    transform: translateX(-50%) translateY(-2px) scale(1.06);
  }

  .media-fullscreen:hover,
  .media-close:hover {
    background: var(--coral);
    transform: translateY(-2px) scale(1.04);
  }
}

@keyframes brandPulse {
  0%,
  70%,
  100% {
    box-shadow: 0 0 0 0 rgba(241, 114, 91, 0);
  }
  82% {
    box-shadow: 0 0 0 5px rgba(241, 114, 91, 0.1);
  }
}

@keyframes counterTick {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scanLine {
  0% {
    top: -8%;
    opacity: 0;
  }
  20% {
    opacity: 0.75;
  }
  100% {
    top: 105%;
    opacity: 0;
  }
}

@keyframes playRing {
  0% {
    opacity: 0.72;
    transform: scale(0.9);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

@media (max-height: 760px) {
  .slide {
    padding-top: calc(env(safe-area-inset-top, 0px) + 76px);
    padding-bottom: calc(var(--safe-bottom) + 76px);
  }

  .exercise {
    gap: 9px;
  }

  .content {
    gap: 7px;
  }

  .title {
    font-size: 21px;
  }

  .cue {
    padding: 9px 10px;
    font-size: 13px;
  }

  .safety {
    font-size: 11px;
  }
}

@media (min-width: 700px) {
  .app {
    width: 430px;
    height: 932px;
    margin: 20px auto;
    border: 1px solid #cbd6d0;
    box-shadow: 0 30px 80px rgba(22, 48, 42, 0.2);
  }

  .slides,
  .slide {
    height: 932px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slides {
    scroll-behavior: auto;
  }

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