/* Mobile-only presentation layer. The existing viewer owns scene and input. */
.mobile-ui { display: none; }
@media (max-width: 650px), (pointer: coarse) and (max-width: 1024px) {
  body.mobile-layout {
    --edge-left: max(18px, env(safe-area-inset-left));
    --edge-right: max(18px, env(safe-area-inset-right));
    --edge-top: max(18px, env(safe-area-inset-top));
    --edge-bottom: max(22px, env(safe-area-inset-bottom));
    --ink: #354039;
    --paper: #faf8f2f5;
  }
  .mobile-layout > header, .mobile-layout > #hint,
  .mobile-layout > #touch-hint { display: none !important; }
  .mobile-layout .mobile-ui { display: block; }
  .mobile-layout .mobile-logo {
    position: fixed; z-index: 22; left: var(--edge-left); top: var(--edge-top);
    width: 70px; height: 70px; object-fit: contain; pointer-events: none;
    filter: drop-shadow(0 1px 6px #fff8);
  }
  .mobile-layout .corner-button {
    display: grid; place-items: center; position: fixed; z-index: 24;
    width: 50px; height: 50px; min-height: 50px; padding: 0;
    border: 1px solid #ffffffa6; border-radius: 17px;
    background: var(--paper); color: var(--ink);
    box-shadow: 0 4px 20px #14251a12; backdrop-filter: blur(12px);
    touch-action: manipulation; transition: transform .15s;
  }
  .mobile-layout .corner-button:disabled { opacity: .45; cursor: wait; }
  .mobile-layout .corner-button[aria-expanded="true"] {
    background: var(--ink); color: #faf8f2; border-color: #ffffff30;
  }
  .corner-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .corner-button .close-icon, .corner-button[aria-expanded="true"] .open-icon { display: none; }
  .corner-button[aria-expanded="true"] .close-icon { display: block; }
  #mobile-menu-toggle { right: var(--edge-right); top: var(--edge-top); }
  #mobile-plan-toggle { right: calc(var(--edge-right) + 62px); top: var(--edge-top); }
  .mobile-layout #fullscreen { right: var(--edge-right); bottom: var(--edge-bottom); top: auto; width: 50px; }
  .mobile-layout #mobile-menu {
    position: fixed; z-index: 23; top: calc(var(--edge-top) + 64px);
    right: var(--edge-right); width: min(310px, calc(100% - var(--edge-left) - var(--edge-right)));
    max-height: calc(100dvh - var(--edge-top) - var(--edge-bottom) - 256px);
    overflow-y: auto; overscroll-behavior: contain; padding: 24px;
    border-radius: 22px; background: var(--paper); color: var(--ink);
    border: 1px solid #ffffffa6; box-shadow: 0 12px 40px #15221926;
    backdrop-filter: blur(16px); scrollbar-width: thin;
  }
  #mobile-menu[hidden] { display: none !important; }
  #mobile-menu h2 { font: 25px Georgia, serif; letter-spacing: -.4px; margin: 0 0 6px; }
  #mobile-menu .menu-caption { margin: 0 0 22px; font-size: 11px; color: #747b72; line-height: 1.5; }
  #mobile-menu .section-label { margin: 20px 0 8px; font-size: 9px; letter-spacing: 1.8px; text-transform: uppercase; color: #747b72; }
  .mobile-layout #mobile-menu #rooms {
    position: static; display: grid; transform: none; width: 100%; max-width: none;
    padding: 0; gap: 2px; border: 0; border-radius: 0; background: none;
    backdrop-filter: none; overflow: visible; white-space: normal;
  }
  #mobile-menu #rooms button {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 44px; padding: 0 12px; text-align: left; font-size: 13px; border-radius: 10px;
  }
  #mobile-menu #rooms button::after { content: '\2197'; color: #7a847a; font-size: 16px; }
  #mobile-menu #rooms button.active { background: #e9ede5; color: #354039; }
  #mobile-menu #rooms button.active::after { content: '\2022'; color: #536a4e; }
  .mobile-layout #mobile-menu .fov-control {
    position: static; display: block; width: 100%; padding: 14px 0 0; margin-top: 16px;
    border: 0; border-top: 1px solid #35403920; border-radius: 0; background: none; backdrop-filter: none;
  }
  .mobile-layout.plan #mobile-menu .fov-control { display: none; }
  #mobile-menu .fov-control input { height: 44px; }
  #mobile-menu .menu-settings { display: flex; gap: 8px; margin-top: 8px; }
  .mobile-layout #mobile-menu #quality {
    position: static; display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; font-size: 11px; border: 1px solid #35403926;
    border-radius: 12px; background: transparent; backdrop-filter: none;
  }
  #mobile-menu #quality { flex: 1; }
  .mobile-layout #fullscreen svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  #mobile-menu .menu-help { font-size: 11px; color: #697268; line-height: 1.7; margin: 20px 0 0; }
  .mobile-layout #mobile-menu footer {
    position: static; display: block; padding: 18px 0 0; background: none;
    color: #737d72; text-shadow: none; font-size: 8px; letter-spacing: 1.3px;
  }
  #mobile-menu footer > span { display: none; }
  #mobile-menu footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .mobile-layout #stick, body.mobile-layout.plan #stick {
    display: grid; place-items: center; position: fixed; z-index: 23; left: var(--edge-left);
    bottom: var(--edge-bottom); width: 176px; height: 176px;
    border: 1px solid #ffffffa6; border-radius: 50%; background: #faf8f270;
    backdrop-filter: blur(8px); touch-action: none;
  }
  .mobile-layout #stick div { width: 68px; height: 68px; border: 1px solid #fff9; border-radius: 50%; background: #faf8f2ed; pointer-events: none; box-shadow: 0 2px 10px #18221a1a; }
  .mobile-layout #loading { padding: 100px 24px; }
  .mobile-layout #loading h2 { font-size: 48px; }
  @media (max-height: 480px) {
    .mobile-layout #mobile-menu { padding: 16px 20px; }
    .mobile-layout .mobile-logo { width: 58px; height: 58px; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-layout button, .mobile-layout #loading { transition: none; }
}
