:root {
  color-scheme: light;
  --ink: #12201e;
  --muted: #61706b;
  --paper: #f7faf5;
  --surface: #ffffff;
  --soft: #edf4ef;
  --line: #dbe5df;
  --teal: #03a99e;
  --teal-dark: #067f79;
  --coral: #ff6b57;
  --lime: #d3e86d;
  --gold: #f3b64b;
  --plum: #5d537b;
  --shadow: 0 18px 50px rgba(18, 32, 30, 0.13);
  --radius: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3faf5;
  --muted: #a8b9b2;
  --paper: #0e1716;
  --surface: #162421;
  --soft: #20322f;
  --line: #29413d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  max-width: 100%;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem clamp(1rem, 4vw, 4rem);
  color: #ffffff;
  background: rgba(15, 31, 29, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(18px);
}

.brand,
.main-nav,
.hero-actions,
.panel-title,
.timer-controls,
.workout-summary,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  color: var(--lime);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22));
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark rect {
  fill: #10201f;
  stroke: rgba(211, 232, 109, 0.42);
  stroke-width: 2;
}

.brand-mark-d {
  fill: var(--lime);
}

.brand-mark-spark {
  fill: var(--gold);
}

.main-nav {
  gap: 0.35rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.main-nav a,
.header-action {
  min-height: 2.25rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.92rem;
  font-weight: 700;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: #0f1f1d;
  background: #ffffff;
  outline: none;
}

.header-action {
  color: #10201f;
  background: var(--lime);
}

.hero {
  position: relative;
  min-height: clamp(440px, 58svh, 620px);
  overflow: hidden;
  color: #ffffff;
}

.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-media {
  background-image: url("assets/home-fitness-hero.png");
  background-position: center;
  background-size: cover;
  transform: scale(1.01);
}

.hero-shade {
  background:
    linear-gradient(90deg, rgba(10, 18, 17, 0.88) 0%, rgba(10, 18, 17, 0.62) 38%, rgba(10, 18, 17, 0.12) 76%),
    linear-gradient(0deg, rgba(15, 31, 29, 0.6) 0%, rgba(15, 31, 29, 0) 44%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(4.5rem, 9vh, 7rem) 0 clamp(3.5rem, 7vh, 5.5rem);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--lime);
}

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

h1 {
  max-width: 10ch;
  margin-bottom: 0.8rem;
  font-size: clamp(3rem, 4.8rem, 5.4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 2.1rem, 2.5rem);
  line-height: 1.08;
}

h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.12;
}

.hero-copy {
  max-width: 40rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.75rem 1.05rem;
  border-radius: var(--radius);
  font-weight: 850;
}

.primary-action {
  color: #10201f;
  background: var(--lime);
}

.secondary-action {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.08);
}

.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible,
.header-action:hover,
.header-action:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.75rem, 4vw, 3.5rem) 0;
}

.today-layout,
.nutrition-layout,
.planner-layout,
.insights-layout {
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-heading {
  display: grid;
  gap: 0.1rem;
  margin-bottom: 1rem;
}

.metric-grid,
.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric-card,
.insight-card,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card,
.insight-card {
  min-height: 126px;
  padding: 1rem;
}

.today-tools {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.today-card,
.calendar-panel,
.backup-panel {
  min-width: 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.today-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quick-actions,
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.quick-start {
  min-height: 2.45rem;
  padding: 0.55rem 0.85rem;
  color: #10201f;
  background: var(--lime);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.goal-setting {
  min-width: 9rem;
  margin: 0;
}

.reminder-setting {
  display: grid;
  grid-template-columns: auto 7.5rem;
  gap: 0.55rem;
  align-items: center;
}

.reminder-setting .check-option {
  min-height: 2.45rem;
}

#reminder-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: right;
}

.nutrition-grid,
.nutrition-layout-grid {
  display: grid;
  gap: 0.85rem;
}

.nutrition-grid {
  grid-template-columns: 1.1fr 0.95fr 0.8fr;
  margin-bottom: 0.85rem;
}

.nutrition-layout-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  margin-bottom: 0.85rem;
}

.nutrition-panel {
  display: grid;
  gap: 0.85rem;
}

.nutrition-form {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 0.65fr 0.65fr 0.75fr auto;
  gap: 0.65rem;
  align-items: end;
}

.nutrition-list,
.quick-food-list,
.nutrition-history-list {
  display: grid;
  gap: 0.55rem;
}

.nutrition-card,
.quick-food-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nutrition-card strong,
.nutrition-card em,
.quick-food-card strong,
.quick-food-card em {
  display: block;
}

.nutrition-card em,
.quick-food-card em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.nutrition-meta {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  min-width: 6.5rem;
  text-align: right;
}

.nutrition-day-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nutrition-day-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.nutrition-day-head strong,
.nutrition-day-head em {
  display: block;
}

.nutrition-day-head em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.nutrition-day-foods {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nutrition-day-foods li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.nutrition-day-foods strong {
  flex: 0 0 auto;
  color: var(--ink);
}

.metric-label,
.metric-card span,
.insight-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-card strong,
.insight-card strong {
  display: block;
  margin: 0.35rem 0 0.15rem;
  font-size: 1.65rem;
  line-height: 1.05;
}

.accent-card {
  color: #ffffff;
  background: #14201e;
  border-color: #14201e;
}

.accent-card .metric-label,
.accent-card span {
  color: rgba(255, 255, 255, 0.72);
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  padding: clamp(1rem, 2.4vw, 1.35rem);
}

.panel-title {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.icon-button,
.theme-toggle,
.round-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: var(--ink);
  background: var(--soft);
  cursor: pointer;
}

.icon-button {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
}

.theme-toggle,
.legal-menu-toggle {
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  color: #10201f;
  background: var(--gold);
  border-radius: 50%;
}

.legal-menu-toggle {
  background: var(--lime);
}

.icon-button:hover,
.icon-button:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.legal-menu-toggle:hover,
.legal-menu-toggle:focus-visible,
.round-button:hover,
.round-button:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  outline: none;
}

.planner-form {
  display: grid;
  gap: 1rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segment {
  min-height: 2.5rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.segment.active,
.segment:hover,
.segment:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 0.55fr;
  gap: 0.8rem;
}

.plan-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.8rem;
  margin: 0;
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.check-option input {
  width: 1.1rem;
  height: 1.1rem;
  min-height: auto;
  accent-color: var(--teal-dark);
}

select,
input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

[data-theme="dark"] select,
[data-theme="dark"] input {
  background: #101d1b;
}

select:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(3, 169, 158, 0.18);
}

.custom-builder {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.exercise-form {
  display: grid;
  grid-template-columns: 1fr 0.75fr 0.7fr auto;
  gap: 0.65rem;
  align-items: end;
  padding: 0.75rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.exercise-detail-field {
  grid-column: span 2;
}

.builder-head,
.builder-actions,
.tool-filters {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.builder-head {
  justify-content: space-between;
}

#selection-count {
  flex: 0 0 auto;
  padding: 0.35rem 0.6rem;
  color: var(--teal-dark);
  background: #e6f6f3;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 900;
}

.tool-filters {
  flex-wrap: wrap;
}

.tool-filter,
.builder-button {
  min-height: 2.45rem;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
}

.tool-filter {
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  background: var(--soft);
}

.tool-filter.active,
.tool-filter:hover,
.tool-filter:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  outline: none;
}

.exercise-library {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.library-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  min-height: 6.1rem;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.library-card:hover,
.library-card:focus-within,
.library-card.selected {
  border-color: rgba(3, 169, 158, 0.55);
  background: #eefaf7;
}

[data-theme="dark"] .library-card:hover,
[data-theme="dark"] .library-card:focus-within,
[data-theme="dark"] .library-card.selected,
[data-theme="dark"] .exercise-item.done {
  background: #17322e;
}

.library-card input {
  width: 1.1rem;
  height: 1.1rem;
  min-height: auto;
  margin-top: 0.1rem;
  accent-color: var(--teal-dark);
}

.library-copy strong,
.library-copy span,
.library-copy em {
  display: block;
}

.library-copy strong {
  overflow-wrap: anywhere;
}

.library-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}

.library-copy em {
  margin-top: 0.3rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.library-actions,
.template-actions {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  justify-items: end;
}

.builder-actions {
  flex-wrap: wrap;
}

.builder-button,
.mini-button {
  padding: 0.55rem 0.85rem;
  color: var(--ink);
  background: var(--soft);
}

.mini-button {
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: 999px;
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.favorite-mini,
.favorite-button {
  color: #8a5b00;
  background: #fff4cf;
}

.favorite-mini.active,
.favorite-button.active {
  color: #10201f;
  background: var(--gold);
}

.danger-button {
  color: #8b241a;
  background: #ffe6e1;
}

.primary-builder {
  color: #10201f;
  background: var(--lime);
}

.builder-button:hover,
.builder-button:focus-visible,
.mini-button:hover,
.mini-button:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  outline: none;
}

.template-panel,
.template-list,
.history-list {
  display: grid;
  gap: 0.55rem;
}

.template-save {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.template-card,
.history-card,
.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.template-card strong,
.history-card strong,
.template-card em,
.history-card em {
  display: block;
}

.template-card em,
.history-card em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.empty-state {
  justify-content: center;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.workout-summary {
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.9rem;
  background: #14201e;
  border-radius: var(--radius);
  color: #ffffff;
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: -0.35rem 0 1rem;
}

.plan-actions span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.workout-summary span {
  display: block;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.88rem;
}

.workout-summary strong {
  font-size: 1.15rem;
}

.progress-ring {
  display: grid;
  flex: 0 0 auto;
  width: 4.4rem;
  height: 4.4rem;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lime) 0deg, rgba(255, 255, 255, 0.17) 0deg);
}

.progress-ring span {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  color: #ffffff;
  background: #14201e;
  border-radius: 50%;
  font-size: 0.94rem;
  font-weight: 900;
}

.exercise-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exercise-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 4.5rem;
  padding: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.favorite-button {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
}

.details-button {
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  border: 0;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #e6f6f3;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
}

.details-button:hover,
.details-button:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  outline: none;
}

.exercise-item input {
  width: 1.2rem;
  height: 1.2rem;
  min-height: auto;
  accent-color: var(--teal-dark);
}

.exercise-copy strong {
  display: block;
  overflow-wrap: anywhere;
}

.exercise-copy span,
.exercise-load {
  color: var(--muted);
  font-size: 0.9rem;
}

.exercise-load {
  padding: 0.35rem 0.55rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.exercise-item.done {
  border-color: rgba(3, 169, 158, 0.45);
  background: #eefaf7;
}

.exercise-item.done .exercise-copy strong {
  text-decoration: line-through;
}

.timer-panel {
  position: sticky;
  top: 88px;
  color: #ffffff;
  background: #12201e;
  border-color: #12201e;
}

.timer-panel.timer-active {
  box-shadow: 0 20px 60px rgba(3, 169, 158, 0.24);
}

.timer-panel .eyebrow,
.timer-panel .panel-title span {
  color: var(--lime);
}

.phase-pill {
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-weight: 850;
}

.timer-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0.85rem 0 1rem;
  padding: 0.28rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.timer-tab {
  min-height: 2.55rem;
  padding: 0.55rem 0.75rem;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  font-weight: 900;
  cursor: pointer;
}

.timer-tab.active {
  color: #10201f;
  background: var(--lime);
}

.timer-tab:hover,
.timer-tab:focus-visible {
  color: #10201f;
  background: var(--gold);
}

.timer-face {
  display: grid;
  gap: 0.4rem;
  min-height: 14rem;
  place-items: center;
  padding: 1.25rem;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(3, 169, 158, 0.22), transparent 62%),
    rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.timer-face strong {
  font-size: clamp(3.2rem, 4.4rem, 5.1rem);
  line-height: 1;
}

.timer-total {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  color: #10201f;
  background: var(--lime);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 900;
}

.timer-face span {
  color: rgba(255, 255, 255, 0.72);
}

.timer-face .timer-total {
  color: #10201f;
}

.timer-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 1rem;
}

.timer-settings label {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0.65rem;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 850;
}

.timer-settings input {
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  font-size: 1.1rem;
  font-weight: 900;
}

.timer-settings input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(211, 232, 109, 0.2);
}

.timer-settings span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.74rem;
}

.timer-controls {
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.round-button {
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 50%;
}

.primary-round {
  width: 3.8rem;
  height: 3.8rem;
  color: #10201f;
  background: var(--lime);
}

.timer-active .primary-round {
  transform: scale(1.06);
}

.recovery-strip {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem;
  color: #10201f;
  background: var(--gold);
  border-radius: var(--radius);
}

.recovery-strip span {
  color: rgba(18, 32, 30, 0.68);
  font-size: 0.88rem;
  font-weight: 800;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.calendar-panel {
  margin-bottom: 1rem;
}

#calendar-month-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.calendar-weekday,
.calendar-day {
  display: grid;
  min-height: 2.25rem;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
}

.calendar-weekday {
  min-height: 1.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-day {
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
}

.calendar-day.muted {
  cursor: default;
  opacity: 0;
}

.calendar-day.trained {
  color: #10201f;
  background: var(--lime);
  border-color: var(--lime);
}

.calendar-day:hover,
.calendar-day:focus-visible {
  color: #ffffff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  outline: none;
}

.calendar-day.today {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.day-bar {
  display: grid;
  align-content: end;
  min-height: 11rem;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bar-fill {
  min-height: 1.2rem;
  background: linear-gradient(0deg, var(--teal-dark), var(--teal));
  border-radius: 6px;
}

.day-bar.today .bar-fill {
  background: linear-gradient(0deg, var(--coral), var(--gold));
}

.day-bar span {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
  text-align: center;
}

.day-bar strong {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  text-align: center;
}

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

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.badge-card {
  min-width: 0;
  padding: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.badge-card.active {
  color: #10201f;
  background: var(--lime);
  border-color: var(--lime);
}

.badge-card strong,
.badge-card span {
  display: block;
}

.badge-card strong {
  font-size: 0.95rem;
}

.badge-card span {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.history-panel {
  margin-top: 1rem;
  padding: clamp(1rem, 2.4vw, 1.35rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.backup-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  align-items: center;
}

.backup-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.history-card {
  align-items: center;
}

.history-meta {
  display: grid;
  gap: 0.1rem;
  min-width: 5.5rem;
  text-align: right;
}

.day-detail-list {
  display: grid;
  gap: 0.75rem;
}

.day-detail-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.day-detail-card strong,
.day-detail-card span {
  display: block;
}

.day-detail-card span,
.day-detail-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.day-detail-card ul {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.1rem;
}

.day-detail-card em {
  color: var(--teal-dark);
  font-style: normal;
  font-weight: 900;
}

.exercise-dialog,
.legal-dialog {
  width: min(560px, calc(100% - 2rem));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.exercise-dialog::backdrop,
.legal-dialog::backdrop {
  background: rgba(5, 12, 11, 0.58);
  backdrop-filter: blur(8px);
}

.legal-dialog {
  width: min(760px, calc(100% - 2rem));
  max-height: min(86svh, 760px);
}

.legal-menu-dialog {
  width: min(420px, calc(100% - 2rem));
}

.dialog-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--soft);
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 900;
}

.dialog-body {
  display: grid;
  gap: 0.85rem;
  padding: 1.35rem;
}

.legal-copy {
  max-height: min(82svh, 720px);
  overflow: auto;
  padding-right: 1.75rem;
}

.legal-copy h3 {
  margin-top: 0.45rem;
  font-size: 1rem;
}

.legal-copy p {
  margin-bottom: 0;
  color: var(--muted);
}

.legal-copy a {
  color: var(--teal-dark);
  font-weight: 900;
}

.detail-load {
  justify-self: start;
  padding: 0.35rem 0.65rem;
  color: #10201f;
  background: var(--lime);
  border-radius: 999px;
  font-weight: 900;
}

.detail-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.detail-list div {
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-list dt {
  color: var(--teal-dark);
  font-weight: 900;
}

.detail-list dd {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.site-footer {
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1rem, 4vw, 4rem);
  color: rgba(255, 255, 255, 0.76);
  background: #12201e;
}

.site-footer a {
  color: var(--lime);
  font-weight: 850;
}

.footer-links,
.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.footer-links button,
.legal-button {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  color: var(--lime);
  background: transparent;
  border: 1px solid rgba(211, 232, 109, 0.34);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
}

.footer-links button:hover,
.footer-links button:focus-visible,
.legal-button:hover,
.legal-button:focus-visible {
  color: #10201f;
  background: var(--lime);
  outline: none;
}

.legal-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.legal-panel h2 {
  font-size: 1.2rem;
}

.legal-panel .legal-button {
  color: var(--teal-dark);
  background: var(--soft);
  border-color: var(--line);
}

.mobile-tabs {
  display: none;
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.app-tab {
  min-height: 2.8rem;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
}

.app-tab.active,
.app-tab:hover,
.app-tab:focus-visible {
  color: #10201f;
  background: var(--lime);
  outline: none;
}

.today-layout,
.planner-layout,
.nutrition-layout,
.insights-layout {
  display: none;
}

body[data-mobile-view="today"] .today-layout,
body[data-mobile-view="nutrition"] .nutrition-layout,
body[data-mobile-view="progress"] .insights-layout {
  display: block;
}

body[data-mobile-view="plan"] .planner-layout,
body[data-mobile-view="custom"] .planner-layout,
body[data-mobile-view="timer"] .planner-layout {
  display: grid;
}

body[data-mobile-view="plan"] .planner-layout,
body[data-mobile-view="custom"] .planner-layout,
body[data-mobile-view="timer"] .planner-layout {
  grid-template-columns: minmax(0, 1fr);
  width: min(860px, 100%);
  margin-inline: auto;
}

body[data-mobile-view="plan"] .custom-builder,
body[data-mobile-view="plan"] .timer-panel,
body[data-mobile-view="custom"] .planner-panel > .panel-title,
body[data-mobile-view="custom"] .planner-form,
body[data-mobile-view="custom"] .workout-summary,
body[data-mobile-view="custom"] .plan-actions,
body[data-mobile-view="custom"] .exercise-list,
body[data-mobile-view="custom"] .timer-panel,
body[data-mobile-view="timer"] .planner-panel {
  display: none;
}

body[data-mobile-view="custom"] .custom-builder {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

body[data-mobile-view="timer"] .planner-layout {
  width: min(520px, 100%);
}

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

  .hero {
    min-height: 520px;
  }

  .hero-shade {
    background:
      linear-gradient(90deg, rgba(10, 18, 17, 0.9) 0%, rgba(10, 18, 17, 0.6) 68%, rgba(10, 18, 17, 0.22) 100%),
      linear-gradient(0deg, rgba(15, 31, 29, 0.68) 0%, rgba(15, 31, 29, 0) 50%);
  }

  .metric-grid,
  .nutrition-grid,
  .nutrition-layout-grid,
  .planner-layout,
  .insight-grid,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .timer-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: calc(4.55rem + env(safe-area-inset-bottom));
  }

  .site-header {
    min-height: 64px;
    gap: 0.55rem;
    padding-inline: 0.75rem;
  }

  .brand {
    min-width: 0;
    gap: 0.5rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }

  .brand span:last-child {
    max-width: 7.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .theme-toggle,
  .legal-menu-toggle {
    width: 2.25rem;
    height: 2.25rem;
  }

  .header-action {
    display: none;
  }

  .hero {
    display: none;
  }

  .app-shell {
    width: 100%;
    padding: 0.75rem 0.65rem 0;
  }

  .app-tabs {
    display: none;
  }

  .section-heading {
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.45rem;
  }

  h3 {
    font-size: 1.18rem;
  }

.today-layout,
.planner-layout,
.nutrition-layout,
.insights-layout {
  display: none;
  margin-bottom: 1rem;
}

body[data-mobile-view="today"] .today-layout,
body[data-mobile-view="nutrition"] .nutrition-layout,
body[data-mobile-view="progress"] .insights-layout {
  display: block;
}

  body[data-mobile-view="plan"] .planner-layout,
  body[data-mobile-view="custom"] .planner-layout,
  body[data-mobile-view="timer"] .planner-layout {
    display: grid;
  }

  body[data-mobile-view="plan"] .timer-panel,
  body[data-mobile-view="timer"] .planner-panel {
    display: none;
  }

  body[data-mobile-view="timer"] .timer-panel {
    display: block;
    min-height: auto;
  }

  .metric-grid,
  .nutrition-grid,
  .nutrition-layout-grid,
  .today-tools,
  .planner-layout,
  .insight-grid,
  .stats-grid,
  .badge-grid,
  .week-chart,
  .form-row,
  .plan-options,
  .exercise-form,
  .nutrition-form,
  .template-save {
    grid-template-columns: 1fr;
  }

  .today-card,
  .backup-panel {
    display: grid;
    gap: 0.75rem;
  }

  .quick-actions,
  .backup-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .backup-actions {
    grid-template-columns: 1fr 1fr;
  }

  .reminder-setting {
    grid-template-columns: 1fr 1fr;
  }

  .segmented {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    padding: 0.3rem;
  }

  .exercise-library {
    grid-template-columns: 1fr;
    max-height: none;
    padding-right: 0;
  }

  .panel,
  .history-panel,
  .calendar-panel,
  .backup-panel,
  .legal-panel {
    padding: 0.85rem;
    box-shadow: none;
  }

  .metric-card,
  .insight-card {
    min-height: auto;
    padding: 0.85rem;
  }

  .metric-card strong,
  .insight-card strong {
    font-size: 1.35rem;
  }

  .tool-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-filter,
  .builder-button {
    width: 100%;
    min-height: 2.55rem;
  }

  .builder-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segment {
    min-height: 2.75rem;
  }

  .timer-settings {
    grid-template-columns: 1fr;
    margin-top: 0.8rem;
  }

  .timer-face {
    min-height: 12rem;
    padding: 0.9rem;
  }

  .timer-face strong {
    font-size: clamp(2.65rem, 15vw, 4rem);
  }

  .timer-total {
    max-width: 100%;
    font-size: 0.78rem;
    text-wrap: balance;
  }

  .exercise-item {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.75rem;
  }

  .exercise-load,
  .details-button,
  .favorite-button {
    grid-column: 2;
    justify-self: start;
  }

  .library-card,
  .nutrition-card,
  .quick-food-card,
  .history-card,
  .template-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem;
  }

  .nutrition-card,
  .quick-food-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .nutrition-meta {
    justify-items: start;
    text-align: left;
  }

  .nutrition-day-head,
  .nutrition-day-foods li {
    display: grid;
    gap: 0.25rem;
  }

  .library-actions,
  .template-actions {
    grid-column: 2;
    justify-items: start;
  }

  .history-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-card .mini-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .week-chart {
    gap: 0.45rem;
  }

  .day-bar {
    grid-template-columns: minmax(0, 1fr) 3rem;
    align-items: center;
    min-height: auto;
  }

  .bar-fill {
    height: 1.2rem;
  }

  .day-bar span {
    margin-top: 0;
    text-align: right;
  }

  .day-bar strong {
    grid-column: 2;
    margin-top: 0;
    text-align: right;
  }

  .site-footer {
    display: none;
  }

  .legal-panel {
    display: grid;
  }

  .legal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .legal-dialog {
    width: calc(100% - 1rem);
    max-height: 88svh;
  }

  .legal-copy {
    max-height: 84svh;
    padding: 1rem;
  }

  .mobile-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
    background: rgba(18, 32, 30, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    display: grid;
    min-width: 0;
    min-height: 3.35rem;
    place-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.2rem;
    color: rgba(255, 255, 255, 0.68);
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.58rem;
    font-weight: 900;
  }

  .mobile-tab svg {
    width: 1.12rem;
    height: 1.12rem;
  }

  .mobile-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-tab.active {
    color: #10201f;
    background: var(--lime);
  }

  .mobile-tab:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
}

@media (max-width: 380px) {
  .site-header {
    min-height: 58px;
  }

  .brand span:last-child {
    max-width: 5.8rem;
  }

  .theme-toggle,
  .legal-menu-toggle {
    width: 2.05rem;
    height: 2.05rem;
  }

  .app-shell {
    padding-inline: 0.5rem;
  }

  .panel,
  .history-panel,
  .calendar-panel,
  .backup-panel,
  .legal-panel,
  .metric-card,
  .insight-card {
    padding: 0.72rem;
  }

  .timer-face strong {
    font-size: clamp(2.35rem, 14vw, 3.35rem);
  }

  .timer-controls {
    gap: 0.5rem;
  }

  .round-button {
    width: 2.85rem;
    height: 2.85rem;
  }

  .primary-round {
    width: 3.35rem;
    height: 3.35rem;
  }

  .mobile-tab {
    min-height: 3.15rem;
    font-size: 0.62rem;
  }
}

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