/* ==========================================================================
   Historical Mobile Cascade Overrides (v0.55 - v0.57)
   Preserved to guarantee exact cascade precedence at <= 560px.
   ========================================================================== */

@media(max-width: 560px) {
  main {
    width: min(1180px, calc(100% - 24px));
    padding: 28px 0 34px;
  }
  .topbar {
    gap: 20px;
    margin-bottom: 30px;
  }
  .brand-line {
    width: 100%;
    align-items: center;
    gap: 9px 10px;
  }
  h1 {
    font-size: clamp(2.55rem, 12.8vw, 3.15rem);
  }
  .friends-trigger {
    align-self: center;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.1;
  }
  .site-version {
    align-self: center;
    margin-left: 0;
    padding: 4px 7px;
  }
  .top-nav-group {
    display: flex;
    flex: 1 0 100%;
    width: 100%;
    align-items: center;
    gap: 10px 15px;
    flex-wrap: wrap;
    margin-top: 5px;
  }
  .top-nav-link {
    align-self: auto;
    padding: 0;
    font-size: 0.73rem;
    line-height: 1.2;
  }
  .top-right {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    align-items: start;
  }
  .language-switch {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    justify-self: end;
    margin: 0;
  }
  .status[hidden] {
    display: none;
  }
  .status {
    display: contents;
  }
  #status {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    text-align: left;
    font-size: 0.76rem;
    line-height: 1.3;
  }
  .status-actions {
    display: contents;
  }
  .refresh {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    font-size: 0.76rem;
  }
  .push-controls {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    width: 100%;
    margin-top: 7px;
  }
  .push-toggle, .push-settings-button {
    height: 44px;
    border-radius: 12px;
  }
  .push-toggle {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    font-size: 0.75rem;
    white-space: normal;
    line-height: 1.15;
  }
  .push-settings-button {
    width: 44px;
    font-size: 1rem;
  }
  .push-settings-panel {
    right: 0;
    width: min(340px, calc(100vw - 24px));
  }
  .push-ios-hint {
    left: 0;
    width: min(330px, calc(100vw - 24px));
  }
  .profile-title {
    margin-top: 0;
    margin-bottom: 14px;
    gap: 8px;
  }
}

/* v0.56: chart history window + fixed HH:MM separator */
@media(max-width: 560px) {
  #lpChartSection .chart-mode-switch {
    flex: 1 1 auto;
    justify-content: center;
  }
  .chart-days-switch {
    margin-left: 0;
  }
  .chart-days-button {
    min-width: 0;
    flex: 1;
  }
  .push-time-control {
    height: 40px;
    min-height: 40px;
  }
  .push-settings-field .push-time-part {
    height: 38px;
  }
}

@media(max-width: 560px) {
  .top-right {
    row-gap: 0;
  }
  #status {
    line-height: 1.15;
  }
  .refresh {
    line-height: 1.15;
    margin-top: 0;
  }
  .push-controls {
    margin-top: 9px;
  }
}

@media (max-width: 820px) {
  .top-right { display: flex; flex-direction: column; align-items: flex-end; }
  .language-switch { align-self: flex-end; }
  .status { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
  #status { text-align: right; align-self: flex-end; }
  .status-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: auto; }
  .refresh { justify-self: auto; }
  .action-buttons-row { width: auto; justify-content: flex-end; }
}
