:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #111827;
  --text: #172033;
  --muted: #64748b;
  --line: #d9e1ec;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warning: #b45309;
  --shadow: 0 14px 32px rgba(20, 30, 50, 0.12);
}

body.dark {
  color-scheme: dark;
  --bg: #0f141c;
  --panel: #171f2b;
  --panel-strong: #e5edf7;
  --text: #edf3fb;
  --muted: #9aa9bc;
  --line: #2a3545;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow,
.muted {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
}

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

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero-panel,
.run-card,
.timer-panel,
.editor-panel,
.empty-state,
.plan-card,
.exercise-card,
.history-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  margin-bottom: 22px;
}

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

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.section-heading.compact {
  margin-top: 14px;
}

.primary-action,
.secondary-action,
.primary-small,
.text-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
}

.primary-action,
.primary-small {
  background: var(--accent);
  color: white;
  font-weight: 750;
}

.primary-action {
  padding: 0 18px;
}

.primary-small {
  min-height: 38px;
  padding: 0 12px;
}

.secondary-action {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 0 4px;
}

.icon-button {
  width: 44px;
  background: var(--panel-strong);
  color: var(--bg);
  font-size: 1.45rem;
}

.full {
  width: 100%;
}

.exercise-list,
.plan-list,
.history-list {
  display: grid;
  gap: 10px;
}

.exercise-card,
.plan-card,
.history-card,
.empty-state {
  padding: 14px;
}

.exercise-card h4,
.plan-card h4,
.history-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.detail-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 750;
}

.next-plan {
  border-color: var(--accent);
}

.plan-exercises-toggle {
  margin-top: 12px;
}

.plan-exercises-summary {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.plan-exercises-summary[hidden] {
  display: none;
}

.simple-exercise-row {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.simple-exercise-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.simple-exercise-row strong {
  color: var(--text);
  font-size: 0.9rem;
}

.simple-exercise-row > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.intensity-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.intensity-strong {
  background: #fee2e2;
  color: #991b1b;
}

.intensity-medium,
.intensity-light-medium {
  background: #fef3c7;
  color: #92400e;
}

.intensity-light {
  background: #dcfce7;
  color: #166534;
}

.intensity-unknown {
  background: var(--line);
  color: var(--muted);
}

.muscle-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.calendar-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.calendar-legend > div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.calendar-legend > div:last-child {
  border-right: 0;
}

.legend-check {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 900;
}

.legend-check.green {
  color: #16a34a;
}

.legend-check.yellow {
  color: #ca8a04;
}

.legend-check.double {
  letter-spacing: -2px;
}

.calendar-title {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 800;
  text-transform: capitalize;
}

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

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  position: relative;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 6px 4px;
  text-align: center;
}

.calendar-day.blank {
  visibility: hidden;
}

.calendar-day strong {
  display: block;
  font-size: 0.86rem;
}

.calendar-day span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day.trained {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.18);
}

.calendar-day.interrupted {
  border-color: #eab308;
  background: #fef9c3;
}

.calendar-check {
  position: absolute;
  top: 2px;
  right: 4px;
  color: #16a34a;
  font-size: 0.78rem;
  font-weight: 900;
}

.calendar-check.double {
  letter-spacing: -2px;
}

.interrupted-check {
  color: #ca8a04;
}

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

.run-card,
.timer-panel,
.stretch-card {
  padding: 18px;
}

.run-card {
  display: grid;
  gap: 14px;
}

.exercise-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: center;
  gap: 12px;
}

.exercise-title-row h2,
.exercise-title-row p {
  margin-bottom: 4px;
}

.exercise-notes {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.exercise-sticker {
  width: 86px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}

.exercise-sticker svg {
  display: block;
  width: 100%;
  height: 100%;
}

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

.exercise-rail {
  display: flex;
  gap: 8px;
  margin: -2px -4px 2px;
  padding: 2px 4px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.rail-chip {
  flex: 0 0 min(68%, 220px);
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  padding: 10px;
  text-align: left;
  min-height: 68px;
}

.rail-chip strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
}

.rail-chip span {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
}

.rail-chip.current {
  border-color: #f59e0b;
  background: #ffedd5;
}

.rail-chip.done {
  border-color: #22c55e;
  background: #dcfce7;
  opacity: 1;
}

.rail-chip:not(.current):not(.done) {
  border-color: #60a5fa;
  background: #dbeafe;
}

body.dark .rail-chip.current {
  color: #fed7aa;
  background: #7c2d12;
}

body.dark .rail-chip.done {
  color: #bbf7d0;
  background: #14532d;
}

body.dark .rail-chip:not(.current):not(.done) {
  color: #bfdbfe;
  background: #1e3a8a;
}

.rail-chip:disabled {
  cursor: default;
}

.elapsed-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
}

.elapsed-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.elapsed-strip strong {
  color: var(--panel-strong);
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}

.record-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.record-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
}

.record-strip span,
.effort-panel > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.record-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--panel-strong);
  font-size: 1.15rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-weight: 650;
}

.progress-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.set-dots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 8px;
}

.set-dot {
  min-height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.set-dot.done {
  background: var(--accent);
}

.effort-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
}

.effort-panel[hidden] {
  display: none;
}

.effort-options {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.effort-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 750;
}

.effort-chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.timer-panel {
  min-height: 58vh;
  display: grid;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.stretch-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stretch-instructions {
  color: var(--text);
  line-height: 1.5;
}

.stretch-timer {
  color: var(--panel-strong);
  font-size: clamp(3.5rem, 20vw, 6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.72);
}

.modal-backdrop[hidden] {
  display: none;
}

.app-modal {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.app-modal p {
  color: var(--muted);
  line-height: 1.5;
}

.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.timer-count {
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 24vw, 7.5rem);
  font-weight: 850;
  line-height: 1;
  color: var(--panel-strong);
}

.timer-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.editor-panel {
  padding: 14px;
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.editor-panel[hidden] {
  display: none;
}

.editor-panel.always-open {
  margin-top: 14px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

legend {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

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

.weekday-grid label,
.switch-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.weekday-grid input,
.switch-line input {
  width: auto;
  min-height: auto;
}

.weekday-grid span {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.weekday-grid input {
  position: absolute;
  opacity: 0;
}

.weekday-grid input:checked + span {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.16);
  color: var(--accent-strong);
}

.exercise-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  gap: 10px;
}

.three-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.exercise-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px max(12px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(14px);
}

.resume-bar {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 696px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 10px;
}

.resume-bar[hidden] {
  display: none;
}

.resume-bar span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.resume-bar strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.nav-item {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.nav-item.active {
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-strong);
}

@media (max-width: 460px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .primary-action {
    width: 100%;
  }

  .metric-grid,
  .three-cols {
    grid-template-columns: 1fr;
  }
}

/* Great Media energetic training theme */
:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --panel-strong: #17231e;
  --text: #18231e;
  --muted: #637169;
  --line: #d7e1db;
  --accent: #0d9f6e;
  --accent-strong: #087a55;
  --energy: #f15b3d;
  --energy-strong: #c83c25;
  --sun: #f4b942;
  --sky: #2587d8;
  --shadow: 0 10px 28px rgba(24, 56, 42, 0.11);
}

body.dark {
  --bg: #101713;
  --panel: #18221d;
  --panel-strong: #f0f7f3;
  --text: #edf5f0;
  --muted: #a2b3a9;
  --line: #314138;
  --accent: #34d399;
  --accent-strong: #6ee7b7;
  --energy: #fb7358;
  --energy-strong: #ff9a85;
  --sun: #f7c85c;
  --sky: #62aef0;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

.app-shell {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  padding: 4px 2px;
}

h1 {
  color: var(--panel-strong);
}

.hero-panel {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  border-left: 5px solid var(--energy);
}

.primary-action,
.primary-small {
  box-shadow: 0 5px 12px rgba(13, 159, 110, 0.2);
}

.primary-action:active,
.primary-small:active,
.secondary-action:active {
  transform: translateY(1px);
}

.secondary-action {
  background: var(--panel);
}

.icon-button {
  background: var(--energy);
  color: #ffffff;
  box-shadow: 0 5px 12px rgba(241, 91, 61, 0.25);
}

.badge {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.next-plan {
  border-color: var(--energy);
  box-shadow: 0 10px 28px rgba(241, 91, 61, 0.12);
}

.plan-card.expanded-plan {
  border: 2px solid var(--accent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 18%, transparent);
}

.intensity-strong {
  background: #ffe1da;
  color: #a92f1b;
}

.intensity-medium,
.intensity-light-medium {
  background: #fff0c7;
  color: #8a5607;
}

.intensity-light {
  background: #d8f6e8;
  color: #08704b;
}

.calendar-day.trained {
  background: color-mix(in srgb, var(--accent) 17%, var(--panel));
}

.calendar-day.interrupted {
  border-color: var(--sun);
  background: color-mix(in srgb, var(--sun) 25%, var(--panel));
}

.exercise-sticker {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.elapsed-strip {
  border-color: color-mix(in srgb, var(--sky) 30%, var(--line));
  background: color-mix(in srgb, var(--sky) 7%, var(--panel));
}

.rail-chip.current {
  border-color: var(--energy);
  background: #ffe5de;
}

.rail-chip.done {
  border-color: var(--accent);
  background: #d8f6e8;
}

.rail-chip:not(.current):not(.done) {
  border-color: var(--sky);
  background: #deeffd;
}

body.dark .rail-chip.current {
  color: #fed7aa;
  background: #7c2d12;
}

body.dark .rail-chip.done {
  color: #bbf7d0;
  background: #14532d;
}

body.dark .rail-chip:not(.current):not(.done) {
  color: #bfdbfe;
  background: #1e3a8a;
}

.timer-count,
.stretch-timer {
  color: var(--energy);
}

.bottom-nav {
  border-top: 3px solid var(--accent);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  box-shadow: 0 -8px 22px rgba(24, 56, 42, 0.1);
}

.nav-item.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.app-credit {
  margin: 28px 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.app-credit strong {
  color: var(--energy);
  font-weight: 850;
}

.section-heading h2,
.section-heading h3 {
  position: relative;
  padding-left: 11px;
}

.section-heading h2::before,
.section-heading h3::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 4px;
  border-radius: 999px;
  background: var(--energy);
  content: "";
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

.run-card,
.stretch-card,
.timer-panel {
  border-top: 4px solid var(--energy);
}

.calendar-panel {
  border-top: 4px solid var(--accent);
}

.app-modal {
  border-top: 5px solid var(--energy);
}
