/* Mobile stabilization pass 4: keep mobile navigation and Tools controls usable. */
@media (max-width: 900px) {
  /* The desktop header is sticky, but on mobile it becomes a tall multi-row
     header. Keeping that entire stack sticky lets page content scroll beneath
     the navigation and visually collide with headings. Let the full mobile
     header remain in normal document flow instead. */
  .msh-app-header {
    position: relative;
    top: auto;
  }

  /* Mobile header composition:
     row 1 = brand
     row 2 = workspace navigation + compact appearance utility.
     The appearance control no longer reserves its own column beside the logo. */
  .msh-app-header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
  }

  .msh-app-logo {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .msh-app-nav {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
    min-width: 0;
    padding: 0 0 10px;
  }

  .msh-app-header-actions {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    padding-bottom: 10px;
  }

  .msh-theme-control {
    align-self: auto;
  }

  .msh-theme-trigger {
    width: 38px;
    height: 38px;
  }

  [data-msh-mobile-nav] {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .msh-glass-workspace[data-glass-state="tools"] {
    min-height: auto !important;
  }

  .msh-glass-workspace[data-glass-state="tools"] .msh-glass-content {
    grid-template-columns: minmax(0, 1fr) !important;
    padding-bottom: 116px !important;
  }

  .msh-glass-workspace[data-glass-state="tools"] .msh-glass-back {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    display: inline-flex !important;
    width: fit-content;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    padding: 0 18px;
    border: 1px solid color-mix(in srgb, var(--msh-personal-accent) 56%, var(--msh-glass-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--msh-glass-panel-bg) 86%, transparent);
    color: var(--msh-glass-ink);
    font-size: 14px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
  }

  .msh-glass-workspace[data-glass-state="tools"] .msh-glass-status {
    right: 20px !important;
    bottom: 28px !important;
    left: 20px !important;
    max-width: calc(100% - 40px);
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
  }
}
