* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #0d0400;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* --- NAVBAR RESPONSIVA --- */
.navbar {
    width: 100%;
    background: rgba(20, 8, 4, 0.95);
    border-bottom: 1px solid var(--border-soft, rgba(255, 85, 0, 0.2));
    box-shadow: 0 4px 20px var(--glow-ultra-soft, rgba(255, 85, 0, 0.05));
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: border-color 0.8s ease, box-shadow 0.8s ease;
    backdrop-filter: blur(5px);
}

.navbar-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.brand {
    font-size: 20px;
    font-weight: 600;
    color: var(--theme-glow); /* A cor agora vai escutar a variável alterada via JS */
    text-shadow: 0 0 10px var(--glow-ultra-soft, rgba(255, 85, 0, 0.3));
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: color 0.8s ease, text-shadow 0.8s ease;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s, text-shadow 0.3s;
    cursor: pointer;
}

.nav-links a:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--theme-glow, #ffaa00);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    width: 100%;
    height: 2px;
    background-color: var(--theme-glow, #ff5500);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- LAYOUT DO JOGO --- */
#game-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
}

/* HUD com Borda Fina, Suave e Elegante */
#hud {
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #eee;
    background: rgba(12, 4, 2, 0.6);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-soft, rgba(255, 85, 0, 0.25));
    box-shadow: 0 0 15px var(--glow-ultra-soft, rgba(255, 85, 0, 0.08)),
                inset 0 0 15px var(--glow-ultra-soft, rgba(255, 85, 0, 0.03));
    transition: border-color 0.8s ease, box-shadow 0.8s ease;
    backdrop-filter: blur(8px);
}

#hud > div {
    white-space: nowrap;
}

#timer {
    color: var(--theme-glow, #ff5500);
    transition: color 0.8s ease;
}

/* Canvas com Borda Fina de 1px e Brilho Sutil */
canvas {
    width: 100%;
    height: auto;
    max-width: 800px;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border-soft, rgba(255, 85, 0, 0.3));
    border-radius: 12px;
    background: radial-gradient(circle, #1a0802 0%, #080200 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
                0 0 20px var(--glow-ultra-soft, rgba(255, 85, 0, 0.08));
    cursor: crosshair;
    display: block;
    transition: border-color 0.8s ease, box-shadow 0.8s ease;
}

.instrucoes {
    margin-top: 14px;
    color: #888;
    text-align: center;
    width: 100%;
    max-width: 800px;
    font-size: 13px;
    line-height: 1.5;
    padding: 0 5px;
}

/* --- MODAIS --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #140702;
    border: 1px solid var(--border-soft, rgba(255, 85, 0, 0.3));
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8),
                0 0 20px var(--glow-ultra-soft, rgba(255, 85, 0, 0.1));
    color: #fff;
    position: relative;
    transition: border-color 0.8s ease;
}

.modal-content h2 {
    color: var(--theme-glow, #ffaa00);
    margin-bottom: 15px;
    font-size: 20px;
    transition: color 0.8s ease;
}

.modal-content p, .modal-content ul {
    font-size: 14px;
    line-height: 1.6;
    color: #bbb;
    margin-bottom: 15px;
}

.modal-content ul {
    padding-left: 20px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border-soft, rgba(255, 85, 0, 0.3));
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    float: right;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--theme-glow, #ff3300);
    border-color: transparent;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #140804;
        flex-direction: column;
        align-items: center;
        gap: 0;
        border-bottom: 1px solid var(--border-soft, rgba(255, 85, 0, 0.2));
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out, border-color 0.8s ease;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 5px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-links.active {
        max-height: 250px;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -7px);
    }
}

@media (max-width: 500px) {
    #hud {
        font-size: 13px;
        gap: 6px;
    }
    .instrucoes {
        font-size: 11px;
    }
}

/* --- RODAPÉ RESPONSIVO --- */
.footer {
    width: 100%;
    margin-top: auto;
    background: rgba(14, 6, 3, 0.95);
    border-top: 1px solid var(--border-soft, rgba(255, 85, 0, 0.2));
    box-shadow: 0 -4px 20px var(--glow-ultra-soft, rgba(255, 85, 0, 0.05));
    transition: border-color 0.8s ease, box-shadow 0.8s ease;
    backdrop-filter: blur(5px);
    padding: 25px 20px 15px;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s, text-shadow 0.3s;
    cursor: pointer;
}

.footer-links a:hover {
    color: var(--theme-glow, #ffaa00);
    text-shadow: 0 0 8px var(--theme-glow, rgba(255, 170, 0, 0.4));
}

.footer-copy {
    color: #666;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 500px) {
    .footer-links {
        gap: 12px;
    }
    .footer-links a {
        font-size: 12px;
    }
}
