:root {
    --primary-red: #ff4757;
    --primary-blue: #2ed573;
    --dark-bg: #2f3542;
    --text-color: #ffffff;
    --accent: #ffa502;
    --nav-bg: #1e272e;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #1e272e;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first constraint */
    height: 100%;
    max-height: 85vh;
    background-color: var(--dark-bg);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Adjust for bottom nav if needed, but absolute covers it */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2f3542 0%, #1e272e 100%);
    z-index: 10;
    transition: opacity 0.3s;
    padding-bottom: 60px;
    /* Space for bottom nav */
}

.hidden {
    display: none !important;
}

/* Typography */
h1.title {
    font-family: 'Bangers', cursive;
    font-size: 4rem;
    color: var(--primary-red);
    text-shadow: 3px 3px 0px #000;
    margin: 0;
    letter-spacing: 2px;
    text-align: center;
    line-height: 1;
}

h2.subtitle {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Character Selection */
.character-select {
    display: flex;
    gap: 1rem;
    width: 90%;
    justify-content: center;
}

.char-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1rem;
    width: 45%;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.char-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
}

.char-card h3 {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.char-card p {
    font-size: 0.8rem;
    color: #ccc;
}

.char-icon {
    width: 80px;
    height: 80px;
    background-color: #57606f;
    border-radius: 50%;
    margin: 0 auto;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.sami-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="%23ff4757"/><text x="50" y="65" font-size="40" text-anchor="middle" fill="white">S</text></svg>');
}

.moiz-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="%232ed573"/><text x="50" y="65" font-size="40" text-anchor="middle" fill="white">M</text></svg>');
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.score-board,
.status-board {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    color: white;
    text-shadow: 1px 1px 2px black;
}

#pause-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Game Scene */
#game-scene {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #747d8c;
    /* Generic wall color */
    display: flex;
    justify-content: center;
    align-items: center;
}

#scene-content {
    width: 100%;
    height: 100%;
    position: relative;
}

/* VFX */
#vfx-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.flash-red {
    animation: flashRed 0.2s ease-out;
}

@keyframes flashRed {
    0% {
        background-color: rgba(255, 0, 0, 0.8);
    }

    100% {
        background-color: transparent;
    }
}

/* Suspects (Sami Mode) */
.suspect {
    width: 100px;
    height: 150px;
    background-color: #a4b0be;
    position: absolute;
    bottom: 20%;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Bangers';
    font-size: 2rem;
    color: rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
}

.suspect:active {
    transform: scale(0.95);
}

.suspect.guilty {
    /* Subtle hint */
    border: 2px dashed rgba(0, 0, 0, 0.1);
}

/* Moiz Mode Elements */
.sami-back {
    width: 150px;
    height: 200px;
    background-color: #ff6b6b;
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.sami-back::after {
    content: "SAMI";
    font-family: 'Bangers';
    font-size: 2rem;
    color: white;
}

.charge-meter {
    position: absolute;
    bottom: 80px;
    /* Moved up slightly */
    width: 200px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.charge-fill {
    height: 100%;
    background: linear-gradient(90deg, yellow, red);
    width: 0%;
    transition: width 0.1s linear;
}

/* Ads */
.ad-banner {
    width: 320px;
    height: 50px;
    background-color: #444;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 0.8rem;
    border: 1px dashed #666;
}

.ad-interstitial {
    width: 300px;
    height: 250px;
    background-color: #444;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    border: 1px dashed #666;
}

/* Buttons */
.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

button {
    padding: 12px 24px;
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: var(--primary-red);
    color: white;
}

.btn-secondary {
    background-color: var(--primary-blue);
    color: white;
}

.reward-ad-btn {
    margin-top: 1rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Footer (Legacy - kept for desktop compatibility if needed, but hidden on mobile usually) */
#main-footer {
    display: none;
    /* Replaced by bottom nav */
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #7f8c8d;
    font-size: 0.7rem;
    transition: color 0.2s;
    width: 25%;
    height: 100%;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-text {
    font-weight: bold;
}

/* Game Over Modal */
#game-over {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    /* Ensure it's above everything */
}

.game-over-content {
    background: linear-gradient(135deg, #2f3542 0%, #1e272e 100%);
    padding: 2rem;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 90%;
    transform: scale(0.8);
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.game-over-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.2s;
}

.game-over-content h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.3s;
}

.game-over-content p {
    color: #ccc;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.4s;
}

.game-over-content .ad-interstitial {
    margin: 1rem auto;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.5s;
}

.game-over-content .buttons {
    justify-content: center;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.6s;
}

.game-over-content .reward-ad-btn {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.7s;
}

/* Animations */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    transform: scale(0.95);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: var(--primary-red);
    color: white;
}

.btn-secondary {
    background-color: var(--primary-blue);
    color: white;
}

.reward-ad-btn {
    margin-top: 1rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Footer (Legacy - kept for desktop compatibility if needed, but hidden on mobile usually) */
#main-footer {
    display: none;
    /* Replaced by bottom nav */
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #7f8c8d;
    font-size: 0.7rem;
    transition: color 0.2s;
    width: 25%;
    height: 100%;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-text {
    font-weight: bold;
}

/* Game Over Modal */
#game-over {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    /* Ensure it's above everything */
}

.game-over-content {
    background: linear-gradient(135deg, #2f3542 0%, #1e272e 100%);
    padding: 2rem;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 90%;
    transform: scale(0.8);
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.game-over-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.2s;
}

.game-over-content h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.3s;
}

.game-over-content p {
    color: #ccc;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.4s;
}

.game-over-content .ad-interstitial {
    margin: 1rem auto;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.5s;
}

.game-over-content .buttons {
    justify-content: center;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.6s;
}

.game-over-content .reward-ad-btn {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards 0.7s;
}

/* Animations */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: 1;
}

/* More Menu Dropdown */
.more-menu {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: #2f3542;
    border: 1px solid #57606f;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 150;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.menu-item {
    color: white;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #2f3542;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    border: 2px solid #57606f;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: white;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: #ff4757;
}

#donation-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    border-top: 1px solid #444;
    padding-top: 20px;
}

#donation-form input,
#donation-form textarea {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #57606f;
    background: #1e272e;
    color: white;
    font-family: 'Roboto', sans-serif;
}

#donation-form button {
    margin-top: 10px;
}