/* ---------- Top navigation (home, detail, exercises, plans) ---------- */
#topnav { position: sticky; top: 0; z-index: 10; }
.topnav { display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.topnav .brand { font-size: 13px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.topnav nav { display: flex; gap: 4px; }
.topnav nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 700; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; }
.topnav nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }
.topnav nav a:hover { color: var(--ink); }
.topnav .spacer { flex: 1; }
.settings-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; }
.settings-btn:hover, .settings-btn:focus-visible { background: var(--line-2); color: var(--ink); }
@media (max-width: 600px) {
  .topnav { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topnav nav a { padding: 0 8px; }
}
/* Activity colours: the same hue on an exercise's swatch and on its filter chip. */
.act-strength { --act: #C4420A; } .act-conditioning { --act: #B3261E; } .act-stretch { --act: #1F8A4C; }
.act-mobility { --act: #117C80; } .act-yoga { --act: #4B2AA3; } .act-breathing { --act: #1E5FB3; }

/* ---------- Browse pages ---------- */
.page { width: min(1040px, 100%); margin: 0 auto; padding: 24px 24px 60px; }
.page h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 900; letter-spacing: -0.01em; margin: 0 0 4px; }
.page h1:focus { outline: none; }
.page .sub { color: var(--ink-2); margin: 0 0 20px; }
.page a.btn { text-decoration: none; }
a.rbtn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 600px) { .page { padding: 16px 16px 48px; } }

/* ---------- Home ---------- */
.home-section { margin-top: 26px; }
.home-section .lbl { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.home-section .lbl h2 { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.home-section .lbl a { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--blue); text-decoration: none; }
.home .grow { flex: 1; min-width: 0; }
.home .t { font-weight: 800; }
.home .m { font-size: 13px; color: var(--ink-2); }

.resume, .continue { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; margin-top: 8px; }
.resume { background: var(--bg); color: var(--text); }
.resume .m { color: var(--muted); }
.resume .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(56, 214, 245, 0.2); flex: none; }
.resume .resume-btn { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.continue { background: var(--blue-soft); border: 1px solid #C9D8FF; }
.continue .eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue); }
.continue a.btn { text-decoration: none; }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } }
.poster { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.poster .cover { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 150px; padding: 14px; color: #fff; text-decoration: none; }
.poster .cover .tt { margin: 0; font-size: 24px; font-weight: 900; line-height: 1.05; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }
.poster .cover .dur { position: absolute; top: 12px; right: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); font-size: 12px; font-weight: 800; backdrop-filter: blur(4px); }
.poster .body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; flex: 1; }
.poster .desc { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster .desc.desc-empty { color: var(--ink-3); font-style: italic; }
.poster .chips, .home .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.home .chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.home .chip.mine { background: var(--blue-soft); color: var(--blue); }
.home .chip.focus-kettlebell { background: var(--orange-soft); color: var(--orange-ink); }
.home .chip.focus-yoga { background: var(--purple-soft); color: var(--purple); }
.home .chip.focus-personal { background: var(--blue-soft); color: var(--blue); }
.poster .acts { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.poster .acts .btn { min-height: 40px; }
.poster .acts a.btn { text-decoration: none; }
details.menu { position: relative; margin-left: auto; }
details.menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 40px; border-radius: 10px; font-weight: 900; color: var(--ink-2); font-size: 18px; letter-spacing: 0.05em; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary:hover, details.menu[open] summary { background: var(--line-2); color: var(--ink); }
details.menu .menu-items { position: absolute; right: 0; bottom: calc(100% + 6px); min-width: 180px; display: flex; flex-direction: column; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); z-index: 5; }
details.menu .menu-items button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-weight: 700; }
details.menu .menu-items button:hover { background: var(--line-2); }
.problem { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--orange-soft); color: var(--orange-ink); font-size: 12px; font-weight: 700; }
.catalog-error { padding: 16px; border-radius: 12px; border-left: 3px solid var(--orange); background: var(--orange-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.catalog-error p { margin: 0; flex: 1; }

.plan-rows { display: flex; flex-direction: column; gap: 8px; }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.plan-row a.btn { text-decoration: none; }

.wks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .wks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wk-card { display: flex; align-items: center; gap: 6px; min-height: 64px; padding: 10px 10px 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.wk-card:hover { border-color: var(--ink-3); }
.wk-card .wk-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.wk-card .wk-ic { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.wk-card .ex-body { display: flex; flex-direction: column; min-width: 0; }
.wk-card .tt { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-card .m { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-card .wk-play { flex: none; width: 36px; padding: 0; justify-content: center; }
.workouts-page .empty { margin: 0; padding: 16px; color: var(--ink-2); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }

.exs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 720px) { .exs { grid-template-columns: 1fr 1fr; } }
.ex-card { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 12px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.ex-card:hover { border-color: var(--ink-3); }
.ex-card .ex-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--line-2); flex: none; }
.ex-card .ex-body { display: flex; flex-direction: column; min-width: 0; }
.ex-card .tt { font-weight: 800; font-size: 13px; }
.ex-card .m { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.home-foot label.btn { cursor: pointer; }
.home-foot .sound-controls { display: flex; gap: 6px; margin-left: auto; }

/* ---------- Exercise browser ---------- */
.ex-filters { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.ex-filters .search { min-height: 44px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-size: 15px; }
.ex-filters .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-filters .chip { min-height: 36px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.ex-filters .chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ex-filters .chip[class*="act-"]::before { content: ''; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--act); }
.ex-filters .chip { display: inline-flex; align-items: center; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ex-card.browse { align-items: flex-start; }
.ex-card.browse .ex-body { gap: 2px; }
.ex-card .video { color: var(--orange-ink); font-weight: 700; }
.ex-empty { padding: 24px; text-align: center; color: var(--ink-2); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }
.ex-empty p { margin: 0 0 12px; }
@media (max-width: 720px) { .ex-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .ex-grid { grid-template-columns: 1fr; } }

/* ---------- Workout detail ---------- */
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink-2); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.detail-cover { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 180px; padding: 18px 20px; border-radius: 14px; color: #fff; margin: 6px 0 16px; }
.detail-cover h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }
.detail-cover .dur { position: absolute; top: 14px; right: 14px; padding: 5px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); font-size: 13px; font-weight: 800; backdrop-filter: blur(4px); }
.detail-desc { margin: 0 0 16px; color: var(--ink-2); line-height: 1.5; max-width: 70ch; }
.detail-desc.desc-empty { color: var(--ink-3); font-style: italic; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.facts > div { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.facts dt { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.facts dd { margin: 4px 0 0; font-weight: 700; }
.facts dd .hint { display: block; font-weight: 500; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.detail-section { margin-top: 22px; }
.detail-section h2 { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.detail-block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.detail-block h3 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; font-size: 15px; border-bottom: 1px solid var(--line-2); }
.detail-block h3 .rule { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--blue); background: var(--blue-soft); padding: 3px 9px; border-radius: 6px; }
.detail-steps { list-style: none; margin: 0; padding: 0; }
.detail-step { display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--line-2); min-height: 44px; }
.detail-step:last-child { border-bottom: 0; }
.detail-step .name { flex: 1; min-width: 0; font-weight: 700; }
.detail-step .name.link { background: none; border: 0; padding: 8px 0; text-align: left; color: var(--blue); cursor: pointer; font-weight: 700; }
.detail-step .name.link:hover { text-decoration: underline; }
.detail-step.rest .name { color: var(--ink-2); font-style: italic; font-weight: 500; }
.detail-step .meta { font-size: 13px; color: var(--ink-2); text-align: right; }

.detail-step { flex-wrap: wrap; }
.detail-step > .workout-note { flex-basis: 100%; margin: 0 0 6px; }
