@media (max-width: 860px) {
  .app-hero {
    grid-template-columns: 1fr;
    min-height: 176px;
  }

  .app-hero-badge {
    justify-self: start;
  }

  .app-hero-side {
    justify-self: start;
    justify-items: start;
  }

  .app-hero-actions {
    justify-content: flex-start;
  }

  .page-head,
  .layout-grid,
  .chart-grid,
  .algorithm-layout,
  .tuning-set-layout,
  .base-config-grid,
  .workout-definition-row,
  .workout-schedule-head,
  .workout-schedule-row,
  .account-profile-grid,
  .theme-choice-grid,
  .fallback-rule-grid,
  .grammar-preview-summary {
    grid-template-columns: 1fr;
  }

  .settings-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-help-link {
    width: fit-content;
  }

  .plan-row-main {
    grid-template-columns: 1fr;
  }

  .plan-row-meta {
    justify-items: start;
  }

  .row-stat-pills,
  .plan-row-actions {
    justify-content: flex-start;
  }

  .plan-row-footer {
    justify-content: flex-start;
  }

  .tuning-set-picker-main {
    grid-template-columns: 1fr;
  }

  .help-table > div,
  .help-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px), ((hover: none) and (pointer: coarse) and (max-height: 560px) and (max-width: 960px)) {
  :root[data-theme="dark"] .distance-projection:not(.compact) .distance-projection-mobile-axis span {
    color: rgba(199, 209, 222, 0.72);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.46);
  }

  :root {
    --metrics-footer-bottom-extension: 0px;
    --metrics-footer-underlap-fill-height: 0px;
    --z-floating-popover: 1100;
  }

  html {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    min-height: -webkit-fill-available;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 280px),
      linear-gradient(135deg, rgba(47, 128, 98, 0.055) 0 1px, transparent 1px 28px),
      linear-gradient(180deg, #e7edf2 0%, #f3f6f8 48%, #eaf1ed 100%);
    background-color: var(--paper);
    overflow-x: clip;
    overscroll-behavior: none;
  }

  body {
    width: 100%;
    max-width: 100%;
    min-height: -webkit-fill-available;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    overflow-x: clip;
    background-color: var(--paper);
    overscroll-behavior: none;
  }

  #app {
    width: 100%;
    max-width: 100%;
    min-height: -webkit-fill-available;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    overflow-x: clip;
  }

  .shell {
    min-height: -webkit-fill-available;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    background: transparent;
    background-color: transparent;
  }

  @media (display-mode: standalone) {
    :root {
      --metrics-footer-bottom-extension: max(28px, env(safe-area-inset-bottom));
      --metrics-footer-underlap-fill-height: calc(154px + var(--metrics-footer-bottom-extension, 0px));
    }
  }

  .auth-page {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    place-items: center;
    padding:
      max(16px, env(safe-area-inset-top, 0px))
      16px
      max(16px, env(safe-area-inset-bottom, 0px));
  }

  .auth-panel {
    width: min(358px, 100%);
  }

  .auth-panel .brand-row {
    min-height: 146px;
    padding: 22px 24px;
  }

  .auth-tabs,
  .auth-form,
  .auth-panel > .message {
    margin-inline: 16px;
  }

  .main {
    padding: 0 10px 32px;
  }

  .shell:not(.metrics-collapsed) .main {
    padding-bottom: calc(190px + 10vh);
  }

  .shell.metrics-collapsed .main {
    padding-bottom: calc(82px + 10vh);
  }

  .metrics-footer::before {
    display: none;
    height: 0;
  }

  .metrics-footer.is-collapsed::before {
    height: var(--metrics-footer-underlap-fill-height);
  }

  @media (display-mode: standalone) {
    .metrics-footer::before {
      display: block;
      height: var(--metrics-footer-underlap-fill-height);
    }

    .metrics-footer.is-collapsed::before {
      height: calc(92px + var(--metrics-footer-bottom-extension, 0px));
    }
  }

  .plan-end-note {
    gap: 16px;
    padding-inline: 4px;
  }

  .plan-row-form.beyond-row {
    min-height: 92px;
    height: 92px;
  }

  .run-calendar {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
  }

  .run-calendar-month {
    padding: 10px;
  }

  .run-calendar-month h3 {
    font-size: 0.86rem;
  }

  .run-calendar-weekdays {
    font-size: 0.62rem;
  }

  .run-calendar-days {
    gap: 2px;
  }

  .run-calendar-day {
    font-size: 0.72rem;
  }

  .run-calendar-arrow .icon {
    width: 16px;
    height: 16px;
  }

  .beyond-action-menu {
    top: 8px;
    right: 8px;
  }

  .distance-projection {
    --projection-mobile-axis-width: 56px;
    --projection-mobile-chart-height: 189px;

    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    padding-inline: 8px;
  }

  .distance-projection:not(.compact) .distance-projection-mobile-axis {
    position: absolute;
    top: 0;
    left: 8px;
    z-index: 4;
    display: block;
    width: var(--projection-mobile-axis-width);
    height: var(--projection-mobile-chart-height);
    pointer-events: none;
    background: transparent;
  }

  .distance-projection:not(.compact) .distance-projection-mobile-axis span {
    position: absolute;
    top: var(--axis-y);
    left: 0;
    color: rgba(102, 112, 133, 0.62);
    font-size: 10px;
    font-weight: 780;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
    transform: translateY(-50%);
    white-space: nowrap;
  }

  .distance-projection:not(.compact) .distance-projection-scroll {
    margin-inline: -8px;
    padding-inline: 8px;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .distance-projection:not(.compact) .distance-projection-slider {
    display: grid;
    gap: 5px;
    justify-self: stretch;
    margin-top: -2px;
    padding-inline: 18px;
  }

  .distance-projection:not(.compact) .distance-projection-slider input {
    min-height: 44px;
  }

  .distance-projection:not(.compact) .distance-projection-slider input[type="range"]::-webkit-slider-thumb {
    width: 34px;
    height: 34px;
    margin-top: -13px;
  }

  .distance-projection:not(.compact) .distance-projection-slider input[type="range"]::-moz-range-thumb {
    width: 34px;
    height: 34px;
  }

  .distance-projection:not(.compact) .distance-projection-scale {
    display: none;
  }

  .distance-projection:not(.compact) .distance-projection-chart-wrap {
    min-width: 760px;
  }

  .distance-projection:not(.compact) .distance-projection-chart {
    height: var(--projection-mobile-chart-height);
    min-height: var(--projection-mobile-chart-height);
  }

  .distance-projection:not(.compact) .distance-projection-grid text {
    display: none;
  }

  .distance-projection-chart {
    min-height: 112px;
  }

  .distance-projection-grid text {
    font-size: 10px;
  }

  .distance-projection-scale {
    font-size: 0.64rem;
  }

  .sticky-dashboard {
    position: static !important;
    top: auto;
    z-index: auto;
    gap: 8px;
    padding: 10px 0 8px;
    transform: none;
  }

  .sticky-dashboard::before {
    display: none;
  }

  .mobile-command-bar {
    display: block;
    position: fixed;
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
    z-index: var(--z-mobile-command);
    margin: 0;
    padding: 0 2px;
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 180ms ease,
      visibility 180ms ease;
    visibility: hidden;
    will-change: opacity;
  }

  .mobile-command-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-command-glass {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    background:
      linear-gradient(135deg, rgba(20, 30, 44, 0.94), rgba(39, 115, 86, 0.8)),
      rgba(24, 33, 47, 0.88);
    box-shadow:
      0 18px 42px rgba(16, 24, 40, 0.26),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(18px) saturate(1.18);
    -webkit-backdrop-filter: blur(18px) saturate(1.18);
    padding: 5px;
    pointer-events: auto;
  }

  .mobile-command-controls {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .mobile-command-icon,
  .mobile-current-week-button {
    width: 34px;
    height: 34px;
    min-height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    padding: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  }

  .mobile-command-icon.active {
    border-color: rgba(136, 230, 185, 0.7);
    background: rgba(71, 178, 131, 0.82);
    color: white;
  }

  .mobile-command-icon:hover,
  .mobile-command-icon:focus-visible,
  .mobile-current-week-button:hover,
  .mobile-current-week-button:focus-visible {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.25);
    color: white;
    outline: 0;
  }

  .mobile-command-icon.active:hover,
  .mobile-command-icon.active:focus-visible {
    background: rgba(71, 178, 131, 0.94);
    color: white;
  }

  .week-action-menu {
    position: static;
  }

  .beyond-action-menu.week-action-menu {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .week-action-menu-panel {
    position: fixed;
    top: 50%;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    z-index: 420;
    width: auto;
    max-height: calc(100svh - 48px);
    overflow-y: auto;
    border-radius: 18px;
    box-shadow:
      0 28px 80px rgba(15, 23, 42, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
    padding: 10px;
    transform: translateY(-50%);
  }

  .beyond-action-menu .week-action-menu-panel {
    top: 50%;
    bottom: auto;
  }

  .week-action-menu.reset-only .week-action-menu-panel {
    width: auto;
  }

  .mobile-command-icon .icon,
  .mobile-current-week-button .icon {
    width: 17px;
    height: 17px;
  }

  .mobile-command-main {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
  }

  .mobile-command-pill {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    padding: 4px 9px;
    font-size: 0.73rem;
    font-weight: 850;
    white-space: nowrap;
  }

  .mobile-account-week-pill {
    max-width: 100%;
    padding: 4px 9px 4px 4px;
  }

  .mobile-account-week-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-command-signout {
    min-height: 24px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 3px 7px;
    font-size: 0.68rem;
    font-weight: 850;
  }

  .mobile-command-signout:hover,
  .mobile-command-signout:focus-visible {
    border-color: rgba(255, 255, 255, 0.44);
    background: rgba(255, 255, 255, 0.3);
    outline: 0;
  }

  .mobile-command-readonly {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.84);
  }

  .mobile-command-caption {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.66rem;
    font-weight: 800;
    white-space: nowrap;
  }

  .app-hero {
    min-height: 156px;
    gap: 9px;
    padding:
      46px
      max(14px, env(safe-area-inset-right, 0px))
      14px
      max(14px, env(safe-area-inset-left, 0px));
  }

  .help-shell {
    width: min(calc(100% - 20px), 1120px);
    padding: 18px 0 48px;
  }

  .help-hero,
  .help-section {
    padding: 18px;
  }

  .help-hero h1 {
    font-size: 2.4rem;
  }

  .help-back-link {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 18px;
  }

  .plan-row-form {
    scroll-margin-top: var(--sticky-row-offset, 58px);
  }

  .app-hero-image {
    inset: -20% -32%;
    width: 156%;
    height: 142%;
  }

  .app-hero-corner-actions {
    top: 10px;
    left: max(10px, env(safe-area-inset-left, 0px));
    gap: 6px;
  }

  @media (display-mode: standalone) {
    .sticky-dashboard {
      padding-top: 0;
    }

    .app-hero {
      margin-top: calc(-1 * env(safe-area-inset-top, 0px));
      padding-top: calc(46px + env(safe-area-inset-top, 0px));
    }

    .app-hero-image {
      inset: calc(-20% - env(safe-area-inset-top, 0px)) -32% auto -32%;
      height: calc(142% + env(safe-area-inset-top, 0px));
    }

    .app-hero-corner-actions {
      top: calc(10px + env(safe-area-inset-top, 0px));
    }
  }

  .app-hero-corner-btn {
    width: 34px;
    height: 34px;
  }

  .app-hero-corner-btn.debug-toggle {
    width: 34px;
    gap: 0;
    padding: 0;
  }

  .app-hero-corner-btn.debug-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .app-hero-title {
    font-size: clamp(1.42rem, 8vw, 1.95rem);
  }

  .app-hero-detail {
    margin-top: 5px;
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .app-hero-side {
    width: 100%;
    justify-self: stretch;
    justify-items: start;
  }

  .app-hero-badge {
    max-width: 100%;
    min-height: 32px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .account-week-pill {
    max-width: 100%;
    padding: 4px 4px 4px 9px;
  }

  .account-week-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-signout-pill {
    flex: 0 0 auto;
    min-height: 24px;
    padding-inline: 8px;
  }

  .hero-current-week-button {
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: 10px;
    min-height: 32px;
    padding: 6px 8px;
  }

  .hero-current-week-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .topbar,
  .brand-row {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .compact-topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar-actions,
  .settings-head-actions,
  .button-row {
    width: 100%;
  }

  .compact-topbar .topbar-actions {
    justify-content: flex-end;
  }

  .topbar-actions .btn,
  .settings-head-actions .btn,
  .app-hero-actions .btn,
  .button-row .btn {
    flex: 1;
  }

  .er-settings-dialog {
    width: 100%;
    height: min(calc(100dvh - 16px), 900px);
    max-height: min(calc(100dvh - 16px), 900px);
  }

  .er-dialog-backdrop {
    align-items: start;
    min-height: 100vh;
    min-height: 100dvh;
    justify-items: center;
    overflow-y: auto;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
    place-items: start center;
    -webkit-overflow-scrolling: touch;
  }

  .er-dialog {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    margin: 0;
  }

  .er-dialog-compact {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .er-dialog-compact {
    width: 100%;
  }

  .er-dialog-head {
    gap: 10px;
    padding: 12px;
  }

  .er-dialog-title {
    font-size: 1.14rem;
  }

  .er-dialog-body {
    gap: 12px;
    padding: 12px;
  }

  .er-settings-dialog-body {
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 0;
  }

  .starter-setup-banner {
    width: 100%;
  }

  .starter-setup-form {
    grid-template-columns: 1fr;
  }

  .starter-setup-carousel,
  .starter-setup-program-controls {
    grid-template-columns: 1fr;
  }

  .starter-setup-day-grid {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
  }

  .settings-tabs {
    display: flex;
    gap: 6px;
    margin: 0 -12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 9px 12px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-tab {
    flex: 0 0 auto;
    min-width: max-content;
    min-height: 34px;
    padding: 0 11px;
    scroll-snap-align: start;
  }

  .algorithm-preview-top {
    display: none;
  }

  .compact-topbar .topbar-actions .btn {
    flex: 0 0 auto;
  }
  .run-cell,
  .run-entry-row,
  .form-grid,
  .factor-map-visual {
    grid-template-columns: 1fr;
  }

  .tuning-set-actions {
    justify-content: flex-start;
  }

  .tuning-set-actions .btn {
    flex: 1 1 150px;
  }

  .plan-scroll {
    gap: 8px;
  }

  .plan-row-main {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 9px 8px 12px;
  }

  .plan-title-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    width: 100%;
  }

  .plan-row-title h4 {
    font-size: 0.94rem;
  }

  .plan-row-title p {
    margin-top: 3px;
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .row-kicker {
    min-height: 18px;
    padding: 2px 5px;
    font-size: 0.6rem;
  }

  .title-factor {
    min-height: 20px;
    padding: 2px 6px;
    font-size: 0.63rem;
  }

  .plan-row-meta {
    width: 100%;
  }

  .row-stat-pills {
    width: 100%;
    justify-content: stretch;
  }

  .row-stat-pill {
    max-width: 100%;
    min-height: 28px;
    padding: 4px 7px;
    font-size: 0.7rem;
  }

  .row-stat-pill.stat-average {
    width: 100%;
    justify-content: space-between;
  }

  .row-stat-label {
    min-width: 0;
    gap: 3px;
  }

  .row-stat-value strong {
    font-size: 0.82rem;
  }

  .row-stat-value small {
    font-size: 0.62rem;
  }

  .row-stat-pill .metric-label-meta {
    min-height: 17px;
    padding: 2px 5px;
    font-size: 0.62rem;
  }

  .row-stat-pill .info-icon {
    width: 15px;
    height: 15px;
  }

  .run-grid {
    gap: 0;
    padding: 8px 7px 9px 10px;
  }

  .run-grid:not(.single-run) {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-x: contain;
    padding: 8px 18px 10px;
    scroll-padding-inline: 18px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .run-grid:not(.single-run)::-webkit-scrollbar {
    display: none;
  }

  .run-grid:not(.single-run) .week-day-slot {
    flex: 0 0 min(74vw, 258px);
    min-width: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .run-grid:not(.single-run) .week-day-slot.rest-day-slot {
    flex-basis: 54px;
  }

  .run-grid:not(.single-run) .week-day-cell {
    min-height: 88px;
    grid-template-rows: auto minmax(30px, 1fr) auto;
    gap: 4px;
    border-left: 1px solid rgba(213, 220, 230, 0.92);
    border-radius: 8px;
    padding: 7px 9px 6px;
    box-shadow: 0 8px 18px rgba(37, 49, 68, 0.08);
  }

  .run-grid:not(.single-run) .rest-day-slot .week-day-cell {
    min-height: 88px;
    padding: 7px 4px 6px;
  }

  .run-grid:not(.single-run) .mobile-focus-slot .week-day-cell {
    box-shadow:
      inset 0 0 0 1px rgba(47, 128, 98, 0.18),
      0 0 0 2px rgba(47, 128, 98, 0.08);
  }

  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete {
    --iphone-card-background:
      linear-gradient(135deg, transparent 0 calc(100% - 30px), color-mix(in srgb, var(--blue) 70%, white) calc(100% - 29px) 100%),
      linear-gradient(135deg, color-mix(in srgb, var(--blue) 88%, white), var(--blue) 48%, color-mix(in srgb, var(--iphone-deep-run-blue) 84%, var(--blue)) 130%);
    --iphone-card-hover-background:
      linear-gradient(135deg, transparent 0 calc(100% - 30px), color-mix(in srgb, var(--blue) 76%, white) calc(100% - 29px) 100%),
      linear-gradient(135deg, color-mix(in srgb, var(--blue) 92%, white), color-mix(in srgb, var(--blue) 96%, var(--iphone-deep-run-blue)) 48%, color-mix(in srgb, var(--iphone-deep-run-blue) 88%, var(--blue)) 130%);
    --iphone-card-border-color: color-mix(in srgb, var(--blue) 60%, var(--border));
    --iphone-card-hover-border-color: color-mix(in srgb, var(--blue) 74%, var(--border));
    background:
      var(--iphone-card-background);
    border-color: var(--iphone-card-border-color);
    color: white;
    box-shadow:
      inset 0 1px 0 rgba(245, 247, 232, 0.2),
      inset 0 0 0 1px rgba(245, 247, 232, 0.1),
      0 12px 24px color-mix(in srgb, var(--blue) 22%, transparent);
  }

  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-abbrev,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-description,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-distance,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-distance small,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-workout,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-achieved-distance,
  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-pace {
    color: rgba(255, 255, 255, 0.9);
  }

  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .week-day-cell:is(.run-day, .start-run).pace-complete .week-day-distance {
    color: white;
  }

  :root[data-color-theme="iphone"] .plan-row-form.active .run-grid:not(.single-run) .week-day-cell.needs-pace::before {
    border-color: rgba(255, 255, 255, 0.84);
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--blue) 24%, transparent),
      inset 0 0 0 3px var(--blue);
  }

  :root[data-color-theme="iphone"] .run-grid:not(.single-run) .mobile-focus-slot .week-day-cell {
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--blue) 34%, transparent),
      0 0 0 2px color-mix(in srgb, var(--blue) 18%, transparent),
      0 12px 24px color-mix(in srgb, var(--blue) 18%, transparent);
  }

  .week-day-cell {
    min-height: 74px;
    grid-template-rows: auto minmax(24px, 1fr) auto;
    gap: 4px;
    padding: 6px 2px 5px;
  }

  .week-day-cell.start-run {
    min-height: 86px;
  }

  .week-day-abbrev {
    font-size: 0.58rem;
  }

  .week-day-description {
    font-size: 0.52rem;
  }

  .week-day-distance {
    font-size: clamp(0.86rem, 5.8vw, 1.3rem);
  }

  .run-day-slot .week-day-distance,
  .start-run-slot .week-day-distance {
    font-size: clamp(0.98rem, 6.2vw, 1.42rem);
  }

  .rest-day-slot .week-day-distance small {
    display: none;
  }

  .week-day-pace {
    flex-direction: row;
    gap: 2px;
    font-size: 0.65rem;
  }

  .pace-entered-value,
  .pace-threshold-compare {
    max-width: 100%;
    justify-content: center;
  }

  .pace-threshold-compare {
    font-size: 0.78em;
  }

  .run-edit-grid {
    grid-template-columns: 1fr;
  }

  .plan-title-line {
    flex-wrap: wrap;
  }

  .trend-card {
    min-height: 110px;
    gap: 6px;
  }

  .metric-number-card {
    min-height: 110px;
  }

  .metric-number-card .metric-value {
    font-size: 1.5rem;
  }

  .metrics-footer {
    position: fixed;
    right: 0;
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    left: 0;
    z-index: var(--z-metrics-footer);
    padding:
      0
      max(8px, env(safe-area-inset-right, 0px))
      0
      max(8px, env(safe-area-inset-left, 0px));
    pointer-events: none;
  }

  .metrics-footer-glass {
    border-radius: 10px;
    box-shadow: var(--metrics-footer-mobile-shadow);
  }

  .metrics-footer-head {
    padding: 8px 9px 6px;
  }

  .metrics-footer-kicker {
    font-size: 0.6rem;
  }

  .metrics-footer-title {
    font-size: 0.84rem;
  }

  .metrics-footer-toggle {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .metrics-footer-body {
    padding: 0 8px 8px;
  }

  .metrics-footer .metric {
    padding: 10px;
  }

  .summary-grid {
    grid-auto-columns: minmax(210px, calc(100% - 36px));
    gap: 8px;
    padding: 1px 2px 4px;
  }

  .metric-title {
    font-size: 0.66rem;
  }

  .metric-value {
    font-size: 1.2rem;
  }

  .metric-sparkline,
  .metric-empty-spark {
    min-height: 42px;
    height: 42px;
  }

  .metric-slide-button {
    display: none;
  }

  .share-link-row {
    grid-template-columns: 1fr;
  }

  .watch-pairing-row,
  .watch-device-row {
    grid-template-columns: 1fr;
  }

  .watch-code-card {
    width: 100%;
  }

  .watch-device-rename-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .watch-device-rename-form input {
    grid-column: 1 / -1;
  }

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

  .invite-policy-toggle {
    min-width: 0;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .section-head,
  .plan-head-actions {
    align-items: flex-start;
  }

  .plan-head-actions {
    align-self: flex-start;
  }

  .section-head {
    flex-direction: column;
  }

  .main {
    padding-inline: 10px;
  }
}
