/**
 * Live Stats — モバイルシェル（≤960px）
 * サイドバー非表示 · 下部タブ · ハンバーガー · コンパクト密度
 */

@media (max-width: 960px) {
  /* ── サイドバー非表示 ── */
  #liver-shell .sidebar--saas {
    display: none !important;
  }

  #liver-shell.mobile-tab-mode {
    grid-template-columns: 1fr;
  }

  #liver-shell.mobile-tab-mode .main.liver-main {
    padding: 2.85rem 0.65rem calc(6.75rem + env(safe-area-inset-bottom));
    min-height: 100dvh;
    scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }

  #liver-shell.mobile-tab-mode .home-dashboard {
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom));
  }

  /* ── コンパクトトップバー ── */
  .mobile-topbar {
    display: grid;
    grid-template-columns: 2.25rem 1fr;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
    margin: 0 -0.65rem 0.5rem;
    padding: max(0.45rem, env(safe-area-inset-top)) 0.65rem 0.45rem;
    background: rgba(6, 7, 14, 0.88);
    border-bottom: 1px solid rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(12px);
  }

  .mobile-topbar__menu,
  .mobile-topbar__notify {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.12);
    color: #e9d5ff;
    font-size: 1rem;
    cursor: pointer;
  }

  .mobile-topbar__title {
    flex: 1;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-topbar__profile {
    flex-shrink: 0;
    max-width: 5.5rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    background: rgba(124, 58, 237, 0.15);
    color: #f5f3ff;
    font-size: 0.68rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-topbar__profile {
    display: none;
  }

  /* デスクトップ用ヘッダー — モバイルタブモードでは非表示（mobile-brand-header を使用） */
  #liver-shell.mobile-tab-mode .dash-header.growth-header {
    display: none !important;
  }

  #liver-shell.mobile-tab-mode .dash-header__title,
  #liver-shell.mobile-tab-mode .dash-date,
  #liver-shell.mobile-tab-mode .dash-sync,
  #liver-shell.mobile-tab-mode .mgr-back-btn {
    display: none !important;
  }

  #liver-shell.mobile-tab-mode .dash-header__actions {
    pointer-events: auto;
    margin-left: auto;
  }

  #liver-shell.mobile-tab-mode .header-profile__trigger {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
    max-width: 7.5rem;
  }

  #liver-shell.mobile-tab-mode .header-profile__dropdown {
    position: fixed;
    top: calc(2.75rem + env(safe-area-inset-top));
    right: 0.65rem;
    left: 0.65rem;
    max-width: none;
  }

  /* ── タブパネル切替 ── */
  #liver-shell.mobile-tab-mode .mobile-tab-panel,
  #liver-shell.mobile-tab-mode .mobile-drawer-panel {
    display: none;
  }

  #liver-shell.mobile-tab-mode .mobile-tab-panel.is-active,
  #liver-shell.mobile-tab-mode .mobile-drawer-panel.is-active {
    display: block;
  }

  /* PK / VS サブビュー */
  #liver-shell.mobile-tab-mode #battle-section.mobile-view--pk .battle-subsection:not(#battle-pk-section),
  #liver-shell.mobile-tab-mode #battle-section.mobile-view--pk .liver-section__head {
    display: none;
  }

  #liver-shell.mobile-tab-mode #battle-section.mobile-view--vs .battle-subsection:not(#battle-vs-section),
  #liver-shell.mobile-tab-mode #battle-section.mobile-view--vs .liver-section__head {
    display: none;
  }

  #liver-shell.mobile-tab-mode #battle-section.mobile-view--pk,
  #liver-shell.mobile-tab-mode #battle-section.mobile-view--vs {
    margin-bottom: 0.5rem;
  }

  #liver-shell.mobile-tab-mode #battle-pk-section .pk-page {
    gap: 0.85rem;
  }

  #liver-shell.mobile-tab-mode #battle-pk-section .pk-page__title {
    font-size: 0.82rem;
    margin-bottom: 0.45rem;
  }

  /* ── ホーム: 3秒ダッシュボードのみ ── */
  .dash-home {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  #live-stats-summary-section,
  .dash-today-battle-wrap,
  .home-legacy-sections,
  .growth-hero--compact {
    display: none !important;
  }

  .home-dashboard {
    order: 1;
  }

  .growth-glance-wrap__head {
    margin-bottom: 0.35rem;
  }

  .growth-glance-wrap__title {
    font-size: 0.88rem;
  }

  .growth-glance-wrap__hint {
    display: none;
  }

  /* ── 密度アップ ── */
  .growth-panel {
    padding: 0.6rem 0.7rem;
    margin-bottom: 0;
    border-radius: 12px;
  }

  .growth-panel__head {
    margin-bottom: 0.45rem;
  }

  .growth-panel__title {
    font-size: 0.82rem;
  }

  .growth-panel__desc,
  .liver-section__desc,
  .battle-subsection__desc {
    display: none;
  }

  .growth-glance {
    gap: 0.4rem;
  }

  .glance-card {
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
  }

  .glance-card__label {
    font-size: 0.58rem;
  }

  .glance-card__value {
    font-size: 0.95rem;
  }

  .growth-week-summary__grid {
    gap: 0.4rem;
  }

  .growth-week-card {
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
  }

  .growth-week-card__label {
    font-size: 0.58rem;
  }

  .growth-week-card__value {
    font-size: 0.88rem;
  }

  .growth-card {
    padding: 0.6rem 0.7rem;
    border-radius: 12px;
  }

  .growth-card__title {
    font-size: 0.82rem;
  }

  .growth-card--coach-teaser {
    border-color: rgba(236, 72, 153, 0.35);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(124, 58, 237, 0.1));
  }

  .coach-teaser {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin: 0.35rem 0 0;
  }

  .coach-teaser dt {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.45);
  }

  .coach-teaser dd {
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
  }

  .coach-teaser__advice {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    line-height: 1.4;
  }

  #growth-level-section,
  #daily-missions-section {
    min-height: 0;
  }

  .growth-level__title,
  .growth-missions__summary {
    font-size: 0.72rem;
  }

  .growth-level__xp {
    font-size: 0.68rem;
  }

  .growth-missions__list {
    display: none;
  }

  .liver-section,
  .league-simple {
    margin-bottom: 0.5rem;
    scroll-margin-top: 3rem;
  }

  .liver-section__head,
  .league-simple__head {
    margin-bottom: 0.5rem;
  }

  .liver-section__title,
  .league-simple__title,
  .battle-subsection__title {
    font-size: 0.92rem;
  }

  .league-simple {
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
  }

  .league-simple__period {
    display: block;
  }

  .pk-stat-card,
  .kpi-card,
  .stat-card {
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
  }

  .pk-stat-card__value,
  .kpi-card__value {
    font-size: 0.95rem;
  }

  .chart-card {
    padding: 0.55rem 0.65rem;
  }

  .chart-card__body {
    min-height: 120px;
  }

  .panel {
    padding: 0.55rem 0.65rem;
  }

  .battle-subsection {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    scroll-margin-top: 3rem;
  }

  .footer {
    display: none;
  }

  /* ── 下部タブ（コンパクト） ── */
  .mobile-nav {
    padding: 0.15rem 0.2rem calc(0.15rem + env(safe-area-inset-bottom));
    box-shadow: 0 -3px 18px rgba(0, 0, 0, 0.32);
  }

  .mobile-nav__item {
    padding: 0.2rem 0.1rem;
    font-size: 0.5rem;
    gap: 0.06rem;
    border-radius: 8px;
  }

  .mobile-nav__item span {
    font-size: 0.82rem;
  }
}

/* ── ハンバーガードロワー ── */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.mobile-drawer.is-open {
  pointer-events: auto;
}

.mobile-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-drawer.is-open .mobile-drawer__backdrop {
  opacity: 1;
}

.mobile-drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 82vw);
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem 1rem;
  background: #0c0d18;
  border-right: 1px solid rgba(168, 85, 247, 0.2);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}

.mobile-drawer.is-open .mobile-drawer__panel {
  transform: translateX(0);
}

body.mobile-drawer-open {
  overflow: hidden;
}

.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.mobile-drawer__close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}

.mobile-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-drawer__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.82rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.mobile-drawer__link:hover,
.mobile-drawer__link.is-active {
  background: rgba(124, 58, 237, 0.2);
  color: #faf5ff;
}

.mobile-drawer__icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

.mobile-drawer__divider {
  height: 1px;
  margin: 0.5rem 0;
  background: rgba(255, 255, 255, 0.08);
}

/* デスクトップでは非表示 */
.mobile-topbar,
.mobile-drawer {
  display: none;
}

@media (max-width: 960px) {
  .mobile-topbar,
  .mobile-drawer {
    display: block;
  }
}
