/* Earth Mirror mobile shell.
   This file is viewport-scoped. Desktop rules belong in the desktop source. */
@media (max-width: 760px) {
  :root {
    --mobile-nav-height: 72px;
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-gutter: 12px;
  }
  html { overflow-x: hidden; }
  body.mobile-ui-v1 {
    min-width: 0;
    overflow-x: hidden;
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
    -webkit-text-size-adjust: 100%;
  }
  body.mobile-ui-v1.em-mobile-overlay-open { overflow: hidden; }
  body.mobile-ui-v1 main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 18px var(--mobile-gutter) calc(96px + var(--mobile-safe-bottom));
  }
  body.mobile-ui-v1 .earth-mirror-brand { max-width: 78vw; }
  body.mobile-ui-v1 .earth-mirror-brand-logo { max-width: 100%; height: auto; }
  body.mobile-ui-v1 .world-toolbar {
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body.mobile-ui-v1 .world-toolbar::-webkit-scrollbar { display: none; }
  body.mobile-ui-v1 .time { margin-top: 16px; font-size: clamp(19px, 6vw, 26px); }
  body.mobile-ui-v1 > main > .tabs { display: none; }
  body.mobile-ui-v1 .panel { min-width: 0; }
  body.mobile-ui-v1 .mobile-only { display: initial; }

  .em-mobile-nav {
    position: fixed;
    z-index: 120;
    left: 8px;
    right: 8px;
    bottom: max(8px, var(--mobile-safe-bottom));
    height: 64px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 3px solid #10110f;
    background: linear-gradient(90deg, #fff700, #ffd86f 55%, #f7a8c8);
    box-shadow: 6px 6px 0 #10110f;
  }
  .em-mobile-nav button {
    min-width: 0;
    border: 0;
    border-right: 2px solid #10110f;
    background: transparent;
    color: #10110f;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
    touch-action: manipulation;
  }
  .em-mobile-nav button:last-child { border-right: 0; }
  .em-mobile-nav button[aria-current="page"] {
    background: #19a447;
    color: #fff;
  }
  .em-mobile-nav .em-mobile-nav-icon {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 3px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }
  .em-mobile-nav .em-mobile-nav-label { display: block; }
  body.dm-chat-open .em-mobile-nav,
  body.em-mobile-dialog-open .em-mobile-nav,
  body.em-mobile-more-open .em-mobile-nav { display: none; }

  .em-mobile-more {
    position: fixed;
    inset: 0;
    z-index: 160;
    padding: max(18px, env(safe-area-inset-top)) 14px calc(18px + var(--mobile-safe-bottom));
    overflow-y: auto;
    background: linear-gradient(155deg, #fff700 0 120px, #f7a8c8 120px 58%, #fffdf3 58%);
  }
  .em-mobile-more[hidden] { display: none; }
  .em-mobile-more-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 84px;
    margin-bottom: 18px;
  }
  .em-mobile-more-head h2 { margin: 0; color: #10110f; font-size: 28px; letter-spacing: -.04em; }
  .em-mobile-more-head button {
    min-width: 48px;
    border: 2px solid #10110f;
    background: #fff;
    box-shadow: 4px 4px 0 #10110f;
    font: inherit;
    font-size: 24px;
    font-weight: 900;
  }
  .em-mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
  .em-mobile-more-grid button {
    min-height: 92px;
    padding: 13px 10px;
    border: 3px solid #10110f;
    background: #fff;
    color: #10110f;
    box-shadow: 5px 5px 0 #10110f;
    font: inherit;
    font-weight: 900;
    text-align: left;
  }
  .em-mobile-more-grid button:nth-child(3n+1) { background: #19a447; color: #fff; }
  .em-mobile-more-grid button:nth-child(3n+2) { background: #fff700; }

  .em-mobile-section-back {
    display: none;
    width: 100%;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 2px solid #10110f;
    background: #fff700;
    color: #10110f;
    box-shadow: 4px 4px 0 #10110f;
    font: inherit;
    font-weight: 900;
    text-align: left;
  }
  body.mobile-resident-detail .em-mobile-section-back { display: block; }
}
