/* battle.css */
#battle-screen.hidden {
    display: none;
}

#battle-screen {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.battle-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #bbdefb;
    padding: 20px;
    box-sizing: border-box;
}

.battlefield {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 20px;
}

.party-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.enemy-character,
.player-character,
.character-card {
    transition: all 0.3s ease;
    width: 20%;
    min-width: 150px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.char-icon {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.character-details {
    width: 100%;
    text-align: center;
}

.character-name,
.char-name {
    margin: 5px 0;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.hp-bar-container,
.mp-bar-container {
    width: 80%;
    height: 10px;
    background-color: #ccc;
    border-radius: 5px;
    margin-top: 5px;
    position: relative;
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    background-color: #e57373;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.mp-bar-fill {
    height: 100%;
    background-color: #42a5f5;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.hp-text,
.mp-text {
    font-size: 0.8em;
    color: #555;
    margin-top: 2px;
}


.ui-container {
    display: flex;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 15px;
    gap: 20px;
    min-height: 450px;
}

.log-box {
    flex-grow: 1;
    background-color: #e3f2fd;
    padding: 10px;
    border-radius: 8px;
    overflow-y: auto;
    height: 430px;
}

.log-box p {
    margin: 0 0 5px 0;
    line-height: 1.2;
    font-size: 0.9em;
}

/* コマンドUI */
.command-box {
    width: 200px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.commands {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.command-button,
.skill-button {
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s;
    width: 100%;
}

.command-button:hover,
.skill-button:hover {
    background-color: #45a049;
}

.command-button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

.skill-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 10px;
}

.skill-item {
    position: relative;
    width: 100%;
}

.skill-button {
    font-size: 0.9em;
    padding: 8px;
    background-color: #81c784;
}

.skill-button:hover {
    background-color: #66bb6a;
}

.hidden {
    display: none !important;
}

/* ハイライト機能の強化 */
.character-card.active {
    outline: 4px solid #ffeb3b;
    box-shadow: 0 0 20px 8px rgba(255, 235, 59, 0.8);
    transform: scale(1.08);
}

.character-card.selectable {
    outline: 3px solid #00bcd4;
    box-shadow: 0 0 15px 5px rgba(0, 188, 212, 0.6);
    cursor: pointer;
}

.character-card.selectable:hover {
    transform: scale(1.05);
}

.character-card.fainted {
    opacity: 0.4;
    filter: grayscale(80%);
}

/* Log message colors */
.log-message.damage { color: #d32f2f; }
.log-message.heal { color: #43a047; }
.log-message.status-effect { color: #1976d2; }
.log-message.special-event { color: #fbc02d; font-weight: bold; }
.log-message.system { color: #6a1b9a; font-style: italic; }
.log-message.turn-start { color: #004d40; font-weight: bold; border-top: 1px solid #004d40; padding-top: 5px; margin-top: 5px; }


/* 勝利・敗北演出のスタイル */
.battle-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.battle-result-overlay.show {
    opacity: 1;
}

.battle-result-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    animation: resultAppear 0.6s ease-out forwards;
    max-width: 500px;
    width: 90%;
}

@keyframes resultAppear {
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.battle-result-title {
    font-size: 4em;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.battle-result-message {
    font-size: 1.4em;
    color: #f0f0f0;
    margin: 0 0 40px 0;
}

.battle-result-button {
    background: linear-gradient(135deg, #ff6b35, #ff8e53);
    color: white;
    font-size: 1.4em;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.battle-result-button:hover {
    transform: translateY(-3px) scale(1.05);
}

.waiting-message {
    color: #eee;
    font-style: italic;
}

.skill-description {
    position: fixed; /* 画面基準で位置を決定 */
    padding: 10px;
    background-color: #334e68; /* 見やすい濃い青 */
    color: #fff; /* 白い文字 */
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 200px;
    text-align: left;
    white-space: normal;
    z-index: 10;
    pointer-events: none; /* マウスイベントを貫通させる */
}

.skill-description.hidden {
    display: none;
}