:root {
  --bg: #f7f5f2;
  --panel: #ffffff;
  --ink: #1e2430;
  --sub: #5c6472;
  --line: #e4e1da;
  --accent: #c1440e;
  --accent-dark: #9f340c;
  --accent-soft: #f4e2d8;
  --accent2: #2f6f5e;
  --accent2-soft: #e0efe9;
  --rest: #eef0f3;
  --shadow: 0 1px 2px rgba(30, 36, 48, 0.06), 0 8px 24px rgba(30, 36, 48, 0.06);
  --font-display: "Bricolage Grotesque", "Arial Rounded MT Bold", sans-serif;
  --font-sans: "Plus Jakarta Sans", "Avenir Next", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.5;
  padding: 32px 20px 80px;
}
.wrap {
  display: flex;
  min-height: calc(100vh - 112px);
  max-width: 640px;
  flex-direction: column;
  margin: 0 auto;
}
.wrap.wide {
  max-width: 1000px;
}
.site-header {
  width: 100%;
  margin: 0 0 26px;
  padding: 4px 0 26px;
  border-bottom: 1px solid var(--line);
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.brand {
  display: inline-block;
  line-height: 0;
  flex-shrink: 0;
}
.brand-logo {
  display: block;
  width: clamp(145px, 20vw, 176px);
  height: auto;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
}
.site-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.site-nav-link:hover {
  color: var(--ink);
  background: var(--panel);
}
.site-nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}
.site-nav-link.primary {
  color: #fff;
  background: var(--accent);
}
.site-nav-link.primary:hover {
  color: #fff;
  background: var(--accent-dark);
}
.hero-copy {
  width: 100%;
}
.hero-copy h2 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 10px;
  letter-spacing: -0.025em;
  font-weight: 600;
  line-height: 1.12;
}
.tagline {
  max-width: none;
  width: 100%;
  color: var(--sub);
  font-size: 16px;
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.55;
}
.intro-benefits {
  margin: 14px 0 0;
  color: var(--accent2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---------------- chat ---------------- */
.chat {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}
.msg {
  display: flex;
  margin-bottom: 14px;
  animation: msgIn 0.18s ease-out;
}
.msg.bot {
  justify-content: flex-start;
}
.msg.user {
  justify-content: flex-end;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.bubble {
  border-radius: 16px;
  padding: 14px 16px;
  max-width: 100%;
}
.bot-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
  width: 100%;
}
.bot-bubble.locked {
  opacity: 0.92;
}
.user-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  max-width: 75%;
}
.q-text {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.5;
}
.q-hint {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--sub);
  margin: 10px 0 8px;
}
.availability-notice {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid #ead2a6;
  border-radius: 9px;
  color: #6c4a12;
  background: #fff8e8;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
}
.availability-notice[hidden] {
  display: none;
}
.questionnaire-progress {
  padding: 4px 2px 2px;
}
.questionnaire-progress-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent2-soft);
  color: var(--accent2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.questionnaire-progress .q-text {
  margin-bottom: 6px;
  font-size: 17px;
}
.questionnaire-progress p {
  margin: 0;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
}
.questionnaire-progress-summary {
  display: grid;
  gap: 2px;
  margin-top: 16px;
  color: var(--ink);
  font-family: var(--font-sans);
}
.questionnaire-progress-summary strong {
  font-size: 14px;
}
.questionnaire-progress-summary span {
  color: var(--sub);
  font-size: 11.5px;
}
.questionnaire-progress-track {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--rest);
}
.questionnaire-progress-track span {
  display: block;
  width: 39%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #dd713f);
}
.questionnaire-paths {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.questionnaire-paths .continue-btn {
  margin-top: 0;
}
.secondary-btn {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf8;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
}
.secondary-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opt-btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  transition: all 0.15s ease;
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.opt-btn:disabled {
  cursor: default;
}
.opt-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.opt-btn .opt-desc {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--sub);
  text-align: left;
  width: 100%;
}
.opt-btn.selected .opt-desc {
  color: rgba(255, 255, 255, 0.85);
}
.opt-btn.chip {
  padding: 9px 16px;
  font-weight: 600;
}
.continue-btn {
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.continue-btn:disabled {
  background: #d8d5cc;
  cursor: not-allowed;
}

/* typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 18px;
  width: auto;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sub);
  opacity: 0.5;
  animation: typingBounce 1.1s infinite ease-in-out;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}
.generation-state {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding-top: 2px;
  text-align: center;
}
.generation-state .q-text {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.generation-lottie {
  width: min(180px, 55vw);
  aspect-ratio: 546 / 636;
  margin: 2px auto 0;
  overflow: hidden;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.generation-steps {
  display: grid;
  gap: 8px;
  width: min(360px, 100%);
  margin-top: 4px;
  text-align: left;
}
.generation-step {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #9a978f;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.35;
  transition: color 0.2s ease;
}
.generation-step span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid #c9c5bb;
  border-radius: 50%;
  background: transparent;
}
.generation-step.active {
  color: var(--ink);
  font-weight: 600;
}
.generation-step.active span {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.generation-step.complete {
  color: var(--sub);
}
.generation-step.complete span {
  border-color: var(--accent2);
  background: var(--accent2);
}
@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* race search */
.race-search {
  position: relative;
  margin-bottom: 4px;
}
.race-search-input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: 14.5px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s ease;
}
.race-search-input:focus {
  border-color: var(--accent);
}
.selection-builder {
  display: grid;
  gap: 11px;
  margin-top: 12px;
}
.selection-controls {
  display: grid;
  grid-template-columns: minmax(130px, 1.35fr) repeat(3, minmax(70px, 0.65fr)) minmax(130px, 1.2fr);
  gap: 8px;
  align-items: end;
}
.selection-field {
  display: grid;
  gap: 5px;
}
.selection-field label {
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.selection-input {
  width: 100%;
  min-height: 43px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf8;
  color: var(--ink);
  font: 14px var(--font-sans);
  padding: 9px 10px;
  outline: none;
}
.selection-input:focus {
  border-color: var(--accent);
}
.selection-actions,
.selection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e6d6cd;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font: 600 13px var(--font-sans);
  padding: 7px 10px;
}
.selection-chip button {
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: 700 17px/1 sans-serif;
  padding: 0;
}
.selection-empty {
  color: var(--sub);
  font: 13px var(--font-sans);
}
.selection-error {
  color: #b42318;
  display: none;
  font: 12px var(--font-sans);
}
@media (max-width: 680px) {
  .selection-controls {
    grid-template-columns: repeat(3, 1fr);
  }
  .selection-field:first-child,
  .selection-field:last-child {
    grid-column: span 3;
  }
}
.race-results {
  margin-top: 6px;
  border-radius: 10px;
  max-height: min(520px, 65vh);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 6px 18px rgba(30, 26, 20, 0.08);
}
.race-results:empty {
  display: none;
}
.race-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
  border-bottom: 1px solid var(--line);
}
.race-result:last-child {
  border-bottom: none;
}
.race-result:hover {
  background: var(--accent-soft);
}
.race-results-title {
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: 700 12px/1.3 var(--font-sans);
  letter-spacing: 0.04em;
  padding: 10px 14px;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}
.race-result .rr-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.race-result .rr-loc {
  font-size: 12px;
  color: var(--sub);
  margin-top: 1px;
}
.race-result .rr-date {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.race-result .rr-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 6px;
  margin-left: 6px;
}
.race-empty {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--sub);
  padding: 8px 2px;
}
.race-attribution {
  border-top: 1px solid var(--line);
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 8px 14px;
  text-align: right;
}
.race-attribution a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

/* inline calendar (reuses the dp- naming, no popover positioning needed) */
.inline-cal {
  margin-top: 4px;
}
.my-plans {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.my-plans[hidden] {
  display: none;
}
.my-plans-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.my-plans-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
}
.my-plans-controls {
  display: flex;
  gap: 6px;
}
.my-plans-control {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fbfaf8;
  font-size: 16px;
  cursor: pointer;
}
.my-plans-control:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.my-plans-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.my-plan-card {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  gap: 4px;
  padding: 14px 48px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fbfaf8;
  font-family: var(--font-sans);
  text-decoration: none;
}
.my-plan-card-wrap {
  position: relative;
  min-width: min(220px, 78vw);
  flex: 0 0 min(220px, 78vw);
  scroll-snap-align: start;
}
.my-plan-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.my-plan-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 3px 10px rgba(30, 36, 48, 0.12);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-3px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}
.my-plan-delete svg {
  display: block;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.my-plan-card-wrap:hover .my-plan-delete,
.my-plan-card-wrap:focus-within .my-plan-delete {
  opacity: 1;
  transform: translateY(0);
}
.my-plan-delete:hover {
  border-color: var(--accent);
  color: var(--accent);
}
@media (hover: none) {
  .my-plan-delete {
    opacity: 1;
    transform: none;
  }
}
.my-plan-card-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.my-plan-card-date {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.my-plan-card-goal {
  color: var(--sub);
  font-size: 11.5px;
  line-height: 1.4;
}
.delete-plan-dialog {
  width: min(440px, calc(100% - 28px));
}
.delete-plan-dialog-copy {
  margin: 18px 0 22px;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
}
.delete-plan-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.delete-plan-dialog-actions button {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
}
.delete-plan-cancel {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fbfaf8;
}
.delete-plan-confirm {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dp-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  font-family: var(--font-display);
}
.dp-nav {
  width: 28px;
  height: 28px;
  padding: 0;
  font-weight: 400;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.dp-nav:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.dp-weekdays span {
  text-align: center;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sub);
  padding: 4px 0;
}
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 34px;
  gap: 2px;
}
.dp-day {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}
.dp-day:hover:not(:disabled) {
  background: var(--accent-soft);
}
.dp-day.outside {
  color: #c4c0b6;
}
.dp-day.today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.dp-day.selected,
.dp-day.selected:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}
.dp-day.selected.outside {
  background: var(--accent-dark);
  color: #fff;
}
.dp-day:disabled {
  color: #d8d5cc;
  cursor: not-allowed;
}

/* ---------------- results ---------------- */
.results-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 20px;
}
.results-actions button {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 9px;
  cursor: pointer;
}
.export-menu-wrap {
  position: relative;
}
#exportBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
#exportBtn:hover,
#exportBtn[aria-expanded="true"] {
  background: #fbfaf8;
  border-color: var(--accent);
}
#exportBtn:disabled {
  cursor: wait;
  opacity: 0.65;
}
#exportBtn[aria-busy="true"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: export-spin 0.7s linear infinite;
}
@keyframes export-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #exportBtn[aria-busy="true"]::before {
    animation-duration: 1.4s;
  }
}
.export-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(30, 36, 48, 0.18);
}
.export-menu[hidden] {
  display: none;
}
.export-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.export-menu button:hover,
.export-menu button:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
#editAnswersBtn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}
#editAnswersBtn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
#editAnswersBtn:disabled {
  cursor: wait;
  opacity: 0.55;
}
#restartBtn {
  background: var(--accent);
  border: none;
  color: #fff;
}
#restartBtn:hover {
  box-shadow: 0 4px 14px rgba(193, 68, 14, 0.35);
}

/* share link */
.share-card {
  display: none;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.share-card.show {
  display: block;
}
.share-title {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sub);
  margin-bottom: 8px;
}
.share-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-url {
  flex: 1;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-copy-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--ink);
  border: none;
  color: #fff;
  white-space: nowrap;
}
.share-note {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--sub);
  margin-top: 8px;
}

/* progress */
.progress-card {
  display: none;
}
.progress-card.show {
  display: block;
}
.glossary-progress {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.progress-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sub);
}
.progress-text {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.progress-track {
  background: var(--rest);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}
.progress-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
  width: 0%;
}

/* answers / edit */
.answers-list {
  display: flex;
  flex-direction: column;
}
.answers-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 40px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(30, 36, 48, 0.24);
}
.answers-dialog::backdrop {
  background: rgba(30, 36, 48, 0.46);
  backdrop-filter: blur(3px);
}
.answers-dialog-inner {
  padding: 22px 24px 24px;
}
#answersDialog {
  overflow: hidden;
}
#answersDialog .answers-dialog-inner {
  display: flex;
  height: min(760px, calc(100vh - 40px));
  height: min(760px, calc(100dvh - 32px));
  flex-direction: column;
}
#answersDialog .answers-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}
.answers-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.answers-dialog-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}
.answers-dialog-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fbfaf8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.answers-dialog-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.answers-dialog-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -24px -24px;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 -10px 24px rgba(30, 36, 48, 0.05);
}
.answers-dialog-footer button {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.answers-dialog-cancel {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}
.answers-dialog-update {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}
.answers-dialog-update[hidden] {
  display: none;
}
.answer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.answer-row:first-child {
  border-top: none;
}
.answer-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.answer-label {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--sub);
}
.answer-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.answer-edit-btn {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  flex-shrink: 0;
}
.answer-edit-btn:hover {
  text-decoration: underline;
}
#answerEditor {
  flex: 0 0 100%;
  margin-top: 3px;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  width: 100%;
}
.answer-row.editing {
  padding-bottom: 14px;
}
.answer-row.editing .answer-edit-btn {
  color: var(--sub);
}

.results-reveal {
  animation: resultsReveal 180ms ease-out both;
}
@keyframes resultsReveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .results-reveal,
  .workout-guide-dialog[open] {
    animation: none;
  }
}

#planEditError {
  display: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: #8a3018;
  background: #fdece6;
  border: 1px solid #f0c4ae;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

#summary {
  display: none;
}
#summary.show {
  display: block;
}
.plan-overview {
  display: none;
  margin-bottom: 24px;
  padding: 22px 24px 24px;
}
.plan-overview.show {
  display: block;
}
.plan-overview-title {
  margin: 0 0 16px;
  font-size: 23px;
  font-weight: 600;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}
.personalized-overview {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 18px;
  padding: 18px 20px;
}
.personalized-overview h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}
.personalized-overview p {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}
.personalized-overview .plan-schedule-explanation {
  background: #f1f6f3;
  border-left: 3px solid var(--accent);
  color: var(--sub);
  margin-top: 14px;
  padding: 10px 12px;
}
.plan-compromises {
  background: #fff8ed;
  border: 1px solid #ead8bc;
  border-radius: 12px;
  margin-top: 18px;
  padding: 16px 20px;
}
.plan-compromises h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}
.plan-compromises ul {
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  padding-left: 20px;
}
.generated-source-link {
  align-items: center;
  background: var(--accent2-soft);
  border: 1px solid rgba(47, 111, 94, 0.18);
  border-radius: 999px;
  color: var(--accent2);
  display: inline-flex;
  font-size: 0.88em;
  font-weight: 700;
  gap: 4px;
  line-height: 1.4;
  margin: 0 2px;
  max-width: 100%;
  padding: 1px 7px;
  text-decoration: none;
  vertical-align: baseline;
}
.generated-source-link::after {
  content: "↗";
  font-size: 0.9em;
}
.generated-source-link:hover {
  background: #d2e7df;
  border-color: rgba(47, 111, 94, 0.32);
  text-decoration: underline;
}
.plan-decisions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  list-style: none;
  margin: 16px 0 0;
  padding: 14px 0 0;
}
.plan-decisions li {
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  padding-left: 18px;
  position: relative;
}
.plan-decisions li::before {
  color: var(--accent);
  content: "→";
  font-weight: 700;
  left: 0;
  position: absolute;
}
.plan-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: var(--accent);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.plan-more-toggle:hover {
  background: var(--accent-soft);
}
.plan-more-toggle:focus-visible {
  outline: 3px solid rgba(193, 68, 14, 0.25);
  outline-offset: 2px;
}
.plan-more-toggle::after {
  content: "↓";
}
.plan-more-toggle[aria-expanded="true"]::after {
  content: "↑";
}
.plan-more-details[hidden] {
  display: none;
}
.stat {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat .num {
  font-size: 26px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
}
.stat .lbl {
  font-family: var(--font-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sub);
  margin-top: 4px;
}
#startNote,
#injuryNote,
.ai-plan-note {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--sub);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 16px;
}
.ai-plan-note {
  padding: 13px 15px;
}
.ai-note-label {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.ai-note-copy {
  color: var(--sub);
  line-height: 1.6;
}
#planArea {
  display: none;
}
#planArea.show {
  display: block;
}
.week {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  color: inherit;
  background: #fbfaf8;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.week-head:hover {
  background: #f7f4ef;
}
.week-head:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(193, 68, 14, 0.28);
  outline-offset: -3px;
}
.week-head[aria-expanded="false"] {
  border-bottom-color: transparent;
}
.week-head-details {
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.week-head .wk-title {
  font-weight: 700;
  font-size: 15px;
}
.week-head .wk-title .phase {
  font-weight: 500;
  color: var(--sub);
  font-size: 12.5px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.week-head .wk-meta {
  font-size: 13px;
  color: var(--sub);
}
.week-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sub);
  transition: transform 0.18s ease;
}
.week-head[aria-expanded="true"] .week-chevron {
  transform: rotate(180deg);
}
.week-content {
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .week-chevron {
    transition-duration: 0.01ms;
  }
}
.week-intro {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--sub);
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fdfcfa;
}
.week-head[aria-expanded="false"] + .week-intro {
  border-bottom: 0;
}
.week.taper .week-intro {
  color: #4f7a6c;
}
.week.race .week-intro {
  color: var(--accent);
  font-weight: 500;
}
.week.taper .week-head {
  background: var(--accent2-soft);
}
.week.race .week-head {
  background: var(--accent-soft);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sub);
  text-align: left;
  padding: 8px 10px 6px;
}
td {
  padding: 10px;
  font-size: 14.5px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
th.chk,
td.chk {
  width: 34px;
  padding-right: 0;
  padding-left: 12px;
}
td.chk input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}
tr.workout-row {
  cursor: pointer;
}
tr.workout-row td {
  transition: background-color 0.12s ease;
}
tr.workout-row:hover td {
  background-color: #fbf7f2;
}
tr.day-done td:not(.chk) {
  opacity: 0.5;
}
tr.day-done td.workout,
tr.day-done .ex-name {
  text-decoration: line-through;
}
.workout-name {
  display: block;
}
.workout-name-button {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: help;
}
.workout-name-button:hover,
.workout-name-button:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}
.workout-name-button:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.mobile-plan-date,
.mobile-heading {
  display: none;
}
.workout-details {
  display: block;
  margin-top: 4px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}
.workout-pace {
  display: block;
  margin-top: 5px;
  color: var(--accent2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
td.plan-date {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--sub);
  white-space: nowrap;
  width: 96px;
}
td.dist {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  width: 70px;
}
tr.rest-row td.workout {
  color: var(--sub);
  font-style: italic;
}
tr.long-row td.workout {
  font-weight: 600;
}
tr.race-row td {
  background: var(--accent-soft);
}
tr.race-row:hover td {
  background: #f1d8cb;
}
tr.strength-row td.ex-cell {
  padding: 12px 10px 14px;
}
.ex-header {
  font-family: var(--font-sans);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #6a4a9e;
  margin-bottom: 8px;
}
.ex-light-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: #6a4a9e;
  background: #efe9f7;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.ex-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.training-stats {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 20px 0 24px;
  padding: 20px;
}
.training-stats-head {
  margin-bottom: 14px;
}
.training-stats-title {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}
.training-stats-note {
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 12px;
  margin: 2px 0 0;
}
.training-stats-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.training-stat {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
}
.training-stat-value {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}
.training-stat-label {
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-top: 3px;
  text-transform: uppercase;
}
.ex-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #faf8fc;
  border: 1px solid #e8e1f1;
  border-radius: 10px;
  padding: 6px 10px 6px 6px;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    transform 0.12s ease;
}
.ex-chip:hover {
  background: #f5f0fa;
  border-color: #cdbde0;
  transform: translateY(-1px);
}
.ex-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ex-chip .ex-video-icon {
  flex: 0 0 auto;
  color: #6a4a9e;
  font-size: 11px;
  line-height: 1;
}
.ex-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #efe9f7;
  color: #6a4a9e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ex-icon svg {
  width: 15px;
  height: 15px;
}
.ex-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.ex-name {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.ex-note {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-style: italic;
  color: var(--sub);
  white-space: nowrap;
}
.ex-sets {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  color: #6a4a9e;
  background: #efe9f7;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  margin-left: 2px;
}
@media (max-width: 480px) {
  .week table {
    table-layout: fixed;
  }
  .week th.plan-date-heading,
  .week td.plan-date {
    display: none;
  }
  .week .desktop-heading {
    display: none;
  }
  .week .mobile-heading,
  .week .mobile-plan-date {
    display: block;
  }
  .week .mobile-plan-date {
    margin-bottom: 2px;
    color: var(--sub);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
  }
  .week th.workout-heading,
  .week td.workout,
  .week td.ex-cell {
    padding-left: 8px;
  }
  .week th.dist-heading,
  .week td.dist {
    width: 68px;
    padding-right: 10px;
    padding-left: 4px;
    text-align: right;
  }
  .week .ex-list {
    flex-direction: column;
  }
  .week .ex-chip {
    width: 100%;
    min-width: 0;
  }
  .week .ex-text {
    flex: 1;
    min-width: 0;
  }
  .week .ex-name,
  .week .ex-note {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .week .ex-sets {
    flex-shrink: 0;
  }
}
.glossary {
  margin-bottom: 24px;
  padding: 20px 24px;
}
.glossary-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 14px;
}
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
}
.gloss-item {
  display: block;
  align-items: flex-start;
  border-radius: 8px;
  scroll-margin: 82px 0 24px;
}
.gloss-item.guide-target {
  background: var(--accent-soft);
}
.gloss-item .gloss-text {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--sub);
  line-height: 1.45;
}
.gloss-item .gloss-text strong {
  color: var(--ink);
  font-weight: 600;
}
.gloss-kind {
  display: block;
  margin-bottom: 3px;
  color: var(--accent2);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* plan + sticky glossary sidebar */
.plan-layout {
  display: block;
}
.plan-main {
  min-width: 0;
}
.mobile-guide-btn {
  display: none;
}
html.workout-guide-scroll-locked {
  overflow: hidden;
  overscroll-behavior: none;
}
body.workout-guide-scroll-locked {
  position: fixed;
  inset-inline: 0;
  top: var(--workout-guide-scroll-offset, 0);
  width: 100%;
  overflow: hidden;
}
.workout-guide-dialog {
  width: min(560px, calc(100% - 32px));
  height: min(80vh, 720px);
  height: min(80dvh, 720px);
  max-height: min(80vh, 720px);
  max-height: min(80dvh, 720px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 -18px 60px rgba(30, 36, 48, 0.2);
}
.workout-guide-dialog::backdrop {
  background: rgba(30, 36, 48, 0.42);
  backdrop-filter: blur(2px);
}
.workout-guide-inner {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0 20px max(22px, env(safe-area-inset-bottom));
}
.workout-guide-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.workout-guide-dialog .mobile-glossary-grid {
  position: relative;
  z-index: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  contain: paint;
  padding: 18px 8px;
}
.workout-guide-dialog .gloss-item {
  padding: 8px;
}
.workout-guide-dialog .glossary-progress {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 16px;
  background: var(--panel);
}
.workout-guide-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}
.workout-guide-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fbfaf8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.workout-guide-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
@media (min-width: 900px) {
  .plan-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }
  .plan-aside {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    margin-bottom: 0;
    max-height: calc(100vh - 40px);
    flex-direction: column;
    overflow: hidden;
  }
  .plan-aside .glossary-grid {
    min-height: 0;
    flex: 1;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 14px;
    overflow-y: auto;
    padding-right: 6px;
    overscroll-behavior: contain;
  }
  .plan-aside .glossary-title,
  .plan-aside .glossary-progress {
    flex: 0 0 auto;
  }
  .plan-aside .glossary-progress {
    position: sticky;
    bottom: 0;
    z-index: 1;
    background: var(--panel);
  }
}
@media (max-width: 899px) {
  #resultsWrap {
    padding-bottom: 64px;
  }
  .plan-aside {
    display: none !important;
  }
  .mobile-guide-btn.show {
    position: fixed;
    left: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 9px 12px 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #fff;
    background: var(--ink);
    box-shadow: 0 8px 26px rgba(30, 36, 48, 0.28);
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
  }
  .mobile-guide-btn.show:hover {
    background: #2b3340;
  }
  .mobile-guide-progress {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--ink);
    background: #fff;
    font-size: 11px;
    line-height: 1;
  }
  .workout-guide-dialog {
    width: 100%;
    max-width: none;
    height: min(76vh, 680px);
    height: min(76dvh, 680px);
    max-height: min(76vh, 680px);
    max-height: min(76dvh, 680px);
    margin: auto 0 0;
    padding: 0;
    border-width: 1px 0 0;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
  }
  .workout-guide-dialog[open] {
    animation: guide-sheet-in 180ms ease-out;
  }
  .mobile-glossary-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
@keyframes guide-sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* support / buy me a coffee */
.support-card {
  margin-top: 24px;
  text-align: center;
  padding: 26px 24px;
}
.support-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 8px;
}
.support-text {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--sub);
  line-height: 1.55;
  max-width: 460px;
  margin: 0 auto 16px;
}
.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 700;
  color: #2a1a05;
  background: #ffdd00;
  padding: 11px 22px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 3px 0 #d9bc00;
  transition: transform 0.1s ease;
}
.support-btn:hover {
  transform: translateY(-1px);
}
.support-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #d9bc00;
}
.analytics-consent {
  position: fixed;
  inset: auto 18px 18px auto;
  width: min(430px, calc(100vw - 36px));
  margin: 0;
  padding: 18px;
  box-sizing: border-box;
  border: 1px solid rgba(49, 43, 37, 0.18);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 18px 50px rgba(49, 43, 37, 0.2);
}
.analytics-consent[hidden] {
  display: none;
}
.analytics-consent p {
  margin: 0 0 14px;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.5;
}
.analytics-consent .analytics-consent-title {
  margin-bottom: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.analytics-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.analytics-consent button,
.footer-button {
  font: inherit;
  cursor: pointer;
}
.analytics-consent button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.footer-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
}
.disclaimer-dialog-copy {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}
.disclaimer-dialog-copy p {
  margin: 0;
}
.calendar-dialog-copy {
  margin: 16px 0 18px;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
}
.calendar-options {
  display: grid;
  gap: 10px;
}
.calendar-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fbfaf8;
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.calendar-option:hover,
.calendar-option:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.calendar-option strong {
  font-size: 14px;
}
.calendar-option span {
  color: var(--sub);
  font-size: 12px;
}
.calendar-export-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--accent2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
}
.sponsor-placement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 14px;
  padding: 18px 20px;
  border: 1px solid #c8ddd5;
  border-radius: 12px;
  background: var(--accent2-soft);
  box-shadow: var(--shadow);
}
.sponsor-placement-copy {
  min-width: 0;
}
.sponsor-placement-title {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}
.sponsor-placement-text {
  margin: 0;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.45;
}
.sponsor-placement-btn {
  flex-shrink: 0;
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.sponsor-placement-btn:hover {
  background: #275f51;
}
.sponsor-dialog {
  width: min(540px, calc(100% - 28px));
}
.sponsor-dialog-copy {
  margin: 14px 0 18px;
  color: var(--sub);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
}
.sponsor-form {
  display: grid;
  gap: 14px;
}
.sponsor-field {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
}
.sponsor-field input,
.sponsor-field textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: 14px var(--font-sans);
}
.sponsor-field input:focus,
.sponsor-field textarea:focus {
  border-color: var(--accent2);
  outline: 3px solid rgba(47, 111, 94, 0.14);
}
.sponsor-field textarea {
  min-height: 94px;
  resize: vertical;
}
.sponsor-optional {
  color: var(--sub);
  font-weight: 500;
}
.sponsor-form-status {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font: 12.5px/1.45 var(--font-sans);
}
.sponsor-form-status.success {
  color: var(--accent2);
}
.sponsor-submit {
  justify-self: start;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.sponsor-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}
.sponsor-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  margin: auto auto 0;
  padding-top: 64px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--sub);
  text-align: center;
}
.footer-logo-link {
  display: inline-block;
  line-height: 0;
}
.footer-logo {
  display: block;
  width: 118px;
  height: auto;
}
.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  flex-wrap: wrap;
}
.footer-link {
  color: var(--accent2);
  font-weight: 700;
  text-decoration: none;
}
.footer-link:hover {
  text-decoration: underline;
}
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]),
  textarea,
  select {
    font-size: 16px;
  }
}
@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .chat,
  .results-actions,
  .plan-more-toggle,
  .answers-dialog,
  .workout-guide-dialog,
  .mobile-guide-btn,
  .sponsor-placement,
  .sponsor-dialog,
  .site-nav,
  footer {
    display: none !important;
  }
  .card,
  .week {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  .week-content[hidden] {
    display: block !important;
  }
  .plan-more-details[hidden] {
    display: block !important;
  }
  .week-content {
    height: auto !important;
    opacity: 1 !important;
    overflow: visible !important;
  }
  .week-chevron {
    display: none;
  }
}
@media (max-width: 560px) {
  body {
    padding: 18px 14px 60px;
  }
  .wrap {
    min-height: calc(100vh - 78px);
  }
  .site-header {
    padding: 2px 0 22px;
    margin-bottom: 20px;
  }
  .masthead {
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
  }
  .brand-logo {
    width: 142px;
  }
  .week-head {
    padding: 12px 14px;
  }
  .week-head-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .week-head .wk-title .phase {
    margin-left: 5px;
  }
  .sponsor-placement {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
  .site-nav {
    gap: 2px;
  }
  .site-nav-link {
    width: 36px;
    min-height: 36px;
    justify-content: center;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 50%;
  }
  .site-nav-link:hover,
  .site-nav-link:focus-visible {
    border-color: var(--line);
  }
  .site-nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .hero-copy h2 {
    font-size: 30px;
  }
  .tagline {
    font-size: 14.5px;
  }
  .results-actions button {
    flex: 1;
  }
  .export-menu-wrap {
    flex: 1;
  }
  #exportBtn {
    width: 100%;
  }
  .export-menu button {
    flex: none;
  }
  .answers-dialog-inner {
    padding: 18px;
  }
  .answers-dialog-footer {
    margin: 0 -18px -18px;
    padding-right: 18px;
    padding-left: 18px;
  }
}
