/* Shared compact navigation. Keep the escape route from every simulator visible. */
.shell-navtoggle { display: none; }

@media (max-width: 700px), (max-height: 560px) and (max-width: 1024px) {
  :root { --shell-topbar-h: 60px; --shell-header-h: 60px; }
  .shell-header {
    display: block;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid var(--border-soft);
  }
  .shell-header .shell-bar {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas: "brand toggle actions" "nav nav nav";
    gap: 0 8px;
    height: auto;
    min-height: 60px;
    max-height: none;
    padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
    border: 0;
  }
  .shell-brand { min-height: 44px; justify-content: center; }
  .shell-brand .brand-mark { width: 28px; height: 28px; }
  .shell-brand .brand-text { display: none; }
  .shell-navtoggle {
    grid-area: toggle;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-sunken);
    color: var(--text);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }
  .shell-navtoggle:active { background: var(--accent-tint); }
  .shell-navtoggle__icon { width: 18px; height: 18px; flex: none; color: var(--accent); }
  .shell-navtoggle__text { display: grid; min-width: 0; flex: 1; gap: 2px; }
  .shell-navtoggle__title { font-size: .8rem; font-weight: 700; line-height: 1.2; }
  .shell-navtoggle__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .68rem;
    line-height: 1.3;
    color: var(--text-soft);
  }
  .shell-navtoggle__label:empty { display: none; }
  .shell-navtoggle__chevron {
    width: 10px; height: 6px; flex: none;
    transform: rotate(180deg);
    transition: transform 160ms ease-out;
  }
  html[data-nav-open="false"] .shell-navtoggle__chevron { transform: none; }
  .shell-header .shell-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
  }
  .shell-nav__link {
    flex: 1 0 auto;
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
    font-size: .8rem;
    border-radius: 10px;
    background: var(--surface-sunken);
  }
  .shell-nav .shell-nav__icon { display: none; }
  .shell-nav__link[aria-current] { background: var(--accent); color: #fff; }
  .shell-header .shell-subnav {
    height: auto;
    padding: 0 max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
    background: var(--surface);
    border: 0;
  }
  .shell-subnav__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    max-height: 32dvh;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .shell-subnav__link {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    font-size: .8rem;
    line-height: 1.4;
    white-space: normal;
    color: var(--text-soft);
  }
  .shell-subnav__link[aria-current="page"] {
    color: var(--accent-strong);
    background: var(--accent-tint);
    border-color: var(--accent);
  }
  .shell-subnav__link[aria-current="page"]::after { content: none; }
  /* No height animation: avoid repeatedly resizing expensive WebGL frames.
     display:none also immediately removes closed links from keyboard focus. */
  html[data-nav-open="false"] .shell-header .shell-nav,
  html[data-nav-open="false"] .shell-header .shell-subnav { display: none; }
  .shell-subnav__list[hidden], .shell-header .shell-subnav[hidden] { display: none; }
  .shell-actions { gap: 2px; }
  .shell-actions .lang-toggle-btn, .shell-actions .shell-account {
    width: 44px; height: 44px; padding: 0; gap: 0; justify-content: center;
  }
  .shell-actions .lang-toggle-btn > span,
  .shell-actions .ht-top-btn > span,
  .shell-actions .ht-top-btn .ht-chevron { display: none; }
  .shell-actions .lang-globe-icon { width: 18px; height: 18px; }
  .shell-actions .ht-top-btn { min-height: 44px; padding: 6px 8px; }
  .shell-navtoggle:focus-visible,
  .shell-nav__link:focus-visible,
  .shell-subnav__link:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -3px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .shell-navtoggle__chevron { transition: none; }
}
