@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("assets/manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f6f1;
  --panel: #fff;
  --panel-hover: #f7faf6;
  --line: #dce7de;
  --border: var(--line);
  --text: #182a22;
  --muted: #52665a;
  --accent: #35634e;
  --accent-faint: #e9f2e9;
  --lime: #d8f77c;
  --forest: #214a37;
  --shadow: 0 3px 18px #233f2c0a;
  --radius: 25px;
  --heading: Manrope, "DM Sans", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --content-width: 1160px;
  --gutter: clamp(18px, 3.1vw, 36px);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font: 400 1rem/1.5 var(--body); }
body:has(dialog[open]) { overflow: hidden; }
a, button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
svg { display: inline-block; flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 800; line-height: 1.12; letter-spacing: -.045em; }
:focus-visible { outline: 2px solid #528966; outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
::selection { color: var(--text); background: var(--lime); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  border-radius: 24px;
  background: var(--lime);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.eyebrow { font-size: .82rem; font-weight: 700; letter-spacing: .035em; }
.panel { background: var(--panel); border: 1px solid #e6eee4; border-radius: var(--radius); box-shadow: var(--shadow); }

.button, .btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  line-height: 1.22;
  text-align: center;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button-primary, .btn-primary { background: var(--forest); color: white; }
.button-primary:hover, .btn-primary:hover { background: #306149; }
.button-secondary, .btn-secondary { color: var(--forest); background: #ecf3eb; }
.button-secondary:hover, .btn-secondary:hover { background: #e0eddf; }
.button-danger { background: #a13132; color: white; }
.button-danger:hover { background: #852528; }
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--forest);
  background: var(--accent-faint);
  border: 1px solid transparent;
  border-radius: 50%;
}
.icon-button:hover { background: #daebdb; }
.text-link { display: inline-flex; align-items: center; min-height: 40px; color: var(--accent); font-size: .92rem; font-weight: 700; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid #e6eee4;
  background: #f9fbf8f5;
  backdrop-filter: blur(16px);
}
.topbar-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  max-width: calc(var(--content-width) + 2 * var(--gutter));
  min-height: 76px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; min-width: 0; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--lime);
  background: var(--forest);
  border-radius: 13px;
}
.brand-icon svg { width: 24px; height: 24px; }
.brand strong { font: 800 1.16rem/1 var(--heading); letter-spacing: -.045em; }
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 99px;
  background: #ecf2ea;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 99px;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { color: var(--forest); background: #e1ece0; }
.nav-link[aria-current="page"] { color: var(--forest); background: #fff; box-shadow: 0 2px 7px #213e2810; }
.bottom-nav { display: none; }
.account-tools { display: flex; justify-content: end; min-width: 0; }
.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 45px;
  max-width: 170px;
  padding: 3px 13px 3px 4px;
  color: var(--forest);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: .9rem;
  font-weight: 700;
}
.account-button:hover { background: var(--accent-faint); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  color: var(--forest);
  background: #e4efdf;
  font: 800 .92rem/1 var(--heading);
}
.account-button[href="#profile"] .avatar, .quick-profile .avatar { background: var(--lime); }

.main { max-width: calc(var(--content-width) + 2 * var(--gutter)); margin: 0 auto; padding: 35px var(--gutter) 62px; }
.session-main { width: min(100%, 850px); margin: 0 auto; padding: 24px var(--gutter); }
.view-heading, .home-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin: 0 0 24px;
}
.view-heading h1, .home-heading h1 {
  font-size: clamp(2.1rem, 5vw, 3.55rem);
  letter-spacing: -.06em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.view-heading p, .home-heading p { margin-top: 7px; color: var(--muted); font-size: 1.04rem; }
.today { display: inline-flex; flex-shrink: 0; align-items: center; gap: 7px; padding-bottom: 2px; color: var(--muted); font-size: .9rem; font-weight: 600; }

.home-feature { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(312px, 1fr); gap: 16px; }
.hero {
  display: flex;
  align-items: center;
  position: relative;
  isolation: isolate;
  min-height: 331px;
  overflow: hidden;
  border-radius: 30px;
  background: #183a2c;
  color: white;
  box-shadow: 0 8px 24px #1d3a3023;
}
.hero::before, .hero::after { position: absolute; content: ""; inset: 0; z-index: -1; }
.hero::before { background: url("assets/hero.webp") 64% 36% / cover no-repeat; }
.hero::after {
  background: linear-gradient(90deg, #142f26 1%, #153127e8 29%, #16332889 58%, #1c422b14 84%),
              linear-gradient(0deg, #142d2599, transparent 64%);
}
.hero-content { max-width: 100%; padding: clamp(24px, 3.5vw, 42px); }
.hero-badge { display: inline-flex; align-items: center; gap: 7px; color: #f1f8ed; font-size: .9rem; font-weight: 700; }
.hero-badge > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #dffb9a;
  background: #d8f77c25;
  border-radius: 50%;
}
.hero h2 {
  max-width: 12ch;
  margin: 9px 0 12px;
  color: white;
  font-size: clamp(2.95rem, 6vw, 5.1rem);
  line-height: .99;
  letter-spacing: -.07em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 12px #0c1d1633;
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; margin-bottom: 23px; }
.hero-meta span { display: inline-flex; gap: 6px; align-items: center; color: #eef5ed; font-size: .94rem; font-weight: 600; }
.hero-meta svg { color: #dbefa4; }
.hero-button { min-height: 50px; padding-inline: 20px; background: var(--lime); color: #1d3323; }
.hero-button:hover { background: #e5ff9b; box-shadow: 0 5px 12px #14271f4a; }

.week-summary { display: flex; flex-direction: column; min-width: 0; padding: 24px; }
.week-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; justify-content: space-between; }
.week-heading h2 { font-size: 1.33rem; }
.week-number {
  color: var(--forest);
  background: var(--accent-faint);
  font-size: .81rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 99px;
  padding: 4px 9px;
}
.week-overview { display: flex; align-items: center; gap: 14px; margin: 21px 0 17px; }
.week-overview strong { display: block; font-size: 1rem; }
.week-overview p { margin-top: 3px; color: var(--muted); font-size: .85rem; }
.week-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 82px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#628f58 var(--week-progress), #e6efe4 var(--week-progress));
}
.week-ring span {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  width: 67px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: white;
  color: var(--forest);
  font: 800 1.55rem/1 var(--heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
}
.week-ring small { color: var(--muted); font-size: .86rem; }
.week-markers { display: flex; gap: 6px; padding: 0; margin: 0 0 17px; list-style: none; }
.week-markers li { flex: 1 1 0; min-width: 0; }
.week-markers a {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 39px;
  border-radius: 13px;
  color: #4b6255;
  background: #f0f5ef;
  font-size: .88rem;
  font-weight: 700;
}
.week-markers a:hover { background: #e1eddf; }
.week-markers a.done { color: var(--forest); background: #e0efde; }
.week-markers a.next { color: var(--forest); background: #e7f6be; box-shadow: inset 0 0 0 1px #cae279; }
.week-link { width: 100%; margin-top: auto; font-size: .93rem; min-height: 43px; }

.home-section { margin-top: 27px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 11px; }
.section-head h2 { font-size: clamp(1.27rem, 2.5vw, 1.62rem); }
.section-head .text-link { flex-shrink: 0; }
.stat-grid, .library-entry-grid { display: grid; gap: 13px; }
.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { display: flex; gap: 12px; align-items: start; padding: 17px 18px; min-width: 0; }
.stat-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 43px; height: 43px; color: #356149; background: #e8f2e7; border-radius: 14px; }
.stat-icon.peach { color: #8e503c; background: #f9ebe2; }
.stat-icon.blue { color: #435c80; background: #eaf0f9; }
.stat-content h3 { font: 700 .94rem/1.4 var(--body); letter-spacing: 0; }
.stat-content p { color: var(--muted); font-size: .89rem; }
.stat-value { display: flex; align-items: baseline; gap: 5px; margin: 3px 0; }
.stat-value strong { font: 800 1.95rem/1.05 var(--heading); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.stat-value span { color: var(--accent); font-size: .88rem; font-weight: 700; }
.library-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.library-entry { display: flex; align-items: center; min-width: 0; gap: 13px; min-height: 80px; padding: 13px 16px; transition: background .18s ease, box-shadow .18s ease; }
.library-entry:hover { background: var(--panel-hover); box-shadow: 0 5px 16px #213e2819; }
.library-entry span:nth-child(2) { display: grid; }
.library-entry strong { font: 800 1.03rem/1.4 var(--heading); letter-spacing: -.025em; }
.library-entry small { color: var(--muted); font-size: .88rem; }
.library-entry-photo {
  background: linear-gradient(90deg, #fff 46%, #ffffffde 70%, #ffffff16 100%), url("assets/hero-group.webp") right 47% / 60% auto no-repeat, white;
}
.library-entry-photo:hover {
  background: linear-gradient(90deg, #f7faf6 46%, #f7faf6de 70%, #ffffff16 100%), url("assets/hero-group.webp") right 47% / 60% auto no-repeat, var(--panel-hover);
}

.dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 27px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 22px 90px #172d2355;
  overscroll-behavior: contain;
}
.dialog::backdrop { background: #172b22a8; backdrop-filter: blur(4px); }
.dialog-inner { padding: 25px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.dialog-head h2 { font-size: clamp(1.5rem, 4.3vw, 2.15rem); }
.dialog-head .icon-button { flex-shrink: 0; }
.login-dialog { width: min(430px, calc(100% - 28px)); }
.quick-profiles { display: grid; gap: 7px; margin-top: 16px; }
.quick-profile {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 53px;
  padding: 5px 10px;
  color: var(--forest);
  background: #edf5ea;
  border: 1px solid #e2efdf;
  border-radius: 16px;
  text-align: left;
}
.quick-profile:hover { background: #e5f0e1; }
.quick-profile .avatar { width: 37px; height: 37px; }
.quick-profile > span:last-child { overflow-wrap: anywhere; }
.login-form { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.login-form label { font-weight: 700; }
.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid #cddace;
  border-radius: 13px;
  background: #fcfdfb;
  color: var(--text);
}
.form-error { color: #9d352e; font-size: .94rem; }
.form-error:empty { display: none; }
.login-form .button { margin-top: 3px; }
.delete-training-dialog { width: min(445px, calc(100% - 28px)); }
.delete-training-detail {
  display: grid;
  gap: 3px;
  margin: 13px 0;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--accent-faint);
}
.delete-training-detail span { color: var(--muted); font-size: .9rem; }
.delete-training-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
  margin-top: 17px;
}
.exercise-dialog { width: min(900px, calc(100% - 30px)); }
.exercise-translation { margin-bottom: 12px; }
.segment-control {
  display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px;
  border-radius: 99px; background: #edf3eb;
}
.segment-control :is(a, button) {
  display: inline-grid; place-items: center; min-height: 36px; padding: 4px 13px;
  color: var(--muted); border: 0; border-radius: 99px; background: transparent; font-weight: 700;
}
.segment-control :is([aria-current="page"], [aria-pressed="true"]) { color: var(--forest); background: white; box-shadow: 0 1px 5px #203f271a; }
.exercise-variants { margin-bottom: 12px; }
.exercise-figure { overflow: hidden; border-radius: 15px; background: #e5ece2; }
.exercise-figure img { width: 100%; height: auto; }
.exercise-zoom { min-height: 44px; margin-top: 10px; font-size: .91rem; }
.exercise-figure.zoomed { overflow-x: auto; scrollbar-color: #8daa91 #edf3e9; }
.exercise-figure.zoomed img { width: max(175%, 680px); max-width: none; }
.exercise-steps { display: grid; gap: 8px; padding-inline-start: 22px; margin: 15px 0; }
.exercise-steps li::marker { color: var(--accent); font-weight: 700; }
.exercise-source { margin-top: 14px; font-size: .84rem; }
.install-instructions { display: grid; gap: 12px; }
.toast-region { position: fixed; z-index: 10; pointer-events: none; right: 18px; bottom: 18px; max-width: min(410px, calc(100% - 36px)); }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 12px 15px;
  border-radius: 15px; background: var(--forest); color: #fff; box-shadow: 0 5px 18px #213c3059;
}
.toast svg { color: var(--lime); }

@media (max-width: 860px) {
  .topbar-content { grid-template-columns: 1fr auto; min-height: 62px; }
  .desktop-nav { display: none; }
  .main { padding-top: 26px; padding-bottom: calc(97px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed;
    z-index: 6;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px max(12px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid #e1ebe0;
    background: #fdfffdf4;
    box-shadow: 0 -8px 22px #244b3110;
    backdrop-filter: blur(15px);
  }
  .bottom-nav .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 54px;
    padding: 0 2px;
    border-radius: 15px;
    font-size: .77rem;
  }
  .bottom-nav .nav-link svg { width: 20px; height: 20px; box-sizing: content-box; padding: 2px 11px; border-radius: 99px; }
  .bottom-nav .nav-link[aria-current="page"] { background: transparent; box-shadow: none; }
  .bottom-nav .nav-link[aria-current="page"] svg { background: #dff0d9; }
  .toast-region { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .session-mode .toast-region { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (max-width: 660px) {
  .brand-icon { width: 36px; height: 36px; border-radius: 11px; }
  .brand-icon svg { width: 22px; height: 22px; }
  .brand strong { font-size: 1.05rem; }
  .brand { gap: 7px; }
  .account-button { min-height: 44px; padding-right: 10px; }
  .account-button .avatar { width: 33px; height: 33px; }
  .view-heading, .home-heading { margin-bottom: 18px; }
  .view-heading p, .home-heading p { margin-top: 5px; font-size: 1rem; }
  .home-heading { align-items: start; flex-direction: column-reverse; gap: 6px; }
  .today { font-size: .84rem; padding-bottom: 0; }
  .today svg { width: 16px; height: 16px; }
  .home-feature { grid-template-columns: 1fr; gap: 12px; }
  .hero { min-height: 253px; border-radius: 25px; }
  .hero::before { background-position: 65% 35%; }
  .hero::after {
    background: linear-gradient(90deg, #142f26f5 2%, #153127d9 28%, #15332882 56%, #1c422b1f 89%),
                linear-gradient(0deg, #142d257d 2%, transparent 60%);
  }
  .hero h2 { margin: 9px 0 11px; font-size: clamp(2.55rem, 12.4vw, 4.55rem); }
  .hero-meta { margin-bottom: 15px; gap: 5px 10px; }
  .hero-meta span { font-size: .86rem; }
  .week-summary { padding: 17px; }
  .week-overview { gap: 11px; margin: 13px 0 11px; }
  .week-ring { width: 62px; }
  .week-ring span { width: 51px; font-size: 1.26rem; }
  .week-ring small { font-size: .74rem; }
  .week-markers { gap: 5px; margin-bottom: 12px; }
  .week-markers a { min-height: 42px; }
  .home-section { margin-top: 21px; }
  .section-head { margin-bottom: 8px; }
  .section-head .text-link { font-size: .86rem; }
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 15px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid #e6eee4;
    box-shadow: var(--shadow);
  }
  .stat-card { align-items: center; padding: 11px 0; border: 0; border-radius: 0; box-shadow: none; }
  .stat-card + .stat-card { border-top: 1px solid var(--line); }
  .stat-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; width: 100%; min-width: 0; }
  .stat-content p { grid-column: 1; font-size: .82rem; line-height: 1.25; }
  .stat-value { grid-column: 2; grid-row: 1 / span 2; padding-left: 2px; }
  .stat-value strong { font-size: 1.55rem; }
  .stat-value span { font-size: .77rem; }
  .library-entry-grid { grid-template-columns: 1fr; gap: 8px; }
  .library-entry { min-height: 69px; padding: 9px 14px; }
  .dialog, .login-dialog, .exercise-dialog, .delete-training-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 100%);
    margin: 0 auto;
    border-radius: 25px 25px 0 0;
  }
  .dialog-inner { padding: 17px var(--gutter) calc(18px + env(safe-area-inset-bottom)); }
  .session-main { padding-block: 14px; }
}

@media (max-width: 370px) {
  :root { --gutter: 14px; }
  .main { padding-top: 18px; }
  .hero { min-height: 244px; }
  .hero-content { padding: 19px; }
  .week-heading { column-gap: 5px; }
  .week-heading h2 { font-size: 1.18rem; }
  .week-number { font-size: .76rem; }
  .week-summary { padding: 14px; }
  .bottom-nav .nav-link { font-size: .73rem; }
  .stat-icon { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; }
}
