:root {
  --orange: #fc5200;
  --orange-dark: #d84100;
  --ink: #1f1f1f;
  --muted: #6d6d72;
  --line: #e6e6e8;
  --surface: #ffffff;
  --canvas: #f5f5f7;
  --soft-orange: #fff0e8;
  --green: #16875d;
  --shadow: 0 8px 30px rgba(22, 22, 24, .07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }
.grain { display: none; }

.topbar {
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; color: inherit; text-decoration: none; }
.brand img { display: block; width: 166px; height: 52px; object-fit: contain; object-position: left center; }
nav { display: flex; height: 100%; gap: 24px; }
.nav-link { position: relative; border: 0; background: transparent; padding: 0 3px; cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); }
.nav-link::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link.active::after { background: var(--orange); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 9px; }
.sync-button { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.sync-button:hover { border-color: var(--orange); color: var(--orange); }
.sync-button:disabled { cursor: wait; opacity: .65; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sync-button.syncing .sync-dot { background: var(--orange); animation: pulse 1s infinite; }
.sync-button.error .sync-dot { background: #cc2f2f; }
.logout-button { border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.logout-button:hover { color: var(--orange); }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }
.race-chip { background: var(--soft-orange); color: var(--orange-dark); border-radius: 999px; padding: 8px 12px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.race-chip span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); margin-right: 6px; }

main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 80px; }
.view { display: none; animation: appear .25s ease; }
.view.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }

.eyebrow { margin: 0 0 9px; color: var(--orange); font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }

.hero {
  min-height: 350px;
  margin-top: 28px;
  padding: clamp(34px, 5vw, 64px);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 15%, rgba(252,82,0,.75), transparent 28%),
    linear-gradient(125deg, #181818 0%, #292522 58%, #5c2710 100%);
  color: #fff;
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  align-items: center;
  gap: 50px;
  overflow: hidden;
  position: relative;
}
.hero::after { content: "42.2"; position: absolute; right: -25px; bottom: -70px; font-size: 220px; line-height: 1; font-weight: 900; letter-spacing: -.1em; color: rgba(255,255,255,.045); pointer-events: none; }
.hero .eyebrow { color: #ffb18b; }
.hero-logo { display: block; width: min(290px, 75%); height: auto; margin: -15px 0 8px -13px; }
.hero h1 { margin: 0 0 22px; font-size: clamp(52px, 7vw, 86px); line-height: .94; letter-spacing: -.06em; font-weight: 780; }
.hero-intro { max-width: 610px; margin: 0; color: rgba(255,255,255,.7); font-size: 17px; line-height: 1.55; }
.hero-intro strong { color: #fff; }
.countdown-panel { justify-self: end; width: 255px; min-height: 255px; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; padding: 28px; background: rgba(255,255,255,.08); backdrop-filter: blur(12px); display: flex; flex-direction: column; justify-content: center; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.2); z-index: 1; }
.panel-label, .countdown-unit { color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; }
.countdown-panel > strong { margin: 3px 0 -2px; color: #fff; font-size: 82px; line-height: 1; font-weight: 800; letter-spacing: -.07em; }
.goal-line { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.16); font-size: 12px; }
.goal-line b { color: #ff8a51; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 48px; }
.metric-card { min-height: 132px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 15px rgba(22,22,24,.03); }
.metric-card span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.metric-card strong { display: block; margin: 17px 0 5px; font-size: 35px; line-height: 1; letter-spacing: -.04em; }
.metric-card:first-child strong { color: var(--orange); }
.metric-card small { color: var(--muted); font-size: 11px; }

.section-shell.prediction-section { display: grid; grid-template-columns: 1.15fr auto 1fr; align-items: center; gap: 34px; background: var(--ink); color: #fff; }
.prediction-copy h2 { margin: 0 0 9px; font-size: 32px; }
.prediction-copy > p:last-child { margin: 0; color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.5; }
.prediction-time { min-width: 190px; padding: 5px 30px; border-right: 1px solid rgba(255,255,255,.13); border-left: 1px solid rgba(255,255,255,.13); text-align: center; }
.prediction-time span, .prediction-time small { display: block; color: rgba(255,255,255,.55); font-size: 9px; text-transform: uppercase; }
.prediction-time strong { display: block; margin: 7px 0; color: #ff7d3d; font-size: 42px; letter-spacing: -.05em; }
.prediction-factors { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.prediction-factors span { padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.1); }
.prediction-factors b, .prediction-factors small { display: block; }
.prediction-factors b { font-size: 14px; }
.prediction-factors small { margin-top: 3px; color: rgba(255,255,255,.5); font-size: 8px; text-transform: uppercase; }

.outline-button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.outline-button:hover { border-color: var(--orange); color: var(--orange); }
.outline-button:disabled { cursor: default; opacity: .55; }
.today-sessions { border-top: 1px solid var(--line); }
.empty-day { min-height: 120px; display: grid; place-content: center; padding: 25px; border: 1px dashed #d2d2d5; border-radius: 10px; text-align: center; }
.empty-day strong { font-size: 16px; }
.empty-day p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.activity-alerts { margin-top: 12px; }
.activity-alerts:empty { display: none; }
.alerts-heading { display: flex; justify-content: space-between; margin-bottom: 6px; color: #9a6100; font-size: 10px; }
.alerts-heading span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #fff0cc; }
.activity-alerts article { padding: 9px 11px; border-left: 3px solid #d18a00; background: #fff9eb; }
.activity-alerts article + article { margin-top: 5px; }
.activity-alerts b { font-size: 10px; }
.activity-alerts p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }

.readiness-section { position: relative; overflow: hidden; }
.readiness-section::after { content: "3:20"; position: absolute; right: -16px; top: -50px; color: rgba(252,82,0,.035); font-size: 170px; font-weight: 900; letter-spacing: -.09em; pointer-events: none; }
.readiness-heading { position: relative; z-index: 1; }
.readiness-level { padding: 7px 10px; border-radius: 999px; background: var(--soft-orange); color: var(--orange-dark); font-size: 10px; font-weight: 800; }
.readiness-layout { position: relative; z-index: 1; display: grid; grid-template-columns: .75fr 1.5fr; gap: 38px; }
.readiness-score-block { display: flex; align-items: center; gap: 22px; }
.score-ring { --score: 0; flex: 0 0 auto; width: 124px; height: 124px; padding: 10px; border-radius: 50%; background: conic-gradient(var(--orange) calc(var(--score) * 1%), #ececee 0); }
.score-inner { width: 100%; height: 100%; display: grid; place-content: center; border-radius: 50%; background: var(--surface); text-align: center; }
.score-inner strong { font-size: 36px; line-height: .9; letter-spacing: -.05em; }
.score-inner small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.readiness-message h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.15; }
.readiness-message p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.readiness-criteria { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.criterion-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; }
.criterion-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.criterion-head strong { font-size: 11px; }
.criterion-status { color: var(--muted); font-size: 8px; font-weight: 750; text-transform: uppercase; }
.criterion-status.ready { color: var(--green); }
.criterion-value { margin: 7px 0; color: var(--muted); font-size: 10px; }
.criterion-track { height: 4px; overflow: hidden; border-radius: 99px; background: #e7e7e9; }
.criterion-track span { display: block; height: 100%; border-radius: inherit; background: var(--orange); }

.section-shell { margin-bottom: 24px; padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 25px; }
.section-heading h2 { margin: 0; font-size: clamp(27px, 4vw, 38px); font-weight: 750; }
.text-button { border: 0; background: none; color: var(--orange); font-size: 12px; font-weight: 750; cursor: pointer; }
.text-button:hover { color: var(--orange-dark); }
.current-layout { display: grid; grid-template-columns: 1.5fr .7fr; gap: 36px; }
.week-progress-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.phase-tag { border-radius: 5px; padding: 6px 9px; background: var(--soft-orange); color: var(--orange-dark); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.progress-track { height: 7px; margin: 12px 0 20px; border-radius: 99px; overflow: hidden; background: #eeeef0; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--orange); transition: width .45s ease; }
.week-review { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); border-left: 3px solid #b8b8bc; border-radius: 0 9px 9px 0; background: #fafafa; }
.week-review.success { border-left-color: var(--green); }
.week-review.warning { border-left-color: #d18a00; }
.week-review.progress { border-left-color: var(--orange); }
.week-review > div:first-child > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.week-review > div:first-child > strong { font-size: 13px; }
.week-review p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.week-review-stats { display: flex; gap: 14px; }
.week-review-stats span { min-width: 45px; text-align: center; }
.week-review-stats b, .week-review-stats small { display: block; }
.week-review-stats b { font-size: 12px; }
.week-review-stats small { margin-top: 2px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.weekly-adjustment { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: -8px 0 18px; padding: 13px 14px; border-radius: 9px; background: #f2f2f4; }
.weekly-adjustment.reduce { background: #fff6e4; }
.weekly-adjustment.increase { background: #edf8f3; }
.weekly-adjustment span, .weekly-adjustment strong { display: block; }
.weekly-adjustment span { margin-bottom: 3px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .09em; }
.weekly-adjustment strong { font-size: 12px; }
.weekly-adjustment p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.weekly-adjustment > b { color: var(--green); font-size: 10px; text-transform: uppercase; }
.session-list { border-top: 1px solid var(--line); }
.session-row { width: 100%; display: grid; grid-template-columns: 38px 78px 1fr auto; gap: 10px; align-items: center; padding: 13px 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.session-row:hover { background: #fafafa; }
.session-row.done .session-description { color: #999; text-decoration: line-through; }
.day-number { color: var(--muted); font-size: 14px; font-weight: 700; }
.day-name { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.session-description { font-size: 13px; font-weight: 620; }
.session-status { color: var(--muted); font-size: 11px; white-space: nowrap; }
.done-dot { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: var(--green); color: #fff; font-size: 11px; font-weight: 900; }
.pace-card { align-self: start; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; }
.pace-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pace-item:last-child { border: 0; }
.pace-code { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; }
.pace-item strong, .pace-item small { display: block; }
.pace-item strong { font-size: 12px; }
.pace-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.chart-section { overflow: hidden; }
.legend { color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin: 0 4px 0 10px; border-radius: 2px; background: var(--orange); }
.legend i:nth-child(2) { background: #d7d7da; }
.weekly-chart { height: 230px; display: flex; align-items: end; gap: clamp(3px, .6vw, 8px); padding: 18px 2px 24px; overflow-x: auto; }
.bar-group { position: relative; height: 100%; min-width: 22px; flex: 1; display: flex; align-items: end; gap: 2px; border-bottom: 1px solid var(--line); }
.bar { width: 50%; min-height: 2px; border-radius: 3px 3px 0 0; background: #d7d7da; transition: height .4s ease; }
.bar.actual { background: var(--orange); }
.bar-group small { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); color: #999; font-size: 8px; }
.bar-group.current::after { content: ""; position: absolute; inset: -6px -3px -1px; border: 1px solid var(--orange); border-radius: 5px 5px 0 0; }

.page-heading { max-width: 780px; padding: 56px 0 32px; }
.page-heading h1 { margin: 0 0 14px; font-size: clamp(48px, 7vw, 78px); line-height: 1; font-weight: 780; }
.page-heading > p:last-child { max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.training-guide { margin-bottom: 20px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 14px rgba(22,22,24,.035); }
.guide-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 12px; }
.guide-heading .eyebrow { margin: 0; color: var(--orange); }
.guide-heading h2 { margin: 0; font-size: 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); }
.guide-grid article { min-height: 66px; display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 10px 12px; background: var(--surface); }
.guide-grid article > b { display: grid; place-items: center; align-self: start; width: 27px; height: 27px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 9px; }
.guide-grid article strong { font-size: 11px; }
.guide-grid article p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.35; }
.guide-grid .term-card > b { background: var(--soft-orange); color: var(--orange-dark); }
.phase-filter { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.filter-button:hover, .filter-button.active { border-color: var(--orange); background: var(--orange); color: #fff; }
.plan-weeks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.week-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 14px rgba(22,22,24,.035); }
.week-card.current { border: 2px solid var(--orange); }
.week-card-header { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.week-index { color: var(--orange); font-size: 26px; font-weight: 800; letter-spacing: -.04em; }
.week-card h3 { margin: 0 0 3px; font-size: 14px; }
.week-card-header small, .week-km small { color: var(--muted); font-size: 10px; }
.week-km { text-align: right; }
.week-km strong, .week-km small { display: block; }
.week-km strong { font-size: 17px; }
.week-sessions { padding: 5px 15px 10px; }
.week-sessions .session-row { grid-template-columns: 64px 1fr auto; padding: 10px 2px; }
.week-sessions .day-name { font-size: 9px; }

.bests-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.best-card { min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.best-card:first-child { background: var(--orange); color: #fff; border-color: var(--orange); }
.best-card span { color: inherit; opacity: .72; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.best-card strong { display: block; font-size: clamp(28px, 3vw, 39px); letter-spacing: -.04em; }
.best-card small { display: block; margin-top: 7px; color: inherit; opacity: .65; font-size: 10px; }
.shoe-form { display: grid; grid-template-columns: 1.4fr .7fr .7fr auto; align-items: end; gap: 10px; margin-bottom: 18px; }
.shoe-form label { color: var(--muted); font-size: 9px; font-weight: 700; }
.shoe-form input { width: 100%; height: 36px; margin-top: 6px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); }
.small-action-button { height: 36px; padding: 0 14px; border: 0; border-radius: 7px; background: var(--orange); color: #fff; font-size: 10px; font-weight: 800; cursor: pointer; }
.shoe-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shoe-card { position: relative; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.shoe-card.retired { opacity: .58; }
.shoe-card > div:first-child span, .shoe-card > div:first-child strong { display: block; }
.shoe-card > div:first-child span { color: var(--orange); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.shoe-card > div:first-child strong { margin-top: 4px; font-size: 13px; }
.shoe-km { margin-top: 14px; }
.shoe-km b, .shoe-km small { display: block; }
.shoe-km b { font-size: 20px; }
.shoe-km small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.shoe-track { height: 4px; margin-top: 11px; overflow: hidden; border-radius: 99px; background: #e1e1e4; }
.shoe-track span { display: block; height: 100%; background: var(--orange); }
.shoe-card button { position: absolute; top: 12px; right: 12px; border: 0; background: none; color: var(--muted); font-size: 9px; cursor: pointer; }
.empty-inline { margin: 0; color: var(--muted); font-size: 11px; }
.recent-run { display: grid; grid-template-columns: 95px 1fr repeat(4, minmax(65px, 90px)); gap: 14px; align-items: center; padding: 15px 3px; border-bottom: 1px solid var(--line); font-size: 12px; }
.recent-run time, .recent-run small { color: var(--muted); }
.recent-run strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-identity { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.activity-identity strong { max-width: 100%; }
.sport-pill { display: inline-block; padding: 3px 6px; border-radius: 4px; background: var(--soft-orange); color: var(--orange-dark); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.shoe-select { max-width: 150px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); font-size: 8px; }
.run-stat b, .run-stat small { display: block; }
.run-stat small { margin-top: 2px; font-size: 8px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.calendar-page-heading { max-width: none; display: flex; justify-content: space-between; align-items: end; }
.calendar-page-heading > div { max-width: 760px; }
.calendar-export { margin-bottom: 10px; padding: 11px 16px; border-radius: 7px; background: var(--orange); color: #fff; text-decoration: none; font-size: 11px; font-weight: 800; }
.calendar-toolbar { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; margin-bottom: 12px; }
.calendar-toolbar h2 { margin: 0; text-align: center; font-size: 25px; }
.calendar-toolbar button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; }
.calendar-toolbar button:last-child { justify-self: end; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; overflow: hidden; background: #eeeef0; }
.calendar-weekdays span { padding: 9px; text-align: center; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: var(--line); gap: 1px; }
.calendar-day { min-height: 125px; padding: 8px; background: #fff; }
.calendar-day.other-month { background: #f0f0f2; color: #aaa; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--orange); }
.calendar-day-number { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 750; }
.calendar-events { display: grid; gap: 4px; }
.calendar-event { width: 100%; overflow: hidden; padding: 6px; border: 0; border-left: 3px solid var(--orange); border-radius: 4px; background: var(--soft-orange); text-align: left; cursor: grab; }
.calendar-event.cross { border-left-color: #555; background: #eeeeef; }
.calendar-event.rescheduled { outline: 1px dashed var(--orange); }
.calendar-event b, .calendar-event span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event b { font-size: 9px; }
.calendar-event span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.calendar-help { margin: 10px 0 0; color: var(--muted); font-size: 10px; }

dialog { width: min(510px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 25px 100px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(18,18,18,.66); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 30px; }
.dialog-close { position: absolute; top: 13px; right: 16px; border: 0; background: none; color: var(--muted); font-size: 27px; cursor: pointer; }
dialog h2 { margin-bottom: 10px; padding-right: 25px; font-size: 30px; }
.dialog-description { margin-bottom: 24px; color: var(--muted); line-height: 1.45; }
.instruction-card { margin: 0 0 22px; padding: 15px; border-left: 3px solid var(--orange); border-radius: 0 8px 8px 0; background: var(--soft-orange); }
.instruction-card span { color: var(--orange-dark); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.instruction-card p { margin: 7px 0 0; font-size: 12px; line-height: 1.55; }
.actual-comparison { margin-bottom: 22px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; }
.actual-comparison[hidden] { display: none; }
.comparison-title { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.comparison-title b { color: var(--green); }
.actual-comparison > strong { display: block; overflow: hidden; margin-bottom: 12px; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.comparison-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.comparison-stats span { padding: 8px 5px; border-radius: 6px; background: #fff; text-align: center; }
.comparison-stats b, .comparison-stats small { display: block; }
.comparison-stats b { font-size: 11px; }
.comparison-stats small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.actual-comparison > p { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.stream-analysis { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.stream-analysis[hidden] { display: none; }
.stream-analysis-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.stream-analysis-head b { color: var(--orange-dark); }
.stream-phases { display: grid; gap: 4px; margin-top: 9px; }
.stream-phases span { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-left: 3px solid #aaa; border-radius: 4px; background: #fff; }
.stream-phases span.work { border-left-color: var(--orange); }
.stream-phases span.recovery { border-left-color: var(--green); }
.stream-phases span.off-target { background: #fff7e8; }
.stream-phases b { font-size: 9px; }
.stream-phases small { color: var(--muted); font-size: 8px; }
.nutrition-fields { margin: 0 0 22px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.nutrition-fields[hidden] { display: none; }
.nutrition-fields legend { padding: 0 6px; color: var(--orange-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nutrition-fields > p { margin: 0 0 10px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.nutrition-fields > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nutrition-fields label { margin: 0 !important; color: var(--muted); font-size: 8px !important; }
.nutrition-fields input[type="number"] { width: 100%; height: 32px; margin-top: 5px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; }
.nutrition-fields > p:last-child { margin: 10px 0 0; color: var(--ink); font-weight: 700; }
dialog label:not(.check-row) { display: block; margin: 18px 0 7px; font-size: 11px; font-weight: 750; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; cursor: pointer; }
.check-row input { position: absolute; opacity: 0; }
.custom-check { display: grid; place-items: center; width: 23px; height: 23px; border: 2px solid #bbb; border-radius: 5px; }
.check-row input:checked + .custom-check { border-color: var(--orange); background: var(--orange); color: #fff; }
.check-row input:checked + .custom-check::after { content: "✓"; font-weight: 900; }
input[type="range"] { width: 100%; accent-color: var(--orange); }
textarea { width: 100%; resize: vertical; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--ink); }
.date-input { width: 100%; height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); color: var(--ink); }
.primary-button { width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 6px; background: var(--orange); color: #fff; font-weight: 750; cursor: pointer; }
.primary-button:hover { background: var(--orange-dark); }
#toast { position: fixed; left: 50%; bottom: 25px; z-index: 30; padding: 11px 18px; border-radius: 7px; background: #242424; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.auth-page { min-height: 100vh; min-width: 0; display: grid; place-items: center; padding: 24px; background: #171717; }
.auth-shell { width: min(920px, 100%); min-height: 560px; display: grid; grid-template-columns: 1.1fr .9fr; margin: 0; padding: 0; overflow: hidden; border-radius: 22px; background: #fff; box-shadow: 0 35px 100px rgba(0,0,0,.38); }
.auth-panel { position: relative; padding: 54px; overflow: hidden; background: radial-gradient(circle at 85% 15%, rgba(252,82,0,.75), transparent 28%), linear-gradient(135deg, #1b1b1b, #4b210f); color: #fff; }
.auth-panel::after { content: "42.2"; position: absolute; right: -25px; bottom: -35px; color: rgba(255,255,255,.05); font-size: 150px; font-weight: 900; letter-spacing: -.1em; }
.auth-panel img { width: 230px; margin: -12px 0 70px -11px; }
.auth-panel h1 { margin: 0 0 22px; font-size: 53px; line-height: .98; }
.auth-panel > p:last-of-type { max-width: 350px; color: rgba(255,255,255,.68); font-size: 14px; line-height: 1.55; }
.login-card { align-self: center; padding: 48px; }
.login-card > div span { color: var(--orange); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.login-card h2 { margin: 8px 0 35px; font-size: 34px; }
.login-card label { display: block; margin: 17px 0 7px; color: var(--muted); font-size: 10px; font-weight: 750; }
.login-card input { width: 100%; height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); }
.login-card input:focus { border-color: var(--orange); outline: 2px solid var(--soft-orange); }
.login-card #login-error { min-height: 18px; margin: 12px 0 -5px; color: #b42318; font-size: 10px; line-height: 1.4; }
.login-card button:disabled { cursor: wait; opacity: .6; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; backdrop-filter: none; }
  .topbar nav { position: fixed; left: 50%; bottom: 12px; z-index: 30; width: min(calc(100% - 24px), 390px); height: 50px; justify-content: space-around; padding: 0 10px; gap: 0; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.96); box-shadow: 0 8px 30px rgba(0,0,0,.14); transform: translateX(-50%); }
  .nav-link::after { bottom: 5px; }
  .race-chip { display: none; }
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .countdown-panel { justify-self: start; width: 100%; min-height: auto; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; text-align: left; }
  .countdown-panel > strong { font-size: 58px; }
  .goal-line { justify-self: end; width: 180px; margin: 0; padding: 12px 0 12px 18px; border-top: 0; border-left: 1px solid rgba(255,255,255,.16); }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .prediction-section { grid-template-columns: 1fr 1fr; }
  .prediction-copy { grid-column: 1 / -1; }
  .prediction-time { border-left: 0; }
  .current-layout { grid-template-columns: 1fr; }
  .week-review { grid-template-columns: 1fr; }
  .week-review-stats { justify-content: space-between; }
  .readiness-layout { grid-template-columns: 1fr; }
  .plan-weeks { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
  .bests-grid { grid-template-columns: repeat(2, 1fr); }
  .shoe-list { grid-template-columns: repeat(2, 1fr); }
  .shoe-form { grid-template-columns: 1fr 1fr; }
  .recent-run { grid-template-columns: 80px 1fr repeat(2, 70px); }
  .recent-run .run-stat:nth-last-child(-n+2) { display: none; }
  .calendar-day { min-height: 105px; padding: 5px; }
  .calendar-event span { display: none; }
}

@media (max-width: 560px) {
  main { width: min(100% - 24px, 1240px); padding-bottom: 100px; }
  .brand img { width: 132px; height: 46px; }
  .hero { margin-top: 12px; padding: 28px 22px; border-radius: 14px; }
  .hero h1 { font-size: 47px; }
  .hero-intro { font-size: 14px; }
  .countdown-panel { grid-template-columns: auto 1fr; padding: 18px; }
  .countdown-unit { align-self: end; padding-bottom: 9px; }
  .goal-line { grid-column: 1 / -1; width: 100%; padding: 12px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.16); }
  .summary-grid { gap: 8px; margin-top: 10px; }
  .metric-card { min-height: 112px; padding: 15px; }
  .metric-card strong { font-size: 27px; }
  .metric-card small { font-size: 9px; }
  .prediction-section { grid-template-columns: 1fr; gap: 20px; }
  .prediction-time { padding: 15px 0; border: 0; border-top: 1px solid rgba(255,255,255,.13); border-bottom: 1px solid rgba(255,255,255,.13); text-align: left; }
  .prediction-factors { grid-template-columns: 1fr 1fr; }
  .section-shell { padding: 20px 15px; }
  .readiness-score-block { align-items: flex-start; }
  .score-ring { width: 105px; height: 105px; }
  .score-inner strong { font-size: 30px; }
  .readiness-criteria { grid-template-columns: 1fr; }
  .weekly-adjustment { align-items: flex-start; flex-direction: column; }
  .comparison-stats { grid-template-columns: repeat(3, 1fr); }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 27px; }
  .daily-heading { display: block; }
  .daily-heading .outline-button { margin-top: 12px; }
  .session-row { grid-template-columns: 28px 60px 1fr; }
  .session-row .session-status { grid-column: 3; }
  .week-sessions .session-row { grid-template-columns: 58px 1fr auto; }
  .week-sessions .session-status { grid-column: auto; }
  .page-heading { padding-top: 38px; }
  .page-heading h1 { font-size: 47px; }
  .training-guide { padding: 16px 12px; }
  .guide-heading { display: block; }
  .guide-heading h2 { font-size: 24px; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-grid article { min-height: auto; }
  .bests-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .best-card { min-height: 135px; padding: 16px; }
  .shoe-form, .shoe-list { grid-template-columns: 1fr; }
  .nutrition-fields > div { grid-template-columns: 1fr 1fr; }
  .recent-run { grid-template-columns: 70px 1fr 55px; }
  .recent-run .run-stat:nth-last-child(-n+3) { display: none; }
  .calendar-page-heading { display: block; }
  .calendar-export { display: inline-block; }
  .calendar-weekdays span { padding: 7px 1px; font-size: 8px; }
  .calendar-day { min-height: 78px; padding: 4px; }
  .calendar-event { padding: 4px 3px; }
  .calendar-event b { font-size: 8px; }
  dialog form { padding: 26px 20px; }
  .auth-page { padding: 12px; }
  .auth-shell { min-height: 0; grid-template-columns: 1fr; border-radius: 15px; }
  .auth-panel { padding: 28px; }
  .auth-panel img { width: 180px; margin: -8px 0 38px -8px; }
  .auth-panel h1 { font-size: 39px; }
  .auth-panel > p:last-of-type { margin-bottom: 0; }
  .login-card { padding: 30px 28px 35px; }
  .login-card h2 { margin-bottom: 24px; }
}
