* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: #080b12;
  color: #f4eee3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  display: grid;
  place-items: center;
}

[hidden] {
  display: none !important;
}

#war-enemy-screen {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 480px;
  height: 720px;
  transform: translate(-50%, -50%) scale(var(--war-scale, 1));
  transform-origin: center;
  background: #141b29;
  border: 1px solid #334460;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  font-size: 20px;
  line-height: 1.25;
  overflow: hidden;
}

/* クラン決戦画面内包時（絶対配置スケールは使わない） */
#war-enemies-panel {
  width: 100%;
  height: 100%;
  background: #141b29;
  display: flex;
  flex-direction: column;
  font-size: 18px;
  line-height: 1.25;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

/* ヘッダー */
.enemy-page-header {
  height: 48px;
  flex-shrink: 0;
  background: #0f1522;
  border-bottom: 2px solid #28374e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.header-back-btn {
  font-size: 18px;
  font-weight: bold;
  color: #93c5fd;
  text-decoration: none;
  background: #1c2b42;
  border: 1px solid #4a638a;
  border-radius: 6px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.header-back-btn:active {
  background: #2a3d5e;
}

.header-title-box {
  text-align: center;
  flex: 1;
}

.enemy-page-header h1 {
  font-size: 22px;
  margin: 0;
  color: #ffd679;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.header-sub {
  font-size: 14px;
  color: #cbd5e1;
  display: block;
  margin-top: -2px;
}

/* フェーズタブ */
.phase-tabs {
  display: flex;
  height: 52px;
  flex-shrink: 0;
  background: #0b101c;
  border-bottom: 2px solid #1e2a3c;
  gap: 4px;
  padding: 4px 6px;
}

.phase-tab-btn {
  flex: 1;
  font: inherit;
  font-size: 17px;
  font-weight: bold;
  color: #94a3b8;
  background: #172132;
  border: 1px solid #2d3c52;
  border-radius: 6px;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.phase-tab-btn .tab-sub {
  font-size: 13px;
  font-weight: normal;
  color: #64748b;
  margin-top: 1px;
}

.phase-tab-btn.active {
  color: #fff;
  background: #263854;
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
}

.phase-tab-btn.active .tab-sub {
  color: #ffd679;
  font-weight: bold;
}

/* スクロール領域 */
.enemy-scroll-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* スクロールバースタイル */
.enemy-scroll-content::-webkit-scrollbar {
  width: 6px;
}
.enemy-scroll-content::-webkit-scrollbar-track {
  background: #0b101c;
}
.enemy-scroll-content::-webkit-scrollbar-thumb {
  background: #334460;
  border-radius: 3px;
}

/* フェーズ概要サマリーカード */
.phase-summary-card {
  background: #192437;
  border: 1px solid #3c5072;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a3952;
  padding-bottom: 6px;
}

.summary-title {
  font-size: 21px;
  font-weight: bold;
  color: #fcd34d;
  margin: 0;
}

.summary-difficulty {
  font-size: 17px;
  font-weight: bold;
  color: #f87171;
  background: #381919;
  border: 1px solid #7f1d1d;
  padding: 2px 8px;
  border-radius: 4px;
}

.summary-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  font-size: 17px;
  color: #e2e8f0;
}

.meta-item {
  background: #111827;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #1f2937;
}

.meta-label {
  color: #94a3b8;
  font-size: 14px;
  display: block;
}

.meta-val {
  font-weight: bold;
  color: #38bdf8;
  font-size: 18px;
}

.summary-desc {
  font-size: 17px;
  color: #e2e8f0;
  line-height: 1.35;
  background: #111a28;
  border-left: 3px solid #f59e0b;
  padding: 6px 8px;
  border-radius: 0 4px 4px 0;
  margin: 2px 0 0;
}

/* 敵セクション見出し */
.enemies-section-title {
  font-size: 19px;
  font-weight: bold;
  color: #e2e8f0;
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.enemies-section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  background: #60a5fa;
  border-radius: 2px;
}

/* 敵カード */
.enemy-card {
  background: #162030;
  border: 1px solid #2d3e58;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.enemy-card.is-boss {
  border-color: #dc2626;
  background: linear-gradient(180deg, #26161c 0%, #171c26 100%);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

.enemy-card.is-reinforce {
  border-color: #8b5cf6;
  background: linear-gradient(180deg, #1f182c 0%, #162030 100%);
}

.enemy-top-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.enemy-img-box {
  width: 72px;
  height: 72px;
  background: #090e18;
  border: 1px solid #374661;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.enemy-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.enemy-title-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.enemy-name {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enemy-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.enemy-tag {
  font-size: 14px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-count {
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #2563eb;
}

.tag-boss {
  background: #450a0a;
  color: #fca5a5;
  border: 1px solid #b91c1c;
}

.tag-reinforce {
  background: #3b0764;
  color: #d8b4fe;
  border: 1px solid #9333ea;
}

.tag-normal {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
}

/* ステータス数値グリッド */
.enemy-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: #0c121e;
  border: 1px solid #223046;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-cell .stat-lbl {
  font-size: 13px;
  font-weight: bold;
  color: #94a3b8;
}

.stat-cell .stat-val {
  font-size: 19px;
  font-weight: bold;
  color: #f8fafc;
}

.stat-cell.hp .stat-val { color: #4ade80; }
.stat-cell.atk .stat-val { color: #f87171; }
.stat-cell.def .stat-val { color: #60a5fa; }
.stat-cell.spd .stat-val { color: #fbbf24; }
.stat-cell.mdef .stat-val { color: #c084fc; }

/* 属性・弱点・耐性行 */
.enemy-affinity-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 15px;
  background: #0f1624;
  border-radius: 4px;
  padding: 5px 8px;
}

.affinity-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.affinity-lbl {
  font-size: 14px;
  font-weight: bold;
  color: #94a3b8;
  width: 52px;
  flex-shrink: 0;
}

.affinity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.affinity-badge {
  font-size: 13px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 3px;
  color: #fff;
}

/* 属性バッジカラー */
.elem-fire { background: #b91c1c; border: 1px solid #ef4444; }
.elem-water { background: #1d4ed8; border: 1px solid #3b82f6; }
.elem-earth { background: #b45309; border: 1px solid #f59e0b; }
.elem-wind { background: #047857; border: 1px solid #10b981; }
.elem-thunder { background: #a16207; border: 1px solid #eab308; }
.elem-holy { background: #eab308; color: #422006; border: 1px solid #fef08a; }
.elem-dark { background: #6b21a8; border: 1px solid #a855f7; }
.elem-none { background: #334155; border: 1px solid #64748b; }

/* 敵特徴・説明テキスト */
.enemy-desc-box {
  font-size: 17px;
  line-height: 1.35;
  color: #f1f5f9;
  background: #0f1624;
  border-left: 3px solid #38bdf8;
  padding: 6px 8px;
  border-radius: 0 4px 4px 0;
}

/* フッター */
.enemy-page-footer {
  height: 52px;
  flex-shrink: 0;
  background: #0f1522;
  border-top: 2px solid #28374e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
}

.footer-back-btn {
  font: inherit;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  background: #253856;
  border: 1px solid #60a5fa;
  border-radius: 6px;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.footer-back-btn:active {
  background: #334e77;
}
