/* Mobile layout: touch targets, safe areas and the elevated navigation dock. */
@media (max-width: 760px) {
  :root {
    --mobile-gutter: 16px;
    --mobile-nav-height: 70px;
  }

  body {
    overflow-x: hidden;
    background:
      radial-gradient(circle at 100% -10%, rgba(166,244,106,.14), transparent 38%),
      var(--bg);
  }
  .app-shell { min-height: 100svh; overflow-x: clip; }
  main { min-width: 0; }

  .topbar {
    min-height: 78px;
    padding: 13px var(--mobile-gutter);
    gap: 12px;
    border-bottom-color: rgba(255,255,255,.07);
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
  }
  .topbar > div:first-child { min-width: 0; }
  .eyebrow { margin-bottom: 4px; font-size: 8px; letter-spacing: .13em; }
  .topbar h1 { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex: 0 0 auto; gap: 7px; }
  .account-pill { width: 40px; height: 40px; min-height: 40px; border-radius: 12px; }
  .account-avatar { width: 28px; height: 28px; margin: auto; }
  .topbar-task.ui-button { gap: 0; width: 42px; padding: 0; border-radius: 12px; }
  .topbar-task.ui-button > span:not(.ui-button-icon) { display: none; }
  .topbar-task.ui-button .ui-button-icon svg { width: 18px; height: 18px; }

  .workspace-content { gap: 28px; padding: 18px var(--mobile-gutter) calc(var(--mobile-nav-height) + 42px); }
  .workspace-module { scroll-margin-top: 90px; }
  .workspace-module-toolbar { min-height: 28px; margin-bottom: 9px; padding-inline: 2px; }
  .workspace-module-toolbar > span { font-size: 8px; letter-spacing: .08em; }
  .workspace-module-toolbar button { width: 30px; height: 30px; }
  .workspace-module > .section { padding-top: 9px; }

  .hero { gap: 12px; }
  .hero-copy.ui-card { min-height: 348px; padding: 30px 22px; }
  .hero-copy h2, .hero-copy .hero-title { font-size: clamp(35px, 11vw, 43px); line-height: 1; }
  .hero-copy p, .hero-copy .hero-description { margin: 17px 0 22px; font-size: 12px; line-height: 1.6; }
  .hero-orbit { width: 310px; height: 310px; right: -145px; top: -82px; }
  .quota-card { min-height: 0; padding: 19px; border-radius: 22px; }
  .quota-main { margin: 22px 0 21px; gap: 16px; }
  .quota-ring { width: 92px; height: 92px; }
  .quota-ring::before { width: 76px; height: 76px; }
  .quota-ring strong { font-size: 22px; }

  .section { padding-top: 35px; scroll-margin-top: 90px; }
  .section-heading { gap: 9px; margin-bottom: 14px; }
  .section-heading h2, .section-heading .ui-heading-2 { font-size: 22px; }
  .privacy-note { font-size: 8px; }
  .project-tools { gap: 7px; }
  .search-box { height: 42px; border-radius: 12px; }

  .activity-list, .terminal-card, .thread-panel { border-radius: 20px; }
  .activity-project-heading { min-height: 60px; padding: 10px 13px; }
  .activity-project-heading strong { font-size: 10px; }
  .run-summary { min-height: 64px; padding: 13px; }
  .run-detail { padding: 5px 13px 17px 34px; }

  .thread-dock { padding: 0 var(--mobile-gutter) calc(var(--mobile-nav-height) + 35px); }
  .thread-panel { min-height: 510px; }

  .sidebar {
    inset: auto 10px max(10px, env(safe-area-inset-bottom));
    height: var(--mobile-nav-height);
    padding: 7px 6px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 22px;
    box-shadow: 0 16px 45px rgba(0,0,0,.42), 0 0 0 1px rgba(166,244,106,.04);
  }
  .sidebar nav { height: 100%; gap: 3px; }
  .nav-item {
    min-height: 54px;
    position: relative;
    padding: 6px 3px;
    border-radius: 16px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-item em { font-size: 8px; letter-spacing: .01em; }
  .nav-item.active { background: rgba(166,244,106,.12); }
  .nav-item.active::after {
    content: "";
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 9px rgba(166,244,106,.8);
  }

  .toast-region { right: var(--mobile-gutter); bottom: calc(var(--mobile-nav-height) + 20px); left: var(--mobile-gutter); }
  .toast { max-width: none; font-size: 10px; }
}

@media (max-width: 370px) {
  .topbar { padding-inline: 12px; }
  .topbar h1 { font-size: 16px; }
  .workspace-content { --mobile-gutter: 12px; }
  .hero-copy.ui-card { padding-inline: 18px; }
  .hero-copy .hero-title { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
