/* Centralized stylesheet for rpg-o-mania FIGHT!! */

body {
    color: #fff;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    background-color: #3a4d7c;
    background-image: url(woodpanel.png);
    background-repeat: repeat;
    background-attachment: fixed;
    min-height: 100%;
    margin: 0;
    padding: 10px;
}

.logo { width: 250px; display: block; margin: 0 auto; }

/* ---- Menu-style pages: index.php, manual.php, restore.php, victory_screen.php ---- */

.box {
    background: #222;
    border: 2px solid #444;
    display: inline-block;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
    max-width: 400px;
}

.box.box--narrow { max-width: 300px; }

.box input, .box select {
    margin: 10px;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    width: 80%;
}

.box button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 10px;
}

.token-info {
    font-size: 0.8em;
    color: #888;
    margin-top: 20px;
    border-top: 1px dashed #444;
    padding-top: 10px;
}

.token-info.token-info--light { color: #fff; }

.char-link {
    display: block;
    margin: 10px;
    color: #44aaff;
    text-decoration: none;
    border: 1px solid #333;
    padding: 5px;
}

.char-link:hover { background: #333; }

.restore-link {
    color: #aaa;
    font-size: 0.7em;
    text-decoration: underline;
    cursor: pointer;
}

.restore-link.restore-link--lg { font-size: 0.8em; }

.link-muted { color: #666; font-size: 0.8em; }

.box--restore input {
    margin: 0;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    width: 250px;
    max-width: 100%;
    text-align: center;
}

.box--restore button { background: #007bff; }

/* ---- Battle screen: battle.php ---- */

#battle-screen {
    box-sizing: border-box;
    width: 100%;
    max-width: 644px;
    border: 2px solid #444;
    padding: 20px;
    background: #000;
    border-radius: 15px;
    box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
}

.stats-box { border: 2px solid #555; padding: 10px; margin-bottom: 10px; }

.hp-bar-bg { width: min(200px, 100%); height: 15px; background: #222; border: 1px solid #fff; }

.hp-bar-fill {
    height: 100%;
    /* A little bit of Breath of Fire 2, hehe */
    background: linear-gradient(to bottom, #880022 0%, #CC2244 50%, #880022 100%);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2);
    transition: width 0.5s;
}

.sprites {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 350px;
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: center;
}

.sprite {
    width: 300px;
    height: 300px;
    transition: opacity 1.5s ease-out;
}

.faded { opacity: 0; }

.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

#battle-screen button {
    padding: 10px;
    cursor: pointer;
    background: #444;
    color: #fff;
    border: 2px solid #fff;
}

#battle-screen button:hover { background: #666; }

#log { margin-top: 15px; height: 60px; overflow-y: auto; font-size: 0.9em; color: #aaa; }

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    20% { transform: translate(-3px, 0px) rotate(-1deg); }
    40% { transform: translate(3px, 2px) rotate(1deg); }
    60% { transform: translate(-3px, 1px) rotate(-1deg); }
    80% { transform: translate(3px, 1px) rotate(1deg); }
    100% { transform: translate(1px, -2px) rotate(0deg); }
}

.shake-animation { animation: shake 0.5s; }

/* ---- Mobile layout for the battle screen ---- */

@media (max-width: 700px) {
    #battle-screen {
        display: flex;
        flex-direction: column;
        border-radius: 0;
    }
    .stats-box--enemy { order: 1; }
    .stats-box--player { order: 2; }
    .sprites {
        order: 3;
        height: 40vh;
        flex-direction: column;
    }
    .sprite {
        height: 50%;
        width: auto;
        max-width: 92%;
        object-fit: contain;
    }
    .menu { order: 4; }
    #log { order: 5; }
}
