:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --surface: #151619;
  --raised: #202125;
  --border: #2b2d32;
  --muted: #a1a3ab;
  --orange: #f5ad42;
  --header-height: 72px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 38px; line-height: 1.15; letter-spacing: .01em; }
h1 span { color: var(--orange); }
h2, h3 { font-family: var(--ff-font-body); text-transform: none; letter-spacing: -.025em; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border: 0; border-radius: 14px; background: transparent; }
.icon-button:hover { background: var(--raised); }
.skip-link { position: fixed; top: -100px; left: 20px; background: var(--orange); color: #000; padding: 12px; z-index: 20; }
.skip-link:focus { top: 15px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 216px; display: flex; flex-direction: column; padding: 32px 18px; border-right: 1px solid var(--border); background: #101113; z-index: 4; }
.brand { margin: 0 7px 54px; }
.brand img { width: 166px; height: auto; display: block; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { display: flex; align-items: center; gap: 13px; min-height: 52px; padding: 12px 16px; border-radius: 13px; color: var(--muted); font-weight: 550; }
.sidebar nav a[aria-current=page] { color: var(--orange); background: #302517; }
.sidebar nav a:hover { color: white; }
.sidebar nav small { margin-left: auto; font-size: 12px; }
.sidebar-signature { margin-top: auto; padding: 24px 16px 0; font-family: var(--ff-font-heading); color: #8e9098; font-size: 12px; letter-spacing: 1.5px; }
.workspace { margin-left: 216px; }
.topbar { position: sticky; top: 0; height: var(--header-height); padding: 0 36px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: #101113f5; backdrop-filter: blur(16px); z-index: 3; }
.app-identity, .header-actions { display: flex; align-items: center; gap: 12px; }
.app-identity img { object-fit: contain; }
.app-identity > span { font-size: 18px; font-weight: 650; letter-spacing: -.03em; }
.connection { font-size: 12px; color: var(--muted); }
.connection:before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #9faf92; margin-right: 7px; }
.connection.offline:before { background: var(--orange); }
main { padding: 28px 36px 40px; max-width: 1280px; margin: auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { font-size: 11px; letter-spacing: 1.3px; font-weight: 600; color: var(--orange); margin-bottom: 7px; }
.subtitle { font-size: 14px; color: var(--muted); margin-top: 10px; }
.coach-badge { color: #a7a09a; font-size: 10px; letter-spacing: 1px; background: #1c1c1d; border: 1px solid var(--border); padding: 7px 9px; border-radius: 7px; white-space: nowrap; }
.week-summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(115deg,#302719,#1e1c18 60%,#171819); border: 1px solid #483823; border-radius: 18px; padding: 22px 24px; margin-bottom: 28px; }
.summary-label { display: block; color: #cebfa9; font-size: 12px; }
.week-copy > div { display: flex; align-items: baseline; gap: 9px; }
.week-copy b { font-family: var(--ff-font-heading); font-size: 38px; line-height: 1.3; color: var(--orange); }
.week-copy div > span { color: #b6ada2; font-size: 13px; }
.week-summary > .icon { color: #b2a38c; width: 18px; }
.week-days { display: flex; gap: 13px; margin-left: auto; }
.week-day { display: grid; justify-items: center; gap: 9px; color: #a4a19c; font-size: 11px; }
.week-day i { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #484238; border-radius: 50%; font-style: normal; font-size: 12px; }
.week-day.logged i { background: var(--orange); color: #231608; border-color: var(--orange); }
.week-day.today i { box-shadow: 0 0 0 3px #f5ad4226; border-color: #e5b775; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 26px 0 15px; }
.section-heading p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.section-heading > a { display: flex; align-items: center; gap: 4px; min-height: 44px; color: var(--orange); font-size: 13px; white-space: nowrap; }
.section-heading > a .icon { width: 17px; }
#saved-count { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; margin-left: 4px; background: #2a251b; border-radius: 7px; font-size: 12px; }
.focus-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.focus-card { border: 1px solid var(--border); background: var(--surface); padding: 0; text-align: left; border-radius: 16px; overflow: hidden; }
.focus-card:hover { border-color: #9c7035; }
.focus-visual { display: grid; place-items: center; aspect-ratio: 9/12; background: #08090a; position: relative; }
.focus-visual img { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: contain; }
.focus-copy { display: block; padding: 13px 14px; position: relative; }
.focus-copy h3 { font-size: 16px; font-weight: 600; padding-right: 12px; }
.focus-copy small { color: var(--muted); font-size: 12px; }
.focus-copy .icon { position: absolute; right: 10px; top: 16px; width: 16px; height: 16px; color: var(--orange); }
.home-drills { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.drill-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.drill-open { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.drill-card:hover { border-color: #62616a; }
.drill-visual { width: 100%; aspect-ratio: 9/16; background: #08090a; position: relative; display: grid; place-items: center; overflow: hidden; }
.drill-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.play-icon { position: absolute; right: 12px; bottom: 12px; width: 32px; height: 32px; border: 1px solid #ffffff5c; background: #111a; backdrop-filter: blur(8px); border-radius: 50%; display: grid; place-items: center; }
.play-icon .icon { width: 15px; height: 15px; fill: currentColor; stroke-width: 0; }
.drill-copy { padding: 14px 15px 18px; width: 100%; }
.drill-copy .eyebrow { font-size: 10px; letter-spacing: .6px; margin-bottom: 6px; }
.drill-copy h3 { font-size: 15px; font-weight: 550; line-height: 1.4; letter-spacing: -.02em; margin-bottom: 8px; }
.drill-copy small { font-size: 12px; color: var(--muted); }
.save-button { position: absolute; right: 7px; top: 7px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #ffffff26; background: #17181bdd; backdrop-filter: blur(8px); border-radius: 12px; }
.save-button .icon { width: 21px; height: 21px; }
.save-button[aria-pressed=true] { color: var(--orange); }
.save-button[aria-pressed=true] .icon { fill: #f5ad4226; }
.home-drills .drill-open { flex-direction: row; align-items: center; min-height: 120px; padding-right: 49px; }
.home-drills .drill-visual { align-self: stretch; width: 68px; min-height: 120px; aspect-ratio: 9/16; flex-shrink: 0; }
.home-drills .drill-copy { padding: 12px; }
.home-drills .drill-copy h3 { font-size: 14px; margin-bottom: 5px; }
.home-drills .drill-copy .eyebrow { font-size: 10px; }
.home-drills .play-icon { display: none; }
.home-drills .save-button { top: 50%; transform: translateY(-50%); right: 7px; background: transparent; border: 0; }
.library-shortcut { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 60px; border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; margin-top: 16px; color: #c9cbd2; font-size: 14px; }
.library-shortcut > .icon:first-child { color: var(--orange); }
.library-shortcut > span { flex: 1; }
.library-controls { position: sticky; top: var(--header-height); z-index: 2; background: var(--bg); padding: 8px 0; }
.library-toolbar { display: flex; gap: 10px; }
.search { display: flex; align-items: center; gap: 10px; border: 1px solid #33353b; border-radius: 13px; background: #1a1b1e; padding: 0 13px; flex: 1; min-width: 0; min-height: 48px; }
.search .icon { width: 21px; color: var(--muted); }
.search input { background: transparent; border: 0; color: white; width: 100%; min-width: 0; min-height: 46px; font-size: 16px; }
select { background: #1a1b1e; color: white; border: 1px solid #33353b; border-radius: 12px; padding: 10px 12px; min-height: 48px; font-size: 16px; }
#sort { width: 88px; }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 1px 4px; }
.filters::-webkit-scrollbar { display: none; }
.filter { min-height: 44px; padding: 9px 15px; border: 1px solid #33353b; background: #17181b; color: #b4b6bd; border-radius: 24px; font-size: 13px; white-space: nowrap; }
.filter[aria-pressed=true] { color: #19120a; background: var(--orange); border-color: var(--orange); font-weight: 600; }
.results-meta { display: flex; justify-content: space-between; gap: 12px; margin: 17px 0; font-size: 12px; color: var(--muted); }
.drill-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.empty-state { grid-column: 1/-1; padding: 36px 20px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.empty-state h2 { font-size: 21px; margin-bottom: 9px; }
.empty-state p { max-width: 350px; margin: 0 auto 20px; color: var(--muted); font-size: 14px; }
.local-note { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.activity-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.activity-item > div { min-width: 0; }
.activity-item h3 { font-size: 15px; margin-bottom: 7px; }
.activity-item p { color: #b7b9c1; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.activity-item small { display: block; color: var(--orange); font-size: 12px; margin-bottom: 7px; }
.activity-item button { min-height: 44px; min-width: 44px; padding: 10px; background: transparent; border: 0; color: #b8bac2; font-size: 13px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 48px; padding: 12px 18px; border: 1px solid transparent; border-radius: 13px; font-size: 14px; font-weight: 600; }
.primary { background: var(--orange); color: #201509; }
.primary:hover { background: #ffc065; }
.secondary { background: var(--raised); border-color: #393b42; }
.quiet { color: var(--orange); background: transparent; }
.notice { padding: 14px 16px; border: 1px solid #7f6138; border-radius: 12px; background: #2a2318; color: #e9cfa9; font-size: 14px; margin-bottom: 18px; }
.placeholder-mark { font-family: var(--ff-font-heading); color: #ffffff18; font-size: 48px; }
/* Detail is a screen with its own scroll area, persistent header and bottom action. */
dialog { color: white; background: var(--bg); border: 1px solid #393b40; padding: 0; border-radius: 24px; }
dialog::backdrop { background: #000b; backdrop-filter: blur(8px); }
body:has(dialog[open]) { overflow: hidden; }
.detail-screen[open] { display: flex; flex-direction: column; }
.detail-screen { width: min(760px,calc(100% - 40px)); height: min(960px,calc(100dvh - 40px)); max-height: none; overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-shrink: 0; padding: 8px 14px; background: #151619; border-bottom: 1px solid var(--border); z-index: 1; }
.dialog-header > span, .dialog-header h2 { font-size: 16px; font-weight: 600; }
.dialog-header > span { margin-right: auto; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.player { display: grid; place-items: center; background: #040405; }
.player video { display: block; width: 100%; height: min(40dvh,380px); object-fit: contain; }
.player-message { padding: 36px 24px; font-size: 14px; color: var(--muted); text-align: center; }
.player-message a { display: inline-block; color: var(--orange); min-height: 44px; padding: 12px; }
.dialog-body { padding: 23px 26px 32px; }
.dialog-body > h2 { font-family: var(--ff-font-heading); font-size: 31px; text-transform: uppercase; line-height: 1.25; margin-bottom: 16px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 24px; }
.detail-tags span { background: #1e2024; border-radius: 7px; font-size: 12px; padding: 6px 10px; color: #bfc1c9; }
#coaching-section > h3 { margin-bottom: 12px; }
.coaching-notes { color: #c0c2ca; font-size: 15px; line-height: 1.8; white-space: pre-line; }
.detail-actions { flex-shrink: 0; padding: 12px 20px; background: #151619; border-top: 1px solid var(--border); }
.detail-actions .button { width: 100%; min-height: 52px; }
.detail-actions #show-log { justify-content: space-between; }
.dialog-feedback { flex-shrink: 0; padding: 12px 20px; color: #f7cc8b; background: #322719; font-size: 14px; border-top: 1px solid #5d4425; }
.detail-screen[data-mode=log] .player, .detail-screen[data-mode=log] .detail-tags { display: none; }
.form-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.form-heading .button { font-size: 13px; padding: 8px; }
#log-form label { display: block; color: #c3c5ce; font-size: 14px; }
#log-form label > span { color: #8e919b; font-size: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.measure-field { grid-column: 1/-1; }
#log-form input, #log-form textarea, #log-form select { display: block; width: 100%; min-width: 0; margin-top: 7px; border: 1px solid #3a3d46; border-radius: 12px; background: #191b20; padding: 12px 14px; color: white; font-size: 16px; min-height: 50px; }
.settings-screen { width: min(480px,calc(100% - 32px)); max-height: calc(100dvh - 32px); }
.settings-screen .dialog-header { position: sticky; top: 0; justify-content: flex-start; }
.settings-body { padding: 24px; }
.settings-body > img { display: block; margin: 10px 0 28px; }
.settings-body section { border-top: 1px solid var(--border); padding: 22px 0; }
.settings-body p { font-size: 14px; color: var(--muted); margin: 10px 0 14px; line-height: 1.7; }
.toast { position: fixed; bottom: 24px; left: calc(50% + 108px); transform: translateX(-50%); max-width: calc(100vw - 32px); width: max-content; display: flex; align-items: center; gap: 14px; background: #f5ad42; color: #221608; padding: 14px 18px; border-radius: 14px; box-shadow: 0 8px 36px #0007; font-size: 14px; z-index: 10; }
.toast button { min-height: 44px; padding: 8px; background: none; border: 0; text-decoration: underline; color: inherit; font-weight: 600; }
@media (max-width: 1100px) and (min-width: 901px) {
  .sidebar { width: 180px; padding: 26px 12px; }
  .brand img { width: 145px; }
  .workspace { margin-left: 180px; }
  .topbar { padding: 0 24px; }
  main { padding: 24px; }
  .drill-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .week-days { gap: 8px; }
}
@media (max-width: 900px) {
  :root { --header-height: calc(60px + env(safe-area-inset-top)); }
  .sidebar { inset: auto 0 0; width: auto; padding: 4px max(12px,env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); background: #141518f5; backdrop-filter: blur(20px); border: 0; border-top: 1px solid #34363c; }
  .brand, .sidebar-signature, #nav-count { display: none; }
  .sidebar nav { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  .sidebar nav a { flex-direction: column; justify-content: center; gap: 4px; padding: 6px 4px; min-height: 54px; border-radius: 12px; font-size: 11px; font-weight: 500; }
  .sidebar nav a[aria-current=page] { background: transparent; }
  .sidebar nav a[aria-current=page] .icon { fill: #f5ad4222; }
  .sidebar nav .icon { width: 23px; height: 23px; }
  .workspace { margin-left: 0; }
  .topbar { padding: env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left)); }
  .app-identity { gap: 9px; }
  .app-identity > span { font-size: 17px; }
  .app-identity img { width: 30px; height: 30px; }
  .connection { font-size: 11px; }
  .header-actions { gap: 6px; }
  .header-actions .icon-button { width: 44px; height: 44px; }
  main { padding: 22px max(18px,env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); }
  .page-heading { margin-bottom: 18px; }
  h1 { font-size: 34px; }
  .eyebrow { font-size: 10px; }
  .week-summary { padding: 16px; gap: 14px; margin-bottom: 24px; border-radius: 16px; }
  .week-copy b { font-size: 33px; }
  .week-copy > div { gap: 6px; }
  .week-copy div > span { font-size: 11px; }
  .week-days { gap: 7px; }
  .week-day { font-size: 10px; gap: 6px; }
  .week-day i { width: 21px; height: 21px; font-size: 10px; }
  .week-summary > .icon { display: none; }
  .section-heading { margin: 22px 0 12px; }
  h2 { font-size: 19px; }
  .section-heading > a { font-size: 13px; }
  .focus-grid { display: flex; overflow-x: auto; gap: 12px; padding: 2px 0 10px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .focus-grid::-webkit-scrollbar { display: none; }
  .focus-card { flex: 0 0 138px; scroll-snap-align: start; }
  .focus-visual { height: 184px; aspect-ratio: auto; }
  .focus-copy { padding: 12px; }
  .focus-copy h3 { font-size: 15px; }
  .focus-copy small { font-size: 11px; }
  .focus-copy .icon { right: 6px; top: 16px; width: 14px; }
  .home-drills { grid-template-columns: 1fr; gap: 10px; }
  .home-drills .drill-open { min-height: 108px; }
  .home-drills .drill-visual { width: 61px; min-height: 108px; }
  .home-drills .drill-copy h3 { font-size: 15px; }
  .drill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .drill-copy { padding: 13px 12px 16px; }
  .drill-copy h3 { font-size: 14px; }
  .drill-copy small { font-size: 12px; }
  .drill-copy .eyebrow { font-size: 10px; }
  .results-meta > span + span { display: none; }
  .library-controls { padding-top: 8px; }
  .filter { padding: 9px 14px; }
  .detail-screen { margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .dialog-header { padding: calc(6px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 6px max(12px,env(safe-area-inset-left)); min-height: calc(64px + env(safe-area-inset-top)); }
  .dialog-body { padding: 20px max(20px,env(safe-area-inset-right)) 28px max(20px,env(safe-area-inset-left)); }
  .dialog-body > h2 { font-size: 29px; }
  .detail-actions { padding: 10px max(18px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); }
  .dialog-feedback { padding: 11px 20px; font-size: 14px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; }
  .settings-screen { border-radius: 20px; }
  .settings-screen .dialog-header { padding: 8px; min-height: 64px; }
}
@media (max-width: 359px) {
  main { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 30px; }
  .coach-badge { display: none; }
  .week-summary { padding: 13px; gap: 8px; }
  .week-days { gap: 5px; }
  .week-day i { width: 19px; height: 19px; }
  .week-copy div > span { max-width: 40px; line-height: 1.2; }
  .week-copy b { font-size: 30px; }
  .home-drills .drill-copy h3 { font-size: 14px; }
  .form-heading { align-items: flex-start; }
  .form-heading h3 { max-width: 100px; padding-top: 10px; }
  .connection { max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .detail-screen { --player-height: calc(100dvh - 148px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .detail-screen:has(.dialog-feedback:not([hidden])) { --player-height: calc(100dvh - 196px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .detail-scroll { display: grid; grid-template-columns: minmax(180px,40%) 1fr; }
  .player { position: sticky; top: 0; align-self: start; height: var(--player-height); min-height: 0; overflow: hidden; }
  .player video { height: var(--player-height); max-height: var(--player-height); min-height: 0; }
  .dialog-body { padding-top: 18px; }
  .detail-screen[data-mode=log] .detail-scroll { display: block; }
  .dialog-feedback { font-size: 12px; padding: 6px 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .icon-button, .save-button { transition: background .15s, color .15s; }
  .detail-screen[open] { animation: screen-in .18s ease-out; }
  @keyframes screen-in { from { opacity: .6; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

.soundtrack-settings select { width: 100%; font-size: 16px; min-height: 44px; margin-top: 8px; }
.soundtrack-settings audio { width: 100%; height: 54px; }
#soundtrack-now { font-weight: 600; color: var(--text); }
.credits ul { list-style: none; padding: 0; margin: 0; }
.credits li { margin: 12px 0; }
.credits a { display: inline-block; padding-block: 10px; text-decoration: underline; text-underline-offset: 3px; }
.credits small { display: block; color: var(--muted); line-height: 1.5; }
@media(max-width: 600px) { .header-actions:has(#music-toggle:not([hidden])) .connection { display: none; } #music-toggle { font-size: 12px; min-height: 44px; padding-inline: 8px; } }
