/* MineBrush mobile ergonomics
   Loaded last so every portal surface follows the same compact mobile rules. */

@media (max-width: 700px) {
  html:has(.mb-mobile-nav[open]),
  body:has(.mb-mobile-nav[open]) {
    overflow: hidden;
  }

  .mb-head {
    position: fixed;
    z-index: 90;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    min-height: 66px;
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
  }

  body.mb {
    padding-top: 66px;
  }

  .mb-brand {
    min-width: 0;
    font-size: 18px;
    letter-spacing: -.055em;
    white-space: nowrap;
  }

  .mb-brand i {
    width: 16px;
    height: 16px;
    margin-right: 7px;
    border-radius: 4px;
  }

  .mb-mobile-nav {
    position: static;
    order: 2;
    margin: 0;
  }

  .mb-mobile-nav summary {
    min-height: 38px;
    box-sizing: border-box;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  .mb-mobile-nav[open] summary {
    border-color: #a8ff9b80;
    box-shadow: 0 0 0 3px #8ff58a18;
  }

  body.mb:has(.mb-mobile-nav[open])::before {
    position: fixed;
    z-index: 89;
    inset: 66px 0 0;
    background: #02070dcc;
    backdrop-filter: blur(5px);
    content: "";
  }

  .mb-mobile-nav > div {
    position: fixed;
    z-index: 97;
    top: 75px;
    right: 12px;
    left: 12px;
    display: grid;
    width: auto;
    max-height: calc(100dvh - 88px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 10px;
    overflow: auto;
    border-radius: 14px;
    background: linear-gradient(145deg, #111d27, #091119);
    box-shadow: 0 25px 70px #000e;
    overscroll-behavior: contain;
  }

  .mb-mobile-nav a {
    display: flex;
    min-width: 0;
    min-height: 42px;
    box-sizing: border-box;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid #ffffff0f;
    border-radius: 9px;
    background: #ffffff05;
    color: #dce7e5;
    font-size: 10px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .mb-mobile-nav a:hover,
  .mb-mobile-nav a:focus-visible {
    border-color: #7aea746b;
    background: #183023;
  }

  .mb-mobile-nav__join {
    border-color: #6ee66d61 !important;
    background: #15311e !important;
    color: #bcffb5 !important;
  }

  .mb-user {
    min-width: 0;
    order: 3;
  }

  .mb-guest-actions {
    gap: 3px;
  }

  .mb-guest-actions summary,
  .mb-signin {
    min-height: 38px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 9px;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
  }

  .mb-guest-actions form {
    position: fixed;
    z-index: 100;
    top: 75px;
    right: 12px;
    left: 12px;
    width: auto;
    box-sizing: border-box;
  }

  .mb-account-menu summary {
    min-height: 38px;
    padding: 7px 9px;
  }

  .mb-account-menu summary span {
    font-size: 9px;
  }

  .mb-account-menu__panel {
    position: fixed;
    top: 75px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 88px);
    overflow: auto;
  }

  /* Shop cards: one clear status, a shorter image and a single action row. */
  .mb-product-grid {
    gap: 12px;
  }

  .mb-product-card {
    min-height: 0 !important;
    border-radius: 14px;
  }

  .mb-product-card .mb-product-art {
    height: 174px !important;
    min-height: 174px !important;
    margin: 8px 8px 0 !important;
    border-radius: 11px !important;
  }

  .mb-product-card .mb-product-art:after {
    display: none !important;
  }

  .mb-product-card > small,
  .mb-product-card > h2,
  .mb-product-card > p,
  .mb-product-card > div:last-child {
    margin-right: 13px !important;
    margin-left: 13px !important;
  }

  .mb-product-card > small {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px !important;
    font-size: 8px !important;
  }

  .mb-product-card > small b {
    flex: 0 0 auto;
    padding: 5px 7px !important;
    font-size: 7px !important;
  }

  .mb-product-card h2 {
    margin-top: 7px !important;
    margin-bottom: 6px !important;
    font-size: 19px !important;
    line-height: 1.12;
  }

  .mb-product-card > p {
    display: -webkit-box;
    min-height: 0 !important;
    margin-bottom: 0;
    overflow: hidden;
    font-size: 10.5px !important;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mb-product-card > div:last-child {
    align-items: center !important;
    flex-direction: row !important;
    margin-top: 12px;
    margin-bottom: 13px !important;
    padding-top: 11px;
    border-top: 1px solid #ffffff12;
  }

  .mb-product-card .mb-price-stack {
    min-width: 0;
    flex: 1 1 auto;
  }

  .mb-product-card .mb-secondary {
    flex: 0 0 auto;
    min-height: 36px;
    box-sizing: border-box;
    padding: 9px 12px !important;
  }

  /* Library results should scan like a catalogue, not a stack of posters. */
  .mb-content:has(.mb-library-card),
  .mb-content:has(.mb-variant-card) {
    gap: 12px !important;
    padding-top: 16px !important;
  }

  .mb-library-card,
  .mb-variant-card {
    border-radius: 14px !important;
  }

  .mb-library-card__art,
  .mb-variant-card__art {
    height: 168px !important;
  }

  .mb-library-card__body,
  .mb-variant-card__body {
    padding: 14px 15px !important;
  }

  .mb-library-card__body h2,
  .mb-variant-card__body h2 {
    margin: 8px 0 6px !important;
    font-size: 18px !important;
    line-height: 1.12 !important;
  }

  .mb-library-card__summary,
  .mb-variant-card__summary {
    min-height: 0 !important;
    font-size: 10.5px !important;
    line-height: 1.48 !important;
    -webkit-line-clamp: 2 !important;
  }

  .mb-library-card__body > a:last-child,
  .mb-variant-card__body > div:last-child {
    margin-top: 10px !important;
    padding-top: 10px !important;
  }

  /* Full resource pages: compact media, readable headings and no overflow. */
  .mb-variant-page {
    padding: 18px 14px 54px !important;
  }

  .mb-variant-hero {
    border-radius: 17px !important;
  }

  .mb-variant-visual {
    min-height: 210px !important;
    height: 210px;
  }

  .mb-variant-hero > div:first-child {
    min-width: 0;
    padding: 23px 18px !important;
  }

  .mb-variant-hero h1 {
    max-width: 100%;
    margin: 12px 0 !important;
    font-size: clamp(29px, 9.1vw, 36px) !important;
    line-height: 1 !important;
    letter-spacing: -.055em !important;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  .mb-variant-hero p {
    margin: 0;
    font-size: 11.5px !important;
    line-height: 1.55 !important;
  }

  .mb-variant-actions {
    gap: 10px;
    margin-top: 18px;
  }

  .mb-skin-turntable__hint {
    top: 10px;
    left: 10px;
    padding: 6px 8px;
    font-size: 8px;
  }

  .mb-variant-ribbon {
    gap: 8px;
    margin: 11px 0;
    padding: 13px 14px;
  }

  .mb-variant-reader {
    margin-top: 11px;
  }

  .mb-variant-reader article {
    padding: 20px 17px !important;
  }

  .mb-variant-reader article h2 {
    margin-top: 28px;
    font-size: 24px;
  }
}

@media (max-width: 410px) {
  .mb-head {
    padding-right: 10px;
    padding-left: 10px;
  }

  .mb-brand {
    font-size: 16px;
  }

  .mb-mobile-nav summary {
    padding-right: 8px;
    padding-left: 8px;
  }

  .mb-guest-actions summary,
  .mb-signin {
    padding-right: 6px;
    padding-left: 6px;
    font-size: 8px;
  }

  .mb-product-card .mb-product-art {
    height: 158px !important;
    min-height: 158px !important;
  }
}

@media (max-width: 350px) {
  .mb-guest-actions > .mb-signin {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mb:has(.mb-mobile-nav[open])::before {
    backdrop-filter: none;
  }
}
