@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Barlow:wght@400;500;600;700&display=swap');

:root {
  --bg: #020617;
  --surface: rgba(15, 23, 42, .92);
  --surface-2: rgba(30, 41, 59, .82);
  --line: rgba(148, 163, 184, .2);
  --orange: #f97316;
  --green: #22c55e;
}

html {
  color-scheme: dark;
  overscroll-behavior: contain;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(249, 115, 22, .16), transparent 18rem),
    radial-gradient(circle at 90% 18%, rgba(34, 197, 94, .12), transparent 14rem),
    linear-gradient(180deg, #020617 0%, #0f172a 100%);
  font-family: Barlow, system-ui, sans-serif;
  overflow-wrap: anywhere;
}

h1, h2, h3, .btn {
  font-family: "Barlow Condensed", Barlow, system-ui, sans-serif;
  letter-spacing: 0;
}

a, button, input, select {
  touch-action: manipulation;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(249, 115, 22, .95);
  outline-offset: 3px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  padding: 1rem;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 8px;
  padding: .68rem .9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:active {
  opacity: .82;
}

.btn-primary {
  border: 1px solid rgba(251, 146, 60, .7);
  background: #f97316;
  color: #111827;
}

.btn-soft {
  border: 1px solid rgba(148, 163, 184, .24);
  background: rgba(30, 41, 59, .86);
  color: #f8fafc;
}

.field {
  display: grid;
  gap: .35rem;
  color: #cbd5e1;
  font-size: .78rem;
  font-weight: 800;
}

.input {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 8px;
  background: rgba(2, 6, 23, .88);
  color: #f8fafc;
  padding: .7rem .75rem;
  font-size: 1rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, .86);
  padding: .9rem;
}

.metric span {
  display: block;
  color: #94a3b8;
  font-size: .78rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: .3rem;
  color: #fff7ed;
  font-size: 1.85rem;
  line-height: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(249, 115, 22, .32);
  border-radius: 999px;
  background: rgba(249, 115, 22, .1);
  color: #fed7aa;
  padding: .25rem .65rem;
  font-size: .78rem;
  font-weight: 800;
}

.toggle {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, .9);
  padding: .75rem;
  font-weight: 800;
}

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

.exercise-card.hidden, .hidden {
  display: none !important;
}

.demo-box {
  border-radius: 8px;
  background: #0f172a;
  padding: .5rem;
}

.demo-panel {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: #f8fafc;
}

.demo-panel.external-media {
  aspect-ratio: 1 / 1;
  display: block;
  background: #fff;
}

.media-zoom-button {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
  padding: 0;
}

.media-zoom-button img,
.media-zoom-button video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, .96);
  padding: 16px;
}

.media-lightbox img {
  width: min(94vw, 680px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.media-lightbox-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  min-height: 44px;
  border: 1px solid rgba(248, 250, 252, .28);
  border-radius: 8px;
  background: rgba(15, 23, 42, .94);
  color: #f8fafc;
  padding: .6rem .85rem;
  font-weight: 900;
}

.media-link {
  color: #fed7aa;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cue-detail {
  display: grid;
  gap: .25rem;
  border: 1px solid rgba(34, 197, 94, .36);
  border-left: 5px solid #22c55e;
  border-radius: 8px;
  background: rgba(22, 163, 74, .1);
  padding: .75rem;
}

.cue-detail.setup {
  border-color: rgba(249, 115, 22, .38);
  border-left-color: #f97316;
  background: rgba(249, 115, 22, .1);
}

.cue-detail.danger {
  border-color: rgba(239, 68, 68, .4);
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, .1);
}

.cue-detail strong {
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cue-detail b {
  color: #f8fafc;
  font-size: 1rem;
}

.cue-detail p {
  margin: 0;
  color: #cbd5e1;
  font-size: .9rem;
}

.demo-tab {
  min-height: 42px;
  border-radius: 8px;
  background: rgba(30, 41, 59, .88);
  color: #cbd5e1;
  font-size: .78rem;
  font-weight: 900;
}

.demo-tab.active {
  background: rgba(249, 115, 22, .24);
  color: #fed7aa;
  outline: 1px solid rgba(249, 115, 22, .48);
}

.library-media {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: .75rem;
  border-top: 1px solid rgba(148, 163, 184, .18);
  padding-top: .75rem;
}

.library-media img {
  width: 78px;
  height: 78px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.library-media a {
  color: #fed7aa;
  font-size: .78rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cue-card {
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: rgba(22, 163, 74, .08);
  padding: .75rem;
}

.cue-card.danger {
  border-color: #ef4444;
  background: rgba(239, 68, 68, .08);
}

.cue-card.knee {
  border-color: #facc15;
  background: rgba(250, 204, 21, .08);
}

.cue-card strong {
  display: block;
  margin-bottom: .15rem;
  font-size: .78rem;
  text-transform: uppercase;
}

.cue-card p {
  margin: 0;
  color: #e2e8f0;
  font-size: .9rem;
}

.timer-sheet {
  position: fixed;
  inset: auto 0 4.6rem;
  z-index: 40;
  margin: 0 auto;
  max-width: 36rem;
  padding: 0 1rem;
}

.demo-static {
  height: 100%;
  display: grid;
  place-content: center;
  gap: .5rem;
  padding: 1rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(34, 197, 94, .16), rgba(15, 23, 42, 1));
}

.demo-static.bad {
  background: linear-gradient(135deg, rgba(239, 68, 68, .18), rgba(15, 23, 42, 1));
}

.demo-static b {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2.4rem;
}

.demo-static span {
  color: #cbd5e1;
}

@media (prefers-reduced-motion: no-preference) {
  .demo-good {
    animation: goodRep 1.8s ease-in-out infinite alternate;
    transform-origin: 180px 112px;
  }
  .demo-bad {
    animation: badRep 1.1s ease-in-out infinite alternate;
    transform-origin: 180px 112px;
  }
}

@keyframes goodRep {
  from { transform: translateY(8px); }
  to { transform: translateY(-6px); }
}

@keyframes badRep {
  from { transform: translate(4px, -8px) rotate(-4deg); }
  to { transform: translate(-8px, 8px) rotate(5deg); }
}
