/* v3.7.11 desktop detail fixes
   Keep mobile behavior unchanged; this file only overrides desktop/tablet-wide layout details.
*/

@media (min-width: 761px) {
  /* Date switcher: keep “查看” and all date controls in one line. */
  .home-date-switcher {
    grid-template-columns: 42px minmax(300px, auto) 72px 42px 68px !important;
    grid-auto-flow: column !important;
    align-items: center !important;
    white-space: nowrap !important;
  }

  .home-date-switcher label {
    grid-template-columns: auto minmax(176px, 1fr) !important;
    min-width: 306px !important;
    white-space: nowrap !important;
  }

  .home-date-switcher .neutral-btn,
  .home-date-switcher button.neutral-btn,
  .home-date-switcher a.neutral-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    min-width: 0 !important;
    line-height: 1 !important;
  }

  .home-date-switcher button.neutral-btn {
    min-width: 72px !important;
  }

  .home-date-switcher a.neutral-btn:not(.icon-only) {
    min-width: 68px !important;
  }

  /* Home: left weekly brief should have more room; More functions stay as three vertical entries. */
  body[data-page="/"] .home-week-grid {
    grid-template-columns: minmax(0, 1.42fr) minmax(250px, .58fr) !important;
    align-items: stretch !important;
  }

  body[data-page="/"] .home-entry-card {
    min-width: 0 !important;
  }

  body[data-page="/"] .home-entry-links {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body[data-page="/"] .home-entry-links a,
  body[data-page="/"] .home-entry-links a:last-child {
    grid-column: auto !important;
    min-height: 58px !important;
    width: 100% !important;
  }

  /* Analysis: four quality cards form a complete 2 x 2 block. */
  body[data-page="/analysis"] .training-quality-card .quality-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-page="/analysis"] .training-quality-card .quality-card-list > div {
    min-height: 116px !important;
  }

  /* Plans: center the summary stats such as 动作 / 默认组数 / 预计时长. */
  body[data-page="/templates"] .plan-stat-grid > div {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  body[data-page="/templates"] .plan-stat-grid > div span,
  body[data-page="/templates"] .plan-stat-grid > div strong,
  body[data-page="/templates"] .plan-stat-grid > div small {
    width: 100% !important;
    text-align: center !important;
  }

  /* Exercise library: keep action name and tags on the same baseline. */
  body[data-page="/exercises"] .exercise-title-line {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    row-gap: 6px !important;
  }

  body[data-page="/exercises"] .exercise-title-line h3 {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 28px !important;
    margin: 0 !important;
    line-height: 1.18 !important;
  }

  body[data-page="/exercises"] .exercise-title-line .pill {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 26px !important;
    line-height: 1 !important;
  }

  body[data-page="/exercises"] .personal-stat-grid > div:first-child strong {
    font-size: clamp(14px, 1.15vw, 17px) !important;
    line-height: 1.18 !important;
    white-space: nowrap !important;
  }

  body[data-page="/exercises"] .pr-strip small {
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  body[data-page="/exercises"] .personal-stat-grid > div:nth-child(3) strong {
    font-size: clamp(16px, 1.35vw, 20px) !important;
    line-height: 1.18 !important;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  body[data-page="/"] .home-week-grid {
    grid-template-columns: 1fr !important;
  }

  .home-date-switcher {
    grid-template-columns: 42px minmax(260px, auto) 72px 42px 68px !important;
  }
}
