/* ハンバーガー */    
.hamburger {
  font-size: 36px;
  cursor: pointer;
  padding: 10px 15px;
  position: fixed;  /* ←画面固定 */
  top: 15px;
  right: 20px;
  z-index: 10;     /* サイドメニューより後ろ */
  background-color: #000;
  color: #fff;
  border-radius: 4px;
}

     
/* サイドメニュー：右から隠れて出てくる（チラ見え対策込み） */
.side-menu {
  position: fixed;
  top: 0;
  right: -400px;              /* ← 隠す量 = 幅 と一致 */
  width: 400px;
  height: 100%;
  background-color: #000;
  color: #fff;
  overflow-y: auto;
  transition: right 0.3s ease;
  z-index: 1000;

  /* ここが超重要：paddingぶんで実幅が増えないようにする */
  box-sizing: border-box;
  text-align: right;
  padding-right: 20px;
}

/* 開いたとき */
.side-menu.open { right: 0; }

.side-menu-header {
  display: flex;
  justify-content: flex-start;
  padding: 10px;
  background-color: #000;
}

.close-menu { font-size: 24px; color: #fff; cursor: pointer; }

.side-menu ul { list-style: none; padding: 0; margin: 20px 0; }
.side-menu li { margin: 10px 0; padding: 10px 20px; border-bottom: 1px solid #333; }
.side-menu li:last-child { border-bottom: none; }

.side-menu a {
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  display: block;
  transition: all 0.3s ease;
}
.side-menu a:hover { background-color: #fff; color: #000; border-radius: 4px; }

/* スマホサイズ以下 */
@media screen and (max-width: 768px) {
  .hamburger { font-size: 24px; padding: 6px 12px; top: 8px; right: 10px; }

  .side-menu {
    width: 40vw;      /* ← あなたの数値を尊重 */
    right: -40vw;     /* ← 幅と“同じ値”に揃える（70→70vw 等、常に一致させる） */
    /* box-sizing は継承されるのでOK / padding-right も幅に含まれる */
  }
  .side-menu.open { right: 0; }
  .side-menu a { font-size: 13px; }
}



    /* 1. ボタン全体を相対配置に */
.to-top {
  position: fixed;
  z-index: 9999;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: inline-block;        /* inline-blockで内容にフィット */
  width: auto;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  pointer-events: none;         /* 非表示時の安全策 */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  position: fixed;
}

/* 表示状態 */
.to-top.is-visible {
  opacity: 0.85;
  pointer-events: auto;
}

/* 2. 相対配置を有効化 */
.to-top {
  position: fixed;
}
.to-top__icon {
  width: 48px;
  height: auto;
  display: block;
  object-fit: contain;
  margin-bottom: 8px; /* 下にラベル用スペース */
}

/* 3. ラベルを画像の下にかぶせる */
.to-top__label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  pointer-events: none;
  white-space: nowrap;
  background: rgba(0,0,0,0.3); /* 任意：文字の読みやすさ向上 */
  padding: 2px 6px;
  border-radius: 4px;
}

/* ホバー時：ぴょーん */
@media (hover: hover) {
  .to-top.is-visible:hover {
    opacity: 1;
    animation: toTopHopSlow .7s ease-out;
  }
}
.to-top.is-visible:focus-visible {
  opacity: 1;
  animation: toTopHopSlow .7s ease-out;
}

/* アニメーション */
@keyframes toTopHopSlow {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(-6px); }
  65%  { transform: translateY(0); }
  85%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* スマホ右下 → サイドバー開いたら左下 */
@media (max-width: 640px) {
  .to-top { left: auto; right: 16px; }
  body.sidebar-open .to-top { right: auto; left: 16px; }
}