/* Beaver Fever page. Loads after site.css (font, Minecraft buttons, toasts, sound toggle). */

.fever-page {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: #ff9a4a;
    -webkit-tap-highlight-color: transparent;
}

#game {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.fever-page button {
    touch-action: manipulation;
}

/* ---------- HUD ---------- */

.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 10px;
    padding: 10px 70px 0 12px;
    font-family: var(--pixel);
    color: #fff;
    text-shadow: 2px 2px 0 #3a1500;
    pointer-events: none;
}

.hud[hidden],
.boss[hidden],
.hud-power[hidden] {
    display: none;
}

.hearts {
    display: flex;
    gap: 3px;
}

.hp {
    width: 28px;
    height: 25px;
    background: var(--heart-full) center / contain no-repeat;
}

.hp.empty {
    background-image: var(--heart-empty);
}

.hp.lost {
    animation: heart-lost 0.6s ease;
}

.hud-power {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 2px 8px 3px 4px;
    font-size: 14px;
    background: rgba(40, 14, 0, 0.45);
    border: 2px solid rgba(0, 0, 0, 0.35);
}

.hud-power img {
    width: 24px;
    height: 24px;
}

.hud-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.hud-score {
    font-size: 30px;
    font-weight: 700;
    color: var(--mc-yellow);
    text-shadow: 3px 3px 0 #7a3000;
}

.hud-score.bump {
    animation: bump-score 0.25s ease;
}

.hud-wave {
    font-size: 15px;
}

.hud-right {
    display: flex;
    justify-content: flex-end;
}

.hud-btn {
    width: 46px;
    height: 46px;
    min-height: 0;
    padding: 0;
    pointer-events: auto;
}

.hud-btn svg {
    width: 18px;
    height: 18px;
}

.boss {
    position: fixed;
    top: 78px;
    left: 50%;
    z-index: 10;
    width: min(520px, 78vw);
    transform: translateX(-50%);
    text-align: center;
    font-family: var(--pixel);
    font-size: 15px;
    color: #fff;
    text-shadow: 2px 2px 0 #400;
    pointer-events: none;
}

.boss-bar {
    height: 18px;
    margin-top: 4px;
    background: #2a0d0d;
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px #5a1a1a;
}

.boss-bar i {
    display: block;
    width: calc(var(--hp, 1) * 100%);
    height: 100%;
    background: linear-gradient(#ff9a7a, #ff3b2f 45%, #b81400);
    transition: width 0.2s ease;
}

.boss.cured .boss-bar i {
    background: linear-gradient(#c6ff87, #80ff20 45%, #4caf16);
}

/* wave banners */
.banner {
    position: fixed;
    top: 36%;
    left: 50%;
    z-index: 12;
    width: max-content;
    max-width: 92vw;
    transform: translate(-50%, -50%);
    text-align: center;
    font-family: var(--pixel);
    color: #fff;
    opacity: 0;
    pointer-events: none;
}

.banner.show {
    animation: banner 2.3s ease both;
}

.banner b {
    display: block;
    font-size: clamp(38px, 9vw, 76px);
    font-weight: 700;
    line-height: 1;
    color: var(--mc-yellow);
    text-shadow: 4px 4px 0 #b34700, 8px 8px 0 #6b1d00;
}

.banner span {
    display: block;
    margin-top: 10px;
    font-size: clamp(16px, 3.2vw, 26px);
    text-shadow: 2px 2px 0 #6b1d00;
}

/* beaver facts between waves */
.fact-card {
    position: fixed;
    top: calc(36% + 70px);
    left: 50%;
    z-index: 12;
    width: min(440px, 88vw);
    padding: 12px 16px 14px;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    background: rgba(32, 12, 2, 0.86);
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px rgba(255, 190, 90, 0.35), 0 12px 30px rgba(40, 10, 0, 0.45);
    pointer-events: none;
    animation: panel-in 0.4s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.fact-card[hidden] {
    display: none;
}

.fact-card b,
.fact-line b,
.end-fact b {
    display: block;
    margin-bottom: 4px;
    font-family: var(--pixel);
    font-size: 15px;
    font-weight: 400;
    color: var(--mc-yellow);
}

.fact-card span {
    font-size: 17px;
    line-height: 1.4;
}

.fact-line {
    max-width: 520px;
    padding: 10px 14px 12px;
    font-size: 15px;
    line-height: 1.4;
    color: #fff3e6;
    background: rgba(255, 255, 255, 0.06);
    border: 2px dashed rgba(255, 225, 77, 0.45);
    cursor: pointer;
}

.fact-line em {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-style: normal;
    color: #ffcf8a;
}

.end-fact {
    max-width: 500px;
    font-size: 15px;
    line-height: 1.4;
    color: #fff3e6;
}

/* ---------- Screens (title, pause, game over, win) ---------- */

.screen {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    background: radial-gradient(ellipse at center, rgba(60, 14, 0, 0.25), rgba(60, 14, 0, 0.6));
}

.screen[hidden] {
    display: none;
}

.panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: min(640px, 100%);
    margin: auto;
    padding: 24px 20px 26px;
    text-align: center;
    background: rgba(32, 12, 2, 0.78);
    border: 3px solid #000;
    box-shadow: inset 0 0 0 3px rgba(255, 190, 90, 0.28), 0 20px 60px rgba(40, 10, 0, 0.5);
    animation: panel-in 0.4s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.fever-title {
    font-family: var(--pixel);
    font-size: clamp(40px, 9vw, 74px);
    font-weight: 700;
    line-height: 1;
    color: #ffe14d;
    text-shadow: 4px 4px 0 #e0531a, 8px 8px 0 #7c2d12;
}

.fever-title span {
    display: inline-block;
    animation: wiggle 1.1s ease-in-out infinite;
    animation-delay: calc(var(--i) * -0.09s);
}

.story {
    max-width: 520px;
    font-size: 17px;
    color: #fff3e6;
}

.story b {
    color: #ffe14d;
}

.pick-title {
    margin-top: 4px;
    font-family: var(--pixel);
    font-size: 19px;
    font-weight: 400;
    color: #fff;
}

.pick {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.hero-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 172px;
    padding: 10px 10px 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.hero-pick img {
    width: 100%;
    height: 118px;
    object-fit: contain;
    filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.35));
    -webkit-user-drag: none;
}

.hero-pick b {
    font-family: var(--pixel);
    font-size: 18px;
}

.hero-pick .perk {
    font-family: var(--pixel);
    font-size: 13px;
    color: var(--mc-yellow);
}

.hero-pick small {
    font-size: 13px;
    line-height: 1.3;
    color: #ffe3c8;
}

.hero-pick:hover {
    background: rgba(255, 255, 255, 0.12);
}

.hero-pick.on {
    border-color: #fff;
    background: rgba(255, 170, 60, 0.22);
    transform: translateY(-4px);
}

.hero-pick.on img {
    animation: hop 0.7s ease-in-out infinite alternate;
}

.play-btn {
    min-width: 230px;
    font-size: 24px;
}

.howto,
.best {
    font-size: 15px;
    color: #ffe3c8;
}

.best b {
    color: var(--mc-yellow);
    font-family: var(--pixel);
}

.back-btn {
    font-size: 15px;
    min-height: 42px;
}

.end-title {
    font-family: var(--pixel);
    font-size: clamp(30px, 7vw, 52px);
    font-weight: 700;
    line-height: 1.05;
    color: #ffe14d;
    text-shadow: 4px 4px 0 #b34700;
}

.end-sub {
    font-size: 17px;
    color: #fff3e6;
}

.end-score {
    font-family: var(--pixel);
    font-size: 20px;
    color: #fff;
}

.end-score b {
    color: var(--mc-yellow);
}

.end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* ---------- Keyframes ---------- */

@keyframes banner {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-8deg); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
    25% { transform: translate(-50%, -50%) scale(1) rotate(0); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

@keyframes wiggle {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-6px) rotate(3deg); }
}

@keyframes hop {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

@keyframes panel-in {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to { opacity: 1; transform: none; }
}

@keyframes heart-lost {
    0%, 100% { transform: none; }
    25% { transform: scale(1.4) rotate(-12deg); }
    60% { transform: scale(0.8) rotate(8deg); }
}

@keyframes bump-score {
    50% { transform: scale(1.25); }
}

@media (max-width: 600px) {
    .hud {
        padding: 8px 54px 0 8px;
        gap: 6px;
    }

    .hp {
        width: 19px;
        height: 17px;
    }

    .hearts {
        gap: 2px;
    }

    .hud-score {
        font-size: 24px;
    }

    .hud-wave {
        font-size: 13px;
    }

    .hud-btn {
        width: 38px;
        height: 38px;
    }

    .boss {
        top: 66px;
        font-size: 13px;
    }

    .panel {
        gap: 10px;
        padding: 18px 12px 20px;
    }

    .story {
        font-size: 15px;
    }

    .hero-pick {
        width: calc(33.3% - 8px);
        min-width: 96px;
        padding: 8px 4px 10px;
    }

    .hero-pick img {
        height: 84px;
    }

    .hero-pick b {
        font-size: 15px;
    }

    .hero-pick small {
        display: none;
    }

    .play-btn {
        min-width: 200px;
        font-size: 21px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .panel {
        gap: 8px;
        padding: 14px 16px 16px;
    }

    .story,
    .howto {
        display: none;
    }

    .hero-pick img {
        height: 70px;
    }

    .hero-pick small {
        display: none;
    }
}
