/* バトル画面固有スタイル */

.battle-screen {
  padding: var(--space-md);
  padding-left: max(var(--space-md), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-md), env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  gap: 0;
  height: 100dvh;
  overflow: hidden;
}

/* ターンヘッダー */
.turn-header {
  text-align: center;
  padding: var(--space-sm) 0;
}

.turn-counter {
  font-size: var(--font-xl);
  font-weight: bold;
}

.turn-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-top: var(--space-xs);
  overflow: hidden;
}

.turn-progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* バトルフィールド */
.battle-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  position: relative;
  min-height: 0;
}

/* プレイヤーパネル */
.player-panel {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
}

.player-panel.opponent {
  flex-direction: row-reverse;
}

.player-sprite {
  flex-shrink: 0;
}

.player-sprite canvas {
  image-rendering: pixelated;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-size: var(--font-sm);
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-xs);
}

/* VS表示 */
.vs-divider {
  font-size: var(--font-2xl);
  font-weight: bold;
  color: var(--text-accent);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  padding: var(--space-sm) 0;
}

/* バトルログ */
.battle-log {
  width: 100%;
  min-height: 80px;
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xs);
}

.log-action {
  font-size: var(--font-base);
  font-weight: bold;
}

.log-detail {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

/* ダメージ表示 */
.damage-number {
  position: absolute;
  font-weight: bold;
  pointer-events: none;
  animation: damageFloat 1s ease-out forwards;
  z-index: 10;
}

.damage-normal {
  font-size: var(--font-xl);
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.damage-critical {
  font-size: var(--font-2xl);
  color: var(--text-accent);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}

.damage-miss {
  font-size: var(--font-lg);
  color: var(--text-muted);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* バトル開始演出 */
.battle-start-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100;
  animation: overlayFadeIn 0.3s ease;
}

.battle-start-text {
  font-size: var(--font-3xl);
  font-weight: bold;
  color: var(--text-accent);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  animation: battleStartPulse 0.8s ease-out;
}

/* 勝敗表示 */
.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
}

.result-text {
  font-size: var(--font-3xl);
  font-weight: bold;
  animation: resultBounce 0.6s ease-out;
}

.result-win {
  color: var(--text-accent);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

.result-lose {
  color: var(--color-accent);
  text-shadow: 0 0 30px rgba(231, 76, 60, 0.4);
}

.result-draw {
  color: var(--text-secondary);
}

/* HP変化時の点滅 */
.hp-flash {
  animation: hpFlash 0.3s ease;
}

/* キャラクタースプライトの揺れ */
.sprite-shake {
  animation: spriteShake 0.3s ease;
}

/* 小画面対応 */
@media (max-height: 600px) {
  .battle-log {
    min-height: 60px;
    padding: var(--space-sm);
  }

  .vs-divider {
    font-size: var(--font-xl);
    padding: var(--space-xs) 0;
  }

  .player-panel {
    padding: var(--space-xs);
  }

  .player-sprite canvas {
    width: 126px !important;
    height: 81px !important;
  }
}
