:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #66726b;
  --paper: #f8f5ed;
  --surface: #ffffff;
  --line: #d8ddd2;
  --court: #2f7b63;
  --court-dark: #1f5748;
  --clay: #d96e43;
  --lime: #d4ef70;
  --ice: #62b6e8;
  --ice-dark: #236d9f;
  --ice-pale: #d9f3ff;
  --shadow: 0 20px 55px rgba(24, 42, 34, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(47, 123, 99, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(47, 123, 99, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

.app-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: min(460px, 100%);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 10px;
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

.selection-screen,
.routine-screen {
  min-height: 0;
  overflow: hidden;
}

.selection-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 10px 2px 2px;
}

.routine-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.selection-top {
  padding-top: 10px;
}

.selection-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.routine-options {
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 0;
}

.routine-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 230px;
  padding: 18px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 10px;
  box-shadow: var(--shadow);
  text-align: left;
}

.routine-logo {
  width: 76px;
  height: 76px;
  display: block;
  overflow: visible;
}

.routine-logo rect {
  fill: #f8f5ed;
  stroke: var(--ink);
  stroke-width: 4;
}

.routine-logo path,
.routine-logo circle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.warmup-logo .flame-main {
  fill: var(--clay);
  stroke: var(--ink);
}

.warmup-logo .flame-core {
  fill: var(--lime);
  stroke: var(--ink);
}

.cooldown-logo .flake-line {
  stroke: var(--ice-dark);
  stroke-width: 6;
}

.cooldown-logo .flake-branch {
  stroke: var(--ice);
  stroke-width: 4;
}

.cooldown-logo .flake-core {
  fill: var(--ice-pale);
  stroke: var(--ink);
}

.routine-text {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.routine-card strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.35rem;
  line-height: 0.95;
}

.routine-text > span:last-child {
  max-width: 18rem;
  color: #435047;
  line-height: 1.35;
}

.routine-tag {
  width: fit-content;
  padding: 7px 9px;
  background: #edf6e7;
  border-radius: 6px;
  color: var(--court-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.warmup-card {
  border-bottom: 5px solid var(--clay);
}

.cooldown-card {
  border-bottom: 5px solid var(--ice);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 2px 2px 0;
}

.back-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--court-dark);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
}

.kicker,
.step-label {
  margin: 0 0 5px;
  color: var(--court-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.08;
}

.exercise-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(23, 32, 27, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.completion-screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(248, 245, 237, 0.8), rgba(248, 245, 237, 0.98)),
    var(--paper);
}

.completion-card {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 24px;
  background: #fff;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 10px;
  box-shadow: var(--shadow);
  text-align: center;
}

.completion-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
}

.completion-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.completion-card .complete-button {
  width: 100%;
}

.player-zone {
  display: grid;
  grid-template-rows: minmax(0, 52%) minmax(0, 48%);
  min-height: 0;
  gap: 10px;
}

.media-stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: #ffffff;
  border: 4px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.media-stage video,
.media-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.exercise-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 12px;
}

.exercise-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.duration-pill {
  flex: 0 0 auto;
  width: fit-content;
  max-width: 160px;
  padding: 7px 8px;
  background: #fff1e8;
  border: 1px solid #f0c4ad;
  border-radius: 6px;
  color: #8f3d1f;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.cue-list {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 0;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.cue-list li {
  position: relative;
  padding-left: 22px;
  color: #344139;
  font-size: 0.92rem;
  line-height: 1.22;
}

.cue-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 9px;
  height: 9px;
  background: var(--clay);
  border-radius: 50%;
}

.navigation-row {
  display: flex;
  gap: 8px;
}

.secondary-button,
.complete-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease;
}

.complete-button {
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
}

.secondary-button {
  flex: 1;
  padding: 0 12px;
  background: #edf1e8;
  color: var(--court-dark);
}

.complete-button {
  flex: 1.25;
  background: var(--court);
}

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

.navigation-row {
  margin-top: 0;
}

.sequence-section {
  position: relative;
  min-height: 0;
  padding: 0 0 2px;
  overflow: hidden;
}

.sequence-section::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 0;
  bottom: 0;
  width: 46px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(90deg, rgba(248, 245, 237, 0), rgba(248, 245, 237, 0.96));
}

.sequence-meta {
  display: block;
  margin: 0 2px 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sequence-meta span:first-child {
  color: var(--court-dark);
}

.section-heading {
  display: none;
}

.exercise-list {
  display: flex;
  gap: 8px;
  overflow-x: scroll;
  overflow-y: hidden;
  padding: 1px 42px 8px 2px;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: none;
  scrollbar-width: none;
}

.exercise-list::-webkit-scrollbar {
  display: none;
}

.exercise-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  flex: 0 0 88px;
  min-height: 52px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  scroll-snap-align: start;
}

.exercise-item.is-active {
  border-color: var(--court);
  box-shadow: inset 0 -4px 0 var(--court);
}

.exercise-item.is-complete {
  background: #edf6e7;
}

.step-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--ink);
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.exercise-item.is-complete .step-number {
  background: var(--court);
}

.item-copy strong,
.item-copy span {
  display: block;
}

.item-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-copy span {
  display: none;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-mark {
  display: none;
  color: var(--court);
  font-size: 1.35rem;
  font-weight: 900;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
  }

  .app-shell {
    width: min(430px, calc(100vw - 32px));
    height: min(900px, calc(100dvh - 32px));
    padding: 12px;
    background: rgba(248, 245, 237, 0.86);
    border: 1px solid rgba(23, 32, 27, 0.12);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(24, 42, 34, 0.22);
  }

  .app-shell.is-selecting .routine-card {
    min-height: 270px;
    padding: 22px;
  }

  .app-shell.is-selecting .routine-logo {
    width: 96px;
    height: 96px;
  }

  .media-stage {
    aspect-ratio: auto;
  }
}
