@media (max-width: 768px) {

  /* ---------- top-nav ---------- */
  .top-nav {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 98px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background: rgba(0,0,0,0.95);
    padding: 12px;
    gap: 12px;
    border: 3px solid white;
    border-radius: 6px;
    box-sizing: border-box;
    z-index: 10003;
  }

  .top-nav.is-open {
    display: flex;
  }

  .top-nav a {
    display: block;
    width: 100%;
    padding: 12px;
    background: black;
    color: white;
    border: 2px solid white;
    text-align: center;
    transition: 0.2s;
  }

  .top-nav a:active {
    transform: translateY(4px);
    background: white;
    color: black;
  }

  /* ---------- COMMAND ---------- */
  .sp-command {
    display: block;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: black;
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    font-family: 'DotGothic16', sans-serif;
    cursor: pointer;
    transition: 0.2s;
    z-index: 10001;
  }

  .sp-command:active {
    transform: translate(-50%, 4px);
    background: white;
    color: black;
  }


  .title h2 {
    font-size: 8vw;
    margin-top: 4vh;
  }
  .rpg-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center; /* 縦中央 */
    align-items: center;     /* 横中央 */
    text-align: left;        /* テキストは左寄せ */
    padding: 40px;
  }

  /* rpg-panel のはみ出し対策（モバイル） */
  .rpg-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px; /* 小さめにして右側の余白を削る */
    box-sizing: border-box;
    max-width: 100%;
    overflow: visible;
  }

  /* コマンドで開くためのスタイル */
  .rpg-panel.is-open {
    position: fixed;
    top: 120px; /* ヘッダーとコマンド下に表示 */
    left: 8px;
    right: 8px;
    background: #141414;
    border: 3px solid white;
    padding: 16px;
    z-index: 10002;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    max-height: calc(100vh - 140px);
    overflow: auto;
  }

  .rpg-content {
    min-width: auto; /* main.css の min-width:300px を解除 */
    width: 100%;
    max-width: 100%;
  }

  .gallery-grid {
    gap: 12px;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
  }

  /* モーダル用大画像の高さを自動化して横幅に合わせる */
  .modal-img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: cover;
  }
  .rpg-title {
    font-size: 36px;
    margin-bottom: 5vh;
    letter-spacing: 4px;
  }

  .rpg-text {
    max-width: 600px;
    font-size: 5vw;
    line-height: 1.1;
  }

  p {
    font-size: 5vw;
    line-height: 1.2;
  }

  .container {
    scroll-margin-top: 60px;
  }

  /* event */
  #event .event-images {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 10%;
    gap: 20px;
    padding-left: 10%;
    padding-right: 10%;
  }

  #event .event-images img {
    flex: 0 0 90%;
    scroll-snap-align: center;
    border-radius: 8px;
  }

  #event .event-images::-webkit-scrollbar {
    display: none;
  }

  /* rpg */
  .rpg-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .rpg-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
  }

  .rpg-tab {
    display: none;
  }

  .mobile-tab-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 18px;
  }

  .mobile-tab-switch button {
    background: black;
    color: white;
    border: 2px solid white;
    padding: 6px 12px;
  }

  .rpg-panel{
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
  }

  .gallery-grid{
    width: 100%;
  }

  .gallery-grid img{
    width: 100%;
    height: auto;
  }

  /* map */
  .section-image {
    margin-top: 7vh;
  }

  /* SNS */
  .sns-icons {
    flex-direction: column;
  }

  .nav-buttons {
    right: 20px;
    bottom: 30px;    
  }

  .nav-buttons button {
    width: 40px;
    height: 40px;
  }

  /* modal */
  .modal-prev,
  .modal-next,
  .modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px; /* 矢印文字を小さくする */
    line-height: 1;
    border-radius: 6px;
  }
}