/* 全体・基本設定 */
body {
  margin: 0;
  background: #05040A;
  color: white;
  font-family: sans-serif;
}

.layout {
  display: flex;
  height: 100vh;
}

/* サイドバー */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #0D0A21;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

/* メニュー全体 */
.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

/* 各ボタン */
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;
  border-radius: 12px;

  text-decoration: none;
  color: white;

  transition: 0.2s ease;
}

/* 画像サイズ */
.menu-item img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
}

/* ホバー時 */
.menu-item:hover {
  background-color: #5752EC;
}

/* サイドバーロゴ全体 */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  /* 下線消す */
}

/* ロゴ画像サイズ */
.logo img {
  width: 45px;
  /* ←ここで大きさ調整 */
  height: 45px;
}

/* LUNABASE文字 */
.logo span {
  font-size: 20px;
  font-weight: bold;

  /* シルバーグラデーション */
  background: linear-gradient(135deg,
      #f5f5f5 0%,
      #d6d6d6 30%,
      #a8b0b8 50%,
      #eaeaea 70%,
      #c2c8cf 100%);

  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  background-clip: text;
  color: transparent;
}
.menu-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #ccc;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.menu-btn.active {
  color: white;
  background: #222;
}

/* メインエリア */
.main {
  flex: 1;
  margin-left: 240px;
  padding: 20px;
  overflow-y: auto;
  background-color: #05040A;
}

/* --- フィルターとスイッチのレイアウト調整 --- */
#header-controls {
  display: flex;
  justify-content: space-between; /* 左右に振り分ける */
  align-items: center;
  margin-bottom: 20px;
  padding: 0 20px;
}

/* 既存の #filters の margin-bottom を 0 に、padding-leftを 0 に修正 */
#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0; /* 修正 */
  align-items: center;
  padding-left: 0; /* 修正 */
}

/* --- スイッチのスタイル --- */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap; /* 改行させない */
}

.toggle-label {
  font-size: 14px;
  color: #ccc;
}

/* スイッチ本体（枠） */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

/* 実際のチェックボックスは隠す */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* スライダー（背景） */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333; /* オフ時の背景色 */
  transition: .4s;
  border: 2px solid #ccc; /* 枠線 */
}

/* 丸い部分 */
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white; /* 丸の色 */
  transition: .4s;
}

/* オン時の背景色 */
input:checked + .slider {
  background-color: #5752EC;
}

/* オン時に丸を右に移動 */
input:checked + .slider:before {
  transform: translateX(24px);
}

/* 角丸（画像のようなデザインに） */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.filter-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  background-color: #111;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s ease-in-out;
}

.filter-btn img {
  width: 40px;
  height: 40px;
  display: block;
}

.filter-btn.active {
  background-color: #333;
}

.filter-btn.active img {
  outline: 2px solid #fff;
  border-radius: 5px;
  transform: scale(1.15);
}

/* 武器カードグリッド（修正） */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px; /* カード同士の間隔をここで一括管理 */
  justify-content: flex-start;
  padding: 20px;
  align-items: flex-start; /* stretchから変更して、高さがバラバラでも上に詰める */
}

/* 武器カード（修正） */
.character-card {
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  margin: 0; /* marginは0にする（gapで制御するため） */
  text-decoration: none;
  color: white;
  border-radius: 8px; /* 少し角丸を抑えるときれい */
  overflow: hidden;
  transition: transform 0.15s ease-in-out;
  background-color: #0D0D0D;
  text-align: center;
}
/* レアリティ別背景 */
.character-card[data-rarity="5"] { background-color: #9E642E; }
.character-card[data-rarity="4"] { background-color: #8068A3; }
.character-card[data-rarity="3"] { background-color: #4A8EA5; }
.character-card[data-rarity="2"] { background-color: #598661; }

/* 画像部分 */
.character-img-wrapper {
  /* 高さは JS で揃える */
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

/* 画像 */
.character-img {
  width: 100%;
  object-fit: cover;
  display: block;
}

/* 名前部分 */
.character-name {
  text-align: center;
  background: #E9E5DC;
  color: black;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;  /* 長い名前の折り返し対応 */
  height: auto;     /* JS で上書きしない */
  font-size: 14px;
}

/* トランジション（動き）を滑らかにするための共通設定 */
.sidebar {
  transition: width 0.3s ease, padding 0.3s ease;
  z-index: 1000;
}

.menu-item span {
  transition: opacity 0.2s ease;
  white-space: nowrap; /* 文字の折り返しを防ぐ */
}

/* --- [1] デスクトップ中画面 (1300px以下) --- */
@media (min-width: 769px) and (max-width: 1300px) {
  .sidebar {
    width: 70px; /* アイコン分の幅に縮小 */
    padding: 20px 10px;
    overflow: hidden; /* はみ出た文字を隠す */
  }

  /* サイドバー内の文字とロゴテキストを隠す */
  .sidebar .logo span,
  .sidebar .menu-item span {
    opacity: 0;
    pointer-events: none;
  }

  /* ホバーした時にシュッと出てくる挙動 */
  .sidebar:hover {
    width: 220px; /* 元の幅に戻る */
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar:hover .logo span,
  .sidebar:hover .menu-item span {
    opacity: 1;
    pointer-events: auto;
  }

  /* メインエリアの余白を狭まったサイドバーに合わせる */
  .main {
    margin-left: 70px;
    transition: margin-left 0.3s ease;
  }
}