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

/* -------- ここから幻想シアター用 -------- */

.page-title {
  font-size: 28px;
  letter-spacing: 0.12em;
  margin: 6px 0 18px 0;
  text-align: center;
}

.tab-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 新デザイン */
.tab-button {
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #e8e8ff;
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tab-button:hover {
  border-color: #5752EC;
  color: #ffffff;
}

.tab-button:hover::before {
  transform: translateX(100%);
}

.tab-button.is-active {
  background: #5752EC;
  border-color: #5752EC;
  color: #ffffff;
}

/* カード（history-itemベース） */

/* アルカナ一覧を2列にする */
#content-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.arcana-card {
  background: #0D0D0D;
  border: 1px solid #ffffff;
  border-radius: 14px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: start;
}

.arcana-image {
  width: 360px;
  height: auto;
  border-radius: 10px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.arcana-desc {
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.86);
}

.arcana-name {
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  color: #ffffff;
}

.arcana-text {
  display: flex;
  flex-direction: column;
}


@media (max-width: 720px) {
  .arcana-card {
    grid-template-columns: 1fr;
  }

  .arcana-image {
    width: 100%;
    max-width: 220px;
  }

  #content-area {
    grid-template-columns: 1fr;
  }
}

/* シャイニングブレス：6x3のボタングリッド */
.blessing-grid {
  display: grid;
  /* 横に9つ、幅は自動調整(minmax) */
  grid-template-columns: repeat(9, minmax(100px, 1fr));
  gap: 14px;

  /* 中央揃えのための設定 */
  justify-content: center;
  margin: 0 auto;

  /* 親要素(content-area)の2列設定を無視して全幅使うための設定 */
  grid-column: 1 / -1;
  width: 100%;
}

/* ボタン内の調整（お好みで） */
.blessing-btn {
  background: #0D0D0D;
  border: 1px solid rgba(255, 255, 255, 0.3);
  /* 少し線を薄くすると綺麗です */
  border-radius: 12px;
  padding: 12px 4px;
  /* 横幅が狭くなるのでパディングを調整 */
  text-align: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;

  /* ボタンの中身も中央寄せ */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.blessing-btn:hover {
  border-color: #5752EC;
  transform: translateY(-2px);
}

.blessing-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px auto;
}

.blessing-name {
  font-size: 12px;
  letter-spacing: 0.06em;
}

@media (max-width: 1100px) {
  .blessing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .blessing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* 9x2ボタンの選択状態 */
.blessing-btn.is-selected {
  border-color: #5752EC;
  background: rgba(87, 82, 236, 0.2);
  box-shadow: 0 0 10px rgba(87, 82, 236, 0.5);
}

/* ツリー表示エリア */
.blessing-detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 左に図、右に説明 */
  gap: 30px;
  margin-top: 40px;
  padding: 30px;
  background: #0D0D0D;
  border: 1px solid #333;
  border-radius: 20px;
}

/* ツリー全体のラッパー */
.tree-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px;
}

.tree-row {
  display: flex;
  gap: 60px;
  justify-content: center;
  width: 100%;
}

.tree-node {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #555;

  /* --- 修正ポイント：背景色を完全に不透明にする --- */
  background-color: #0D0D0D;
  /* 背景と同じ色、または真っ黒(#000)に設定 */

  /* --- 修正ポイント：線よりも手前に表示させる --- */
  position: relative;
  z-index: 2;
  /* SVG(z-index: 0)よりも大きい数字にする */

  cursor: pointer;
  padding: 5px;
  transition: all 0.2s;
  box-sizing: border-box;
  /* サイズ崩れ防止 */
}

.tree-node img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tree-node:hover,
.tree-node.is-active {
  border-color: #5752EC;
  box-shadow: 0 0 15px #5752EC;
  transform: scale(1.1);
}

/* ツリー全体のラッパー */
.tree-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px;
}

/* 2段目以降を包むエリア：ここを広くする */
.columns-wrapper {
  display: flex;
  gap: 150px;
  /* ← 左右の「左系統」と「右系統」の間隔をガッツリ広げる（元は80px） */
  justify-content: center;
  width: 100%;
  max-width: 1000px;
  /* 全体の最大幅を広げる */
  margin: 0 auto;
}

.tree-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
  /* 縦の間隔も少し広げると線が綺麗に見えます */
  flex: 1;
  /* 左右均等に広がるようにする */
}

/* 4段目のボタンペア（5&6 / 7&8） */
.tree-row.row-4 {
  display: flex;
  /* justify-contentをspace-betweenにすると、親の幅いっぱいに端まで離れます */
  justify-content: space-between;
  /* 5と6、7と8の間の距離をここで直接指定 */
  gap: 120px;
  width: 100%;
  max-width: 400px;
  /* ここの数値を大きくすればするほど、もっと離れます */
}

/* 背景に線を引くためのSVG */
.tree-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* これがないとボタンが押せなくなります */
  overflow: visible;
  /* 線がはみ出しても消えないように */
  z-index: 0;
  /* ボタン(z-index: 1)の背後に配置 */
}

/* 線のスタイル */
.tree-lines line {
  stroke: rgb(255, 255, 255);
  /* 線の色 */
  stroke-width: 2;
}

/* 説明パネル */
.info-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border-left: 5px solid #5752EC;
}

.info-name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #fff;
}

.info-desc {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
}


/* --- 幻想シアター全体ページ用 --- */

/* 全体を中央寄せ */
.overall-container {
  text-align: center;
  width: 100%;
}

.theatre-version-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
}

.version-prev,
.version-next {
  cursor: pointer;
  font-size: 1.8rem;
  user-select: none;
}

.version-box {
  text-align: center;
}

.version-name {
  font-size: 1.5rem;
  font-weight: bold;
}

.version-time {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.theatre-elements {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
}

.elem-icon {
  width: 45px;
  height: auto;
}

/* 各セクション（開幕・招待） */
.theatre-section {
  margin-bottom: 50px;
}

.theatre-section h3 {
  text-align: center;
  /* タイトルを中央に */
  font-size: 1.3rem;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-block;
  padding-bottom: 8px;
  min-width: 200px;
}

/* キャスト画像のグリッド */
.cast-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  /* 画像を中央寄せ */
}

/* キャラクター画像：背景色を削除（透過） */
.char-img {
  width: 90px;
  height: auto;
  border-radius: 0;
  /* 枠も不要な場合は0に */
  background: transparent;
  /* 背景なし */
  display: block;
}


/* --- 敵情報セクション --- */
.chambers-section {
  margin-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  /* 左右の余白（ここを調整して全体の幅を決められます） */
  padding: 30px 4% 0 4%;
  width: 100%;
  box-sizing: border-box;
}

.chamber-row {
  display: grid;
  /* ★修正ポイント：中身の数に合わせて100%を等分割する */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;

  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
}

/* 4段目（9-10幕）や5段目（アルカナ）など、2つしかない段も端を揃える設定 */
.chamber-row.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.chamber-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  min-height: 180px;
  /* 高さをある程度統一してガタつきを防ぐ */
}

.chamber-title {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: #5752EC;
  border-left: 4px solid #5752EC;
  padding-left: 10px;
  text-align: left;
  /* タイトルは左寄せで見やすく */
}

/* Config切り替えボタン */
.config-btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.config-btn {
  background: #1A1A1A;
  border: 1px solid #444;
  color: #ccc;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.config-btn.is-active {
  background: #5752EC;
  border-color: #5752EC;
  color: white;
}

.enemy-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  /* 少し広げる */
  justify-content: flex-start;
  margin-bottom: 15px;
}

/* 説明文エリアのスタイル */
.mon-description-area {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
  text-align: left;
  /* 文字が多い場合にボックスが伸びすぎないように調整が必要ならここ */
}

/* 敵画像とHPを包む枠 */
.enemy-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 80px;
  /* 画像サイズに合わせる */
}

.enemy-img {
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.3);
  object-fit: contain;
  border-radius: 4px;
}

/* HP数値のスタイル */
.enemy-hp {
  font-size: 15px;
  color: #ffffff;
  /* 視認性の良い色 */
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
}


/* レスポンシブ：画面が狭いときは2列、さらに狭いときは1列に */
@media (max-width: 1000px) {

  .chamber-row,
  .chamber-row.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {

  .chamber-row,
  .chamber-row.cols-2 {
    grid-template-columns: 1fr;
  }
}


/* 画像化の際、メインエリアの余白がサイドバー分空いてしまうのを防ぐため */
@media print {
  .main {
    margin-left: 0 !important;
    padding: 0 !important;
  }
}

/* 画像保存ボタンのスタイル */
.screenshot-button {
  background-color: #5752EC;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.screenshot-button:hover {
  background-color: #4540c7;
}

/* html2canvas実行中にボタンを隠すためのクラス */
.is-exporting #download-btn {
  display: none !important;
}