/* ── Mobile settings button (reset base styles) ── */
.mobile-settings-btn{
  background:none;border:none;font-family:inherit;cursor:pointer;
  color:inherit;font-size:inherit;padding:0;width:100%;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;min-height:52px;color:var(--text-soft);font-size:.68rem;font-weight:500;
}
.mobile-settings-btn.active{color:var(--accent)}

/* ── Mobile bottom sheet ── */
.mobile-sheet-backdrop{
  display:none;position:fixed;inset:0;z-index:1199;
  background:rgba(0,0,0,.4);
}
.mobile-sheet-backdrop.open{display:block}
.mobile-sheet{
  position:fixed;left:0;right:0;bottom:0;z-index:1200;
  background:var(--bg);border-radius:20px 20px 0 0;
  padding:0 0 env(safe-area-inset-bottom);
  transform:translateY(100%);transition:transform .28s cubic-bezier(.4,0,.2,1);
  max-height:85vh;overflow-y:auto;
}
.mobile-sheet.open{transform:translateY(0)}
.mobile-sheet-handle{
  width:36px;height:4px;border-radius:2px;
  background:var(--line-strong);margin:10px auto 6px;
}
.mobile-sheet-header{
  display:flex;align-items:center;gap:12px;
  padding:12px 20px 14px;
  border-bottom:1px solid var(--line);
}
.mobile-sheet-avatar{
  width:44px;height:44px;border-radius:10px;flex-shrink:0;
  background:var(--accent);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:1.1rem;object-fit:cover;
}
.mobile-sheet-avatar.mobile-sheet-avatar-img{border-radius:10px}
.mobile-sheet-name{display:block;font-size:.95rem;font-weight:600;color:var(--text)}
.mobile-sheet-email{display:block;font-size:.78rem;color:var(--text-soft);margin-top:1px}
.mobile-sheet-body{padding:8px 12px 16px;display:flex;flex-direction:column;gap:1px}
.mobile-sheet-item{
  display:flex;align-items:center;gap:12px;
  padding:13px 10px;border-radius:var(--radius-md);
  font-size:.95rem;font-weight:500;color:var(--text);
  background:none;border:none;font-family:inherit;
  cursor:pointer;text-align:left;width:100%;
  min-height:48px;
}
.mobile-sheet-item:hover,.mobile-sheet-item:active{background:var(--surface-2)}
.mobile-sheet-item .icon-img{width:20px;height:20px;opacity:.65;flex-shrink:0}
.mobile-sheet-divider{height:1px;background:var(--line);margin:6px 0}
.mobile-sheet-danger{color:var(--danger)}
.mobile-sheet-danger .icon-img{opacity:.7}

/* ── Mobile bottom tab bar (手機底部導覽) ── */
.mobile-nav{display:none}

@media(max-width:760px){
  /* 頁面底部預留空間，避免被 tab bar 擋住 */
  .app-main-area{padding-bottom:72px}

  .mobile-nav{
    position:fixed;left:0;right:0;bottom:0;z-index:1100;
    display:grid;grid-template-columns:repeat(5,1fr);
    background:var(--bg);
    border-top:1px solid var(--line);
    padding:0;
    /* iOS safe area */
    padding-bottom:env(safe-area-inset-bottom);
  }

  .mobile-nav a,
  .mobile-nav-explore summary{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:3px;padding:10px 4px;
    color:var(--text-soft);font-size:.68rem;font-weight:500;
    border-radius:0;text-align:center;
    min-height:52px;
    position:relative;
  }
  .mobile-nav a:hover,.mobile-nav-explore summary:hover{color:var(--text)}
  .mobile-nav a.active,.mobile-nav-explore summary.active{color:var(--accent)}

  /* 中間上傳按鈕 — 橘色突出 */
  .mobile-nav .primary-mobile-link{
    color:var(--accent);font-weight:600;
  }
  .mobile-nav .primary-mobile-link::before{
    content:"";
    display:block;width:54px;height:54px;
    background:var(--accent);border-radius:16px;
    position:absolute;top:4px;left:50%;transform:translateX(-50%);
    z-index:-1;
  }
  .mobile-nav .primary-mobile-link{color:#fff;z-index:1}

  /* tab 圖示 */
  .mobile-tab-icon{
    width:22px;height:22px;flex-shrink:0;
    display:flex;align-items:center;justify-content:center;
  }
  .mobile-tab-icon img{width:20px;height:20px;opacity:.65}
  .mobile-nav a.active .mobile-tab-icon img,
  .mobile-nav-explore[open] .mobile-tab-icon img{opacity:1;filter:none}

  /* 上傳按鈕白色圖示 */
  .mobile-tab-icon img.upload-icon{
    opacity:1;
    filter:brightness(0) invert(1);
  }

  /* 探索彈出選單 */
  .mobile-nav-explore{position:relative;display:flex}
  .mobile-nav-explore summary{
    width:100%;list-style:none;cursor:pointer;
    flex-direction:column;
  }
  .mobile-nav-explore summary::-webkit-details-marker{display:none}
  .mobile-nav-explore[open] summary{color:var(--accent)}
  .mobile-nav-explore-panel{
    position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);
    min-width:120px;width:max-content;
    background:var(--surface);border:1px solid var(--line);
    border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);
    padding:4px;display:flex;flex-direction:column;gap:1px;z-index:1200;
  }
  .mobile-nav-explore-panel::after{
    content:"";position:absolute;bottom:-6px;left:50%;transform:translateX(-50%) rotate(45deg);
    width:11px;height:11px;background:var(--surface);
    border-right:1px solid var(--line);border-bottom:1px solid var(--line);
  }
  .mobile-nav-explore-panel a{
    color:var(--text);font-size:.88rem;font-weight:500;
    padding:10px 16px;border-radius:var(--radius-sm);
    white-space:nowrap;text-align:center;
  }
  .mobile-nav-explore-panel a:hover{background:var(--surface-2)}
  .mobile-nav-explore-panel a.active{color:var(--accent);background:var(--accent-soft)}
}
