/* ================================================================
   css/style.css  —  Game 4: Battle Sosiologi (1v1 VS)
   ================================================================ */

:root {
    --primary: #9b59b6;
    --primary-dark: #8e44ad;
    --hp-ok: #2ecc71;
    --hp-low: #f1c40f;
    --hp-crit: #e74c3c;
    --glass: rgba(0, 0, 0, 0.75);
    --glass-border: rgba(155, 89, 182, 0.5);
    --text-color: #fff;
    --bg-battle: #1a1a2e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-battle) url('../assets/vs_bg.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.screen.visible {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ─── Panel (Home & End) ─── */
.panel {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.4);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: #f39c12;
    text-shadow: 3px 3px 0 #c0392b;
}

.title .hl {
    color: #ecf0f1;
}

/* ─── Buttons ─── */
.btn {
    background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
    border: 2px solid #fff;
    color: #fff;
    padding: 12px 25px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.btn:active {
    transform: translateY(2px);
}

.btn-back {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #ccc;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ─── Battle UI ─── */
#screen-battle {
    justify-content: space-between;
    padding: 0;
}

/* Arena Header / HP */
.arena-header {
    width: 100%;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid var(--glass-border);
}

.fighter {
    width: 40%;
}

.f-name {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.boss-side {
    text-align: right;
}

.hp-bar-wrap {
    width: 100%;
    height: 25px;
    background: #333;
    border: 2px solid #fff;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.hp-fill {
    height: 100%;
    width: 100%;
    /* Default 100% */
    background: var(--hp-ok);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.hp-fill.boss-fill {
    float: right;
    /* Drain from left for boss */
    background: #e74c3c;
    /* Boss HP usually red */
}

.vs-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.8rem;
    color: #f1c40f;
    text-shadow: 2px 2px 0 #d35400;
}

/* Timer Bar */
.timer-wrap {
    width: 100%;
    height: 10px;
    background: #222;
}

.timer-fill {
    height: 100%;
    width: 100%;
    background: #3498db;
    transition: width 0.1s linear;
    /* Smooth continuous drain */
}

/* Question Area */
.battle-panel {
    width: 100%;
    max-width: 900px;
    margin: auto;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #555;
    border-radius: 10px;
    padding: 25px;
    position: relative;
}

.battle-message {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #e67e22;
    color: #fff;
    padding: 5px 20px;
    border: 2px solid #fff;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.battle-message.show {
    opacity: 1;
    animation: popMsg 1.5s forwards;
}

@keyframes popMsg {
    0% {
        transform: translate(-50%, 10px);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -20px);
        opacity: 1;
    }

    80% {
        transform: translate(-50%, -20px);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -30px);
        opacity: 0;
    }
}

.q-box {
    font-size: 1.5rem;
    line-height: 1.5;
    margin-bottom: 25px;
    padding: 15px;
    border-bottom: 2px dashed #444;
    min-height: 100px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.opt-btn {
    background: #2c3e50;
    color: #ecf0f1;
    border: 2px solid #34495e;
    padding: 18px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.opt-btn:hover {
    background: #34495e;
    border-color: #f1c40f;
}

.opt-btn.correct {
    background: var(--hp-ok);
    border-color: #fff;
    color: #fff;
}

.opt-btn.wrong {
    background: var(--hp-crit);
    border-color: #fff;
    color: #fff;
}

/* Stage Select */
.cards-wrap {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 80px;
}

.stage-card {
    background: var(--glass);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    width: 250px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.stage-card:hover {
    transform: scale(1.05);
    border-color: #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
}

.stage-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.stage-card h3 {
    color: #f1c40f;
    margin-bottom: 5px;
}

/* Animations / Effects */
.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-8px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(8px, 0, 0);
    }
}

@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: 1.8rem;
    }

    .vs-text {
        font-size: 1.2rem;
    }
}