/* CouchSpring – mobile first. Dark or light as set in Settings or by the system (<html data-theme>,
   see js/services/theme.js); dark is easier on the eyes on a TV, light reads better in a bright gym.
   The brand is the orange and black of the app icon (assets/icon.svg): the dark look is that black with the
   orange as the accent. Target muscles are the accent colour, the helping ones teal, far from it on any
   colour wheel and for colour-blind eyes too. */

:root {
	--bg: #0f1115;
	--surface: #181b22;
	--surface-2: #222632;
	--border: #2c3140;
	--text: #f2f4f8;
	--text-muted: #9aa3b5;
	--accent: #f5a524;
	--accent-text: #0f1115;
	--success: #3ddc84;
	--success-text: #06210f;
	--danger: #ff5c6c;
	--danger-text: #2a0509;
	--muscle-primary: #f5a524;
	--muscle-secondary: #3dd6c6;
	--body-map-base: #2c3140;
	--body-map-hover: #4a5266;
	--sketch-body: #c9cfd9;
	--sketch-far: #6f788b;
	--sketch-primary: var(--muscle-primary);
	--sketch-shine: rgb(255 255 255 / 0.55);
	--sketch-shades: #0b0d12;
	--sketch-lens: #5ec8ff;
	--sketch-shadow: rgb(0 0 0 / 0.45);
	--sketch-metal: #8a93a6;
	--sketch-rope: #5ec8ff;
	--sketch-band: #ff4d6d;
	--tempo-slow: #6cb8ff;
	--tempo-fast: #ff7a45;
	--tempo-quick: #c6f432;
	--tempo-hold: #b493ff;
	--figure-glow: #1e2330;
	--figure-edge: var(--surface);
	--glass: rgb(15 17 21 / 0.7);
	--bar-bg: rgb(24 27 34 / 0.92);
	--nav-shadow: rgb(0 0 0 / 0.7);
	--shadow: 0 6px 24px rgb(0 0 0 / 0.4);
	--radius: 16px;
	--radius-small: 10px;
	--gap: 16px;
	--tabbar-height: 54px;
	/* Safe areas (notch, home indicator, rounded corners). The Android app gets them as --safe-area-inset-*
	   from Capacitor, because older Android WebViews report env() as 0. */
	--safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
	--safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
	--safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
	--safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
	/* The tab bar reaches a little into the bottom safe area (home indicator, gesture bar): its labels sit
	   just above the indicator instead of a full inset higher. */
	--tabbar-inset: max(calc(var(--safe-bottom) - 14px), 0px);
	/* What the tab bar takes at the bottom of the screen; folded away, only the safe area. */
	--tabbar-space: calc(var(--tabbar-height) + var(--tabbar-inset));
	/* Width of the tab bar when it stands on the right edge (landscape), see the end of this file. */
	--rail-width: 0px;
	/* Colours of the user's own workouts (domain/routines.js, ROUTINE_COLOR_COUNT). */
	--routine-0: #5ec8ff;
	--routine-1: #ff6fb5;
	--routine-2: #ffa94d;
	--routine-3: #b493ff;
	--routine-4: #3dd6c6;
	--routine-5: #ffd43b;
	--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	color-scheme: dark;
}

:root[data-theme="light"] {
	--bg: #f2f4f7;
	--surface: #ffffff;
	--surface-2: #e9edf2;
	--border: #d5dbe4;
	--text: #12161d;
	--text-muted: #5a6475;
	--accent: #b45309;
	--accent-text: #ffffff;
	--success: #15803d;
	--success-text: #ffffff;
	--danger: #dc2626;
	--danger-text: #ffffff;
	--muscle-primary: #b45309;
	--muscle-secondary: #0a7a6f;
	--body-map-base: #d5dbe4;
	--body-map-hover: #b3bccb;
	/* A dark figure with bright orange muscles: the darker muscle orange has the same lightness as grey. */
	--sketch-body: #3f4757;
	--sketch-far: #9aa3b3;
	--sketch-primary: #f08c00;
	--sketch-shine: rgb(255 255 255 / 0.3);
	--sketch-shades: #05060a;
	--sketch-lens: #38bdf8;
	--sketch-shadow: rgb(15 23 42 / 0.16);
	--sketch-metal: #8d96a6;
	--sketch-rope: #0e8fd6;
	--sketch-band: #e11d48;
	--tempo-slow: #1d6fd1;
	--tempo-fast: #d9480f;
	--tempo-quick: #4d7c0f;
	--tempo-hold: #7048e8;
	--figure-glow: #ffffff;
	--figure-edge: #e3e8ee;
	--glass: rgb(255 255 255 / 0.8);
	--bar-bg: rgb(255 255 255 / 0.92);
	--nav-shadow: rgb(255 255 255 / 0.9);
	--shadow: 0 6px 24px rgb(16 24 40 / 0.12);
	--routine-0: #0b7bc1;
	--routine-1: #c2257a;
	--routine-2: #c45a00;
	--routine-3: #6f42c1;
	--routine-4: #0b8a7d;
	--routine-5: #9a7400;

	color-scheme: light;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	/* No zoom on a double tap (pinching still zooms), so tapping the figure twice switches it twice. */
	touch-action: manipulation;
}

body {
	margin: 0;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.45;
	-webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
	margin: 0;
}

h1 {
	font-size: 1.75rem;
	line-height: 1.15;
	letter-spacing: -0.01em;
}

a {
	color: var(--accent);
}

ul,
ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

button {
	font: inherit;
	color: inherit;
}

.icon {
	width: 1.25em;
	height: 1.25em;
	flex: none;
}

/* Layout */

.app {
	max-width: 720px;
	margin: 0 auto;
	padding: max(var(--safe-top), 16px) max(var(--safe-right), 16px) 24px max(var(--safe-left), 16px);
}

.has-tabbar .app {
	padding-bottom: calc(var(--tabbar-space) + 24px);
}

/* Loading screen (index.html) from the first paint until the router renders the first view. The icon stands
   where the native splash has it: 20 % of a square that the launch screens aspect-fill (SPLASH_SHARE in
   dev/app-icons.mjs), so 20 % of the longer side. Capped for large desktop screens. */
.loading-screen {
	--logo-size: min(20vmax, 240px);

	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	place-items: center;
	background: var(--bg);
	transition: opacity 200ms ease-out, visibility 0s linear 200ms;
}

/* The first view is there. Pure CSS, so the loading screen never outstays the app, not even when the scripts
   come from an older cache that knows nothing about it. */
.app:not(:empty) ~ .loading-screen {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.loading-screen__logo {
	width: var(--logo-size);
	height: var(--logo-size);
}

/* Under the icon, and only for a slow start: a quick one is over before the bar fades in. */
.loading-screen__progress {
	position: absolute;
	top: calc(50% + var(--logo-size) * 0.5 + 24px);
	left: 50%;
	width: 96px;
	height: 4px;
	overflow: hidden;
	border-radius: 2px;
	background: var(--surface-2);
	transform: translateX(-50%);
	animation: loading-screen-appear 300ms ease-out 1s both;
}

.loading-screen__progress::after {
	content: '';
	position: absolute;
	inset: 0;
	width: 40%;
	border-radius: inherit;
	background: var(--accent);
	animation: loading-screen-progress 1.2s ease-in-out infinite;
}

@keyframes loading-screen-appear {
	from {
		opacity: 0;
	}
}

@keyframes loading-screen-progress {
	from {
		transform: translateX(-100%);
	}

	to {
		transform: translateX(250%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.loading-screen {
		transition: none;
	}

	.loading-screen__progress {
		display: none;
	}
}

.view {
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	overflow-x: clip;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.page-header {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 8px;
}

.eyebrow {
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.muted {
	color: var(--text-muted);
}

/* For screen readers only. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.small {
	font-size: 0.875rem;
}

.section-title {
	margin: 4px 0 10px;
	font-size: 1.1rem;
}

.back-link {
	align-self: flex-start;
	color: var(--text-muted);
	text-decoration: none;
}

button.back-link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	cursor: pointer;
}

/* Copyright and the way to the About page, at the bottom of the main screens. */
.credits {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 16px;
	padding-block: 8px;
	color: var(--text-muted);
	font-size: 0.8rem;
}

.credits a {
	color: inherit;
}

.credits__about {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	text-decoration: none;
}

.credits__about .icon {
	width: 16px;
	height: 16px;
}

.about-libraries {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.about-libraries a {
	color: var(--accent);
}

.sticky-footer {
	position: sticky;
	bottom: calc(var(--tabbar-space) + 8px);
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 0 0;
	background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}

body:not(.has-tabbar) .sticky-footer {
	bottom: calc(var(--safe-bottom) + 8px);
}

/* Tab bar */

.tabbar {
	position: fixed;
	inset: auto 0 0;
	display: none;
	justify-content: space-around;
	height: calc(var(--tabbar-height) + var(--tabbar-inset));
	padding-bottom: var(--tabbar-inset);
	transition: transform 0.2s ease-out, visibility 0.2s;
	background: var(--bar-bg);
	backdrop-filter: blur(12px);
	border-top: 1px solid var(--border);
	z-index: 10;
}

.has-tabbar .tabbar {
	display: flex;
}

/* The tab bar is folded away until the round button in the corner opens it (router.js). The content
   keeps room for that button; a full-width sticky button and the resume bar move out of its way. */
.has-tabbar:not(.is-tabbar-open) {
	--tabbar-space: var(--tabbar-inset);
}

.has-tabbar:not(.is-tabbar-open) .tabbar {
	visibility: hidden;
	transform: translateY(100%);
}

.has-tabbar:not(.is-tabbar-open) .app {
	padding-bottom: calc(var(--tabbar-inset) + 72px);
}

.has-tabbar:not(.is-tabbar-open) .sticky-footer {
	padding-right: 60px;
}

.has-tabbar:not(.is-tabbar-open) .resume-bar {
	margin-right: 56px;
}

.tabbar-toggle {
	position: fixed;
	right: max(var(--safe-right), 12px);
	bottom: calc(var(--tabbar-inset) + 12px);
	z-index: 12;
	display: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--bar-bg);
	box-shadow: var(--shadow);
	color: var(--text);
	backdrop-filter: blur(12px);
	cursor: pointer;
}

.has-tabbar:not(.is-tabbar-open) .tabbar-toggle {
	display: flex;
}

.tabbar__item.tabbar__fold {
	border: 0;
	background: none;
	font: inherit;
	font-size: 0.72rem;
	cursor: pointer;
}

.tabbar__item {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	color: var(--text-muted);
	font-size: 0.72rem;
	text-decoration: none;
}

.tabbar__item .icon {
	width: 22px;
	height: 22px;
}

.tabbar__item.is-active {
	color: var(--accent);
}

.resume-bar {
	position: fixed;
	right: 12px;
	bottom: calc(var(--tabbar-space) + 10px);
	left: 12px;
	z-index: 11;
	display: none;
	max-width: 696px;
	margin: 0 auto;
}

.has-resume-bar .resume-bar {
	display: block;
}

.has-resume-bar .app {
	padding-bottom: calc(var(--tabbar-space) + 88px);
}

.resume-bar__link {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--accent);
	box-shadow: var(--shadow);
	color: var(--accent-text);
	font-weight: 700;
	text-decoration: none;
}

.resume-bar__progress {
	margin-left: auto;
	font-size: 0.85rem;
	font-weight: 600;
}

/* Silent looping video that keeps the screen on during a workout (see services/wake-lock.js). */
.keep-awake-video {
	position: fixed;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	opacity: 0.01;
	pointer-events: none;
}

/* Cards */

.card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.card--highlight {
	border-color: var(--accent);
}

.card--muted {
	opacity: 0.75;
}

.card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.card__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 1.05rem;
}

/* Buttons */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 20px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: var(--surface-2);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.1s ease, opacity 0.2s ease;
}

.button:active:not(:disabled) {
	transform: scale(0.97);
}

.button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.button--primary {
	background: var(--accent);
	color: var(--accent-text);
}

.button--ghost {
	background: transparent;
	border-color: var(--border);
	color: var(--text);
}

.button--success {
	background: var(--success);
	color: var(--success-text);
}

.button--danger {
	background: var(--danger);
	color: var(--danger-text);
}

.button--danger-ghost {
	background: transparent;
	border-color: color-mix(in srgb, var(--danger) 40%, transparent);
	color: var(--danger);
}

.button--google {
	border-color: var(--border);
	background: #fff;
	color: #1f1f1f;
}

.button--block {
	width: 100%;
}

.button--large {
	min-height: 60px;
	font-size: 1.15rem;
}

.button--small {
	min-height: 36px;
	padding: 6px 14px;
	font-size: 0.875rem;
}

.button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--surface-2);
	cursor: pointer;
}

.icon-button.is-active {
	border-color: var(--accent);
	color: var(--accent);
}

.icon-button:disabled {
	opacity: 0.35;
}

.icon-button--small {
	width: 32px;
	height: 32px;
}

.link-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--accent);
	font-weight: 600;
	cursor: pointer;
}

/* Chips, tags, badges */

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

.chip {
	min-height: 40px;
	padding: 8px 14px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface-2);
	font-size: 0.9rem;
	cursor: pointer;
}

.focus-card__more {
	display: inline-flex;
	text-decoration: none;
	align-items: center;
	gap: 6px;
	align-self: flex-start;
	font-size: 0.9rem;
}

.chip--icon {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.chip--icon .icon {
	width: 16px;
	height: 16px;
}

.chip.is-selected {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	color: var(--accent);
	font-weight: 600;
}

.tag {
	align-self: flex-start;
	padding: 2px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--accent) 12%, transparent);
	color: var(--accent);
	font-size: 0.75rem;
	font-weight: 600;
}

.tag--muted {
	background: var(--surface-2);
	color: var(--text-muted);
}

.difficulty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
	--difficulty-color: var(--success);
}

.difficulty--medium {
	--difficulty-color: var(--accent);
}

.difficulty--hard {
	--difficulty-color: var(--danger);
}

.difficulty__meter {
	display: flex;
	gap: 3px;
}

.difficulty__segment {
	width: 8px;
	height: 8px;
	border-radius: 2px;
	background: var(--surface-2);
}

.difficulty__segment.is-filled {
	background: var(--difficulty-color);
}

.difficulty__value {
	color: var(--difficulty-color);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* Tempo: the style as a coloured label and, for slow work, one block per part of a rep, as wide as it
   takes – slow parts blue, brisk ones lime, explosive ones orange-red. */

.tempo--controlled,
.tempo--slow,
.tempo--flow {
	--tempo-color: var(--tempo-slow);
}

.tempo--power,
.tempo--explosive {
	--tempo-color: var(--tempo-fast);
}

.tempo--quick {
	--tempo-color: var(--tempo-quick);
}

.tempo--hold,
.tempo--stretch {
	--tempo-color: var(--tempo-hold);
}

.tempo__style {
	padding: 2px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--tempo-color) 16%, transparent);
	color: var(--tempo-color);
	font-size: 0.8rem;
	font-weight: 700;
	text-align: center;
}

.tempo__text {
	color: var(--text-muted);
	font-size: 0.92rem;
}

.tempo-bar {
	display: flex;
	gap: 4px;
}

.tempo-bar__phase {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	gap: 1px;
	padding: 8px 10px;
	border-radius: var(--radius-small);
	background: color-mix(in srgb, var(--phase-color) 16%, transparent);
	border-top: 3px solid var(--phase-color);
	color: var(--phase-color);
	--phase-color: var(--text-muted);
}

.tempo-bar__phase--slow {
	--phase-color: var(--tempo-slow);
}

.tempo-bar__phase--brisk {
	--phase-color: var(--tempo-quick);
}

.tempo-bar__phase--fast {
	--phase-color: var(--tempo-fast);
}

.tempo-bar__seconds {
	font-size: 1.05rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.tempo-bar__label {
	color: var(--text);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.2;
}

.tempo-bar__speed {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tempo-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
}

.tempo-line__phases {
	color: var(--text-muted);
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
}

.badge {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.badge--accent {
	background: var(--accent);
	color: var(--accent-text);
}

/* Forms */

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.field__label {
	color: var(--text-muted);
	font-size: 0.875rem;
}

.input {
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-small);
	background: var(--bg);
	color: var(--text);
	font: inherit;
	font-size: 1rem;
}

.input:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.input--compact {
	width: 72px;
	min-height: 40px;
	padding: 8px 10px;
	text-align: right;
}

.filter-label {
	margin: 0 0 6px;
	color: var(--text-muted);
	font-size: 0.8rem;
	font-weight: 600;
}

.toggle-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 6px 0;
	cursor: pointer;
}

.toggle-row__label {
	display: block;
	font-weight: 600;
}

.toggle-row__hint {
	display: block;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.switch {
	appearance: none;
	position: relative;
	flex: none;
	width: 52px;
	height: 32px;
	margin: 0;
	border-radius: 999px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	cursor: pointer;
	transition: background 0.2s ease;
}

.switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--text-muted);
	transition: transform 0.2s ease, background 0.2s ease;
}

.switch:checked {
	background: var(--accent);
}

.switch:checked::after {
	background: var(--accent-text);
	transform: translateX(20px);
}

.segmented {
	display: flex;
	padding: 4px;
	border-radius: 999px;
	background: var(--bg);
	border: 1px solid var(--border);
}

.segmented__option {
	flex: 1;
	min-height: 40px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	font-weight: 600;
	cursor: pointer;
}

.segmented__option.is-selected {
	background: var(--accent);
	color: var(--accent-text);
}

/* Welcome */

.welcome {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding-top: 24px;
	text-align: center;
}

.welcome .button,
.welcome form {
	width: 100%;
	text-align: left;
}

.welcome__title {
	font-size: 2.25rem;
}

.welcome__tagline {
	color: var(--text-muted);
	max-width: 32ch;
}

.divider {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.divider::before,
.divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--border);
}

/* Equipment */

.weight-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.weight-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.weight-row__field {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
}

.weight-row__times {
	color: var(--text-muted);
}

.weight-row .icon-button {
	margin-left: auto;
}

/* Goals */

.goal-card {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	width: 100%;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	text-align: left;
	cursor: pointer;
}

.goal-card.is-selected {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.goal-card__check {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 28px;
	height: 28px;
	border: 2px solid var(--border);
	border-radius: 50%;
	color: transparent;
}

.goal-card.is-selected .goal-card__check {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--accent-text);
}

.goal-card__name {
	display: block;
	font-weight: 700;
}

.goal-card__description {
	display: block;
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* Plan */

.plan-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 12px;
	counter-reset: plan;
}

.plan-item {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.plan-item__main {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

.plan-item__thumb {
	flex: none;
}

/* A movement sketch shrunk to a square tile, e.g. next to an exercise in the plan. */
.exercise-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 76px;
	height: 76px;
	padding: 4px;
	border-radius: var(--radius-small);
	background: var(--bg);
}

.exercise-thumb .sketch__svg {
	width: 100%;
	height: 100%;
	max-height: none;
}

.plan-item__target {
	color: var(--accent);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.plan-item__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.plan-item__order {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.plan-item__editor {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 8px;
	padding: 10px;
	border-radius: var(--radius-small);
	background: var(--bg);
}

.plan-item__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.stepper {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.stepper__label {
	color: var(--text-muted);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.stepper__controls {
	display: flex;
	align-items: center;
	gap: 4px;
}

.stepper__value {
	min-width: 44px;
	text-align: center;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.exercise-number {
	display: inline-block;
	margin-right: 0.5em;
	padding: 0.1em 0.45em;
	border-radius: 6px;
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 0.7em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	vertical-align: 0.15em;
	white-space: nowrap;
}

/* The name in the other language follows on the same line in small type, so it costs no extra line
   unless it has to wrap. */
.exercise-name {
	display: block;
}

.exercise-name__primary {
	font-weight: 700;
	font-size: 1.05rem;
}

.exercise-name__secondary,
.exercise-title__secondary {
	color: var(--text-muted);
	font-size: 0.85rem;
	font-weight: 400;
	letter-spacing: 0;
}

.exercise-title {
	display: block;
}

.exercise-title__secondary {
	font-size: 0.5em;
}

/* Movement sketch */

.sketch {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 12px;
}

.sketch__panel {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.sketch__panel figcaption {
	color: var(--text-muted);
	font-size: 0.8rem;
}

.sketch__svg {
	width: 100%;
	height: auto;
	max-height: 220px;
}

.sketch__body {
	stroke: var(--sketch-body);
	fill: var(--sketch-body);
}

.sketch__body--far {
	stroke: var(--sketch-far);
	fill: var(--sketch-far);
}

.sketch__body--primary {
	stroke: var(--sketch-primary);
	fill: var(--sketch-primary);
}

.sketch__body--primary.sketch__body--far {
	opacity: 0.6;
}

.sketch__outline {
	stroke: var(--surface);
	fill: var(--surface);
}

.sketch__shine {
	stroke: var(--sketch-shine);
	fill: var(--sketch-shine);
}

.sketch__shades {
	fill: var(--sketch-shades);
	stroke: var(--sketch-shades);
}

.sketch__lens {
	fill: var(--sketch-lens);
	stroke: var(--sketch-lens);
}

.sketch__shades-arm {
	stroke: var(--sketch-shades);
}

.sketch__mouth {
	stroke: var(--surface);
}

.sketch__shadow {
	fill: var(--sketch-shadow);
}

.sketch__ghost {
	stroke: var(--sketch-body);
	fill: var(--sketch-body);
	opacity: 0.18;
}

.sketch__floor {
	stroke: var(--border);
	stroke-width: 1.5;
}

.sketch__prop {
	fill: var(--surface-2);
	stroke: var(--border);
	stroke-width: 1;
}

.sketch__bar,
.sketch__weight {
	stroke: var(--sketch-metal);
	fill: var(--sketch-metal);
}

/* Barbell plates are see-through, so the body behind them stays readable. */
.sketch__plate {
	fill: color-mix(in srgb, var(--sketch-metal) 20%, transparent);
	stroke: var(--sketch-metal);
	stroke-width: 2;
}

.sketch__rope {
	stroke: var(--sketch-rope);
}

.sketch__band {
	stroke: var(--sketch-band);
}

.sketch__arrow {
	stroke: var(--accent);
	stroke-width: 2.4;
	stroke-dasharray: 5 4;
}

.sketch__arrowhead {
	fill: var(--accent);
}

.sketch__legend {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 0;
}

.sketch__swatch {
	flex: none;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background: var(--sketch-primary);
}

/* Figure */

.figure-frame {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 6 / 5;
	max-height: 46vh;
	background: radial-gradient(circle at 50% 40%, var(--figure-glow), var(--figure-edge) 70%);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}

.figure-frame--3d {
	flex-direction: column;
	align-items: stretch;
}

.figure-stage {
	position: relative;
	flex: 1;
	min-height: 0;
	touch-action: pan-y;
}

.figure-canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.figure-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* The 3D badge says which view this is and fades out after a while. */
@keyframes figure-badge-out {
	to { opacity: 0; }
}

/* One view of the stage (positioned by figure.js) with its caption at the top. */
.figure-pane {
	position: absolute;
	display: flex;
	justify-content: center;
	padding-top: 8px;
}

.figure-pane--detail {
	border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
	border-radius: 12px;
	background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.figure-caption {
	overflow: hidden;
	padding: 0 6px;
	color: var(--text-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-align: center;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

/* A rotatable view says so with a small badge in its corner (and turns a little when it appears). */
.figure-pane--rotatable {
	justify-content: flex-start;
	padding: 8px;
}

.figure-caption--rotate {
	animation: figure-badge-out 0.5s ease-in 3s forwards;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 24px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--glass);
}

.figure-caption--rotate .icon {
	width: 16px;
	height: 16px;
}

.figure-pane--detail {
	align-items: flex-start;
}

.figure-pane--detail .figure-caption {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	max-width: calc(100% - 8px);
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--glass);
	color: var(--accent);
}

/* Body map */

/* A picture that zooms by pinching (ui/zoom.js): one finger scrolls the page until it is zoomed in. */
.zoomable {
	position: relative;
	overflow: hidden;
	touch-action: pan-y;
}

.zoomable.is-zoomed {
	touch-action: none;
	cursor: grab;
}

.zoomable.is-dragging {
	cursor: grabbing;
}

/* No text or picture selection while dragging the picture around. */
.zoomable__content {
	user-select: none;
	-webkit-user-select: none;
}

.zoomable__content {
	transform-origin: 0 0;
}

.zoomable__controls {
	position: absolute;
	top: 0;
	right: 0;
	display: flex;
	gap: 6px;
}

.zoomable__controls .icon-button {
	background: var(--glass);
	backdrop-filter: blur(6px);
}

.body-map {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.body-map__views {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.body-map__view {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	margin: 0;
	color: var(--text-muted);
	font-size: 0.8rem;
}

.body-map__view svg {
	width: 100%;
	max-height: 300px;
}

.body-map__outline {
	fill: none;
	stroke: var(--border);
	stroke-width: 3;
}

.body-map__part {
	fill: var(--body-map-base);
}

.body-map__part.is-primary {
	fill: var(--muscle-primary);
}

.body-map__part.is-secondary {
	fill: var(--muscle-secondary);
}

.body-map__info {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.body-map__legend {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.legend-dot {
	width: 10px;
	height: 10px;
	margin-left: 8px;
	border-radius: 50%;
}

.legend-dot:first-child {
	margin-left: 0;
}

.legend-dot.is-primary {
	background: var(--muscle-primary);
}

.legend-dot.is-secondary {
	background: var(--muscle-secondary);
}

.muscle-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.muscle-list__item {
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 600;
}

.muscle-list__item.is-primary {
	background: color-mix(in srgb, var(--muscle-primary) 15%, transparent);
	color: var(--muscle-primary);
}

.muscle-list__item.is-secondary {
	background: color-mix(in srgb, var(--muscle-secondary) 15%, transparent);
	color: var(--muscle-secondary);
}

.player .body-map {
	flex-direction: row;
	align-items: center;
	gap: 16px;
}

.player .body-map__views {
	flex: none;
	width: 42%;
	max-width: 220px;
}

.player .body-map__view svg {
	max-height: 130px;
}

.player .body-map__view figcaption {
	display: none;
}

/* Glossary */

.glossary-map .body-map__part[data-muscle] {
	cursor: pointer;
	transition: fill 0.15s ease;
}

.glossary-map .body-map__part[data-muscle]:hover {
	fill: var(--body-map-hover);
}

.glossary-map .body-map__part.is-primary:hover {
	fill: var(--muscle-primary);
}

.glossary-map .body-map__view svg {
	max-height: 340px;
}

.glossary-detail__name {
	font-size: 1.4rem;
}

.glossary-detail__facts {
	display: grid;
	gap: 4px 0;
	margin: 0;
}

.glossary-detail__facts dt {
	margin-top: 8px;
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.glossary-detail__facts dd {
	margin: 0;
}

.glossary-detail__subtitle {
	margin: 4px 0 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

a.chip,
a.muscle-list__item {
	display: inline-flex;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

a.chip {
	min-height: 40px;
}

a.muscle-list__item.is-primary {
	color: var(--muscle-primary);
}

a.muscle-list__item.is-secondary {
	color: var(--muscle-secondary);
}

/* Catalogue: one column on a phone, figure beside the text from tablet width (and phone landscape),
   three columns on a wide monitor or TV so the whole exercise fits on screen. */

.catalog-filters {
	gap: 12px;
}

/* The line above the exercise: open the filters (what is picked, if anything), clear them, the position. */
.catalog-filter-bar {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	padding-block: 4px;
	scroll-margin-top: 8px;
}

.catalog-filter-bar__chevron {
	display: flex;
	color: var(--text-muted);
	transform: rotate(90deg);
	transition: transform 0.2s ease-out;
}

[aria-expanded="true"] > .catalog-filter-bar__chevron {
	transform: rotate(-90deg);
}

.catalog-filters__done {
	align-self: flex-start;
}

.catalog-filter-bar__position {
	flex: none;
	color: var(--text-muted);
	font-size: 0.9rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.catalog-filter-bar__summary {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 12px;
	min-width: 0;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--text);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.catalog-filter-bar__summary > .icon {
	flex: none;
	color: var(--accent);
}

.catalog-filter-bar__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.catalog-filter-bar__names {
	overflow: hidden;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.catalog-filter-bar__change {
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 600;
}

.filter-row {
	min-width: 0;
}

/* On a phone each chip row is one line that scrolls sideways, running out to the card edges. */
.chips--scroll {
	flex-wrap: nowrap;
	margin-inline: -16px;
	padding-inline: 16px;
	overflow-x: auto;
	scroll-padding-inline: 16px;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
	mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
}

.chips--scroll::-webkit-scrollbar {
	display: none;
}

.chips--scroll .chip {
	flex: none;
}

/* The figure with the arrows over its sides and the stamps that show while the card is dragged. */
.catalog-card__figure {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* On a phone the arrows lie over the sides of the figure (same box as .figure-frame), see-through so the
   figure shows behind them. */
.catalog-card__visual {
	position: relative;
}

.catalog-nav {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	aspect-ratio: 6 / 5;
	max-height: 46vh;
	padding-inline: 2px;
	pointer-events: none;
}

.catalog-nav__button {
	width: 40px;
	height: 40px;
	border: 0;
	background: none;
	color: var(--text);
	filter: drop-shadow(0 1px 2px var(--nav-shadow));
	pointer-events: auto;
}

.catalog-nav__button .icon {
	width: 28px;
	height: 28px;
}

.catalog-stamp {
	position: absolute;
	top: 40px;
	z-index: 1;
	padding: 4px 12px;
	border: 3px solid currentColor;
	border-radius: var(--radius-small);
	color: var(--accent);
	font-size: 1.4rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0;
	pointer-events: none;
}

.catalog-stamp--next {
	right: 16px;
	transform: rotate(12deg);
}

.catalog-stamp--previous {
	left: 16px;
	transform: rotate(-12deg);
}

/* Add the exercise to today's workout or to the user's own ones, each chip in its colour. */
.plan-picker {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.plan-picker__label {
	color: var(--text-muted);
	font-size: 0.8rem;
	font-weight: 600;
}

.plan-chip {
	--plan-color: var(--accent);

	display: inline-flex;
	align-items: center;
	gap: 6px;
	border-color: color-mix(in srgb, var(--plan-color) 45%, var(--border));
	color: var(--text);
}

.plan-chip .icon {
	width: 16px;
	height: 16px;
	color: var(--plan-color);
}

.plan-chip.is-selected {
	border-color: var(--plan-color);
	background: color-mix(in srgb, var(--plan-color) 18%, transparent);
	color: var(--plan-color);
	font-weight: 600;
}

.plan-chip--new {
	border-style: dashed;
	border-color: var(--border);
	color: var(--text-muted);
}

.plan-chip--new .icon {
	color: inherit;
}

.routine-form {
	display: flex;
	align-items: center;
	gap: 8px;
}

.routine-form .input {
	flex: 1;
	min-width: 0;
	min-height: 40px;
	padding-block: 8px;
}

.exercise-layout,
.exercise-layout__visual,
.exercise-layout__info,
.catalog-card__stage {
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	min-width: 0;
}

.catalog-slide--from-next {
	animation: slide-from-right 0.25s ease-out;
}

.catalog-slide--from-previous {
	animation: slide-from-left 0.25s ease-out;
}

@keyframes slide-from-right {
	from { opacity: 0; transform: translateX(40px); }
}

@keyframes slide-from-left {
	from { opacity: 0; transform: translateX(-40px); }
}

.catalog-hint {
	text-align: center;
}

@media (min-width: 640px) {
	/* Labels beside their chips, the availability switch beside the (short) kind row. */
	.catalog-filters {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: 10px 24px;
		padding-block: 12px;
	}

	.filter-row {
		display: flex;
		align-items: baseline;
		gap: 12px;
		grid-column: 1;
	}

	.filter-row .filter-label {
		flex: none;
		min-width: 5.5em;
		margin: 0;
	}

	.filter-row + .filter-row {
		grid-column: 1 / -1;
	}

	.catalog-filters .toggle-row {
		grid-column: 2;
		grid-row: 1;
		padding: 0;
	}

	.catalog-filters__done {
		grid-column: 1 / -1;
	}

	.chips--scroll {
		margin-inline: 0;
		padding-inline: 0 28px;
		scroll-padding-inline: 0;
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
		mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
	}
}

/* The exercise (catalogue and detail): figure beside the text from tablet width and on a phone held
   sideways. The figure with its arrows stays on screen while the text beside it scrolls. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
	/* The arrows move to the edges of the screen, so they change the whole exercise rather than look like
	   a photo gallery: the left one see-through over the figure, the right one over the text. */
	.catalog-nav {
		position: fixed;
		top: 50%;
		right: calc(var(--rail-width) + max(var(--safe-right), 4px));
		left: max(var(--safe-left), 4px);
		z-index: 5;
		height: 0;
		aspect-ratio: auto;
		max-height: none;
	}

	.catalog-nav__button:last-child {
		border: 1px solid var(--border);
		background: var(--glass);
		backdrop-filter: blur(6px);
		filter: none;
	}

	.app:has(> .exercise-page) {
		max-width: 1920px;
		padding-inline: max(var(--safe-left), 24px) max(var(--safe-right), 24px);
	}

	.exercise-layout {
		display: grid;
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		align-items: start;
	}

	.exercise-layout__visual {
		position: sticky;
		top: 16px;
	}

	.exercise-layout .figure-frame {
		min-height: 160px;
		max-height: calc(100dvh - var(--tabbar-space) - 180px);
	}
}

@media (min-width: 900px) {
	.chips--scroll {
		flex-wrap: wrap;
		padding-inline: 0;
		overflow: visible;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.catalog-filters .chip {
		min-height: 36px;
		padding-block: 6px;
	}
}

/* A wide and tall screen (monitor, TV) has room for every section at once: no tabs, the sections flow
   in two columns beside the figure. */
@media (min-width: 1280px) and (min-height: 720px) {
	.app:has(> .exercise-page) {
		padding-inline: 32px;
	}

	.exercise-layout {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
		gap: 24px;
	}

	/* 380px is roughly the header, the filters, the arrows and the button above and below the figure. */
	.exercise-layout .figure-frame {
		min-height: 320px;
		max-height: calc(100dvh - var(--tabbar-space) - 380px);
	}

	.exercise-layout .sections {
		display: block;
		columns: 2;
		column-gap: 24px;
	}

	.exercise-layout .sections__tabs {
		display: none;
	}

	.exercise-layout .sections .sections__panel {
		display: block;
		margin-bottom: 24px;
		break-inside: avoid;
	}

	.exercise-layout .sketch__svg {
		max-height: 180px;
	}

	.exercise-layout .body-map__view svg {
		max-height: 230px;
	}
}

/* Phone in landscape (or AirPlay mirroring it): every line of height counts. The figure fills the left
   half from top to bottom, everything else (back link, filters, the exercise) scrolls on the right. */
@media (orientation: landscape) and (max-height: 500px) {
	:root {
		--tabbar-height: 48px;
	}

	.app {
		padding-top: max(var(--safe-top), 8px);
	}

	.resume-bar {
		left: auto;
		bottom: calc(var(--tabbar-space) + 8px);
	}

	/* The open filters cover the whole screen instead of the right half beside the figure. */
	.catalog-filters {
		position: fixed;
		top: max(var(--safe-top), 8px);
		right: calc(var(--rail-width) + max(var(--safe-right), 8px));
		bottom: max(var(--safe-bottom), 8px);
		left: max(var(--safe-left), 8px);
		z-index: 15;
		overflow-y: auto;
		box-shadow: var(--shadow);
	}

	.has-resume-bar .app {
		padding-bottom: calc(var(--tabbar-space) + 72px);
	}

	.resume-bar__link {
		min-height: 44px;
		padding-block: 6px;
	}

	.exercise-page {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		grid-template-rows: repeat(3, auto) 1fr;
		gap: 12px 20px;
		align-items: start;
	}

	.exercise-page > * {
		grid-column: 2;
	}

	.exercise-page > .exercise-layout {
		display: contents;
	}

	.exercise-layout__visual {
		position: sticky;
		top: max(var(--safe-top), 8px);
		grid-column: 1;
		grid-row: 1 / -1;
		height: calc(100dvh - var(--tabbar-space) - 16px);
	}

	.exercise-layout .figure-frame {
		flex: 1;
		min-height: 0;
		max-height: none;
		aspect-ratio: auto;
	}

	/* The figure fills the column, the add-to chips below it. */
	.catalog-card__stage {
		flex: 1;
		gap: 8px;
		min-height: 0;
	}

	.catalog-card__figure {
		flex: 1;
	}

	.plan-picker {
		flex-direction: row;
		align-items: center;
		gap: 8px;
	}

	.plan-picker .chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.plan-chip {
		flex: none;
		min-height: 36px;
		padding-block: 4px;
	}

	/* Smaller text so the picked section starts on the first screen. */
	.exercise-layout__info {
		gap: 12px;
		font-size: 0.875rem;
	}

	.exercise-layout__info h1 {
		font-size: 1.25rem;
	}

	.exercise-layout__info .page-header {
		gap: 4px;
		padding-top: 0;
	}

	.exercise-layout__info .card {
		position: relative;
		gap: 10px;
		padding: 12px 14px;
	}

	/* The tab already names the section: no card titles, only their buttons in the corner. */
	.exercise-layout__info .sections__panel .card__header {
		display: none;
	}

	.exercise-layout__info .sections__panel .card__header:has(.icon-button) {
		display: block;
		position: absolute;
		top: 6px;
		right: 6px;
	}

	/* Several corner buttons stack, so the text beside them keeps its width. */
	.exercise-layout__info .sections__panel .card__header .button-row {
		flex-direction: column;
		gap: 6px;
	}

	.exercise-layout__info .sections__panel .card__title {
		display: none;
	}

	/* The cue list wraps beside the corner button rather than under it. */
	.exercise-layout__info .sections__panel .card__header + * {
		padding-right: 48px;
	}

	.catalog-filter-bar {
		padding-block: 2px;
	}

	.catalog-hint {
		display: none;
	}
}

.notice {
	padding: 12px 14px;
	border-radius: var(--radius-small);
	background: color-mix(in srgb, var(--muscle-secondary) 12%, transparent);
	color: var(--muscle-secondary);
}

/* The feedback form (a Google form) inside the app. */
.feedback-form {
	width: 100%;
	height: 1100px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}

.link-card {
	flex-direction: row;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

.link-card__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--surface-2);
	color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
	.catalog-slide--from-next,
	.catalog-slide--from-previous {
		animation: none;
	}
}

/* Terms */

.term {
	display: inline;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline dotted var(--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
	cursor: help;
}

.term-sheet {
	position: fixed;
	inset: 0;
	z-index: 30;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 16px 16px calc(16px + var(--safe-bottom));
	background: rgb(0 0 0 / 0.5);
}

.term-sheet__card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	max-width: 560px;
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	font-size: 1.05rem;
}

.term-sheet__title {
	color: var(--accent);
	font-size: 1.2rem;
}

.term-sheet__actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.term-card__name {
	font-weight: 700;
	cursor: pointer;
}

.term-card[open] .term-card__name {
	color: var(--accent);
}

a.segmented__option {
	display: flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	text-decoration: none;
}

/* Cues */

.cue-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cue-list li {
	position: relative;
	padding-left: 22px;
}

.cue-list li::before {
	content: "";
	position: absolute;
	top: 0.55em;
	left: 4px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--accent);
}

.cue-list--large {
	font-size: 1.1rem;
}

.tip {
	padding: 12px 14px;
	border-left: 4px solid var(--accent);
	border-radius: var(--radius-small);
	background: var(--surface);
	font-size: 1.1rem;
}

/* Sections (see ui/sections.js): tabs above, one panel shown at a time. */

.sections {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}

.sections__panel {
	display: none;
	flex-direction: column;
	gap: var(--gap);
	min-width: 0;
}

.sections__panel.is-active {
	display: flex;
}

.sections__tabs .chip {
	min-height: 36px;
	padding-block: 6px;
}

/* Workout player */

.player {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-height: calc(100dvh - 40px);
}

.player__header {
	display: flex;
	align-items: center;
	gap: 12px;
}

.player__counter {
	color: var(--text-muted);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.progress {
	flex: 1;
	height: 6px;
	border-radius: 999px;
	background: var(--surface-2);
	overflow: hidden;
}

.progress__bar {
	height: 100%;
	background: var(--accent);
	transition: width 0.4s ease;
}

.player__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 16px;
}

.player__panel {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
}

.player__title {
	font-size: 1.6rem;
}

.player__target {
	color: var(--accent);
	font-size: 1.2rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.player__big {
	font-size: clamp(4rem, 22vw, 8rem);
	font-weight: 800;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.03em;
}

.player__big--rest {
	color: var(--accent);
}

.player__clock-label {
	color: var(--text-muted);
	font-size: 1.1rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.player__actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: auto;
	padding-bottom: var(--safe-bottom);
}

.player__actions--split {
	flex-direction: row;
}

/* Start the set and skip under the exercise name, in one row: start gets two thirds. */
.player__actions--intro {
	flex-direction: row;
	margin-top: 0;
	padding-bottom: 0;
}

.player__actions--intro .button--primary {
	flex: 2 1 0;
}

.player__actions--intro .button--ghost {
	flex: 1 1 0;
	min-width: 0;
}

.icon-button.is-muted {
	border-color: var(--danger);
	color: var(--danger);
}

.player__actions--split .button {
	flex: 1;
}

.player .figure-frame {
	max-height: 40vh;
}

.player__count {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.player--rest .player__visual {
	opacity: 0.5;
}

/* Landscape = a phone held sideways or mirrored to a TV via AirPlay (the TV shows the phone's screen, so
   it is just as short): animation left, info right, all of it on one screen without scrolling. Sizes
   follow the height, so the same layout grows on a big screen. The sections scroll inside if they have to. */
@media (orientation: landscape) and (min-width: 640px) {
	.app:has(.player) {
		max-width: none;
		padding: 12px max(var(--safe-right), 24px) 12px max(var(--safe-left), 24px);
	}

	.player {
		gap: clamp(8px, 2vh, 16px);
		height: calc(100dvh - 24px);
		min-height: 0;
	}

	.player__body {
		flex-direction: row;
		align-items: stretch;
		gap: clamp(16px, 3vw, 40px);
		min-height: 0;
	}

	.player__visual {
		flex: 1.1;
		max-height: none;
		aspect-ratio: auto;
	}

	.player__panel {
		flex: 1;
		justify-content: center;
		gap: clamp(4px, 1.4vh, 16px);
		min-width: 0;
		min-height: 0;
		overflow-y: auto;
	}

	.player__panel > * {
		flex: none;
	}

	/* The sections take what is left and scroll inside, the tabs and buttons stay put. */
	.player__panel > .sections {
		flex: 0 1 auto;
		min-height: 0;
		gap: clamp(6px, 1.8vh, 12px);
	}

	.player__panel .sections__tabs {
		flex: none;
	}

	.player__panel .sections__panel.is-active {
		flex: 0 1 auto;
		min-height: 0;
		overflow-y: auto;
	}

	/* The number of reps with the weight beside it, the countdown with what to do. */
	.player__count {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: baseline;
		column-gap: 20px;
	}

	.player__count .player__clock-label {
		order: 1;
	}

	.player .figure-frame {
		max-height: none;
	}

	.player__title {
		font-size: clamp(1.2rem, 6vh, 3rem);
	}

	.player__big {
		font-size: clamp(3rem, 20vh, 13rem);
	}

	.player__target,
	.tip,
	.cue-list--large {
		font-size: clamp(0.95rem, 3.8vh, 1.6rem);
	}

	.cue-list--large {
		gap: clamp(4px, 1.4vh, 10px);
	}

	.tip {
		padding: clamp(6px, 1.6vh, 12px) 14px;
	}

	.player .body-map__view svg {
		max-height: max(100px, 30vh);
	}

	.player__actions {
		flex-direction: row;
	}

	.player__actions {
		margin-top: 0;
	}

	.player__actions .button {
		flex: 1;
		width: auto;
		white-space: nowrap;
	}

	.player__actions .button--large {
		min-height: clamp(44px, 12vh, 80px);
		padding-block: 8px;
		font-size: clamp(1rem, 4vh, 1.5rem);
	}

	/* Skip is the less likely choice, so it gets less room. */
	.player__actions .button--ghost {
		flex: 0 1 auto;
		min-height: clamp(44px, 12vh, 80px);
	}

	.player__actions--intro .button--primary {
		flex: 2 1 0;
	}

	.player__actions--intro .button--ghost {
		flex: 1 1 0;
		white-space: normal;
	}
}

/* On a phone held sideways the English (or Czech) second name would cost a line. */
@media (orientation: landscape) and (max-height: 500px) {
	.player .exercise-title__secondary {
		display: none;
	}

	.player .eyebrow {
		font-size: 0.7rem;
	}

	/* The 3D figure already shows the muscles; the names are enough. */
	.player .body-map__views {
		display: none;
	}
}

/* Summary */

.summary-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.sticky-footer .button-row > .button {
	flex: 1;
}

/* A phone held sideways or a TV: the exercises side by side and the buttons in one row, using the width
   of the screen instead of a narrow column with wide margins. */
@media (orientation: landscape) and (min-width: 640px) {
	.app:has(.summary-list),
	.app:has(.change-list) {
		max-width: 1400px;
	}

	.summary-list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	}

	.view:has(.summary-list) .sticky-footer {
		flex-direction: row;
	}

	.view:has(.summary-list) .sticky-footer > * {
		flex: 1;
	}
}

.set-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.set-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 2px solid var(--border);
	background: var(--surface-2);
	font-weight: 700;
	cursor: pointer;
}

.set-chip--done {
	border-color: var(--success);
	background: color-mix(in srgb, var(--success) 15%, transparent);
	color: var(--success);
}

.set-chip--failed {
	border-color: var(--danger);
	background: color-mix(in srgb, var(--danger) 15%, transparent);
	color: var(--danger);
}

.set-chip--pending {
	color: var(--text-muted);
}

.big-check {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 88px;
	height: 88px;
	border-radius: 50%;
	background: var(--accent);
	color: var(--accent-text);
}

.big-check .icon {
	width: 48px;
	height: 48px;
}

.change-list {
	gap: 14px;
}

.change {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.change__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--surface-2);
	font-weight: 800;
}

.change--up .change__icon {
	background: color-mix(in srgb, var(--success) 15%, transparent);
	color: var(--success);
}

.change--down .change__icon {
	background: color-mix(in srgb, var(--danger) 15%, transparent);
	color: var(--danger);
}

.change__text {
	display: block;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.totals__numbers {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.totals__stat {
	display: flex;
	flex-direction: column;
	padding: 12px;
	border-radius: var(--radius-small);
	background: var(--bg);
}

.totals__value {
	color: var(--accent);
	font-size: 1.8rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.totals__label {
	color: var(--text-muted);
	font-size: 0.85rem;
}

/* History */

.history-item__exercises {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.history-item__exercises li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
	.button,
	.progress__bar,
	.switch,
	.switch::after {
		transition: none;
	}
}

/* Landscape (a phone held sideways, a tablet, a TV): the screen is wide, so the tab bar stands on the right
   edge as a rail of icons with their names underneath, always shown; no folding, no menu button. */
@media (orientation: landscape) and (min-width: 640px) {
	body.has-tabbar {
		--rail-width: 76px;
		--tabbar-space: var(--tabbar-inset);

		padding-right: calc(var(--rail-width) + var(--safe-right));
	}

	.tabbar,
	.has-tabbar:not(.is-tabbar-open) .tabbar {
		inset: 0 0 0 auto;
		flex-direction: column;
		justify-content: center;
		gap: 6px;
		width: calc(var(--rail-width) + var(--safe-right));
		height: auto;
		padding: var(--safe-top) var(--safe-right) var(--safe-bottom) 0;
		border-top: 0;
		border-left: 1px solid var(--border);
		visibility: visible;
		transform: none;
	}

	.tabbar__item {
		flex: none;
		min-height: 54px;
		font-size: 0.68rem;
	}

	.tabbar__item.tabbar__fold,
	.has-tabbar:not(.is-tabbar-open) .tabbar-toggle {
		display: none;
	}

	.has-tabbar:not(.is-tabbar-open) .app {
		padding-bottom: calc(var(--tabbar-inset) + 24px);
	}

	.has-tabbar:not(.is-tabbar-open) .sticky-footer {
		padding-right: 0;
	}

	.resume-bar,
	.has-tabbar:not(.is-tabbar-open) .resume-bar {
		right: calc(var(--rail-width) + 12px);
		margin-right: 0;
	}
}
