:root {
  color-scheme: light;
  --ink: #141414;
  --muted: #626262;
  --soft: #f5f2ec;
  --surface: #ffffff;
  --surface-strong: #fbfaf7;
  --line: #e6e1d7;
  --hero: #111311;
  --hero-soft: #1f211f;
  --gold: #d89a22;
  --gold-soft: #f6ead0;
  --green: #3f8f48;
  --red: #a93d2c;
  --shadow: 0 12px 32px rgba(28, 22, 13, 0.1);
  --radius: 8px;
}

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

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

body {
  width: 100%;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

#app {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

a {
  color: inherit;
}

button,
a.button {
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(216, 154, 34, 0.7);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: #fff4df;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 0.9rem;
}

a.button svg {
  flex: 0 0 auto;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: 100%;
  overflow: visible;
  min-width: 0;
  padding-bottom: 3rem;
}

.hero {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  color: #fff;
  background:
    radial-gradient(circle at top right, rgba(216, 154, 34, 0.14), transparent 32rem),
    linear-gradient(140deg, var(--hero), var(--hero-soft));
  min-width: 0;
  padding: 0.7rem 0.65rem 0.8rem;
}

.hero-inner,
.content {
  width: min(100%, 1040px);
  min-width: 0;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.brand-mark {
  flex: 0 0 auto;
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  background: #050505;
  box-shadow: 0 0 0 1px rgba(216, 154, 34, 0.24), 0 12px 30px rgba(0, 0, 0, 0.26);
}

.eyebrow {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0.2rem 0 0.45rem;
  max-width: 760px;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 6vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-meta {
  display: grid;
  gap: 0.32rem;
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.86);
  list-style: none;
}

.hero-meta li {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
}

.hero-meta span,
.hero-actions span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-icon,
.day-icon {
  flex: 0 0 auto;
  color: var(--gold);
}

.hero-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  margin-top: 0.7rem;
}

.hero-actions .button {
  flex: 1 1 0;
  min-height: 38px;
  padding: 0.52rem 0.45rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.hero-actions span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
}

.stat {
  min-width: 0;
  padding: 0.52rem 0.48rem;
  background: rgba(255, 255, 255, 0.055);
}

.stat span {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 0.18rem;
  color: #fff;
  font-size: 0.94rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.content {
  display: grid;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  align-items: start;
  padding: 0.65rem;
}

.overview-stack,
.week-nav-shell,
.plan-stack {
  display: grid;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

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

.panel {
  min-width: 0;
  overflow: hidden;
  padding: 0.75rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  margin-bottom: 0.55rem;
}

.section-title h2,
.week-heading h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  line-height: 1.1;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-height: 28px;
  max-width: 100%;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  background: var(--gold-soft);
  color: #835409;
  font-size: 0.76rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.green {
  background: #e4f2e4;
  color: #2c7135;
}

.focus-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 0.55rem;
  padding: 0.45rem 0 0;
}

.next-up-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.next-up-row {
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.next-up-main,
.next-up-main * {
  min-width: 0;
}

.date-tile {
  width: 52px;
  min-height: 62px;
  min-width: 0;
  border-right: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.date-tile strong {
  display: block;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.date-tile span {
  display: block;
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workout-title {
  min-width: 0;
  overflow: hidden;
}

.workout-title h3 {
  margin: 0;
  overflow: hidden;
  font-size: 1.04rem;
  text-overflow: ellipsis;
}

.workout-title p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.miles {
  color: var(--ink);
  font-weight: 850;
  white-space: nowrap;
}

.week-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  margin: 0.45rem 0 0.55rem;
}

.week-summary-grid div {
  min-width: 0;
  padding: 0.52rem 0.35rem;
  text-align: center;
}

.week-summary-grid div + div {
  border-left: 1px solid var(--line);
}

.week-summary-grid strong {
  display: block;
  font-size: 1rem;
}

.week-summary-grid span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.week-nav-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  align-self: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.week-nav {
  position: static;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 6px;
  border: 1px solid rgba(230, 225, 215, 0.9);
  border-radius: 14px;
  background: rgba(245, 242, 236, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(28, 22, 13, 0.12);
  scrollbar-width: none;
}

.week-nav-shell.is-fixed .week-nav {
  position: fixed;
  top: 0;
  left: var(--week-nav-left, 0);
  z-index: 70;
  width: var(--week-nav-width, 100%);
  max-width: none;
}

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

.week-chip {
  flex: 0 0 auto;
  min-width: 38px;
  width: auto;
  max-width: none;
  border-color: rgba(20, 20, 20, 0.16);
  background: #ddd8cc;
  color: var(--ink);
  box-shadow: none;
}

.button.week-chip {
  flex-direction: column;
  gap: 0.1rem;
  min-height: 32px;
  height: 32px;
  padding: 0.34rem 0.46rem;
  color: #111827;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
  border-radius: 10px;
}

.button.week-chip span {
  display: none;
  color: #111827;
  font-size: 0.58rem;
  font-weight: 750;
}

.week-chip.current {
  border-color: #facc15;
  background: #facc15;
  color: #111827;
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.24);
}

.button.week-chip.current,
.button.week-chip.current span {
  color: #111827;
}

.week-chip.build {
  box-shadow: inset 0 -3px 0 rgba(63, 143, 72, 0.8);
}

.week-chip.down {
  box-shadow: inset 0 -3px 0 rgba(148, 163, 184, 0.82);
}

.week-chip.taper {
  box-shadow: inset 0 -3px 0 rgba(216, 154, 34, 0.9);
}

.week-chip.peak {
  box-shadow: inset 0 -3px 0 rgba(83, 96, 168, 0.9);
}

.week-chip.race {
  box-shadow: inset 0 -3px 0 rgba(169, 61, 44, 0.9);
}

.week-chip.current.build,
.week-chip.current.down,
.week-chip.current.peak,
.week-chip.current.taper,
.week-chip.current.race {
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.24);
}

.weeks {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
  position: relative;
  padding-left: 0;
}

.weeks::before {
  content: none;
}

.week-card {
  position: relative;
  min-width: 0;
  scroll-margin-block: 12px;
  scroll-snap-align: center;
  scroll-snap-stop: normal;
  border-left: 3px solid transparent;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.week-card::before {
  content: none;
}

.week-card::after {
  content: none;
}

.week-card.current-week {
  border-color: rgba(63, 143, 72, 0.34);
  border-left-color: #3f8f48;
  box-shadow: 0 12px 30px rgba(28, 22, 13, 0.12), 0 0 0 1px rgba(63, 143, 72, 0.14);
}

.week-card.current-week::before {
  content: none;
}

.week-card.current-week::after {
  content: none;
}

.week-heading {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.68rem;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

.week-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 850;
  text-transform: uppercase;
}

.week-kicker > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-note {
  min-width: 0;
  margin: 0;
  color: #5b4a2c;
  line-height: 1.45;
}

.week-body {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0.5rem;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.mini-day {
  display: grid;
  grid-template-rows: auto auto auto;
  place-items: center;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  height: 38px;
  min-height: 0;
  padding: 2px;
  border: 1px solid rgba(20, 20, 20, 0.06);
  border-top: 3px solid currentColor;
  border-radius: 7px;
  background: #f3f2ee;
  color: #5e625d;
  box-shadow: none;
}

.mini-day.today {
  border-color: rgba(216, 154, 34, 0.8);
  box-shadow: inset 0 2px 0 var(--gold);
}

.mini-day-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.mini-day strong {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1;
  text-overflow: clip;
}

.mini-day-icon,
.workout-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: currentColor;
}

.mini-day-icon {
  width: 9px;
  height: 9px;
  margin-top: 1px;
}

.workout-dot {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.workout-list {
  display: grid;
  gap: 1px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.workout-row {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.36rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.4rem 0.45rem;
  background: var(--surface);
  box-shadow: inset 3px 0 0 currentColor;
}

.workout-row.today {
  background: #fffaf0;
}

.workout-row time {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workout-icon {
  width: 9px;
  height: 9px;
}

.workout-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
}

.workout-row-text {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
}

.workout-row h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workout-secondary {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workout-mileage {
  justify-self: end;
  min-width: 2.4rem;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.workout-mileage.empty {
  color: #9a9a92;
}

.workout-rest {
  color: #797d78;
}

.workout-easy {
  color: #3f8f48;
}

.workout-workout {
  color: #c5532e;
}

.workout-long {
  color: #5360a8;
}

.workout-race {
  color: #8a5a00;
}

.workout-cross {
  color: #277f8a;
}

.workout-mobility {
  color: #7a5aa5;
}

.mini-day.workout-rest {
  background: #eeeeea;
}

.mini-day.workout-easy {
  background: #e7f3e8;
}

.mini-day.workout-workout {
  background: #fae7dd;
}

.mini-day.workout-long {
  background: #e8e8f7;
}

.mini-day.workout-race {
  background: #f8e7bd;
}

.mini-day.workout-cross {
  background: #e1f1f2;
}

.mini-day.workout-mobility {
  background: #eee6f5;
}

.error-state,
.loading-state {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 0.7rem;
  padding: 1.5rem;
  color: #fff;
  background: linear-gradient(140deg, var(--hero), var(--hero-soft));
}

.error-state h1,
.loading-state h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1;
}

.error-state p,
.loading-state p {
  margin: 0;
  max-width: 42rem;
  color: rgba(255, 255, 255, 0.72);
}

@media (min-width: 400px) and (max-width: 719px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .hero {
    padding: 2rem 1.5rem;
  }

  .brand-row {
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
  }

  .eyebrow {
    font-size: 0.78rem;
  }

  .hero h1 {
    margin: 0.3rem 0 0.65rem;
    font-size: clamp(2rem, 5vw, 4.2rem);
    line-height: 1;
  }

  .hero-meta {
    gap: 0.5rem;
  }

  .hero-meta li {
    gap: 0.55rem;
    font-size: 1rem;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 2rem;
  }

  .hero-actions {
    width: auto;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.15rem;
    min-width: 220px;
    justify-content: end;
  }

  .hero-actions .button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0.72rem 0.9rem;
    font-size: 0.9rem;
  }

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

  .stat {
    padding: 0.68rem;
  }

  .stat span {
    font-size: 0.72rem;
  }

  .stat strong {
    margin-top: 0.25rem;
    font-size: 1.18rem;
  }

  .content {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
    padding: 1.35rem 1.5rem 3rem;
  }

  .panel {
    padding: 1rem;
  }

  .section-title {
    margin-bottom: 0.8rem;
  }

  .section-title h2,
  .week-heading h2 {
    font-size: 1.35rem;
  }

  .overview-stack {
    position: sticky;
    top: 1rem;
    display: grid;
    gap: 0.85rem;
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .week-nav-shell {
    grid-column: 2;
    grid-row: 1;
  }

  .plan-stack {
    display: grid;
    gap: 0.85rem;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  .week-nav {
    gap: 0.55rem;
    margin: 0;
    padding: 0.65rem;
    border: 1px solid rgba(230, 225, 215, 0.9);
    border-radius: 14px;
    background: rgba(245, 242, 236, 0.96);
  }

  .week-chip {
    min-width: 68px;
    min-height: 54px;
  }

  .button.week-chip {
    min-height: 54px;
    height: auto;
    padding: 0.72rem 0.9rem;
    font-size: 0.9rem;
  }

  .week-chip span {
    display: block;
  }

  .week-heading {
    gap: 0.55rem;
    padding: 1rem;
  }

  .week-kicker {
    gap: 0.75rem;
    font-size: 0.78rem;
  }

  .week-body {
    gap: 0.6rem;
    padding: 0.8rem;
  }

  .mini-calendar {
    gap: 4px;
  }

  .mini-day {
    height: 48px;
    min-height: 48px;
  }

  .workout-row {
    grid-template-columns: 5.5rem minmax(0, 1fr) auto;
    padding: 0.52rem 0.65rem;
  }

  .workout-row h3 {
    font-size: 0.9rem;
  }
}

@media (max-width: 390px) {
  .focus-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .date-tile {
    width: 48px;
  }
}
