:root {
  color-scheme: dark;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --bg: #0b1020;
  --panel: rgba(255,255,255,.04);
  --border: rgba(255,255,255,.08);
  --text: #e2e8f0;
  --muted: #94a3b8;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #1e293b, var(--bg) 60%) fixed;
  color: var(--text); display: flex; flex-direction: column; align-items: center;
}
header { text-align: center; padding: 2.5rem 1.25rem 1rem; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 0; letter-spacing: -.02em; }
h1 .wave { background: linear-gradient(90deg,#22c55e,#38bdf8,#f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }
header p { color: var(--muted); margin: .6rem 0 0; }

main { width: 100%; max-width: 720px; padding: 0 1.25rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 1.25rem;
}
.panel h2 { margin: 0 0 .9rem; font-size: 1.05rem; }
.results-panel { scroll-margin-top: 1rem; }

.body-panel { display: flex; flex-direction: column; align-items: center; }
.view-toggle { display: flex; gap: .5rem; margin-bottom: .75rem; }
.view-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: .45rem 1.1rem; border-radius: 999px; cursor: pointer; font-size: .9rem; transition: all .15s ease;
}
.view-btn.active { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }

.body-map { width: 100%; max-width: 300px; }
.body-svg { width: 100%; height: auto; }
.body-svg.hidden { display: none; }

.body-svg .decor { fill: rgba(255,255,255,.08); stroke: rgba(255,255,255,.12); stroke-width: 1; }
.body-svg .torso-outline { fill: rgba(255,255,255,.05); }
.body-svg .zone { cursor: pointer; }
.body-svg .zone rect,
.body-svg .zone circle,
.body-svg .zone ellipse {
  fill: rgba(56, 189, 248, .28);
  stroke: rgba(56, 189, 248, .55);
  stroke-width: 1.5;
  transition: fill .15s ease, stroke .15s ease;
}
.body-svg .zone:hover rect,
.body-svg .zone:hover circle,
.body-svg .zone:hover ellipse,
.body-svg .zone:focus-visible rect,
.body-svg .zone:focus-visible circle,
.body-svg .zone:focus-visible ellipse {
  fill: rgba(56, 189, 248, .45);
}
.body-svg .zone.selected rect,
.body-svg .zone.selected circle,
.body-svg .zone.selected ellipse {
  fill: rgba(34, 197, 94, .55);
  stroke: #22c55e;
}

.selected-zone-label { margin: .9rem 0 0; color: var(--muted); font-size: .95rem; }

.equipment-options { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
  display: flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); cursor: pointer; font-size: .88rem; user-select: none;
}
.chip input { accent-color: var(--accent); }

.results-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.exercise-card {
  text-align: left; background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.1rem; cursor: pointer; color: inherit; font: inherit; transition: transform .15s ease, border-color .15s ease;
}
.exercise-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.exercise-card .ex-name { font-weight: 700; font-size: 1rem; margin: 0 0 .35rem; }
.exercise-card .ex-tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.tag { font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }

.empty-hint { color: var(--muted); text-align: center; padding: 1.5rem 1rem; grid-column: 1 / -1; }

footer { color: #64748b; font-size: .85rem; padding: 0 1rem 2.5rem; text-align: center; }
footer a { color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal.hidden { display: none; }
.modal-content {
  background: #10162a; border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem;
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: .8rem; right: .8rem; background: transparent; border: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer;
}
.modal-content h3 { margin: 0 1.5rem .8rem 0; }
.video-wrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: 10px; overflow: hidden; margin-bottom: 1rem; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.modal-content p#modalDescription { color: var(--text); line-height: 1.5; }
.modal-source { color: var(--muted); font-size: .8rem; }
