* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', monospace;
    background: #0a0a0a;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.start-screen {
    width: 1200px;
    height: 600px;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 4px solid #4ecdc4;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 0 2px #0a0a0a,
        0 0 0 6px #4ecdc4,
        inset 0 0 0 2px #0a0a0a;
}

.start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.title {
    font-size: 48px;
    font-weight: normal;
    color: #ff6b6b;
    text-shadow: 
        4px 4px 0px #0a0a0a,
        8px 8px 0px #4ecdc4;
    margin-bottom: 30px;
    animation: titleGlow 2s ease-in-out infinite;
    z-index: 2;
    position: relative;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 36px;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 40px;
    animation: titleGlow 2s ease-in-out infinite 0.5s;
    z-index: 2;
    position: relative;
}

@keyframes titleGlow {
    0%, 100% { 
        text-shadow: 
            0 0 20px rgba(255, 107, 107, 0.8),
            0 0 40px rgba(78, 205, 196, 0.6),
            0 0 60px rgba(69, 183, 209, 0.4);
        transform: scale(1);
    }
    50% { 
        text-shadow: 
            0 0 30px rgba(255, 107, 107, 1),
            0 0 50px rgba(78, 205, 196, 0.8),
            0 0 70px rgba(69, 183, 209, 0.6);
        transform: scale(1.05);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.start-message {
    font-size: 16px;
    font-weight: normal;
    color: #ffffff;
    text-shadow: 
        2px 2px 0px #0a0a0a,
        4px 4px 0px #4ecdc4;
    margin-bottom: 40px;
    animation: blink 1.5s ease-in-out infinite;
    z-index: 2;
    position: relative;
    letter-spacing: 1px;
}

.mode-message {
    font-size: 14px;
    font-weight: normal;
    color: #fff;
    margin-top: 10px;
    opacity: 0.9;
    z-index: 2;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.fight-message {
    font-size: 72px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.8), 0 0 20px rgba(255,0,0,0.8);
    animation: fightAnimation 0.5s ease-out;
    display: none;
    z-index: 3;
    position: relative;
}

@keyframes fightAnimation {
    0% { 
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* GAMEOVER画面 */
.gameover-screen {
    width: 1200px;
    height: 600px;
    background: #2c1810;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 4px solid #ff6b6b;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 0 2px #0a0a0a,
        0 0 0 6px #ff6b6b,
        inset 0 0 0 2px #0a0a0a;
}

.gameover-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,0,0,0.2) 0%, transparent 70%);
    animation: gameoverPulse 3s ease-in-out infinite;
}

@keyframes gameoverPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.gameover-title {
    font-size: 48px;
    font-weight: normal;
    color: #ff6b6b;
    text-shadow: 
        4px 4px 0px #0a0a0a,
        8px 8px 0px #ff0000;
    margin-bottom: 40px;
    animation: gameoverGlow 2s ease-in-out infinite;
    z-index: 2;
    position: relative;
    letter-spacing: 2px;
}

@keyframes gameoverGlow {
    0%, 100% { 
        text-shadow: 4px 4px 8px rgba(0,0,0,0.9), 0 0 30px rgba(255,0,0,0.8);
        transform: scale(1);
    }
    50% { 
        text-shadow: 4px 4px 8px rgba(0,0,0,0.9), 0 0 50px rgba(255,0,0,1);
        transform: scale(1.05);
    }
}

.winner-message {
    font-size: 24px;
    font-weight: normal;
    color: #ffd700;
    text-shadow: 
        3px 3px 0px #0a0a0a,
        6px 6px 0px #ff6b6b;
    margin-bottom: 40px;
    animation: winnerFlash 1.5s ease-in-out infinite;
    z-index: 2;
    position: relative;
    letter-spacing: 1px;
}

@keyframes winnerFlash {
    0%, 100% { 
        color: #ffd700;
        text-shadow: 3px 3px 6px rgba(0,0,0,0.8), 0 0 20px rgba(255,215,0,0.8);
    }
    50% { 
        color: #ffff00;
        text-shadow: 3px 3px 6px rgba(0,0,0,0.8), 0 0 30px rgba(255,255,0,1);
    }
}

.restart-message {
    font-size: 16px;
    font-weight: normal;
    color: #ffffff;
    text-shadow: 
        2px 2px 0px #0a0a0a,
        4px 4px 0px #4ecdc4;
    animation: restartBlink 2s ease-in-out infinite;
    z-index: 2;
    position: relative;
    letter-spacing: 1px;
}

@keyframes restartBlink {
    0%, 60% { opacity: 1; }
    61%, 100% { opacity: 0.3; }
}

.game-screen {
    width: 1200px;
    height: 600px;
    background: #87CEEB;
    position: relative;
    border: 4px solid #4ecdc4;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 
        0 0 0 2px #0a0a0a,
        0 0 0 6px #4ecdc4,
        inset 0 0 0 2px #0a0a0a;
}

/* KO演出 */
.ko-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 96px;
    color: #ff3b3b;
    text-shadow: 6px 6px 0px #0a0a0a, 0 0 30px rgba(255,0,0,0.8);
    z-index: 20;
    pointer-events: none;
}

.ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    padding: 20px;
}

.player1-ui, .player2-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rounds-dots {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.rounds-dots .dot {
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
}

.rounds-dots .dot.win {
    background: #ffd700;
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255,215,0,0.8);
}

.health-bar {
    width: 300px;
    height: 20px;
    background: #0a0a0a;
    border: 2px solid #4ecdc4;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 
        0 0 0 1px #0a0a0a,
        inset 0 0 0 1px #4ecdc4;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ffff00);
    transition: width 0.3s ease;
    width: 100%;
}

.player-name {
    color: #fff;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.game-area {
    position: relative;
    width: 100%;
    height: 100%;
}

.round-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 56px;
    color: #ffffff;
    text-shadow: 4px 4px 0px #0a0a0a, 0 0 20px rgba(78,205,196,0.9);
    z-index: 12;
    pointer-events: none;
}

.background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 70%, #8B4513 100%);
    background-image: url('./images/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ground {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom, #8B4513, #654321);
    border-top: 3px solid #333;
}

.character {
    position: absolute;
    width: 91px; /* 388:469の比率に合わせて調整 */
    height: 110px; /* 388:469の比率に合わせて調整 */
    bottom: 30%;
    z-index: 5;
}

.player1 {
    left: 200px;
}

.player2 {
    right: 200px;
    /* 向きはJSで動的に反転するため固定反転しない */
    transform: none;
}

.character-sprite {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    position: relative;
    transition: transform 0.05s ease, filter 0.1s ease;
    image-rendering: pixelated; /* ピクセルアートをくっきり表示 */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* ダッシュ演出（軽い縮小と発光） */
.character-sprite.dash {
    filter: brightness(1.2) saturate(1.2) blur(0.2px);
    transform: scale(0.98);
    box-shadow: 0 0 12px rgba(255,255,255,0.3);
}

/* 画像が設定されている場合の背景設定 */
.character-sprite[style*="background-image"] {
    background-color: transparent !important;
}

/* アニメーション状態別のスムーズエフェクト */
.character-sprite.walk {
    animation: walkBounce 0.3s ease-in-out infinite alternate;
}

.character-sprite.jump {
    filter: brightness(1.1);
}

.character-sprite.punch {
    filter: brightness(1.2) contrast(1.1);
    box-shadow: 0 0 15px rgba(255,100,100,0.5); /* パンチ時の赤いオーラ */
    animation: punchFlash 0.3s ease-out;
}

/* 昇竜アニメ（簡易） */
.character-sprite.shoryu {
    filter: brightness(1.3) saturate(1.4);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.6);
    animation: shoryuRise 0.35s ease-out;
}

@keyframes shoryuRise {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

.character-sprite.guard {
    filter: brightness(0.9) saturate(1.2);
    box-shadow: 0 0 20px rgba(100,100,255,0.6); /* ガード時の青いバリア */
}

.character-sprite.crouch {
    /* しゃがみは見た目を変えずにfilterのみ */
    filter: brightness(0.95);
}

.character-sprite.hadoken-cast {
    filter: brightness(1.3) saturate(1.5);
    animation: hadokenGlow 0.2s ease-in-out;
}

.character-sprite.damage {
    filter: brightness(1.1) saturate(0.8) hue-rotate(0deg);
    animation: damageShake 0.3s ease-out;
}

/* 敗北スタイル */
.character-sprite.defeat {
    filter: grayscale(40%) brightness(0.9);
}

/* 勝利ポーズ */
.character-sprite.victory {
    filter: brightness(1.2) saturate(1.1);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.6);
    animation: victoryPulse 1s ease-in-out 1;
}

@keyframes victoryPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes walkBounce {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-2px); }
}

@keyframes hadokenGlow {
    0% { filter: brightness(1.3) saturate(1.5); }
    50% { filter: brightness(1.5) saturate(2); }
    100% { filter: brightness(1.3) saturate(1.5); }
}

@keyframes punchFlash {
    0% { box-shadow: 0 0 15px rgba(255,100,100,0.5); }
    50% { box-shadow: 0 0 25px rgba(255,100,100,0.8); }
    100% { box-shadow: 0 0 15px rgba(255,100,100,0.5); }
}

@keyframes damageShake {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0px); }
}

/* 画像を使用する場合は疑似要素を非表示に */
.character-sprite[style*="background-image"]::before,
.character-sprite[style*="background-image"]::after {
    display: none;
}

.character-sprite::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #ffdbac;
    border-radius: 50%;
    border: 2px solid #333;
}

.character-sprite::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
    background: #4169e1;
    border-radius: 5px;
    border: 2px solid #333;
}

/* アニメーション */
.idle {
    animation: idle 1s ease-in-out infinite;
}

.walk {
    animation: walk 0.5s ease-in-out infinite;
}

.jump {
    animation: jump 0.8s ease-out;
}

/* 削除：crouchのスケール変更 */

.punch {
    animation: punch 0.3s ease-out;
}

.kick {
    animation: kick 0.4s ease-out;
}

.guard {
    background: linear-gradient(45deg, #c0c0c0, #a0a0a0);
    border-color: #666;
}

.hit {
    animation: hit 0.2s ease-out;
}

.guard-break {
    animation: guardBreak 0.5s ease-out;
    background: linear-gradient(45deg, #ff0000, #ffaa00) !important;
}

@keyframes idle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

@keyframes walk {
    0%, 100% { transform: translateX(0px); }
    50% { transform: translateX(5px); }
}

@keyframes jump {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-100px); }
    100% { transform: translateY(0px); }
}

@keyframes punch {
    0% { transform: translateX(0px); }
    50% { transform: translateX(20px); }
    100% { transform: translateX(0px); }
}

@keyframes kick {
    0% { transform: translateX(0px) rotate(0deg); }
    50% { transform: translateX(15px) rotate(15deg); }
    100% { transform: translateX(0px) rotate(0deg); }
}

@keyframes hit {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0px); }
}

@keyframes guardBreak {
    0% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% { 
        transform: scale(1.1) rotate(-5deg);
        opacity: 0.8;
    }
    50% { 
        transform: scale(0.9) rotate(5deg);
        opacity: 0.6;
    }
    75% { 
        transform: scale(1.05) rotate(-2deg);
        opacity: 0.8;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.controls-info {
    position: static;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 40px;
    background: rgba(0,0,0,0.8);
    padding: 20px;
    border-radius: 10px;
    color: white;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.player1-controls, .player2-controls {
    text-align: center;
}

.player1-controls h3, .player2-controls h3 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.player1-controls p, .player2-controls p {
    margin: 5px 0;
    font-size: 14px;
}

/* 攻撃エフェクト */
.attack-effect {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #ffff00, #ff6600);
    border-radius: 50%;
    animation: attackEffect 0.3s ease-out;
    z-index: 3;
}

@keyframes attackEffect {
    0% { 
        transform: scale(0);
        opacity: 1;
    }
    100% { 
        transform: scale(2);
        opacity: 0;
    }
}

/* ダメージエフェクト */
.damage-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.4);
    border-radius: 10px;
    pointer-events: none; /* マウスイベントを無視 */
    z-index: 10; /* 前面に表示 */
    animation: damageFlash 0.2s ease-out;
}

@keyframes damageFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* 波動弾のスタイル */
.projectile {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    z-index: 6;
    animation: projectileMove 0.1s linear infinite;
}

.hadoken {
    background: radial-gradient(circle at 30% 30%, #ffffff, #4444ff, #0000cc);
    box-shadow: 
        0 0 20px rgba(68, 68, 255, 0.8),
        0 0 40px rgba(68, 68, 255, 0.6),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(68, 68, 255, 0.4);
    animation: 
        projectileMove 0.1s linear infinite,
        hadokenGlow 0.5s ease-in-out infinite,
        hadokenSpin 1s linear infinite;
}

@keyframes projectileMove {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

@keyframes hadokenGlow {
    0%, 100% { 
        box-shadow: 
            0 0 20px rgba(68, 68, 255, 0.8),
            0 0 40px rgba(68, 68, 255, 0.6),
            inset 0 0 15px rgba(255, 255, 255, 0.3);
    }
    50% { 
        box-shadow: 
            0 0 30px rgba(68, 68, 255, 1),
            0 0 50px rgba(68, 68, 255, 0.8),
            inset 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

@keyframes hadokenSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 波動アニメーション（キャラクターがハドウケンを放つ時） */
.hadoken-cast {
    background: linear-gradient(45deg, #4444ff, #6666ff);
    border-color: #4444ff;
    animation: hadokenCastEffect 0.5s ease-out;
}

@keyframes hadokenCastEffect {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 rgba(68, 68, 255, 0);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(68, 68, 255, 0.8);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 10px rgba(68, 68, 255, 0.4);
    }
}