/* ========================================
   RPG Design - ゲームエフェクト専用CSS
   ======================================== */

/* ========================================
   ゲームステータスバー
   ======================================== */
.game-status-bar {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95), rgba(45, 45, 45, 0.95));
    backdrop-filter: blur(10px);
    padding: 0.8rem 0;
    z-index: 999;
    border-bottom: 3px solid var(--color-primary);
    box-shadow: 
        0 4px 20px rgba(255, 215, 0, 0.3),
        inset 0 -2px 0 rgba(255, 215, 0, 0.2);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.player-status {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.status-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-dark);
    box-shadow: 
        0 4px 15px rgba(255, 215, 0, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    font-family: var(--font-pixel), sans-serif;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.level-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-pixel), sans-serif;
}

.level-label {
    font-size: 0.9rem;
    color: var(--color-primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.level-value {
    font-size: 1.2rem;
    color: var(--color-primary);
    font-weight: 900;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 215, 0, 0.8);
    animation: numberGlow 2s ease-in-out infinite;
}

@keyframes numberGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

/* HPバー */
.hp-bar-container {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.hp-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-pixel), sans-serif;
}

.hp-label i {
    animation: heartBeat 1s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
}

.hp-bar {
    position: relative;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #333;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.5),
        0 2px 10px rgba(255, 215, 0, 0.2);
}

.hp-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #FF6B6B, #FF8787, #FF6B6B);
    background-size: 200% 100%;
    animation: hpFlow 3s linear infinite;
    transition: width 0.5s ease;
}

.hp-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
}

@keyframes hpFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-pixel), sans-serif;
    font-size: 0.9rem;
    color: white;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.8),
        0 0 5px rgba(255, 255, 255, 0.5);
    z-index: 1;
}

/* コイン表示 */
.coin-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 215, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 2px solid var(--color-primary);
    box-shadow: 
        0 4px 15px rgba(255, 215, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.coin-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.rotating-coin {
    animation: coinRotate 3s linear infinite;
}

@keyframes coinRotate {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
}

.coin-value {
    font-family: var(--font-pixel), sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--color-primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.coin-label {
    font-family: var(--font-pixel), sans-serif;
    font-size: 0.9rem;
    color: var(--color-primary);
}

/* ========================================
   ドット絵風背景
   ======================================== */
.pixel-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 10px,
            rgba(255, 215, 0, 0.03) 10px,
            rgba(255, 215, 0, 0.03) 11px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 10px,
            rgba(255, 215, 0, 0.03) 10px,
            rgba(255, 215, 0, 0.03) 11px
        );
    animation: pixelScroll 20s linear infinite;
}

@keyframes pixelScroll {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 100px, 100px 0; }
}

.pixel-border {
    position: relative;
}

.pixel-border::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        var(--color-primary) 0%, 
        var(--color-secondary) 50%, 
        var(--color-primary) 100%);
    background-size: 200% 200%;
    border-radius: inherit;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ========================================
   敵キャラクター
   ======================================== */
.enemy-container {
    position: absolute;
    top: 20%;
    right: 5%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
}

.enemy-character {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: enemyFloat 3s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enemy-character:nth-child(1) { animation-delay: 0s; }
.enemy-character:nth-child(2) { animation-delay: 1s; }
.enemy-character:nth-child(3) { animation-delay: 2s; }

.enemy-character:hover {
    transform: scale(1.1);
}

@keyframes enemyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.enemy-sprite {
    font-size: 3rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
    animation: enemyShake 0.5s ease-in-out infinite;
}

.enemy-sprite i {
    color: #FF6B6B;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 107, 107, 0.8),
        0 0 20px rgba(255, 107, 107, 0.6);
    transition: all 0.3s ease;
}

/* 敵キャラごとに色を変える */
#enemyChar1 .enemy-sprite i {
    color: #FFD700; /* ドラゴン：ゴールド */
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6);
}

#enemyChar2 .enemy-sprite i {
    color: #9B59B6; /* ゴースト：紫 */
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(155, 89, 182, 0.8),
        0 0 20px rgba(155, 89, 182, 0.6);
}

#enemyChar3 .enemy-sprite i {
    color: #E74C3C; /* スカル：赤 */
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(231, 76, 60, 0.8),
        0 0 20px rgba(231, 76, 60, 0.6);
}

.enemy-character:hover .enemy-sprite i {
    transform: scale(1.2);
    filter: brightness(1.3);
}

@keyframes enemyShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.enemy-hp-bar {
    width: 80px;
    height: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.enemy-hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ECDC4, #45b8b0);
    transition: width 0.5s ease;
}

.enemy-name {
    font-family: var(--font-pixel), sans-serif;
    font-size: 0.7rem;
    color: var(--color-text);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
    margin-top: 0.3rem;
}

/* 敵が倒された時のエフェクト */
@keyframes enemyDefeat {
    0% { opacity: 1; transform: scale(1) rotate(0deg); }
    50% { opacity: 0.5; transform: scale(1.2) rotate(180deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}

/* ========================================
   コインエフェクト
   ======================================== */
.coin-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.flying-coin {
    position: absolute;
    font-size: 2rem;
    color: var(--color-primary);
    animation: coinFly 2s ease-out forwards;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

@keyframes coinFly {
    0% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-100px) scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) scale(0.5) rotate(360deg);
        opacity: 0;
    }
}

/* ========================================
   レベルアップエフェクト
   ======================================== */
.level-up-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

.level-up-effect.active {
    animation: levelUpShow 2s ease-out forwards;
}

@keyframes levelUpShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.level-up-text {
    font-family: var(--font-pixel), sans-serif;
    font-size: 4rem;
    font-weight: 900;
    color: var(--color-primary);
    text-shadow: 
        4px 4px 0 rgba(0, 0, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 1),
        0 0 40px rgba(255, 215, 0, 0.8);
    animation: textPulse 0.5s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.level-up-sparkles {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.sparkle {
    font-size: 3rem;
    animation: sparkleRotate 1s linear infinite;
}

.sparkle:nth-child(1) { animation-delay: 0s; }
.sparkle:nth-child(2) { animation-delay: 0.3s; }
.sparkle:nth-child(3) { animation-delay: 0.6s; }

@keyframes sparkleRotate {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    50% { transform: rotate(180deg) scale(1.3); opacity: 0.7; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* ========================================
   光るエフェクト
   ======================================== */
.glow-effect {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

.glow-text {
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 40px rgba(255, 215, 0, 0.8);
    }
}

/* ========================================
   3Dボタンエフェクト
   ======================================== */
.btn-3d {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.2s ease;
    box-shadow: 
        0 6px 0 rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(255, 215, 0, 0.4);
}

.btn-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    transform: translateZ(-6px);
}

.btn-3d:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 0 rgba(0, 0, 0, 0.3),
        0 12px 25px rgba(255, 215, 0, 0.6);
}

.btn-3d:active {
    transform: translateY(3px);
    box-shadow: 
        0 3px 0 rgba(0, 0, 0, 0.3),
        0 4px 10px rgba(255, 215, 0, 0.3);
}

/* ボタンの光るエフェクト */
.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-3d:hover .btn-shine {
    left: 100%;
}

/* ========================================
   ダメージ数字エフェクト
   ======================================== */
.damage-number {
    position: absolute;
    font-family: var(--font-pixel), sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: #FF6B6B;
    text-shadow: 
        3px 3px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 107, 107, 0.8);
    animation: damageFloat 1s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes damageFloat {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-80px) scale(0.8);
        opacity: 0;
    }
}

/* ========================================
   クリティカルヒットエフェクト
   ======================================== */
.critical-hit {
    color: var(--color-primary) !important;
    font-size: 3rem !important;
    animation: criticalShake 0.5s ease-out forwards;
}

@keyframes criticalShake {
    0%, 100% { transform: translateX(0) translateY(0) rotate(0deg); }
    10% { transform: translateX(-10px) translateY(-10px) rotate(-5deg); }
    20% { transform: translateX(10px) translateY(10px) rotate(5deg); }
    30% { transform: translateX(-10px) translateY(10px) rotate(-5deg); }
    40% { transform: translateX(10px) translateY(-10px) rotate(5deg); }
    50% { transform: translateX(-5px) translateY(-5px) rotate(-2deg); }
    60% { transform: translateX(5px) translateY(5px) rotate(2deg); }
    70% { transform: translateX(-5px) translateY(5px) rotate(-2deg); }
    80% { transform: translateX(5px) translateY(-5px) rotate(2deg); }
    90% { transform: translateX(-2px) translateY(-2px) rotate(-1deg); }
}

/* ========================================
   問題カードのアイコンアニメーション強化
   ======================================== */
.problem-card:nth-child(1) .problem-icon i {
    animation-delay: 0s;
}

.problem-card:nth-child(2) .problem-icon i {
    animation-delay: 0.75s;
}

.problem-card:nth-child(3) .problem-icon i {
    animation-delay: 1.5s;
}

.problem-card:nth-child(4) .problem-icon i {
    animation-delay: 2.25s;
}

/* ========================================
   レスポンシブ対応
   ======================================== */
@media (max-width: 768px) {
    .game-status-bar {
        top: 60px; /* ヘッダーの高さに合わせる */
        padding: 0.5rem 0;
    }
    
    .status-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .player-status {
        justify-content: center;
    }
    
    .status-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .status-name {
        font-size: 0.7rem;
    }
    
    .level-value {
        font-size: 1rem;
    }
    
    .hp-bar-container {
        min-width: 100%;
        width: 100%;
    }
    
    .hp-bar {
        height: 24px;
    }
    
    .hp-text {
        font-size: 0.7rem;
    }
    
    .coin-display {
        width: 100%;
        justify-content: center;
        padding: 0.4rem 0.8rem;
    }
    
    .coin-value {
        font-size: 1rem;
    }
    
    .enemy-container {
        display: none; /* モバイルでは敵キャラを非表示 */
    }
    
    .level-up-text {
        font-size: 2.5rem;
    }
    
    .sparkle {
        font-size: 2rem;
    }
    
    .coin-display {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .game-status-bar {
        top: 60px;
        padding: 0.4rem 0;
    }
    
    .status-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .status-name {
        font-size: 0.65rem;
    }
    
    .level-label {
        font-size: 0.75rem;
    }
    
    .level-value {
        font-size: 0.9rem;
    }
    
    .hp-bar {
        height: 20px;
    }
    
    .hp-text {
        font-size: 0.65rem;
    }
    
    .coin-value {
        font-size: 0.9rem;
    }
    
    .coin-label {
        font-size: 0.75rem;
    }
    
    .level-up-text {
        font-size: 2rem;
    }
    
    .sparkle {
        font-size: 1.5rem;
    }
    
    .coin-value {
        font-size: 1rem;
    }
    
    .enemy-container {
        display: none; /* モバイルでは敵キャラを非表示 */
    }
}
