/* ===== リセット & ベース ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a18;
  --bg2: #12122a;
  --bg3: #1a1a3a;
  --card-bg: #1e1e3e;
  --gold: #f0c040;
  --gold2: #c89b20;
  --purple: #8b5cf6;
  --red: #ef4444;
  --green: #10b981;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --border: #2d2d5a;
  --radius: 12px;
  --hp-color: #ef4444;
  --mp-color: #3b82f6;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: #000;
  /* 背景を黒にしてコンテナ外を隠す */
  color: var(--text);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#game-wrapper {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#game-container {
  width: 480px;
  height: 720px;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ===== 画面管理 ===== */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ===== ボタン ===== */
.btn {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 25px;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0a00;
  box-shadow: 0 4px 15px rgba(240, 192, 64, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(240, 192, 64, 0.6);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  transform: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 16px;
  /* モバイル向けにボタン文字を拡大 */
  padding: 8px 16px;
}

.btn-secondary:hover {
  background: var(--bg2);
  border-color: var(--gold);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text2);
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  margin-top: 12px;
}

/* ===== タイトル画面 ===== */
#screen-title {
  background: radial-gradient(ellipse at 50% 30%, #1a0a3a 0%, #0a0a18 70%);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.title-particles {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Ccircle cx='50' cy='50' r='1' fill='%23ffffff22'/%3E%3Ccircle cx='150' cy='200' r='1.5' fill='%23ffffff22'/%3E%3Ccircle cx='300' cy='80' r='1' fill='%23ffffff22'/%3E%3Ccircle cx='350' cy='300' r='2' fill='%23ffffff22'/%3E%3Ccircle cx='80' cy='350' r='1' fill='%23ffffff22'/%3E%3C/svg%3E");
  animation: particles 20s linear infinite;
}

@keyframes particles {
  0% {
    transform: translateY(0)
  }

  100% {
    transform: translateY(-400px)
  }
}

.title-content {
  position: relative;
  z-index: 1;
}

.title-locale {
  color: var(--text2);
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.title-deities {
  font-size: 28px;
  letter-spacing: 8px;
  margin-bottom: 16px;
  opacity: 0.7;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-6px)
  }
}

.title-main {
  font-size: clamp(42px, 8vw, 80px);
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #ffffff, var(--gold), #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  /* 標準プロパティの不足を解消 */
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  margin-bottom: 8px;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

  0%,
  100% {
    filter: brightness(1)
  }

  50% {
    filter: brightness(1.3)
  }
}

.title-sub {
  color: var(--text2);
  font-size: 25px;
  letter-spacing: 2px;
  margin-bottom: 48px;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.title-buttons .btn {
  width: 220px;
}

/* ===== ステージ選択画面 ===== */
#screen-stage {
  background: linear-gradient(180deg, #0a0f20 0%, #0a1520 100%);
  padding: 0;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stage-header h2 {
  font-size: 20px;
}

.stage-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-hp-indicator {
  color: var(--red);
  font-weight: 600;
}

.stage-progress-text {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  padding: 4px;
  /* 8px -> 4px */
  flex-shrink: 0;
}

.stage-map {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  /* コンテンツによる幅のバラつきを防ぐため minmax(0, 1fr) 指定 */
  gap: 8px;
  padding: 8px 16px 120px;
  overflow-y: auto;
  align-content: start;
}

.stage-card {
  box-sizing: border-box;
  /* 境界線を含めた幅に統一 */
  background: #2a2d3d;
  /* 選択可能なステージは暗いグレー背景 */
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  overflow: visible !important;
}

/* 選択不可（未解放）は黒背景 */
.stage-card.locked {
  background: #050505;
  border-color: #222;
  opacity: 0.6;
  cursor: not-allowed;
}

/* 状態ごとのフチ色統一（優先順位：クリア < 選択中 < ホバー） */
.stage-card.cleared {
  border-color: #10b981 !important;
  /* 緑の縁取り */
}

.stage-card.selected {
  border-color: #ef4444 !important;
  /* 赤フチ */
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
  transform: scale(1.02);
}

.stage-card:hover:not(.locked) {
  border-color: #f97316 !important;
  /* オレンジフチ */
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
  z-index: 2;
}

.stage-card.cleared::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  color: #10b981;
  font-size: 16px;
  font-weight: 900;
}

.stage-card.boss {
  border-color: var(--red);
  animation: bossGlow 2s ease-in-out infinite;
}

@keyframes bossGlow {

  0%,
  100% {
    box-shadow: 0 0 0 rgba(239, 68, 68, 0)
  }

  50% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4)
  }
}

.stage-num {
  font-size: 18px;
  color: var(--text2);
  margin-bottom: 4px;
  line-height: 1;
  text-align: center;
}

.stage-difficulty-symbols {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 8px;
  min-height: 20px;
}

.stage-reward-progress {
  font-size: 11px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(240, 192, 64, 0.3);
  margin-top: 6px;
  display: inline-block;
  white-space: nowrap;
}

.stage-enemy-emoji {
  font-size: 32px;
  margin: 15px 0;
  min-height: 80px;
  /* 画像エリアを縦長に確保 */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stage-god-img {
  width: 72px;
  /* 大きくする */
  height: 90px;
  /* 縦長にする */
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(240, 192, 64, 0.3));
}

.stage-name {
  font-size: 16px;
  /* 少し小さくして折り返しを安定させる */
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.4;
  white-space: normal;
  word-break: break-all;
  flex-grow: 1;
  display: block;
}

.stage-difficulty {
  display: none;
}

/* ステージパネル */
.stage-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg2);
  border-top: 2px solid var(--gold);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  pointer-events: none;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.stage-panel.panel-open {
  transform: translateY(0);
  pointer-events: all;
}

.btn-panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s;
}

.btn-panel-close:hover {
  background: var(--red);
  color: #fff;
}

.stage-panel-inner {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-areas:
    "emoji info"
    "emoji buttons";
  gap: 8px 16px;
  padding: 16px 20px 16px;
  position: relative;
}

.stage-panel-enemy-emoji {
  grid-area: emoji;
  align-self: start;
  /* ... existing styles ... */
  font-size: 44px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.stage-panel-info {
  grid-area: info;
  min-width: 0;
}

.stage-panel-info h3 {
  font-size: 18px;
  color: var(--gold);
  margin-top: 0;
  margin-bottom: 4px;
  padding-right: 40px;
  /* 閉じるボタン（右上固定）を避ける */
}

.panel-story {
  font-size: 24px;
  color: var(--text2);
  margin-bottom: 4px;
  line-height: 1.5;
  /* 右端までテキストを広げる */
}

.panel-enemy-row {
  grid-area: info;
  align-self: end;
  font-size: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.panel-enemy-hp {
  color: var(--red);
  font-weight: 700;
  font-family: 'Inter', monospace;
}

.stage-panel-buttons {
  grid-area: buttons;
  justify-self: end;
  margin-top: 4px;
}

/* ===== デッキ構築画面 ===== */
#screen-deck {
  background: var(--bg);
}

.deck-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.deck-header h2 {
  flex: 1;
}

.deck-count-badge {
  background: var(--bg3);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--gold);
}

.deck-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  flex: 1;
  overflow: visible;
  /* hiddenから変更：ツールチップ見切れ防止 */
  min-height: 0;
  /* FlexBoxの高さを制限 */
}

.deck-selected-panel {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow-y: hidden;
  /* パネル全体ではなく中身のdeck-slotsだけをスクロールさせる */
  position: relative;
}

#btn-battle-start {
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  font-size: 20px;
  /* 28px -> 20px (大幅縮小) */
  padding: 8px 12px;
  /* パディング削減 */
}

.deck-selected-panel h3 {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 4px;
}

.deck-action-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
  /* 下部に押しやる */
  flex-shrink: 0;
}

.deck-action-row .btn {
  flex: 1;
  font-size: 16px;
  /* 縦長パネル内で綺麗に収まるようにする */
  padding: 8px 10px;
}

.deck-slots {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* 4px -> 2px (ギチギチに詰める) */
  flex: 1;
  /* 空白を埋める */
  overflow-y: auto;
  /* ここだけスクロールさせる */
  min-height: 0;
  /* フレックスコンテナ内での縮小を許可 */
  padding-right: 4px;
}

.deck-slot {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  /* 8px 10px -> 4px 8px (極小化) */
  font-size: 14px;
  color: var(--text2);
  min-height: 32px;
  /* 高さを固定して詰める */
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  /* ツールチップの基準点 */
}

.deck-slot.filled {
  border-style: solid;
  border-color: var(--border);
  color: var(--text);
  cursor: pointer;
  position: relative;
}

/* タイプ別の枠色 */
.deck-slot.filled.type-attack {
  border-color: rgba(239, 68, 68, 0.6);
}

.deck-slot.filled.type-defense {
  border-color: rgba(59, 130, 246, 0.6);
}

.deck-slot.filled.type-heal {
  border-color: rgba(16, 185, 129, 0.6);
}

.deck-slot.filled.type-special {
  border-color: rgba(139, 92, 246, 0.6);
}

.deck-slot.filled.type-curse {
  border-color: rgba(148, 163, 184, 0.6);
}

.deck-slot.filled.type-equipment {
  border-color: rgba(245, 158, 11, 0.6);
}

.deck-slot.filled:hover {
  border-color: var(--gold);
}

/* チェイン（共鳴）状態のスロット（アニメーションなし、軽微な強調） */
.deck-slot.filled.chain-active {
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
  border-width: 2px;
  padding: 3px 7px;
  /* ボーダーが太くなった分内側を調整 */
}

/* 文字改行対策 */
.deck-slot-info {
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

.deck-slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-slot-remove {
  width: 24px;
  /* 32px -> 24px */
  height: 24px;
  /* 32px -> 24px */
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  font-size: 16px;
  /* 20px -> 16px */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.deck-slot-remove:hover {
  background: var(--red);
  color: #fff;
  transform: scale(1.1);
}

/* 吹き出し（ツールチップ）- 親要素のスクロール制限に隠れないようfixed（画面基準）風の絶対配置にするか、確実に上にかぶせる */
.deck-slot-tooltip {
  position: absolute;
  left: 0px;
  /* 下にスペースがない場合を考慮しスロットの真上に出す設定に変更 */
  bottom: 100%;
  width: 100%;
  background: var(--bg3);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 10px;
  z-index: 9999;
  /* 他のどの要素よりも手前にする */
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.9);
  margin-bottom: 5px;
  /* スロットの上の隙間 */
  max-height: 250px;
  display: flex;
  flex-direction: column;
}

.deck-slot-tooltip::before {
  content: '';
  position: absolute;
  left: 20px;
  bottom: -16px;
  /* 三角の位置を下向きに変更 */
  border-width: 8px;
  border-style: solid;
  border-color: var(--gold) transparent transparent transparent;
}

.deck-slot.filled:hover .deck-slot-tooltip,
.deck-slot.filled:active .deck-slot-tooltip,
.deck-slot.filled.active .deck-slot-tooltip {
  opacity: 1;
  pointer-events: none;
  /* autoからnoneに変更: ボタンのクリックを妨害しないため */
}

.tooltip-title {
  font-weight: 800;
  color: var(--gold);
  font-size: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.tooltip-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.card-type-mini {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin-right: 8px;
  font-size: 14px;
}

.card-type-mini.attack {
  background: rgba(239, 68, 68, 0.2);
}

.card-type-mini.defense {
  background: rgba(59, 130, 246, 0.2);
}

.card-type-mini.heal {
  background: rgba(16, 185, 129, 0.2);
}

.card-type-mini.special {
  background: rgba(139, 92, 246, 0.2);
}

.card-type-mini.curse {
  background: rgba(148, 163, 184, 0.2);
}

/* 敵イラストのシェイク演出 */
.enemy-battle-img.shake {
  animation: enemyImgShake 0.4s ease-out;
}

@keyframes enemyImgShake {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-8px, -4px) rotate(-2deg);
    filter: brightness(1.5) sepia(1);
  }

  20% {
    transform: translate(10px, 8px) rotate(3deg);
  }

  30% {
    transform: translate(-10px, -6px) rotate(-3deg);
  }

  40% {
    transform: translate(8px, 6px) rotate(2deg);
  }

  50% {
    transform: translate(-6px, 4px) rotate(-1deg);
  }

  60% {
    transform: translate(5px, -3px) rotate(1deg);
  }

  100% {
    transform: translate(0, 0);
  }
}


.deck-owned-panel {
  padding: 12px;
  /* 16px -> 12px */
  overflow-y: auto;
  min-height: 0;
}

/* カード一覧のグリッド表示（図鑑・デッキ共通） */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 8px;
  padding: 4px;
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

.deck-owned-panel h3 {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 12px;
}

/* 重複したカードグリッド設定を削除（上部で統一済み） */

#screen-collection.active {
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.collection-grid {
  padding: 20px;
  flex: 1;
  overflow-y: visible;
  /* 親でスクロールさせる */
}

/* ===== カード ===== */
.game-card {
  width: 100%;
  max-width: 125px;
  /* 横幅を親要素（グリッド）に合わせて可変にする */
  height: 245px;
  /* 220px -> 245px 文字切れ防止のため延長 */
  background: var(--card-bg);
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  user-select: none;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-8px) scale(1.05);
  /* 少し多めに動かす */
  z-index: 100 !important;
  /* 他の要素より常に前面に */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.game-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(240, 192, 64, 0.5);
}

/* ----- 新規: タイプ別カード背景色 ----- */
.game-card.type-attack {
  --card-bg: #2e1616;
  border-color: rgba(239, 68, 68, 0.4);
}

.game-card.type-defense {
  --card-bg: #121e35;
  border-color: rgba(59, 130, 246, 0.4);
}

.game-card.type-heal {
  --card-bg: #102e21;
  border-color: rgba(16, 185, 129, 0.4);
}

.game-card.type-special {
  --card-bg: #211639;
  border-color: rgba(139, 92, 246, 0.4);
}

.game-card.type-curse {
  --card-bg: #21242d;
  border-color: rgba(148, 163, 184, 0.4);
}

.game-card.type-equipment {
  --card-bg: #352109;
  border-color: rgba(245, 158, 11, 0.4);
}

/* ----- 新規: カード背景でのレアリティ表現 ----- */
.game-card.common {
  background: linear-gradient(150deg, var(--card-bg) 60%, rgba(113, 128, 150, 0.2));
}

.game-card.uncommon {
  background: linear-gradient(150deg, var(--card-bg) 60%, rgba(59, 130, 246, 0.25));
  border-color: rgba(59, 130, 246, 0.4);
}

.game-card.rare {
  background: linear-gradient(150deg, var(--card-bg) 60%, rgba(240, 192, 64, 0.25));
  border-color: rgba(240, 192, 64, 0.5);
}

.game-card.in-deck {
  opacity: 0.5;
  cursor: default;
}

.game-card.not-owned {
  opacity: 0.3;
  filter: grayscale(1);
  cursor: default;
}

.card-cost-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 30px;
  height: 30px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg);
}

.card-rarity-bar {
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.card-rarity-bar.common {
  background: #718096;
}

.card-rarity-bar.uncommon {
  background: var(--blue);
}

.card-rarity-bar.rare {
  background: linear-gradient(90deg, var(--gold), var(--purple));
}

.card-art {
  text-align: center;
  font-size: 32px;
  padding: 4px 0 4px;
  /* タグの下にくるため上部パディングを縮小 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-art-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 8px;
}

.card-name {
  text-align: center;
  font-size: 14px;
  /* やや調整 */
  font-weight: 800;
  padding: 0 4px 2px;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.card-type-badge {
  margin: 0 4px 2px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 20px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.card-type-badge.attack {
  background: rgba(239, 68, 68, 0.2);
  color: #fc8181;
}

.card-type-badge.defense {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.card-type-badge.heal {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.card-type-badge.special {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.card-type-badge.curse {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.card-desc {
  font-size: 13px;
  color: var(--text2);
  padding: 1px 6px 6px;
  text-align: center;
  line-height: 1.35;
  flex: 1;

  /* 改行を許可し、最大3行まで表示してあふれたら... */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.card-god-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 6px auto 0;
  /* 上部に少し余白 */
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: fit-content;
  /* 中身に合わせる */
}

.card-god-bar {
  height: 3px;
  border-radius: 0 0 8px 8px;
  margin-top: auto;
}

.card-god-tag.starter,
.card-god-bar.starter {
  background: #718096;
}

.card-god-tag.ibo,
.card-god-bar.ibo {
  background: #48bb78;
}

.card-god-tag.me,
.card-god-bar.me {
  background: #63b3ed;
}

.card-god-tag.i,
.card-god-bar.i {
  background: #f6ad55;
}

.card-god-tag.koshi,
.card-god-bar.koshi {
  background: #68d391;
}

.card-god-tag.ha,
.card-god-bar.ha {
  background: #e2e8f0;
}

.card-god-tag.inochi,
.card-god-bar.inochi {
  background: #fbd38d;
}

.card-god-tag.mimi,
.card-god-bar.mimi {
  background: #b794f4;
}

.card-god-tag.teashi,
.card-god-bar.teashi {
  background: #fc8181;
  /* 手足用 */
}

.card-god-tag.kioku,
.card-god-bar.kioku {
  background: #9f7aea;
  /* 記憶用 */
}

.card-god-tag.boukyaku,
.card-god-bar.boukyaku {
  background: #a0aec0;
  /* 忘却用 */
}

.card-god-tag.sacred,
.card-god-bar.sacred {
  background: #f6e05e;
  color: #000;
}

/* 手札カード（大きめ） */
.hand-card {
  flex-shrink: 0;
  background: var(--card-bg);
}

.hand-card:hover {
  transform: translateY(-10px) scale(1.05);
  z-index: 10;
}

.hand-card.playable {
  border-color: var(--gold);
}

.hand-card.not-playable {
  opacity: 0.5;
  cursor: not-allowed;
}

.hand-card:hover.not-playable {
  transform: none;
}

/* 共鳴待機中のカードエフェクト */
.game-card.resonance-ready {
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.8), inset 0 0 10px rgba(251, 191, 36, 0.4);
  animation: resonancePulse 1.5s infinite;
  border: 1px solid var(--gold);
}

@keyframes resonancePulse {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.8), inset 0 0 10px rgba(251, 191, 36, 0.4);
  }

  50% {
    box-shadow: 0 0 25px rgba(251, 191, 36, 1), inset 0 0 20px rgba(251, 191, 36, 0.6);
  }
}

/* 共鳴！バッジ */
.resonance-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 5;
  pointer-events: none;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

/* ===== バトル画面 ===== */
#screen-battle {
  background: radial-gradient(ellipse at 50% 0%, #1a0a3a 0%, #080814 60%);
  /* display:flex と flex-direction:column は .screen.active が担う */
}

.battle-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.3);
  z-index: 100;
  flex-shrink: 0;
}

.battle-stage-label {
  font-size: 13px;
  color: var(--text2);
  letter-spacing: 1px;
}

.turn-label-badge {
  background: var(--gold);
  color: #000;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(240, 192, 64, 0.4);
}

/* 敵エリア：中央上部・カラム配置 */
.battle-enemy-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 0;
  /* 4px -> 24px (敵の名前等が切れないように下げる) */
  flex-shrink: 0;
}

/* 敵イラスト（大きく中央に） */
.enemy-art-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 140px;
  margin-top: -6px;
  /* 名前インライン化でできた空間へ押し上げる */
}

/* 敵の画像（イラスト用） */
.enemy-battle-img {
  width: 150px;
  height: 135px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(255, 100, 100, 0.5));
  animation: enemyFloat 3s ease-in-out infinite;
}

/* 敵情報行（HP等） */
.enemy-info-row {
  width: 100%;
  max-width: 420px;
  padding: 0px 20px 0px;
  /* パディング全削除して上詰め */
}

.enemy-info-row .bar-row {
  margin-bottom: 2px;
  justify-content: space-between;
  /* 数値を右端へ */
}

.enemy-info-row .unit-name {
  margin-bottom: 2px;
  margin-right: 15px;
  /* 名前とバーの隙間 */
  flex-shrink: 0;
}

/* 旧 enemy-block は非推奨、互換性のため残す */
.enemy-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.enemy-emoji-wrap {
  position: relative;
  flex-shrink: 0;
}

/* 敵のセリフ吹き出し本体 */
.enemy-dialogue-bubble {
  position: absolute;
  /* スライムのイラストに近い高さに調整 */
  bottom: 95%;
  left: 50%;
  /* 中央寄せを維持しつつ、出現時に少し下から浮き上がる演出 */
  transform: translateX(-50%) translateY(10px) scale(0.9);
  width: max-content;
  max-width: 200px;
  /* 背景を白、文字を黒に変更 */
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 表示状態（visibleクラス付与時）の中央配置を維持 */
.enemy-dialogue-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* 吹き出しのしっぽ（外枠：黒） */
.enemy-dialogue-bubble::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -10px;
  /* 中央に固定 */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 10px 0 10px;
  border-color: #000000 transparent transparent transparent;
  z-index: 1;
}

/* 吹き出しのしっぽ（内側：白） */
.enemy-dialogue-bubble::after {
  content: '';
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  margin-left: -9px;
  /* 中央に固定 */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 9px 0 9px;
  border-color: #ffffff transparent transparent transparent;
  z-index: 2;
}

.enemy-emoji {
  font-size: 100px;
  /* 中央上部に大きく表示 */
  display: block;
  animation: enemyFloat 3s ease-in-out infinite;
  line-height: 1;
}

@keyframes enemyFloat {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-8px)
  }
}

.enemy-emoji.shake,
.enemy-battle-img.shake {
  animation: shake 0.4s ease;
}

.enemy-emoji.enemy-attack-jump,
.enemy-battle-img.enemy-attack-jump {
  animation: enemyJump 0.4s ease-in-out;
}

@keyframes enemyJump {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-40px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0)
  }

  25% {
    transform: translateX(-8px)
  }

  75% {
    transform: translateX(8px)
  }
}

.invincible-ring {
  position: absolute;
  inset: -8px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  animation: ringPulse 1s ease-in-out infinite;
}

@keyframes ringPulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.3
  }
}

.enemy-stats-block {
  flex: 1;
}

.unit-name {
  font-size: 20px;
  /* 18px -> 20px */
  font-weight: 800;
  margin-bottom: 2px;
  /* 6px -> 2px (余白削減) */
  color: var(--gold);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  /* 6px -> 4px (余白削減) */
}

.bar-label {
  font-size: 20px;
  color: var(--text2);
  width: 20px;
  flex-shrink: 0;
}

.bar-outer {
  background: rgba(0, 0, 0, 0.4);
  height: 20px;
  /* 特大HPバーにするため20pxへ */
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  flex: 1;
  /* バーを最大限伸ばす */
}

/* ===== MPドット表示用 ===== */
.mp-dots-container {
  display: flex;
  gap: 3px;
  flex: 1;
  align-items: center;
  padding-left: 2px;
}

.mp-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3b82f6;
  /* カードコストの青に統一 */
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
  flex-shrink: 0;
  transition: all 0.2s;
}

.mp-dot.empty {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease;
  border-radius: 999px;
}

.bar-hp {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.bar-hp-player {
  background: linear-gradient(90deg, #10b981, #22c55e);
}

.bar-mp {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.bar-val {
  font-size: 24px;
  font-weight: 900;
  font-family: 'Inter', monospace;
  color: var(--text);
  margin-left: 6px;
  text-align: left;
}

.status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
  min-height: 20px;
  /* 隙間削減 */
}

.status-badge {
  padding: 4px 12px;
  /* 2px 7px -> 4px 12px */
  border-radius: 999px;
  font-size: 24px;
  /* 10px -> 16px (約3倍の視認性) */
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-badge.poison {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

.status-badge.burn {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.status-badge.bleed {
  background: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.status-badge.stun {
  background: rgba(250, 204, 21, 0.3);
  color: #fde68a;
}

.status-badge.silence {
  background: rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
}

.status-badge.weaken_atk {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.status-badge.weaken_def {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.status-badge.regen {
  background: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.status-badge.invincible {
  background: rgba(240, 192, 64, 0.3);
  color: var(--gold);
}

.status-badge.evade {
  background: rgba(6, 182, 212, 0.3);
  color: #67e8f9;
}

.status-badge.reflect {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

.status-badge.counter {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.status-badge.buff_atk {
  background: rgba(239, 68, 68, 0.2);
  color: #fc8181;
}

.status-badge.buff_def {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.status-badge.seal_heal {
  background: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.shield-badge,
.invincible-badge {
  display: inline-block;
  padding: 4px 12px;
  /* 2px 10px -> 4px 12px */
  border-radius: 999px;
  font-size: 24px;
  /* 12px -> 16px */
  font-weight: 800;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  margin-top: 2px;
  /* 4px -> 2px */
}

.invincible-badge {
  background: rgba(240, 192, 64, 0.2);
  color: var(--gold);
  margin-left: 6px;
}

/* バトル中央エリア */
.battle-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  /* ログがはみ出してもOK */
  padding: 0 12px;
  min-height: 0;
  margin-top: -60px;
  /* 敵イラストの上に被さるようにマイナスマージン */
  z-index: 10;
  position: relative;
  pointer-events: none;
  /* 親はイベントを通す */
}

/* プレイヤーエリア全体（下部） */
.battle-player-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 12px 12px;
  flex-shrink: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
  border-top: 1px solid var(--border);
}

/* 上段：顔グラ ＋ ステータス */
.player-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 4px;
}

.bar-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  /* 隙間を極限まで減らす */
}

/* 終了ボタンの小型化 */
.btn-end-turn {
  width: 90px;
  /* 70 -> 60 */
  height: 60px;
  /* 50 -> 40 */
  padding: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-badges-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 0px;
}

.player-char-area {
  width: 44px;
  /* 50px -> 44px */
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border: 2px solid var(--border);
  overflow: hidden;
}

.player-char-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

/* ステータスバー（イラストの右） */
.player-stats-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 下段：手札 ＋ 操作 */
.player-action-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* バーの高さ拡大（モバイルで見やすく） */
.bar-outer {
  height: 10px;
  /* 14px -> 10px */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 18px;
  /* 32px -> 18px 飛躍的に低く */
}

.bar-label {
  font-size: 20px;
  /* 18px -> 13px */
  font-weight: 800;
  width: 24px;
  color: var(--text2);
}

.bar-val {
  font-size: 36px;
  font-family: 'Inter', monospace;
  font-weight: 900;
  color: var(--text);
  margin-left: 10px;
  text-align: left;
  letter-spacing: -0.5px;
}

.battle-log {
  flex: 1;
  min-height: 180px;
  /* 280px -> 180px */
  max-height: 200px;
  /* 315px -> 200px */
  overflow-y: hidden;
  background: none;
  padding: 10px;
  font-size: 22px;
  line-height: 28px;
  height: 180px;
  /* 220px -> 180px (手札に重ならないように縮小) */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* 下詰め固定 */
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: none;
}

.battle-log-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
}

/* ログに薄い文字縁どりをつけて見やすくする */
.battle-log-entry {
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.8),
    1px -1px 0 rgba(0, 0, 0, 0.8),
    -1px 1px 0 rgba(0, 0, 0, 0.8),
    1px 1px 0 rgba(0, 0, 0, 0.8),
    0px 2px 4px rgba(0, 0, 0, 0.9);
}

.battle-log::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

/* 名前表示（敵・プレイヤー） */
.unit-name {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* プレイヤー右側エリア */
.player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-stats-block {
  margin-bottom: 4px;
}

/* プレイヤーHPバー（ゴーストバー付き） */
.player-hp-outer {
  position: relative;
}

/* HPゴーストバー（ダメージ後にゆっくり引く） */
.bar-hp-ghost {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: rgba(239, 68, 68, 0.35);
  transition: width 1.0s ease;
  border-radius: 999px;
  z-index: 0;
}

#player-hp-fill {
  position: relative;
  z-index: 1;
  transition: width 0.3s ease;
}

.hand-container {
  display: flex;
  align-items: center;
  position: relative;
  /* ボタンを絶対配置するため */
  width: 100%;
}

.btn-hand-scroll {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  /* 24px -> 32px （狭すぎるとの指摘により拡大） */
  height: 80px;
  /* 縦長に変更 */
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  z-index: 20;
  backdrop-filter: blur(2px);
  user-select: none;
}

.btn-hand-scroll.scroll-left {
  left: 0;
}

.btn-hand-scroll.scroll-right {
  right: 0;
}

.btn-hand-scroll:hover {
  background: rgba(240, 192, 64, 0.8);
  color: #000;
}

.player-hand {
  flex: 1;
  display: flex;
  gap: 6px;
  /* カード間隔 */
  overflow-x: auto;
  padding: 10px 40px;
  /* 左右のスクロールボタンに隠れないよう、パディングを少し増やす */
  min-height: 240px;
  /* カード拡大(220px)に合わせて調整 */
  align-items: flex-end;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 5;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

/* カードが少ない時は中央寄せにしみはみ出す時は左寄せにする安全な擬似要素 */
.player-hand::before,
.player-hand::after {
  content: '';
  margin: auto;
}

.player-hand::-webkit-scrollbar {
  display: none;
}

/* ターン開始演出 */
.turn-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  z-index: 1000;
  pointer-events: none;
}

.turn-text {
  font-size: 80px;
  /* 120px -> 80px (2桁表示での崩れ防止) */
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(240, 192, 64, 0.8), 0 0 40px rgba(0, 0, 0, 0.9);
  font-style: italic;
  letter-spacing: 2px;
  /* 4px -> 2px */
  white-space: nowrap;
  animation: turnEntrance 1.0s cubic-bezier(0.17, 0.67, 0.83, 0.67) forwards;
}

@keyframes turnEntrance {
  0% {
    transform: scale(0.5);
    opacity: 0;
    filter: blur(10px);
  }

  30% {
    transform: scale(1.1);
    opacity: 1;
    filter: blur(0);
  }

  70% {
    transform: scale(1.0);
    opacity: 1;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
    filter: blur(5px);
  }
}

/* デッキ構築画面の微調整 */
.deck-selected-panel {
  scrollbar-width: none;
}

.deck-selected-panel::-webkit-scrollbar {
  display: none;
}

.deck-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

/* デッキスロット（またはカード枠）の高さを固定 */
.deck-slot,
.deck-selected-card {
  height: 44px;
  /* 空っぽの時と同じ、または固定の高さ */
  box-sizing: border-box;
}

/* ツールチップの上下位置制御用クラス */
.tooltip-top {
  bottom: 110% !important;
  top: auto !important;
}

.tooltip-top::after {
  content: "";
  position: absolute;
  top: 100% !important;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: rgba(10, 10, 24, 0.95) transparent transparent transparent !important;
}

.tooltip-bottom {
  top: 110% !important;
  bottom: auto !important;
}

.tooltip-bottom::after {
  content: "";
  position: absolute;
  bottom: 100% !important;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent rgba(10, 10, 24, 0.95) transparent !important;
}

/* トースト通知 */
.toast-container {
  position: fixed;
  top: 60px;
  /* 手札や敵キャラクター等と被らないよう画面上部に配置 */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.toast {
  background: rgba(10, 15, 30, 0.95);
  color: #fbbf24;
  /* gold系 */
  padding: 14px 28px;
  border: 1px solid #fbbf24;
  border-radius: 40px;
  font-weight: 900;
  font-size: 27px;
  letter-spacing: 1px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(251, 191, 36, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: toastEntrance 3.5s cubic-bezier(0.2, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

@keyframes toastEntrance {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }

  10% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  90% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}

/* バトル画面の上部バー（STAGEラベルがあった場所の余白除去） */
.battle-top-bar {
  display: none;
}

.battle-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.turn-label {
  font-size: 13px;
  color: var(--text2);
}

/* ===== ダメージ演出 ===== */

/* 浮き上がって消えるポップアップ数字 */
.dmg-popup {
  position: absolute;
  font-size: 57px;
  font-weight: 900;
  pointer-events: none;
  z-index: 999;
  text-shadow: 0 0 8px currentColor, 0 2px 6px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  transform: translate(-50%, 0);
}

.dmg-popup.dmg-anim-up {
  animation: floatUp 0.9s ease-out forwards;
}

.dmg-popup.dmg-anim-down {
  animation: floatDown 0.9s ease-out forwards;
}

.dmg-popup.dmg-enemy {
  color: #ff4444;
}

.dmg-popup.dmg-player {
  color: #ff6644;
}

.dmg-popup.dmg-heal {
  color: #22dd88;
  font-size: 45px;
}

.dmg-popup.dmg-shield {
  color: #aaddff;
  /* シールド感のある水色寄りの色 */
  font-size: 48px;
  text-shadow: 0 0 8px currentColor, 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 15px rgba(170, 221, 255, 0.6);
}

.dmg-popup.dmg-crit {
  color: #ffcc00;
  font-size: 72px;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 0px) scale(1.3);
  }

  60% {
    opacity: 1;
    transform: translate(-50%, -40px) scale(1.0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -80px) scale(0.8);
  }
}

@keyframes floatDown {
  0% {
    opacity: 0;
    transform: translate(-50%, -40px) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -20px) scale(1.3);
  }

  60% {
    opacity: 1;
    transform: translate(-50%, 20px) scale(1.0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, 60px) scale(0.8);
  }
}

/* 画面全体のシェイク（プレイヤーがダメージを受けたとき） */
#screen-battle.screen-shake {
  animation: screenShake 0.4s ease;
}

@keyframes screenShake {

  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-10px) rotate(-0.5deg);
  }

  30% {
    transform: translateX(10px) rotate(0.5deg);
  }

  45% {
    transform: translateX(-8px);
  }

  60% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-4px);
  }

  90% {
    transform: translateX(4px);
  }
}

/* 敵イラストが揺れる */
.enemy-battle-img.shake {
  animation: enemyShake 0.35s ease-out;
}

@keyframes enemyShake {

  0%,
  100% {
    transform: translateX(0) scale(1);
  }

  20% {
    transform: translateX(-10px) scale(0.98);
  }

  40% {
    transform: translateX(10px) scale(1.02);
  }

  60% {
    transform: translateX(-5px) scale(0.99);
  }

  80% {
    transform: translateX(5px) scale(1.01);
  }
}

/* 敵HPバーがダメージで揺れる */
.shake-hp {
  animation: hpShake 0.35s ease;
}

@keyframes hpShake {

  0%,
  100% {
    transform: scaleX(1) translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  50% {
    transform: translateX(6px);
  }

  75% {
    transform: translateX(-3px);
  }
}

/* 敵がダメージを受けたときのフラッシュ */
.enemy-emoji-wrap.hit-flash {
  animation: hitFlash 0.35s ease;
}

@keyframes hitFlash {

  0%,
  100% {
    filter: none;
  }

  25% {
    filter: brightness(3) saturate(0);
  }

  50% {
    filter: none;
  }

  75% {
    filter: brightness(2.5) saturate(0);
  }
}

/* プレイヤーダメージ時の赤フラッシュ */
.player-hp-flash {
  animation: playerFlash 0.5s ease;
}

@keyframes playerFlash {

  0%,
  100% {
    box-shadow: none;
  }

  30% {
    box-shadow: inset 0 0 60px rgba(255, 0, 0, 0.6);
  }

  60% {
    box-shadow: inset 0 0 30px rgba(255, 0, 0, 0.3);
  }
}

/* 古いポップアップは非表示（互換性維持） */
.popup {
  display: none;
}

/* ===== 図鑑画面 ===== */
#screen-collection {
  background: var(--bg);
}

.collection-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.collection-header h2 {
  flex: 1;
}

.collection-stats {
  color: var(--gold);
  font-size: 21px;
}

.collection-filters {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--gold);
  color: #1a0a00;
  border-color: var(--gold);
  font-weight: 700;
}

/* ===== オーバーレイ ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.overlay-box {
  background: var(--bg2);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  border: 2px solid var(--border);
  text-align: center;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.clear-title {
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 8px;
}

.clear-god-text {
  font-size: 24px;
  color: var(--text2);
  margin-bottom: 20px;
}

.clear-reward-title {
  font-size: 21px;
  color: var(--text2);
  margin-bottom: 12px;
}

.reward-cards-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* 縦伸び防止 */
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  max-height: 480px;
  /* カード2列分程度の高さに制限 */
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
}

.gameover-title {
  font-size: 54px;
  font-weight: 900;
  color: var(--red);
  margin-bottom: 12px;
}

.gameover-msg {
  color: var(--text2);
  margin-bottom: 24px;
}

.final-title {
  font-size: 39px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 16px;
}

.final-deities {
  font-size: 42px;
  letter-spacing: 8px;
  margin-bottom: 16px;
}

.final-text {
  color: var(--text2);
  line-height: 2;
  margin-bottom: 16px;
}

/* ===== モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-inner {
  background: var(--bg2);
  border-radius: 16px;
  padding: 24px;
  border: 2px solid var(--border);
  max-width: 300px;
  width: 90%;
  text-align: center;
}

.modal-card-large .card-art {
  font-size: 64px;
}

.modal-card-large .card-name {
  font-size: 27px;
}

.modal-card-large .card-desc {
  font-size: 20px;
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== ユーティリティ ===== */
.hidden {
  display: none !important;
}

/* ===== 神様画像スタイル ===== */
/* カードアート画像 */
.card-art-img {
  display: block;
  width: 100%;
  height: 70px;
  object-fit: contain;
  padding: 4px 8px 2px;
  box-sizing: border-box;
}

/* ステージマップ神様画像 */
.stage-god-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 4px auto;
}

/* ステージ内の神様絵文字エリアを画像が来ても崩れないように */
.stage-enemy-emoji {
  font-size: 36px;
  margin: 4px 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 名前入力画面 ===== */
#screen-name-input {
  background: radial-gradient(ellipse at 50% 30%, #1a0a3a 0%, #0a0a18 70%);
  align-items: center;
  justify-content: center;
}

.name-input-screen {
  width: 100%;
  max-width: 360px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.name-input-title {
  font-size: 33px;
  font-weight: 900;
  color: var(--gold);
}

.name-input-sub {
  font-size: 20px;
  color: var(--text2);
  line-height: 1.6;
}

.name-input-field {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 30px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.name-input-field:focus {
  border-color: var(--gold);
}

.name-input-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ===== ランキング画面 ===== */
#screen-ranking {
  background: linear-gradient(180deg, #0a0f20 0%, #0a1520 100%);
}

.ranking-header {
  padding: 16px 20px;
  background: var(--bg2);
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
  text-align: center;
}

.ranking-header h2 {
  font-size: 27px;
  color: var(--gold);
}

.ranking-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 21px;
}

.ranking-table thead th {
  padding: 8px 6px;
  color: var(--text2);
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.ranking-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}

.ranking-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ranking-table tbody td {
  padding: 12px 6px;
}

.ranking-table tbody tr.rank-gold td:first-child::before {
  content: '🥇 ';
}

.ranking-table tbody tr.rank-silver td:first-child::before {
  content: '🥈 ';
}

.ranking-table tbody tr.rank-bronze td:first-child::before {
  content: '🥉 ';
}

.rank-gold {
  color: #f0c040;
  font-weight: 800;
}

.rank-silver {
  color: #c0c8d8;
  font-weight: 700;
}

.rank-bronze {
  color: #cd7f32;
  font-weight: 700;
}

.ranking-footer {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}

/* ===== ストーリーイベントオーバーレイ ===== */
#overlay-story {
  background: rgba(0, 0, 0, 0.95);
  z-index: 400;
}

.story-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.story-img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 16px;
  border: 2px solid rgba(240, 192, 64, 0.4);
  animation: float 3s ease-in-out infinite;
}

.story-title {
  font-size: 27px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 2px;
  min-height: 22px;
}

.story-text {
  font-size: 24px;
  line-height: 2.0;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  min-height: 80px;
}

.story-next-btn {
  margin-top: 8px;
  letter-spacing: 3px;
  font-size: 22px;
}

/* ストーリーページ送りフェード */
@keyframes storyFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#overlay-story.story-fade-in .story-title,
#overlay-story.story-fade-in .story-text,
#overlay-story.story-fade-in .story-img {
  animation: storyFadeIn 0.5s ease forwards;
}

/* 山札・済バッジ（最終簡略版） */
.deck-status-badge {
  background: rgba(0, 0, 0, 0.45);
  color: var(--text2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

.deck-status-badge span#player-deck-count,
.deck-status-badge span#player-discard-count,
.deck-status-badge span#enemy-deck-count,
.deck-status-badge span#enemy-discard-count {
  color: #fff;
  font-weight: bold;
}

/* 敵のバッジ位置：左右に振り分け */
.enemy-deck-status {
  position: absolute;
  top: 72px;
  /* HPバーの下 */
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  box-sizing: border-box;
  pointer-events: none;
}

/* プレイヤーのバッジ位置：ステータスバー周辺（HPバーの下） */
.player-deck-status-bottom {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  justify-content: flex-end;
  /* 右端に寄せる */
  padding-right: 5px;
}

.hand-container {
  position: relative;
  padding-top: 5px;
  /* 上部スペースを削除して視認性向上 */
}


/* ===== バトル中の追加操作 (山札・高速化) ===== */
.battle-extra-controls {
  position: fixed;
  /* 確実な画面中央よりやや上（カードエリアに被らないよう退避）・右寄せ */
  top: 38%;
  right: 15px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: auto;
  z-index: 150;
}

.btn-mini {
  padding: 4px 8px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  color: var(--gold);
  border-radius: 4px;
}

.toggle-fast {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text2);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  cursor: pointer;
}

.toggle-fast input {
  cursor: pointer;
}

/* 山札モーダル特有 */
.modal-deck-inner {
  max-width: 440px;
  width: 95%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.btn-close-circle {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 24px;
  cursor: pointer;
}

.mini-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.mini-grid .game-card {
  width: 100%;
  height: 160px;
  /* 少し高さを抑える */
}

/* カード使用時のアニメーション (Central Play) */
.card-playing {
  position: absolute !important;
  z-index: 2000 !important;
  pointer-events: none !important;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes cardToCenter {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }

  70% {
    transform: translate(var(--tx), var(--ty)) scale(1.3) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translate(var(--tx), var(--ty)) scale(0.5) rotate(0deg);
    opacity: 0;
  }
}

.anim-play-card {
  animation: cardToCenter 0.6s ease-in-out forwards;
}

.anim-play-card-fast {
  animation: cardToCenter 0.3s ease-in-out forwards;
}

/* キーワードツールチップ */
.keyword-link {
  color: var(--gold);
  text-decoration: underline dotted var(--gold);
  cursor: help;
  position: relative;
  font-weight: bold;
}

.keyword-tooltip {
  position: fixed;
  background: rgba(15, 15, 20, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  font-size: 13px;
  line-height: 1.4;
  z-index: 5000;
  pointer-events: none;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.keyword-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.keyword-tooltip strong {
  color: var(--gold);
  display: block;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}

/* 状態異常エフェクト */
.status-vfx {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.vfx-poison {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, transparent 70%);
  animation: pulsePoison 2s infinite ease-in-out;
}

@keyframes pulsePoison {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.9);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.vfx-stun-wrap {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  animation: rotateStun 3s infinite linear;
}

@keyframes rotateStun {
  from {
    transform: translateX(-50%) rotate(0deg);
  }

  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

/* シェイク演出 */
.shake-lite {
  animation: shakeLite 0.3s ease-in-out;
}

.shake-heavy {
  animation: shakeHeavy 0.5s ease-in-out;
}

@keyframes shakeLite {

  0%,
  100% {
    transform: scale(var(--scale, 1)) translate(0, 0);
  }

  25% {
    transform: scale(var(--scale, 1)) translate(2px, -2px);
  }

  50% {
    transform: scale(var(--scale, 1)) translate(-2px, 2px);
  }

  75% {
    transform: scale(var(--scale, 1)) translate(2px, 2px);
  }
}

@keyframes shakeHeavy {

  0%,
  100% {
    transform: scale(var(--scale, 1)) translate(0, 0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: scale(var(--scale, 1)) translate(-6px, 0);
  }

  20%,
  40%,
  60%,
  80% {
    transform: scale(var(--scale, 1)) translate(6px, 0);
  }
}

/* 神器表示 */
.battle-artifacts-row,
.player-artifacts-stage {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.artifact-badge-wrap {
  position: relative;
  display: inline-flex;
  margin-right: -4px;
}

.artifact-badge-wrap.deck-slot {
  background: none;
  border: none;
  min-height: auto;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.artifact-badge {
  width: 24px;
  height: 24px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid var(--gold);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: help;
  transition: transform 0.2s;
  z-index: 10;
}

.artifact-badge:hover {
  transform: scale(1.2);
  background: rgba(251, 191, 36, 0.4);
}

/* ハードモードトグル */
.toggle-hard {
  display: flex;
  align-items: center;
  cursor: pointer;
  background: rgba(239, 68, 68, 0.1);
  padding: 4px 10px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 20px;
  transition: 0.3s;
}

.toggle-hard:hover {
  background: rgba(239, 68, 68, 0.2);
}

.toggle-hard input {
  margin-right: 6px;
  accent-color: var(--red);
}

/* アチーブメント/勲章 */
.achievement-badge {
  font-size: 20px;
  filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.5));
}

.title-achievements {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0 20px 0;
  min-height: 30px;
}

.achievement-icon {
  font-size: 24px;
  background: rgba(255, 255, 255, 0.1);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 0, 0.3);
  cursor: help;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-icon.locked {
  opacity: 0.2;
  filter: grayscale(1);
}

.achievement-icon:not(.locked):hover {
  transform: scale(1.2) rotate(10deg);
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--gold);
}

/* ===== ステージエディタ用スタイル ===== */

/* エディタ全体のレイアウト（2カラム or 3カラム） */
.editor-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* デフォルトは2カラム */
  gap: 24px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* パネル風の見た目 */
.panel-block {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
  color: var(--gold);
}

/* フォーム要素の調整 */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(0, 0, 0, 0.4);
}

/* 2カラムレイアウト */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 選択済みアイテム表示エリア */
.selected-items-area {
  min-height: 60px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* カードピッカーコンテナ */
.card-picker-container {
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
}

/* プレビューエリアの調整 */
.preview-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stage-preview-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gold);
}

.stage-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-label {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
}

.enemy-preview-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.enemy-avatar {
  font-size: 60px;
  margin-bottom: 10px;
}

.enemy-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.hp-label {
  font-size: 14px;
  color: var(--red);
  font-weight: 700;
}

.enemy-hp-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  margin-top: 8px;
  overflow: hidden;
}

.enemy-hp-fill {
  height: 100%;
  background: var(--red);
  transition: width 0.3s;
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
  .editor-layout-grid {
    grid-template-columns: 1fr;
  }
}