body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    background-color: #31353b;
    overflow: hidden;
    font-family: sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* RESTORED: Styles for the counter box */
#counter-box {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: #4f545c;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    z-index: 99;
    pointer-events: all;
    cursor: pointer;
    transition: transform 0.1s;
}
#counter-box:active {
    transform: scale(0.95);
}

#counter-label {
    font-weight: normal;
    font-size: 14px;
    opacity: 0.8;
}

/* Update Text Styles */
#update-text {
    position: absolute;
    bottom: 35px; /* Above the credit text */
    left: 15px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    z-index: 99;
    cursor: pointer;
    transition: color 0.2s, opacity 0.5s;
}
#update-text:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* NEW: Amplify Button Styles */
#amplify-button {
    position: absolute;
    bottom: 30px;
    left: 15px;
    background-color: #2e8b57; /* Sea Green */
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid #3cb371;
    border-radius: 4px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
#amplify-button:hover {
    background-color: #3cb371;
}
/* Active State (Toggled On) */
#amplify-button.active {
    background-color: #00ff00; /* Bright Green */
    color: #000;
    box-shadow: 0 0 10px #00ff00;
    border-color: #00ff00;
}

/* Exploded letters physics style */
.exploded-letter {
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    user-select: none;
}

#credit-text { position: absolute; bottom: 15px; left: 15px; color: rgba(255, 255, 255, 0.5); font-size: 14px; pointer-events: none; z-index: 99; }
#controls { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 95%; }

#button-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

#instruction-text { margin: 0; padding: 0; color: rgba(255, 255, 255, 0.7); font-size: 14px; }
#controls button, #controls a { padding: 10px 20px; font-size: 16px; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.2s; text-decoration: none; display: inline-block; }
#controls button { background-color: #4f545c; }
#controls button:hover { background-color: #686e78; }
#suggest-button { background-color: #c85050; }
#suggest-button:hover { background-color: #d16060; }
#goodbye-button { background-color: #4ca59d; }
#goodbye-button:hover { background-color: #5cc0b8; }
.hidden { display: none !important; }

#attack-container { position: absolute; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
#face-wrapper { position: relative; perspective: 800px; }
#face-wrapper.returning { transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1); }

/* Improved Dynamic Rumble Animation */
.rumble-effect { animation: rumble-shock 0.3s ease-in-out both; }
@keyframes rumble-shock {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    15% { transform: translate(-10px, 5px) scale(1.05) rotate(-5deg); }
    30% { transform: translate(10px, -5px) scale(0.95) rotate(5deg); }
    45% { transform: translate(-8px, -5px) scale(1.02) rotate(-3deg); }
    60% { transform: translate(8px, 5px) scale(0.98) rotate(3deg); }
    75% { transform: translate(-4px, 0px) scale(1.01) rotate(-1deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

#face { width: 30vmin; height: 30vmin; max-width: 250px; max-height: 250px; cursor: pointer; border-radius: 50%; user-select: none; -webkit-user-drag: none; pointer-events: all; }
.attacker-guide { position: absolute; transform: translate(-50%, -50%); z-index: 102; }

/* Standard Slap */
.attacker { width: 20vmin; max-width: 150px; position: absolute; height: auto; opacity: 0; transform: translate(-50%, -50%); animation: slap-anim 0.3s ease-in-out forwards; }
@keyframes slap-anim { 0% { opacity: 0; transform: translate(60vw, -50%) rotate(-60deg); } 30% { opacity: 1; transform: translate(50vw, -50%) rotate(45deg); } 60% { transform: translate(0px, -50%) rotate(-20deg) skewX(30deg); } 80% { opacity: 1; transform: translate(50px, -50%) rotate(-25deg) skewX(30deg); } 100% { opacity: 0; transform: translate(50px, -50%) rotate(-25deg) skewX(30deg); } }

/* Amplified Slap (Red Glow) */
.attacker.amplified {
    filter: drop-shadow(0 0 15px #ff0000) sepia(100%) saturate(500%) hue-rotate(-50deg);
}

/* Deflected Slap (Default Recoil) */
.attacker-deflected { width: 20vmin; max-width: 150px; position: absolute; height: auto; opacity: 0; transform: translate(-50%, -50%); animation: slap-recoil 0.4s ease-out forwards; }

@keyframes slap-recoil {
    0% { opacity: 0; transform: translate(60vw, -50%) rotate(-60deg); }
    30% { opacity: 1; transform: translate(50vw, -50%) rotate(45deg); } 
    50% { opacity: 1; transform: translate(0px, -50%) rotate(-20deg) skewX(30deg) scale(1.1); } 
    100% { opacity: 0; transform: translate(50vw, -80%) rotate(120deg) scale(0.8); }
}

.impact-effect { width: 35vmin; max-width: 225px; position: absolute; height: auto; z-index: 101; transform: translate(-50%, -50%); animation: impact-anim 0.15s ease-out forwards; }
@keyframes impact-anim { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } }
.gas-effect { position: absolute; width: 22vmin; max-width: 190px; height: auto; z-index: 100; pointer-events: none; }
.particle { width: 15vmin; max-width: 120px; position: absolute; height: auto; pointer-events: none; z-index: 101; }

/* Red -1 Text */
.damage-text {
    position: absolute;
    font-size: 6vmin;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 2px 2px 0px #000;
    pointer-events: none;
    z-index: 105;
    animation: float-up 1.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}
@keyframes float-up {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-10deg); }
    15% { opacity: 1; transform: translate(-50%, -150%) scale(1.3) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -300%) scale(1); }
}

.speech-bubble {
    position: absolute;
    top: 0;
    left: 50%;
    background-color: white;
    color: #333;
    padding: 1.5vmin 2.5vmin;
    border-radius: 15px;
    font-family: sans-serif;
    font-weight: 700;
    font-size: 2.5vmin;
    text-align: center;
    width: 40vmin;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 110;
    pointer-events: none;
    animation: bubble-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}
@keyframes bubble-pop {
    0% { opacity: 0; transform: translate(-50%, -80%) scale(0.5); }
    100% { opacity: 1; transform: translate(-50%, -115%) scale(1); }
}

/* === Abuse Button & Finger Animation === */
#abuse-container {
    position: absolute;
    top: 70%; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
}

#abuse-button {
    background-color: #ff1a1a;
    color: white;
    font-weight: 800;
    font-size: 20px;
    padding: 15px 30px;
    border: 3px solid #800000;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: transform 0.1s, background-color 0.2s;
    text-transform: uppercase;
    white-space: nowrap;
}

#abuse-button:hover {
    background-color: #ff4d4d;
}

#abuse-button:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.finger-effect {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 35vmin;
    max-width: 250px;
    height: auto;
    z-index: 200; 
    pointer-events: none;
    animation: finger-pop 1.2s ease-in-out forwards;
}

@keyframes finger-pop {
    0% { bottom: -100%; transform: translateX(-50%) rotate(15deg); }
    15% { bottom: -5%; transform: translateX(-50%) rotate(-5deg); }
    70% { bottom: -5%; transform: translateX(-50%) rotate(-5deg); }
    100% { bottom: -100%; transform: translateX(-50%) rotate(15deg); }
}

@media (max-width: 600px) {
    #controls button, #controls a { padding: 8px 10px; font-size: 13px; }
    #button-bar { gap: 5px; }
    #instruction-text, #credit-text, #counter-box { font-size: 12px; }
    #counter-label { font-size: 10px; }
    
    #abuse-button {
        font-size: 16px;
        padding: 10px 20px;
    }
}