:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --ink: #172026;
  --muted: #64727d;
  --panel: #ffffff;
  --line: #dde5eb;
  --green: #2ca36b;
  --teal: #168c9b;
  --coral: #f06449;
  --yellow: #f4b940;
  --blue: #3f6fd9;
  --shadow: 0 18px 48px rgba(18, 32, 46, 0.11);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-soft: rgba(255, 255, 255, 0.12);
  --glass-panel-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)), rgba(11, 18, 28, 0.86);
  --glass-card-bg: linear-gradient(135deg, rgba(22, 140, 155, 0.22), rgba(124, 58, 237, 0.12)), rgba(255, 255, 255, 0.055);
  --glass-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.36);
  --glass-shadow-md: 0 18px 44px rgba(0, 0, 0, 0.28);
  --text-on-dark: rgba(255, 255, 255, 0.68);
  --glow-teal-purple: linear-gradient(135deg, rgba(22, 140, 155, 0.17), rgba(124, 58, 237, 0.12));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  background:
    radial-gradient(circle at 10% 0%, rgba(44, 163, 107, 0.14), transparent 28rem),
    linear-gradient(135deg, #f6f8fb 0%, #edf5f3 45%, #fff5ec 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.today-page .app-nav {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 16, 20, 0.72);
}

body.today-page .app-nav a {
  color: rgba(255, 255, 255, 0.76);
}

body.today-page .app-nav a.active,
body.today-page .app-nav a:hover {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

body.today-page .nav-logout button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

body.exercises-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(44, 163, 107, 0.22), transparent 24rem),
    radial-gradient(circle at 88% 22%, rgba(240, 100, 73, 0.18), transparent 22rem),
    #050708;
}

body.exercises-page .app-nav {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  background: rgba(5, 7, 8, 0.88);
}

body.exercises-page .app-nav a {
  color: rgba(255, 255, 255, 0.72);
}

body.exercises-page .app-nav a.active,
body.exercises-page .app-nav a:hover {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

body.exercises-page .nav-logout button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

body.exercises-page .topbar,
body.exercises-page .schedule-panel,
body.exercises-page .custom-exercise-panel,
body.exercises-page .library-panel {
  position: relative;
  isolation: isolate;
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045)),
    rgba(12, 17, 20, 0.9);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

body.exercises-page .topbar::after,
body.exercises-page .schedule-panel::after,
body.exercises-page .custom-exercise-panel::after,
body.exercises-page .library-panel::after,
body.exercises-page .schedule-card::after,
body.exercises-page .library-item::after {
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: inherit;
  opacity: 0.52;
  filter: blur(14px);
  content: "";
  pointer-events: none;
}

body.exercises-page .topbar::after {
  background: linear-gradient(135deg, rgba(63, 111, 217, 0.24), rgba(22, 140, 155, 0.1));
}

body.exercises-page .schedule-panel::after {
  background: linear-gradient(135deg, rgba(44, 163, 107, 0.2), rgba(63, 111, 217, 0.1));
}

body.exercises-page .custom-exercise-panel::after {
  background: linear-gradient(135deg, rgba(240, 100, 73, 0.19), rgba(244, 185, 64, 0.11));
}

body.exercises-page .library-panel::after {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(44, 163, 107, 0.1));
}

body.exercises-page .schedule-card,
body.exercises-page .plan-card,
body.exercises-page .library-item {
  position: relative;
  isolation: isolate;
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(22, 140, 155, 0.26), rgba(244, 185, 64, 0.13)),
    rgba(255, 255, 255, 0.055);
}

body.exercises-page .weekday-tabs label {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
}

body.exercises-page .weekday-tabs input:checked + label {
  border-color: rgba(244, 185, 64, 0.62);
  background: linear-gradient(135deg, rgba(244, 185, 64, 0.95), rgba(22, 140, 155, 0.76));
  color: #101820;
}

body.exercises-page .weekday-heading {
  padding: 4px 2px 0;
}

body.exercises-page .weekday-heading h3 {
  color: white;
}

body.exercises-page .schedule-card::after {
  inset: -5px;
  opacity: 0.34;
  filter: blur(10px);
  background: linear-gradient(135deg, rgba(63, 111, 217, 0.18), rgba(240, 100, 73, 0.08));
}

body.exercises-page .library-item::after {
  inset: -5px;
  opacity: 0.32;
  filter: blur(10px);
  background: linear-gradient(135deg, rgba(44, 163, 107, 0.15), rgba(168, 85, 247, 0.1));
}

body.exercises-page .library-item.locked {
  background:
    linear-gradient(135deg, rgba(100, 114, 125, 0.22), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.035);
}

body.exercises-page .exercise-video {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(63, 111, 217, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.055);
}

body.exercises-page .exercise-video iframe {
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

body.exercises-page .exercise-video a,
body.exercises-page .exercise-video span {
  color: rgba(255, 255, 255, 0.82);
}

body.exercises-page h1,
body.exercises-page h2,
body.exercises-page h3,
body.exercises-page strong {
  color: white;
}

body.exercises-page p,
body.exercises-page .section-heading span {
  color: rgba(255, 255, 255, 0.82);
}

body.exercises-page .library-item .exercise-rank-label {
  color: rgba(244, 185, 64, 0.95);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.exercises-page .library-item .exercise-target {
  color: rgba(255, 255, 255, 0.82);
}

body.exercises-page .library-item .exercise-tier-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
}

body.exercises-page .schedule-row label,
body.exercises-page .filter-toggle,
body.exercises-page .builder-summary b,
body.exercises-page .custom-exercise-form label,
body.exercises-page .plan-meta-grid label {
  color: rgba(255, 255, 255, 0.7);
}

body.exercises-page .schedule-row select,
body.exercises-page .custom-exercise-form input:not([type="checkbox"]),
body.exercises-page .schedule-search input,
body.exercises-page .plan-meta-grid input:not([type="checkbox"]),
body.exercises-page .plan-meta-grid select,
body.exercises-page .plan-meta-grid textarea {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

body.exercises-page .form-message {
  border-color: rgba(244, 185, 64, 0.5);
  background: rgba(255, 247, 221, 0.96);
  color: #172026;
}

body.ranks-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 8%, rgba(124, 58, 237, 0.3), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(63, 111, 217, 0.28), transparent 26rem),
    linear-gradient(135deg, #13091f 0%, #101836 54%, #07101f 100%);
}

body.ranks-page .app-nav {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  background: rgba(9, 13, 28, 0.86);
}

body.ranks-page .app-nav a {
  color: rgba(255, 255, 255, 0.72);
}

body.ranks-page .app-nav a.active,
body.ranks-page .app-nav a:hover {
  background: rgba(255, 255, 255, 0.94);
  color: #121827;
}

body.ranks-page .nav-logout button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

body.ranks-page .topbar,
body.ranks-page .unlock-summary,
body.ranks-page .rank-road,
body.ranks-page .badge-summary {
  position: relative;
  isolation: isolate;
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.045)),
    rgba(13, 18, 38, 0.86);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
}

body.ranks-page .topbar::after,
body.ranks-page .unlock-summary::after,
body.ranks-page .rank-road::after,
body.ranks-page .badge-summary::after {
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: inherit;
  opacity: 0.46;
  filter: blur(16px);
  content: "";
  pointer-events: none;
}

body.ranks-page .topbar::after {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.24), rgba(63, 111, 217, 0.12));
}

body.ranks-page .unlock-summary::after {
  background: linear-gradient(135deg, rgba(22, 140, 155, 0.16), rgba(124, 58, 237, 0.14));
}

body.ranks-page .rank-road::after {
  background: linear-gradient(135deg, rgba(63, 111, 217, 0.22), rgba(244, 185, 64, 0.09));
}

body.ranks-page .badge-summary::after {
  background: linear-gradient(135deg, rgba(44, 163, 107, 0.18), rgba(22, 140, 155, 0.14));
}

body.ranks-page .topbar h1,
body.ranks-page .topbar h2,
body.ranks-page .rank-road h2,
body.ranks-page .badge-summary h2,
body.ranks-page .badge-summary h3,
body.ranks-page .unlock-summary strong,
body.ranks-page .rank-meter strong,
body.ranks-page .badge-card strong {
  color: white;
}

body.ranks-page p,
body.ranks-page .heading-meta span,
body.ranks-page .rank-meter span,
body.ranks-page .unlock-summary span,
body.ranks-page .badge-panel p,
body.ranks-page .badge-card span {
  color: rgba(255, 255, 255, 0.68);
}

body.ranks-page .rank-badge {
  position: relative;
  grid-template-columns: 136px minmax(0, 1fr);
  min-width: min(100%, 430px);
  min-height: 178px;
  gap: 10px;
  padding: 24px 26px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(244, 185, 64, 0.26), rgba(124, 58, 237, 0.18)),
    rgba(255, 255, 255, 0.08);
  color: white;
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.ranks-page .rank-badge::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.22), transparent 42%);
  content: "";
  pointer-events: none;
}

body.ranks-page .rank-badge img,
body.ranks-page .rank-badge span,
body.ranks-page .rank-badge strong {
  position: relative;
  z-index: 1;
}

body.ranks-page .rank-badge img {
  width: 136px;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.34));
}

body.ranks-page .rank-badge span {
  justify-self: end;
  width: max-content;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  text-transform: uppercase;
}

body.ranks-page .rank-badge strong {
  color: white;
  font-size: clamp(2.1rem, 4.8vw, 3.1rem);
  line-height: 1.05;
}

body.ranks-page .unlock-summary article {
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(63, 111, 217, 0.09)),
    rgba(255, 255, 255, 0.055);
}

body.ranks-page .unlock-summary article.complete {
  border-color: rgba(44, 163, 107, 0.34);
  background:
    linear-gradient(135deg, rgba(44, 163, 107, 0.24), rgba(244, 185, 64, 0.1)),
    rgba(255, 255, 255, 0.06);
}

body.ranks-page .rank-track {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 12% 20%, rgba(124, 58, 237, 0.24), transparent 18rem),
    radial-gradient(circle at 84% 30%, rgba(63, 111, 217, 0.2), transparent 20rem),
    linear-gradient(135deg, rgba(9, 12, 30, 0.96), rgba(20, 13, 42, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:is(body.today-page, body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) {
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(circle at 14% 8%, rgba(22, 140, 155, 0.24), transparent 26rem),
    radial-gradient(circle at 86% 18%, rgba(124, 58, 237, 0.2), transparent 25rem),
    linear-gradient(135deg, #071014 0%, #101827 52%, #160d26 100%);
}

:is(body.today-page, body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) .app-nav {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  background: rgba(7, 12, 20, 0.86);
}

:is(body.today-page, body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) .app-nav a {
  color: rgba(255, 255, 255, 0.72);
}

:is(body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) .app-nav a.active,
:is(body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) .app-nav a:hover {
  background: rgba(255, 255, 255, 0.94);
  color: #121827;
}

:is(body.workout-page, body.complete-page, body.friends-page, body.profile-page, body.avatar-shop-page, body.auth-page) .nav-logout button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

body.today-page .topbar,
body.workout-page .topbar,
body.complete-page .completion-hero,
body.complete-page .status-panel,
body.complete-page .rank-results article,
body.friends-page .topbar,
body.friends-page .friends-panel,
body.friends-page .status-panel,
body.friends-page .social-panel,
body.profile-page .topbar,
body.profile-page .profile-panel,
body.avatar-shop-page .topbar,
body.avatar-shop-page .avatar-shop-panel,
body.auth-page .auth-panel,
body.workout-page .coach-note,
body.today-page .placement-card,
body.workout-page .placement-steps,
body.workout-page .placement-workout-card,
body.workout-page .placement-wait {
  position: relative;
  isolation: isolate;
  border-color: var(--glass-border);
  background: var(--glass-panel-bg);
  box-shadow: var(--glass-shadow-lg);
}

body.today-page .workout-card,
body.today-page .status-panel,
body.workout-page .exercise-tile,
body.friends-page .social-list article,
body.friends-page .friend-card,
body.profile-page .friend-stats small,
body.avatar-shop-page .avatar-choice {
  position: relative;
  isolation: isolate;
  border-color: var(--glass-border-soft);
  background: var(--glass-card-bg);
  box-shadow: var(--glass-shadow-md);
}

body.today-page .topbar::after,
body.today-page .workout-card::after,
body.today-page .placement-card::after,
body.workout-page .topbar::after,
body.workout-page .exercise-tile::after,
body.workout-page .placement-steps::after,
body.workout-page .placement-workout-card::after,
body.workout-page .placement-wait::after,
body.complete-page .completion-hero::after,
body.friends-page .topbar::after,
body.friends-page .friends-panel::after,
body.friends-page .social-panel::after,
body.profile-page .topbar::after,
body.profile-page .profile-panel::after,
body.avatar-shop-page .topbar::after,
body.avatar-shop-page .avatar-shop-panel::after,
body.auth-page .auth-panel::after {
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: inherit;
  opacity: 0.42;
  filter: blur(15px);
  background: var(--glow-teal-purple);
  content: "";
  pointer-events: none;
}

body.today-page .workout-card:nth-child(2)::after,
body.complete-page .completion-hero::after,
body.profile-page .profile-panel::after {
  background: linear-gradient(135deg, rgba(240, 100, 73, 0.14), rgba(63, 111, 217, 0.13));
}

body.workout-page .exercise-tile:nth-child(odd)::after,
body.workout-page .placement-workout-card:nth-child(odd)::after,
body.friends-page .social-panel::after,
body.auth-page .auth-panel::after {
  background: linear-gradient(135deg, rgba(44, 163, 107, 0.15), rgba(244, 185, 64, 0.09));
}

body.today-page h1,
body.today-page h2,
body.today-page h3,
body.today-page strong,
body.workout-page h1,
body.workout-page h2,
body.workout-page h3,
body.workout-page strong,
body.complete-page h1,
body.complete-page h2,
body.complete-page h3,
body.complete-page strong,
body.friends-page h1,
body.friends-page h2,
body.friends-page h3,
body.friends-page strong,
body.profile-page h1,
body.profile-page h2,
body.profile-page h3,
body.profile-page strong,
body.avatar-shop-page h1,
body.avatar-shop-page h2,
body.avatar-shop-page h3,
body.avatar-shop-page strong,
body.auth-page h1,
body.auth-page h2,
body.auth-page h3,
body.auth-page strong {
  color: white;
}

body.today-page p,
body.today-page .card-actions span,
body.today-page .status-panel span,
body.workout-page p,
body.workout-page .tile-top small,
body.workout-page .tile-bottom em,
body.workout-page .coach-note span,
body.complete-page p,
body.complete-page .rank-results span,
body.complete-page .rank-results small,
body.complete-page .status-panel span,
body.complete-page .completion-actions span,
body.friends-page p,
body.friends-page .status-panel span,
body.friends-page .social-list span,
body.friends-page .friend-card span,
body.friends-page .friend-card p,
body.friends-page .friend-stats small,
body.profile-page p,
body.profile-page .friend-stats small,
body.avatar-shop-page p,
body.avatar-shop-page .avatar-shop-section-head p,
body.auth-page p,
body.auth-page .auth-form label,
body.friends-page .friend-form label,
body.profile-page .auth-form label {
  color: rgba(255, 255, 255, 0.68);
}

body.today-page .pill-list li,
body.friends-page .friend-stats small,
body.profile-page .friend-stats small {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.74);
}

body.today-page .pill-list .done,
body.workout-page .strike-row i.active {
  background: rgba(44, 163, 107, 0.9);
  color: white;
}

body.workout-page .strike-row i {
  background: rgba(255, 255, 255, 0.16);
}

body.today-page .ghost-action,
body.workout-page .ghost-action,
body.complete-page .primary-action,
body.complete-page .ghost-action,
body.friends-page .quiet-button,
body.profile-page .auth-form button,
body.auth-page .auth-form button {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(22, 140, 155, 0.92), rgba(63, 111, 217, 0.86));
  color: white;
}

body.friends-page .friend-form input,
body.profile-page .auth-form input,
body.profile-page .auth-form textarea,
body.auth-page .auth-form input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

body.friends-page .topbar .rank-badge {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: min(100%, 260px);
  min-width: 0;
  text-align: left;
}

body.friends-page .topbar .rank-badge span {
  justify-self: start;
  width: auto;
  white-space: normal;
}

body.friends-page .topbar .rank-badge strong {
  justify-self: end;
  color: #f4b940;
  text-shadow: 0 0 18px rgba(244, 185, 64, 0.34);
}

body.profile-page .auth-form input[type="color"] {
  padding: 4px;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(221, 229, 235, 0.88);
  background: rgba(246, 248, 251, 0.9);
  backdrop-filter: blur(14px);
}

.app-nav a {
  min-width: 104px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
  text-decoration: none;
}

.app-nav a.active,
.app-nav a:hover {
  background: var(--ink);
  color: white;
}

.nav-logout {
  margin: 0;
}

.nav-logout button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 850;
}

button,
.button {
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

button:disabled {
  cursor: default;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.1rem, 7vw, 4.6rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.6rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.app-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.dashboard,
.workout-view,
.complete-view,
.page-stack,
.auth-shell {
  display: grid;
  gap: 20px;
}

.dashboard {
  grid-template-columns: minmax(780px, 1fr) minmax(320px, 420px);
  grid-template-rows: auto auto minmax(28px, 1fr) auto 22px;
  align-items: start;
  min-height: calc(100vh - 132px);
}

.dashboard .topbar {
  grid-column: 1;
  width: min(100%, 1080px);
}

.dashboard .compact-progress {
  grid-column: 2;
  grid-row: 1;
}

.dashboard .workout-grid {
  grid-column: 1;
  grid-row: 4;
  align-self: end;
  justify-self: start;
  width: min(100%, 1080px);
  margin-bottom: 14px;
}

.dashboard .status-grid {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  width: min(100%, 1080px);
}

.dashboard .placement-card {
  grid-column: 1;
  grid-row: 3;
  width: min(100%, 1080px);
  align-self: start;
  justify-self: start;
}

.dashboard .topbar,
.auth-panel,
.workout-card,
.status-panel,
.library-panel,
.schedule-panel,
.custom-exercise-panel,
.friends-panel,
.profile-panel,
.social-panel,
.unlock-summary,
.rank-road,
.completion-hero,
.rank-results article,
.coach-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  padding: 18px 20px;
}

.auth-shell {
  min-height: calc(100vh - 64px);
  align-content: center;
  justify-items: center;
}

.auth-panel {
  display: grid;
  width: min(100%, 520px);
  gap: 14px;
  padding: 28px;
}

.auth-panel h1 {
  font-size: clamp(2.3rem, 8vw, 4rem);
}

.topbar.compact h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rank-badge {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-width: 188px;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(63, 111, 217, 0.24);
  border-radius: 8px;
  background: #edf3ff;
  color: var(--blue);
  text-align: right;
}

.rank-badge img {
  grid-row: span 2;
  width: 48px;
  aspect-ratio: 1;
  object-fit: contain;
  align-self: center;
  justify-self: start;
}

.rank-badge span,
.status-panel span,
.section-heading span,
.card-actions span,
.completion-actions span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.rank-badge strong {
  font-size: 1.15rem;
}

.dashboard .rank-badge {
  position: relative;
  grid-template-columns: 64px minmax(0, 1fr);
  overflow: hidden;
  border-color: rgba(244, 185, 64, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 221, 0.88)),
    #fffaf0;
  color: var(--ink);
  box-shadow:
    0 18px 42px rgba(23, 32, 38, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dashboard .rank-badge::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(240, 100, 73, 0.14), rgba(244, 185, 64, 0.2), rgba(44, 163, 107, 0.1));
  content: "";
  pointer-events: none;
}

.dashboard .rank-badge img,
.dashboard .rank-badge span,
.dashboard .rank-badge strong {
  position: relative;
  z-index: 1;
}

.dashboard .rank-badge img {
  width: 58px;
  filter: drop-shadow(0 8px 12px rgba(23, 32, 38, 0.18));
}

.dashboard .rank-badge span {
  justify-self: end;
  width: max-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(23, 32, 38, 0.08);
  color: #53616c;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.dashboard .rank-badge strong {
  color: #172026;
  font-size: clamp(1.15rem, 2.3vw, 1.45rem);
  line-height: 1.05;
}

.compact-progress {
  display: grid;
  justify-items: end;
  min-height: 156px;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}

.daily-progress {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 0;
  background: transparent;
}

.progress-ring-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: 156px;
  aspect-ratio: 1;
}

.progress-ring-shell.is-day-complete {
  width: 196px;
}

.progress-ring-flames {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.progress-ring-shell.is-day-complete .progress-ring-flames {
  opacity: 1;
}

body.today-page .progress-ring-shell.is-day-complete .progress-ring-flames {
  mix-blend-mode: screen;
}

.progress-ring {
  position: relative;
  z-index: 1;
  display: grid;
  width: 156px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--daily-progress), rgba(255, 255, 255, 0.32) 0);
  box-shadow: var(--shadow);
  font-size: 2rem;
  font-weight: 950;
}

.progress-ring-shell.is-day-complete .progress-ring {
  width: 88px;
  background: transparent;
  box-shadow: none;
  font-size: 1.15rem;
  color: #173628;
}

.progress-ring::before {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  content: "";
}

.progress-ring-shell.is-day-complete .progress-ring::before {
  inset: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 3px rgba(44, 163, 107, 0.55);
}

.progress-ring span {
  position: relative;
  z-index: 1;
}

.placement-card,
.placement-steps,
.placement-wait {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.placement-card {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
  padding: 18px;
}

body.today-page .placement-card {
  gap: 14px;
}

body.today-page .placement-card .primary-action,
body.today-page .placement-card .ghost-action {
  min-height: 42px;
}

body.today-page .placement-card .primary-action {
  border: 0;
  background: linear-gradient(135deg, rgba(22, 140, 155, 0.92), rgba(63, 111, 217, 0.86));
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

body.today-page .placement-card .ghost-action {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.placement-card h2,
.placement-card p {
  margin-bottom: 0;
}

.placement-card-actions,
.placement-actions,
.placement-fail-form {
  gap: 10px;
}

.placement-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: stretch;
  width: 100%;
}

.placement-card-actions > .button,
.placement-card-actions > form {
  min-width: 0;
}

.placement-card-actions .primary-action,
.placement-card-actions .ghost-action,
.placement-card-actions form button {
  width: 100%;
}

.placement-actions,
.placement-fail-form {
  display: flex;
  flex-wrap: wrap;
}

.placement-card-actions form {
  margin: 0;
}

@media (min-width: 520px) {
  .placement-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.rest-day-offer,
.rest-day-active {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(63, 111, 217, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.rest-day-offer h2,
.rest-day-offer p,
.rest-day-active h2,
.rest-day-active p {
  margin-bottom: 0;
}

.rest-day-offer small {
  color: var(--muted);
  font-weight: 700;
}

.rest-day-actions {
  display: grid;
  gap: 10px;
}

.rest-day-actions form {
  margin: 0;
}

.rest-day-actions button {
  width: 100%;
}

body.today-page .rest-day-offer,
body.today-page .rest-day-active {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(63, 111, 217, 0.22), rgba(22, 140, 155, 0.14)),
    rgba(255, 255, 255, 0.06);
}

body.today-page .rest-day-offer h2,
body.today-page .rest-day-active h2,
body.today-page .rest-day-offer p,
body.today-page .rest-day-active p,
body.today-page .rest-day-offer small {
  color: rgba(255, 255, 255, 0.9);
}

@media (min-width: 520px) {
  .rest-day-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.placement-shell {
  display: grid;
  gap: 18px;
}

.placement-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.placement-steps article {
  display: grid;
  gap: 4px;
  min-height: 96px;
  align-content: center;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(22, 140, 155, 0.12), rgba(244, 185, 64, 0.16));
}

.placement-steps strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.placement-steps span {
  color: var(--muted);
  font-weight: 800;
}

.placement-actions {
  align-items: center;
}

.placement-actions button,
.placement-fail-form button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 900;
}

.placement-wait {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 22px;
}

.placement-wait h2,
.placement-wait p {
  margin-bottom: 0;
}

body.workout-page .placement-steps,
body.workout-page .placement-workout-card,
body.workout-page .placement-wait {
  position: relative;
  isolation: isolate;
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)),
    rgba(11, 18, 28, 0.86);
  color: white;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
}

body.workout-page .placement-steps strong,
body.workout-page .placement-workout-card strong,
body.workout-page .placement-workout-card h2,
body.workout-page .placement-wait h2 {
  color: white;
}

body.workout-page .placement-steps span,
body.workout-page .placement-workout-card p,
body.workout-page .placement-wait p {
  color: rgba(255, 255, 255, 0.72);
}

.placement-workout-grid {
  display: grid;
  gap: 18px;
}

.placement-workout-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.placement-workout-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.placement-workout-head h2,
.placement-workout-head p {
  margin-bottom: 0;
}

.placement-workout-head > strong {
  min-width: 58px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  text-align: center;
}

.placement-exercise-board {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.placement-exercise-board .exercise-tile {
  min-height: 220px;
  gap: 16px;
  padding: 18px;
}

.placement-exercise-board .tile-top strong {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.workout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.workout-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 184px;
  padding: 12px;
}

.workout-card h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.workout-card p:not(.eyebrow) {
  margin-bottom: 6px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.workout-card.complete {
  border-color: rgba(44, 163, 107, 0.45);
  background: #f0fbf6;
}

.workout-icon {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  font-weight: 950;
}

.workout-card:nth-child(2) .workout-icon {
  background: var(--teal);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}

.pill-list li {
  padding: 5px 7px;
  border-radius: 8px;
  background: #eef2f5;
  color: #34424d;
  font-size: 0.78rem;
  font-weight: 750;
}

.pill-list .done {
  background: #daf6e8;
  color: var(--green);
}

.card-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-items: end;
  gap: 8px;
}

.primary-action,
.ghost-action {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  border-radius: 8px;
  font-weight: 850;
}

button.ghost-action:disabled {
  min-width: 0;
  padding: 0 14px;
  color: var(--muted);
}

body.today-page button.ghost-action:disabled {
  color: white;
  opacity: 1;
  -webkit-text-fill-color: white;
}

.primary-action {
  min-width: 150px;
  padding: 0 18px;
  background: var(--ink);
  color: white;
}

.ghost-action {
  min-width: 112px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}

.status-panel {
  min-height: 92px;
  padding: 12px;
}

.status-panel strong {
  display: block;
  margin-bottom: 0;
  font-size: 1.55rem;
}

.status-rank-icon {
  width: 66px;
  aspect-ratio: 1;
  object-fit: contain;
}

.library-panel,
.schedule-panel,
.custom-exercise-panel,
.rank-road,
.friends-panel,
.profile-panel,
.social-panel,
.unlock-summary {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.heading-meta {
  display: grid;
  gap: 4px;
  text-align: right;
}

.section-heading h2 {
  margin-bottom: 0;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.schedule-search {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.schedule-search label {
  color: var(--muted);
  font-weight: 850;
}

.schedule-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.schedule-empty {
  padding: 12px;
  border: 1px solid rgba(244, 185, 64, 0.3);
  border-radius: 8px;
  background: rgba(244, 185, 64, 0.12);
}

.builder-panel {
  align-content: start;
}

.builder-panel > .schedule-form {
  padding-top: 4px;
}

.builder-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  cursor: pointer;
  list-style: none;
}

.builder-summary::-webkit-details-marker {
  display: none;
}

.builder-summary span {
  display: grid;
  gap: 4px;
}

.builder-summary strong {
  font-size: 1.35rem;
}

.builder-summary b {
  color: var(--muted);
  font-size: 0.92rem;
}

.builder-summary::after {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  content: "+";
  font-size: 1.4rem;
  font-weight: 900;
}

.builder-panel[open] .builder-summary::after {
  content: "-";
}

.plan-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 224px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.plan-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

.plan-card-head h3 {
  margin-bottom: 0;
}

.plan-card-head strong {
  display: grid;
  width: 52px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #121820;
  font-size: 1.3rem;
}

.plan-card p {
  margin-bottom: 0;
}

.plan-action {
  align-self: end;
  margin-top: auto;
}

.plan-action button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 850;
}

.plan-action button:disabled {
  padding: 0 10px;
  background: rgba(100, 114, 125, 0.32);
  color: rgba(255, 255, 255, 0.76);
  opacity: 1;
}

.plan-card.locked {
  opacity: 0.78;
}

.plan-card.is-filtered {
  display: none;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  font-weight: 850;
}

.filter-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}

.filter-toggle.inline {
  justify-self: start;
}

.filter-toggle.compact {
  min-height: 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

.plan-meta-grid {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.plan-meta-grid label {
  color: var(--muted);
  font-weight: 850;
}

.plan-meta-grid input:not([type="checkbox"]),
.plan-meta-grid select,
.plan-meta-grid textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.plan-meta-grid textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.schedule-form {
  display: grid;
  gap: 16px;
}

.weekday-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-tabs label {
  display: grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.weekday-tabs input:checked + label {
  border-color: rgba(244, 185, 64, 0.72);
  background: linear-gradient(135deg, rgba(244, 185, 64, 0.95), rgba(240, 100, 73, 0.88));
  color: #121820;
}

.weekly-schedule {
  display: grid;
}

.weekday-panel {
  display: none;
  gap: 14px;
}

.weekday-heading {
  display: grid;
  gap: 2px;
}

.weekday-heading h3 {
  margin-bottom: 0;
}

.weekday-tabs:has(#weekday-0:checked) + .weekly-schedule .weekday-panel:nth-child(1),
.weekday-tabs:has(#weekday-1:checked) + .weekly-schedule .weekday-panel:nth-child(2),
.weekday-tabs:has(#weekday-2:checked) + .weekly-schedule .weekday-panel:nth-child(3),
.weekday-tabs:has(#weekday-3:checked) + .weekly-schedule .weekday-panel:nth-child(4),
.weekday-tabs:has(#weekday-4:checked) + .weekly-schedule .weekday-panel:nth-child(5),
.weekday-tabs:has(#weekday-5:checked) + .weekly-schedule .weekday-panel:nth-child(6),
.weekday-tabs:has(#weekday-6:checked) + .weekly-schedule .weekday-panel:nth-child(7) {
  display: grid;
}

.weekday-tabs:has(#plan-weekday-0:checked) + .weekly-schedule .weekday-panel:nth-child(1),
.weekday-tabs:has(#plan-weekday-1:checked) + .weekly-schedule .weekday-panel:nth-child(2),
.weekday-tabs:has(#plan-weekday-2:checked) + .weekly-schedule .weekday-panel:nth-child(3),
.weekday-tabs:has(#plan-weekday-3:checked) + .weekly-schedule .weekday-panel:nth-child(4),
.weekday-tabs:has(#plan-weekday-4:checked) + .weekly-schedule .weekday-panel:nth-child(5),
.weekday-tabs:has(#plan-weekday-5:checked) + .weekly-schedule .weekday-panel:nth-child(6),
.weekday-tabs:has(#plan-weekday-6:checked) + .weekly-schedule .weekday-panel:nth-child(7) {
  display: grid;
}

.custom-exercise-form {
  display: grid;
  gap: 10px;
}

.custom-exercise-form label {
  color: var(--muted);
  font-weight: 850;
}

.custom-exercise-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.custom-visibility {
  margin-top: 2px;
}

.visibility-form {
  display: grid;
  gap: 8px;
  margin: 0;
}

.visibility-form button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(22, 140, 155, 0.14);
  color: var(--ink);
  font-weight: 850;
}

.library-item.is-filtered {
  display: none;
}

.library-item .visibility-form {
  margin-top: 10px;
}

.schedule-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.schedule-card h3 {
  margin-bottom: 2px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
}

.schedule-row label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.schedule-row select,
.friend-form input,
.auth-form input,
.auth-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.schedule-row select {
  padding: 0 10px;
}

.auth-form textarea {
  padding: 10px 12px;
  resize: vertical;
}

.schedule-actions {
  display: flex;
  justify-content: flex-end;
}

.schedule-actions button,
.custom-exercise-form button,
.friend-form button,
.auth-form button,
.social-list button,
.friend-card button {
  min-width: 160px;
  min-height: 42px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 850;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  color: var(--muted);
  font-weight: 850;
}

.auth-form input {
  padding: 0 12px;
}

.auth-link {
  margin-bottom: 0;
  font-weight: 700;
}

.auth-link a {
  color: var(--teal);
  font-weight: 900;
}

.form-message {
  padding: 10px 12px;
  border: 1px solid rgba(240, 100, 73, 0.28);
  border-radius: 8px;
  background: #fff0eb;
  color: var(--coral);
  font-weight: 800;
}

.library-item {
  display: grid;
  min-height: 94px;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(44, 163, 107, 0.32);
  border-radius: 8px;
  background: #f3fbf7;
}

.library-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}

.library-item summary::-webkit-details-marker {
  display: none;
}

.library-item div {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.library-item .exercise-rank-label {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.library-item img {
  width: 54px;
  aspect-ratio: 1;
  object-fit: contain;
  justify-self: end;
  filter: drop-shadow(0 8px 14px rgba(23, 32, 38, 0.16));
}

.exercise-video {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(44, 163, 107, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.exercise-video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 6px;
  background: #000;
}

.exercise-video a,
.exercise-video span {
  color: var(--teal);
  font-weight: 850;
}

.library-item.locked {
  border-color: var(--line);
  background: #f5f7f9;
  color: #89939b;
}

.rank-results article.locked,
.library-item.locked {
  opacity: 0.72;
}

.library-item span,
.library-item small,
.rank-results span,
.rank-results small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.empty-state {
  margin-bottom: 0;
}

.exercise-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.exercise-board form {
  margin: 0;
}

.workout-rest-banner {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid rgba(47, 111, 237, 0.22);
  background: rgba(47, 111, 237, 0.08);
  color: #1f4fbf;
  font-weight: 600;
  text-align: center;
}

.workout-rest-banner[hidden] {
  display: none;
}

.placement-tile-wrap {
  display: grid;
  gap: 8px;
}

.placement-tile-wrap form {
  display: grid;
}

.placement-fail-form button {
  width: 100%;
  border: 1px solid rgba(240, 100, 73, 0.32);
  background: rgba(240, 100, 73, 0.1);
  color: #793124;
}

.exercise-tile {
  display: grid;
  width: 100%;
  min-height: 236px;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.exercise-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(63, 111, 217, 0.4);
}

.exercise-tile.pressed {
  transform: scale(0.99);
}

.exercise-tile.complete {
  border-color: rgba(44, 163, 107, 0.52);
  background: #ecfbf4;
}

.exercise-tile.is-timing {
  border-color: rgba(22, 140, 155, 0.58);
  background: rgba(22, 140, 155, 0.08);
  transform: none;
}

.tile-timer {
  color: var(--teal);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

body.workout-page .exercise-tile.is-timing,
body.placement-page .exercise-tile.is-timing {
  border-color: rgba(22, 140, 155, 0.72);
  background: rgba(22, 140, 155, 0.16);
}

body.workout-page .tile-timer,
body.placement-page .tile-timer {
  color: #8de8df;
}

.tile-top,
.tile-bottom {
  display: grid;
  gap: 6px;
}

.tile-top strong {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
}

.tile-top small,
.tile-bottom em {
  color: var(--muted);
  font-style: normal;
  font-weight: 750;
}

.tile-bottom b {
  color: var(--teal);
}

.strike-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.strike-row i {
  display: block;
  height: 16px;
  border-radius: 999px;
  background: #e2e8ee;
}

.strike-row i.active {
  background: var(--green);
}

.coach-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}

.coach-note span {
  color: var(--muted);
  font-weight: 700;
}

.completion-hero {
  padding: 34px;
}

.completion-hero h1 {
  margin-bottom: 10px;
}

.rank-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rank-track {
  position: relative;
  min-height: 280px;
  padding: 36px 24px 34px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(63, 111, 217, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 32, 38, 0.96), rgba(29, 42, 60, 0.92)),
    var(--ink);
  color: white;
}

.rank-line {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 38px;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  z-index: 0;
}

.rank-line span {
  display: block;
  width: calc(var(--progress-px, 0) * 1px);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--green), var(--blue));
  box-shadow: 0 0 24px rgba(244, 185, 64, 0.6);
}

.rank-track ol {
  position: relative;
  width: calc(var(--track-span-px, 20000) * 1px);
  height: 210px;
  padding: 0 58px;
  margin: 0;
  list-style: none;
  z-index: 1;
}

.rank-node {
  position: absolute;
  left: calc(var(--position-px, 0) * 1px);
  bottom: 74px;
  display: grid;
  width: 160px;
  justify-items: center;
  gap: 7px;
  text-align: center;
  transform: translateX(-50%);
}

.rank-node.edge-start {
  transform: translateX(0);
}

.rank-node.edge-end {
  transform: translateX(-100%);
}

.rank-node.high {
  bottom: 74px;
}

.rank-node b {
  display: grid;
  width: 88px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd3db;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}

.rank-node b img {
  width: 94px;
  aspect-ratio: 1;
  object-fit: contain;
  transform: translateX(-2px);
}

.rank-node.complete b {
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.rank-node.active b {
  width: 104px;
  background: rgba(244, 185, 64, 0.12);
  color: white;
  box-shadow: 0 0 28px rgba(244, 185, 64, 0.7);
}

.rank-node.active b img {
  width: 112px;
}

.rank-node strong {
  max-width: 15ch;
  color: white;
  font-size: 0.98rem;
  line-height: 1.15;
}

.rank-node span,
.rank-meter span,
.unlock-summary span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.rank-node span {
  color: rgba(255, 255, 255, 0.68);
}

.rank-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.unlock-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.unlock-summary article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.unlock-summary article.complete {
  border-color: rgba(44, 163, 107, 0.38);
  background: #eefaf5;
}

.friends-panel {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: center;
}

.profile-panel {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.friend-form {
  display: grid;
  gap: 10px;
}

.friend-form label {
  color: var(--muted);
  font-weight: 850;
}

.friend-form input {
  padding: 0 12px;
}

.friend-form button:disabled,
.friend-form input:disabled {
  opacity: 0.65;
}

.avatar-dot {
  width: 42px;
  aspect-ratio: 4 / 5;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 12px;
  background: var(--avatar);
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.16);
}

.avatar-dot.large,
.avatar-image {
  display: block;
  width: 42px;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.16);
  background: #eef2f6;
}

.avatar-image.large,
.avatar-imagebody.profile-page .app-shell,
body.avatar-shop-page .app-shell,
body.profile-page .page-stack,
body.avatar-shop-page .page-stack {
  min-width: 0;
  max-width: 100%;
}

.profile-rank-icon {
  width: 96px;
  aspect-ratio: 1;
  object-fit: contain;
}

.social-list {
  display: grid;
  gap: 10px;
}

.social-list article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.social-list span,
.friend-card span,
.friend-card p,
.friend-stats small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.quiet-button,
.social-list .quiet-button,
.friend-card .quiet-button {
  min-width: 96px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.friend-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.friend-rank-icon {
  width: 74px;
  aspect-ratio: 1;
  object-fit: contain;
}

.friend-card p {
  margin-bottom: 0;
}

.friend-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.friend-stats small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef2f5;
}

.friend-stats small img {
  width: 22px;
  aspect-ratio: 1;
  object-fit: contain;
}

.rank-results article {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.completion-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Mobile-first layout layer */
body.today-page {
  background:
    linear-gradient(90deg, rgba(8, 13, 18, 0.76), rgba(8, 13, 18, 0.5)),
    url("/static/images/today-background.PNG") center / cover;
}

.app-nav {
  position: sticky;
  top: 0;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  overflow-x: visible;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a,
.nav-logout {
  flex: 0 0 auto;
}

.app-nav a {
  min-width: max-content;
}

.app-shell {
  width: min(100% - 20px, 1160px);
  padding: 12px 0 24px;
}

.dashboard {
  grid-template-columns: 1fr;
  grid-template-rows: none;
  min-height: auto;
  gap: 12px;
}

.dashboard .topbar,
.dashboard .compact-progress,
.dashboard .placement-card,
.dashboard .workout-grid,
.dashboard .status-grid {
  grid-column: 1;
  grid-row: auto;
  width: 100%;
  max-width: none;
  justify-self: stretch;
  align-self: stretch;
  margin-bottom: 0;
}

.dashboard .workout-grid {
  align-self: stretch;
}

.dashboard .topbar {
  order: 1;
}

.dashboard .compact-progress {
  order: 2;
  justify-items: center;
  min-height: auto;
}

.dashboard .placement-card {
  order: 3;
}

.dashboard .status-grid {
  order: 2;
}

.dashboard .workout-grid {
  order: 4;
}

.topbar,
.section-heading,
.coach-note,
.completion-actions {
  align-items: stretch;
  flex-direction: column;
}

.topbar,
.auth-panel,
.library-panel,
.schedule-panel,
.custom-exercise-panel,
.rank-road,
.friends-panel,
.profile-panel,
.social-panel,
.unlock-summary,
.completion-hero {
  padding: 16px;
}

.rank-badge {
  grid-template-columns: 44px minmax(0, 1fr);
  min-width: 0;
  justify-items: start;
  text-align: left;
}

.rank-badge img {
  width: 44px;
}

.compact-progress {
  justify-items: stretch;
  min-height: 132px;
}

.workout-grid,
.status-grid,
.library-grid,
.plan-grid,
.schedule-grid,
.exercise-board,
.rank-results,
.friends-panel,
.profile-panel,
.friend-grid,
.unlock-summary {
  grid-template-columns: 1fr;
}

.status-grid {
  max-width: none;
}

.workout-card {
  grid-template-columns: 1fr;
}

.card-actions {
  grid-template-columns: 1fr;
  justify-items: stretch;
  text-align: left;
}

.primary-action,
.ghost-action {
  width: 100%;
  min-width: 0;
}

.completion-hero {
  padding: 22px;
}

.schedule-row,
.schedule-search,
.plan-meta-grid,
.social-list article {
  grid-template-columns: 1fr;
}

.schedule-actions {
  justify-content: stretch;
}

.schedule-actions button,
.custom-exercise-form button,
.friend-form button,
.auth-form button,
.social-list button,
.friend-card button {
  width: 100%;
}

.exercise-board {
  gap: 12px;
}

.exercise-tile {
  min-height: 188px;
  gap: 16px;
  padding: 18px;
}

.rank-track {
  padding: 28px 10px 30px;
}

.rank-track ol {
  width: 42000px;
}

.rank-meter {
  align-items: flex-start;
  flex-direction: column;
}

.heading-meta {
  text-align: left;
}

@media (min-width: 520px) {
  .app-shell {
    width: min(100% - 32px, 1160px);
    padding: 24px 0 32px;
  }

  .topbar,
  .auth-panel,
  .library-panel,
    .schedule-panel,
  .custom-exercise-panel,
  .rank-road,
  .friends-panel,
  .profile-panel,
  .social-panel,
  .unlock-summary,
  .completion-hero {
    padding: 20px;
  }

  .library-grid,
  .plan-grid,
  .rank-results,
  .friend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-grid,
  .unlock-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workout-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .card-actions {
    grid-template-columns: auto 1fr;
    justify-items: end;
  }

  .primary-action,
  .ghost-action {
    width: auto;
    min-width: 112px;
  }

  .primary-action {
    min-width: 150px;
  }

  .schedule-actions {
    justify-content: flex-end;
  }

  .schedule-actions button,
  .custom-exercise-form button,
  .plan-action button,
  .friend-form button,
  .auth-form button,
  .social-list button,
  .friend-card button {
    width: auto;
  }

  .social-list article {
    grid-template-columns: 42px minmax(0, 1fr);
  }
}

@media (min-width: 720px) {
  .topbar,
  .section-heading,
  .coach-note,
  .completion-actions {
    align-items: center;
    flex-direction: row;
  }

  .rank-badge {
    grid-template-columns: 48px minmax(0, 1fr);
    min-width: 188px;
    justify-items: stretch;
    text-align: right;
  }

  .rank-badge img {
    width: 48px;
  }

  .compact-progress {
    justify-items: end;
    min-height: 156px;
  }

  .placement-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
  }

  .placement-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    width: auto;
  }

  .placement-card-actions > .button,
  .placement-card-actions > form {
    flex: 0 1 auto;
    min-width: 0;
  }

  .placement-card-actions .primary-action,
  .placement-card-actions .ghost-action,
  .placement-card-actions form button {
    width: auto;
  }

  .completion-hero {
    padding: 34px;
  }

  .workout-grid,
  .plan-grid,
  .schedule-grid,
  .exercise-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-meta-grid {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .schedule-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .rank-meter {
    align-items: center;
    flex-direction: row;
  }

  .heading-meta {
    text-align: right;
  }

  .friends-panel {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .profile-panel {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .social-list article {
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
  }
}

@media (min-width: 921px) {
  .dashboard {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    grid-template-rows: auto auto minmax(28px, 1fr) auto 22px;
    min-height: calc(100vh - 132px);
    gap: 20px;
  }

  .dashboard .topbar,
  .dashboard .compact-progress,
  .dashboard .placement-card,
  .dashboard .workout-grid,
  .dashboard .status-grid {
    order: initial;
  }

  .dashboard .topbar {
    grid-column: 1;
    width: min(100%, 1080px);
  }

  .dashboard .compact-progress {
    grid-column: 2;
    grid-row: 1;
  }

  .dashboard .workout-grid {
    grid-column: 1;
    grid-row: 4;
    align-self: end;
    justify-self: start;
    width: min(100%, 1080px);
    margin-bottom: 14px;
  }

  .dashboard .status-grid {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    width: min(100%, 1080px);
  }

  .dashboard .placement-card {
    grid-column: 1;
    grid-row: 3;
    width: min(100%, 1080px);
  }

  .dashboard .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .library-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .plan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rank-results,
  .unlock-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .friend-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rank-track {
    padding: 36px 24px 34px;
  }

  .rank-track ol {
    width: 48000px;
  }
}

@media (min-width: 1120px) {
  .dashboard {
    grid-template-columns: minmax(780px, 1fr) minmax(320px, 420px);
  }
}

@media (max-width: 719px) {
  .plan-grid {
    display: flex;
    grid-template-columns: none;
    gap: 12px;
    max-width: 100%;
    padding: 2px 0 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-inline: 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .plan-card {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .weekday-tabs {
    grid-template-columns: repeat(7, minmax(38px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .weekday-tabs label {
    min-height: 42px;
    padding: 0 8px;
  }

  .schedule-card {
    gap: 14px;
    padding: 18px;
  }

  .schedule-card h3 {
    font-size: 1.42rem;
  }

  .schedule-row {
    gap: 8px;
  }

  .schedule-row label {
    font-size: 1rem;
  }

  .schedule-row select {
    min-height: 56px;
    padding: 0 14px;
    font-size: 1.06rem;
  }

  .rank-track {
    min-height: 620px;
    max-height: 72vh;
    padding: 28px 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .rank-track ol {
    position: relative;
    width: auto;
    height: calc(var(--track-span-px, 20000) * 1px);
    padding: 0 0 0 28px;
  }

  .rank-line {
    top: 0;
    right: auto;
    bottom: auto;
    left: 30px;
    width: 8px;
    height: 100%;
  }

  .rank-line span {
    width: 100%;
    height: calc(var(--progress-px, 0) * 1px);
    max-height: 100%;
    background: linear-gradient(180deg, var(--coral), var(--yellow), var(--green), var(--blue));
  }

  .rank-node,
  .rank-node.high {
    top: calc(var(--position-px, 0) * 1px);
    bottom: auto;
    left: 74px;
    grid-template-columns: 76px minmax(0, 1fr);
    width: min(100% - 84px, 280px);
    align-items: center;
    justify-items: start;
    gap: 10px;
    text-align: left;
    transform: translateY(-50%);
  }

  .rank-node.edge-start {
    transform: translateY(0);
  }

  .rank-node.edge-end {
    transform: translateY(-100%);
  }

  .rank-node b {
    width: 70px;
  }

  .rank-node b img {
    width: 76px;
  }

  .rank-node.active b {
    width: 78px;
  }

  .rank-node.active b img {
    width: 84px;
  }

  .rank-node strong,
  .rank-node span {
    grid-column: 2;
  }

  .dashboard {
    --progress-ring-size: 54px;
    --progress-ring-shell-size: 78px;
  }

  .dashboard .topbar {
    order: 1;
    grid-row: 1;
    min-height: 142px;
    padding-right: 84px;
  }

  .dashboard .compact-progress {
    order: 1;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    justify-items: end;
    min-height: 0;
    width: auto;
    margin: 16px;
    z-index: 2;
    pointer-events: none;
  }

  .dashboard .placement-card {
    order: 3;
  }

  .dashboard .status-grid {
    order: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
  }

  .dashboard .status-panel {
    display: grid;
    align-content: center;
    min-width: 0;
    min-height: 72px;
    padding: 8px 6px;
  }

  .dashboard .status-panel .eyebrow {
    margin-bottom: 4px;
    font-size: 0.56rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .dashboard .status-panel strong {
    font-size: 1rem;
    line-height: 1.05;
  }

  .dashboard .workout-grid {
    order: 4;
    grid-template-columns: 1fr;
  }

  .dashboard .progress-ring-shell {
    width: var(--progress-ring-shell-size);
  }

  .dashboard .progress-ring-shell.is-day-complete {
    width: calc(var(--progress-ring-shell-size) + 18px);
  }

  .dashboard .progress-ring {
    width: var(--progress-ring-size);
    box-shadow: 0 8px 22px rgba(18, 32, 46, 0.16);
  }

  .dashboard .progress-ring-shell.is-day-complete .progress-ring {
    width: calc(var(--progress-ring-size) - 6px);
    box-shadow: none;
  }

  .dashboard .progress-ring-flames {
    inset: -10%;
    width: 120%;
    height: 120%;
  }

  .dashboard .progress-ring::before {
    inset: 8px;
  }

  .dashboard .progress-ring span {
    display: none;
  }

  .dashboard .rank-badge {
    grid-template-columns: 50px minmax(0, 1fr);
    padding: 10px 12px;
  }

  .dashboard .rank-badge img {
    width: 50px;
  }

  body.ranks-page .rank-badge {
    grid-template-columns: 1fr;
    min-width: 0;
    min-height: 0;
    justify-items: center;
    gap: 8px;
    padding: 18px;
    text-align: center;
  }

  body.ranks-page .rank-badge img {
    grid-row: auto;
    width: min(100%, 280px);
    max-height: 280px;
  }

  body.ranks-page .rank-badge strong {
    font-size: clamp(2rem, 12vw, 3.2rem);
  }

  body.ranks-page .rank-badge span {
    justify-self: center;
    order: 3;
  }

  body.ranks-page .rank-badge strong {
    order: 2;
  }

  body.friends-page .topbar .rank-badge {
    width: 100%;
    padding: 12px 14px;
  }

  body.friends-page .topbar .rank-badge strong {
    font-size: clamp(1.4rem, 8vw, 2.15rem);
  }

  .library-item summary {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  .library-item img {
    width: 46px;
  }
}

@media (min-width: 720px) and (max-width: 959px) {
  .placement-exercise-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .placement-exercise-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* PWA shell */
html {
  -webkit-text-size-adjust: 100%;
}

body:has(.bottom-nav) .app-shell {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid rgba(221, 229, 235, 0.88);
  background: rgba(246, 248, 251, 0.92);
  backdrop-filter: blur(14px);
}

.app-brand {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.app-nav-desktop {
  position: static;
  flex: 1 1 auto;
  justify-content: flex-end;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.install-banner {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  z-index: 30;
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(8, 18, 24, 0.96), rgba(22, 140, 155, 0.94)),
    rgba(12, 16, 20, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  color: white;
  backdrop-filter: blur(16px);
}

.install-banner[hidden] {
  display: none !important;
}

.install-banner-copy {
  min-width: 0;
}

.install-banner strong {
  display: block;
  margin-bottom: 4px;
  color: white;
  font-size: 1rem;
}

.install-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.install-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.install-banner-primary,
.install-banner-dismiss {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  font-weight: 850;
}

.install-banner-primary {
  border: 0;
  background: white;
  color: #0d5f68;
}

.install-banner-dismiss {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

body.has-install-banner .app-shell {
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: none;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(221, 229, 235, 0.92);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 30px rgba(18, 32, 46, 0.08);
}

.bottom-nav-link {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 6px 4px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.bottom-nav-link.active,
.bottom-nav-link:hover {
  background: rgba(22, 140, 155, 0.12);
  color: var(--teal);
}

.bottom-nav-icon {
  font-size: 1rem;
  line-height: 1;
}

.app-settings-panel {
  display: grid;
  gap: 16px;
}

.app-settings-actions {
  display: grid;
  gap: 10px;
}

.settings-note {
  margin: 0;
}

.dev-status-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dev-status-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.dev-status-list strong {
  color: var(--ink);
}

.dev-status-list span {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.dev-tool-actions {
  display: grid;
  gap: 10px;
}

.dev-tool-actions form {
  margin: 0;
}

.dev-tool-actions button {
  width: 100%;
}

.dev-queue-note,
.dev-tools-panel code {
  color: var(--muted);
  font-size: 0.92rem;
}

.install-warning {
  color: var(--coral);
  font-weight: 750;
}

.install-inline-guide {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.install-inline-guide ol {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  color: var(--ink);
}

.install-inline-guide li + li {
  margin-top: 8px;
}

body.profile-page .install-inline-guide {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

body.profile-page .install-inline-guide,
body.profile-page .install-inline-guide ol,
body.profile-page .install-inline-guide .eyebrow {
  color: rgba(255, 255, 255, 0.88);
}

.settings-logout button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 850;
}

.delete-account-form {
  width: 100%;
}

.delete-account-button {
  width: 100%;
  min-height: 42px;
  border-color: rgba(180, 35, 24, 0.42);
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
}

body.profile-page .delete-account-button {
  border-color: rgba(255, 120, 104, 0.42);
  background: rgba(180, 35, 24, 0.16);
  color: #ffb4a8;
}

body.profile-page .account-danger-panel {
  display: grid;
  gap: 14px;
}

body.profile-page .account-danger-panel p {
  margin: 0;
}

body.is-standalone .install-banner {
  display: none !important;
}

body.today-page .app-topbar,
body.exercises-page .app-topbar,
body.ranks-page .app-topbar,
body.workout-page .app-topbar,
body.complete-page .app-topbar,
body.friends-page .app-topbar,
body.profile-page .app-topbar,
body.avatar-shop-page .app-topbar {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 16, 20, 0.78);
}

body.today-page .app-brand,
body.exercises-page .app-brand,
body.ranks-page .app-brand,
body.workout-page .app-brand,
body.complete-page .app-brand,
body.friends-page .app-brand,
body.profile-page .app-brand,
body.avatar-shop-page .app-brand {
  color: white;
}

body.today-page .bottom-nav,
body.exercises-page .bottom-nav,
body.ranks-page .bottom-nav,
body.workout-page .bottom-nav,
body.complete-page .bottom-nav,
body.friends-page .bottom-nav,
body.profile-page .bottom-nav,
body.avatar-shop-page .bottom-nav {
  border-top-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 16, 20, 0.94);
}

body.today-page .bottom-nav-link,
body.exercises-page .bottom-nav-link,
body.ranks-page .bottom-nav-link,
body.workout-page .bottom-nav-link,
body.complete-page .bottom-nav-link,
body.friends-page .bottom-nav-link,
body.profile-page .bottom-nav-link,
body.avatar-shop-page .bottom-nav-link {
  color: rgba(255, 255, 255, 0.72);
}

body.today-page .bottom-nav-link.active,
body.today-page .bottom-nav-link:hover,
body.exercises-page .bottom-nav-link.active,
body.exercises-page .bottom-nav-link:hover,
body.ranks-page .bottom-nav-link.active,
body.ranks-page .bottom-nav-link:hover,
body.workout-page .bottom-nav-link.active,
body.workout-page .bottom-nav-link:hover,
body.complete-page .bottom-nav-link.active,
body.complete-page .bottom-nav-link:hover,
body.friends-page .bottom-nav-link.active,
body.friends-page .bottom-nav-link:hover,
body.profile-page .bottom-nav-link.active,
body.profile-page .bottom-nav-link:hover,
body.avatar-shop-page .bottom-nav-link.active,
body.avatar-shop-page .bottom-nav-link:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

@media (max-width: 920px) {
  .app-nav-desktop {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .app-topbar {
    justify-content: center;
  }

  .install-banner {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: minmax(0, 1fr);
  }

  body.has-install-banner .app-shell {
    padding-bottom: calc(188px + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 640px) {
  .install-banner {
    right: 16px;
    left: 16px;
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 921px) {
  .bottom-nav {
    display: none;
  }

  .app-brand {
    display: none;
  }

  body:has(.bottom-nav) .app-shell {
    padding-bottom: 32px;
  }

  body.has-install-banner .app-shell {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .install-banner {
    right: 20px;
    left: auto;
    width: min(420px, calc(100% - 40px));
  }
}

.install-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 13, 18, 0.62);
  backdrop-filter: blur(4px);
}

.install-overlay[hidden] {
  display: none !important;
}

body.install-overlay-open {
  overflow: hidden;
}

.install-overlay .install-sheet-panel {
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.install-sheet-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.install-sheet-close {
  justify-self: end;
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}

.install-sheet-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink);
}

.install-sheet-steps li + li {
  margin-top: 10px;
}

.install-sheet-panel .primary-action {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: white;
  font-weight: 850;
}

body.profile-page .install-sheet-panel,
body.exercises-page .install-sheet-panel {
  background: #ffffff;
}

body.admin-page .auto-notification-list {
  display: grid;
  gap: 16px;
}

body.admin-page .auto-notification-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(12, 16, 20, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

body.admin-page .auto-notification-head h3 {
  margin: 0 0 4px;
}

body.admin-page .auto-notification-head p {
  margin: 0;
  color: var(--muted);
}

body.admin-page .auto-notification-time {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body.admin-page .auto-notification-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.admin-page .auto-notification-actions {
  display: flex;
  gap: 10px;
}

body.admin-page .auto-notification-delete {
  margin: 0;
}

body.admin-page .auto-notification-add {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(12, 16, 20, 0.08);
}

body.admin-page .form-message {
  color: #b42318;
}

body.profile-page .profile-shop-link,
body.avatar-shop-page .avatar-shop-toolbar .primary-action {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  border-radius: 8px;
  font-weight: 850;
  text-decoration: none;
}

body.avatar-shop-page .avatar-shop-form {
  display: grid;
  gap: 16px;
}

body.avatar-shop-page .avatar-shop-panel {
  display: grid;
  gap: 14px;
}

body.avatar-shop-page .avatar-shop-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

body.avatar-shop-page .avatar-shop-section-head h2 {
  margin: 0 0 6px;
}

body.avatar-shop-page .avatar-shop-section-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
}

body.avatar-shop-page .avatar-shop-panel.is-locked {
  opacity: 0.92;
}

body.avatar-shop-page .avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

body.avatar-shop-page .avatar-shop-wallet {
  gap: 14px;
}

body.avatar-shop-page .avatar-shop-toolbar {
  display: flex;
  justify-content: flex-start;
}

body.avatar-shop-page .avatar-shop-toolbar .primary-action {
  display: inline-grid;
  min-height: 48px;
  min-width: min(100%, 320px);
  place-items: center;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: linear-gradient(135deg, #3f6fd9 0%, #5b6eea 42%, #7c3aed 100%);
  box-shadow:
    0 16px 36px rgba(63, 111, 217, 0.38),
    0 8px 22px rgba(124, 58, 237, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  color: white;
  font-weight: 900;
  text-shadow: 0 1px 10px rgba(18, 24, 48, 0.28);
}

body.avatar-shop-page .avatar-shop-toolbar .primary-action:hover {
  filter: brightness(1.07);
}

body.avatar-shop-page .avatar-choice {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(22, 140, 155, 0.22), rgba(124, 58, 237, 0.12)),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

body.avatar-shop-page .avatar-choice.selected {
  border-color: rgba(22, 140, 155, 0.72);
  box-shadow:
    0 0 0 2px rgba(22, 140, 155, 0.24),
    0 18px 44px rgba(0, 0, 0, 0.28);
}

body.avatar-shop-page .avatar-choice.locked {
  opacity: 0.72;
  cursor: not-allowed;
}

body.avatar-shop-page .avatar-choice-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(8, 12, 18, 0.5);
}

body.avatar-shop-page .avatar-choice-preview img,
body.avatar-shop-page .avatar-choice-preview .avatar-dot {
  width: 100%;
  height: 100%;
  border-radius: 14px;
}

body.avatar-shop-page .avatar-choice-preview img {
  object-fit: contain;
}

body.avatar-shop-page .avatar-choice-preview .avatar-dot {
  border: 0;
  box-shadow: none;
}

body.avatar-shop-page .avatar-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(8, 12, 18, 0.52);
  color: white;
  font-size: 1.2rem;
}

/* Avatar portraits: 4:5 cards with soft corners */
.profile-hero {
  align-items: center;
}

.profile-hero-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-hero-visual {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

body.profile-page .profile-hero-visual .profile-hero-avatar,
body.profile-page .profile-hero-visual .avatar-image.profile-hero-avatar,
body.profile-page .profile-hero-visual .avatar-dot.profile-hero-avatar,
body.avatar-shop-page .profile-hero-visual .profile-hero-avatar,
body.avatar-shop-page .profile-hero-visual .avatar-image.profile-hero-avatar,
body.avatar-shop-page .profile-hero-visual .avatar-dot.profile-hero-avatar {
  width: min(81vw, 342px);
  max-width: 100%;
  flex-shrink: 1;
  min-width: 0;
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: 20px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

body.profile-page .profile-hero-visual .avatar-image.profile-hero-avatar,
body.avatar-shop-page .profile-hero-visual .avatar-image.profile-hero-avatar {
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

body.profile-page .profile-hero-visual .profile-rank-icon,
body.avatar-shop-page .profile-hero-visual .profile-rank-icon {
  width: min(57vw, 234px);
  max-width: 100%;
  flex-shrink: 1;
  min-width: 0;
}

.avatar-dot,
.avatar-image {
  aspect-ratio: 4 / 5;
  border-radius: 14px;
}

.avatar-image {
  object-fit: contain;
  background: #eef2f6;
}

@media (max-width: 719px) {
  .topbar.profile-hero {
    min-width: 0;
    max-width: 100%;
  }

  .profile-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-hero-visual {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    gap: 12px;
    padding-top: 8px;
  }

  body.profile-page .profile-hero-visual .profile-rank-icon,
  body.avatar-shop-page .profile-hero-visual .profile-rank-icon {
    width: min(34vw, 128px);
    max-width: 128px;
  }

  body.profile-page .profile-hero-visual .profile-hero-avatar,
  body.profile-page .profile-hero-visual .avatar-image.profile-hero-avatar,
  body.profile-page .profile-hero-visual .avatar-dot.profile-hero-avatar,
  body.avatar-shop-page .profile-hero-visual .profile-hero-avatar,
  body.avatar-shop-page .profile-hero-visual .avatar-image.profile-hero-avatar,
  body.avatar-shop-page .profile-hero-visual .avatar-dot.profile-hero-avatar {
    width: min(76vw, 300px);
    max-width: 100%;
  }

  body.avatar-shop-page .avatar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.avatar-shop-page .avatar-choice {
    min-width: 0;
    padding: 8px;
  }
}

.badge-summary {
  display: grid;
  gap: 16px;
}

.badge-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(22, 140, 155, 0.18), rgba(124, 58, 237, 0.1)),
    rgba(255, 255, 255, 0.045);
}

.badge-panel h3 {
  margin: 0;
  font-size: 1.05rem;
}

.badge-panel p {
  margin: 0;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}

.badge-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.badge-card img {
  width: 52px;
  aspect-ratio: 1;
  object-fit: contain;
}

.badge-card strong {
  font-size: 0.78rem;
  line-height: 1.2;
}

.badge-card span {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.badge-card.current {
  background:
    linear-gradient(135deg, rgba(44, 163, 107, 0.18), rgba(22, 140, 155, 0.12)),
    rgba(255, 255, 255, 0.06);
}

body.avatar-shop-page .avatar-owned {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 999px;
  background: rgba(44, 163, 107, 0.92);
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
}

body.avatar-shop-page .avatar-choice-cost {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
}

body.avatar-shop-page .avatar-cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

body.avatar-shop-page .avatar-cost-chip img {
  width: 18px;
  aspect-ratio: 1;
  object-fit: contain;
}

body.avatar-shop-page .avatar-cost-chip.free,
body.avatar-shop-page .avatar-cost-chip.owned {
  padding-inline: 10px;
}

body.avatar-shop-page .avatar-cost-chip.owned {
  border-color: rgba(44, 163, 107, 0.42);
  background: rgba(44, 163, 107, 0.16);
  color: #b8f0d0;
}

body.avatar-shop-page .avatar-choice.locked .avatar-cost-chip:not(.owned) {
  opacity: 0.72;
}

body.avatar-shop-page .badge-card strong {
  color: white;
}

body.avatar-shop-page .badge-card span {
  color: white;
}

@media (max-width: 719px) {
  .badge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
