/* === モバイル時：縦並び中心、サイドバー開閉対応 === */
@media (max-width: 768px) {

  /* ---------- サイドバー ---------- */
  .sidebar {
    position: fixed;
    top: 59px;
    /* ヘッダーの高さ */
    left: 0;
    width: 240px;
    height: calc(100vh - 59px);
    background: linear-gradient(180deg, rgba(25, 25, 35, 0.95), rgba(40, 40, 60, 0.95));
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.4);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    overflow-y: auto;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  /* 背景オーバーレイ */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 150;
  }

  .sidebar.active+.sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* サイドバー開閉ボタン */
  .menu-toggle {
    border: none;
    background: none;
    font-size: 24px;
    color: inherit;
    cursor: pointer;
    margin-left: 8px;
  }

  /* ---------- メインコンテンツ ---------- */
  .main-content {
    margin-left: 0;
    padding: 24px 16px;
    overflow-x: hidden;
  }

  /* ---------- 全体構造 ---------- */
  .bot-info-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .bot-status-card,
  .guild-info,
  .bot-news-card {
    width: 100%;
    box-sizing: border-box;
  }

  .guild-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* === PC：横並び固定 === */
@media (min-width: 769px) {
  .main-content {
    margin-left: 250px;
    padding: 40px 20px;
  }

  .sidebar {
    left: 0;
    transform: none !important;
    position: fixed;
    top: 59px;
    width: 250px;
    height: calc(100vh - 59px);
    z-index: 50;
  }

  .menu-toggle {
    display: none;
  }
}

/* === 共通：スマホ全般補完（480px以下） === */
@media (max-width: 480px) {

  html,
  body {
    background-color: transparent;
    background-image: inherit;
    color: inherit;
    font-family: "Inter", sans-serif;
    transition: background-color 0.4s, color 0.4s, background-image 0.6s;
  }

  body.light-mode {
    color: #1a1a1a;
    background-image: url("/img/bg_light.png");
  }

  body.dark-mode {
    color: #f5f6fa;
    /* ← 白文字で視認性アップ */
    background-image: url("/img/bg_dark.png");
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    z-index: -1;
    transition: background 0.4s;
  }

  body.dark-mode::before {
    background: rgba(5, 5, 15, 0.65);
  }

  * {
    box-sizing: border-box;
    max-width: 100%;
  }

  main,
  section,
  .main-content,
  .settings-wrapper {
    width: 100%;
    overflow-x: hidden;
  }

  img,
  iframe {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* ヘッダー */
  .navbar {
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 10px 12px;
  }

  .navbar .left,
  .navbar .right {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .bot-icon {
    width: 36px;
    height: 36px;
  }

  .navbar .left h1 {
    font-size: 18px;
    margin-left: 6px;
  }

  .nav-btn,
  .login-btn {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
  }

  /* ボタン統一 */
  .hero-login-btn,
  .donate-btn,
  .premium-btn,
  .subscribe-btn,
  .settings-save-btn,
  .button {
    display: block;
    width: 100%;
    max-width: 320px;
    text-align: center;
    margin: 8px auto;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: 0.2s;
  }

  .hero-login-btn,
  .donate-btn,
  .premium-btn,
  .subscribe-btn {
    background-color: #5865f2;
    color: #fff;
  }

  .button {
    background-color: #1e90ff;
    color: #fff;
  }

  .hero-login-btn:hover,
  .donate-btn:hover,
  .premium-btn:hover,
  .subscribe-btn:hover,
  .button:hover {
    opacity: 0.85;
  }

  /* フッター */
  .footer {
    font-size: 12px;
    padding: 16px 0;
    text-align: center;
  }

  .footer a {
    display: inline-block;
    margin: 4px 6px;
  }

  /* 下部ナビ */
  .bottom-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
  }

  .bottom-links a {
    flex: 1 1 45%;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
  }
}