/* ================= VARIABLES & GLOBAL RESET ================= */
:root {
    --bg-color: #060913;
    --card-bg: rgba(13, 20, 36, 0.85);
    --primary-cyan: #00f3ff;
    --primary-magenta: #ff0055;
    --neon-green: #00ff88;
    --neon-amber: #ffaa00;
    --gold: #ffd700;
    --evil-purple: #9d00ff;
    --hardcore-red: #ff2a00;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 20%, rgba(0, 243, 255, 0.08) 0%, transparent 50%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
}

/* ================= TYPOGRAPHY & BASE CLASSES ================= */
h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    margin: 0 0 5px 0;
    color: var(--primary-cyan);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* SVG Ícones */
.icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
    margin-bottom: 2px;
}

/* =========================================================
   CORREÇÃO DOS ÍCONES / SVG
   ========================================================= */

/* Todo SVG usado como ícone */
svg.icon {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    flex: 0 0 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    overflow: visible !important;
}

/* SVG dentro de botões */
button.btn svg.icon,
a.btn svg.icon {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    flex: 0 0 18px !important;
    margin: 0 !important;
}

/* Garante que o botão realmente centralize ícone + texto */
button.btn,
a.btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
}

/* Corrige o <use> para não criar comportamento estranho */
svg.icon use {
    display: block;
}

/* Ícone de ajuda */
.help-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.help-icon svg.icon {
    width: 13px !important;
    height: 13px !important;
    min-width: 13px !important;
    min-height: 13px !important;
    flex: 0 0 13px !important;
    margin: 0 !important;
}

/* ================= CONTAINERS & SCREENS ================= */
#container {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.15);
    padding: 30px 40px;
    width: 480px;
    max-width: 95vw;
    text-align: center;
    transition: width 0.3s ease;
}

.theme-evil #container {
    border-color: rgba(157, 0, 255, 0.5);
    box-shadow: 0 0 40px rgba(157, 0, 255, 0.2);
}

.theme-hardcore #container {
    border-color: rgba(255, 42, 0, 0.5);
    box-shadow: 0 0 40px rgba(255, 42, 0, 0.2);
}

#countdown-screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ================= BUTTONS ================= */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: var(--text-main);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn:hover {
    background: rgba(0, 243, 255, 0.2);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.btn-gold {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--gold);
    color: var(--gold);
    margin-top: 15px;
}

/* ADICIONE ESTE BLOCO AQUI 👇 */
.btn-gold:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    color: var(--gold);
}

.btn-evil {
    border-color: var(--evil-purple);
    color: var(--evil-purple);
}

.btn-evil:hover {
    background: rgba(157, 0, 255, 0.15);
    box-shadow: 0 0 15px rgba(157, 0, 255, 0.4);
}

.btn-hc {
    border-color: var(--hardcore-red);
    color: var(--hardcore-red);
}

.btn-hc:hover {
    background: rgba(255, 42, 0, 0.15);
    box-shadow: 0 0 15px rgba(255, 42, 0, 0.4);
}

.btn-danger {
    background: rgba(255, 0, 85, 0.1);
    border-color: var(--primary-magenta);
    color: var(--primary-magenta);
}

.btn-danger:hover {
    background: rgba(255, 0, 85, 0.2);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.btn-mp {
    border-color: var(--neon-green);
    color: var(--neon-green);
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

#btn-admin-login {
    position: fixed;
    bottom: 10px;
    right: 10px;
    opacity: 0.1;
    cursor: pointer;
    transition: 0.3s;
}

#btn-admin-login:hover {
    opacity: 0.8;
}

/* ================= MODALS & TOASTS ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

#crowns-container {
    position: fixed;
    top: 75px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.crown-badge {
    background: rgba(6, 9, 19, 0.85);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.crown-badge svg {
    width: 14px;
    height: 14px;
}

.crown-badge.plat {
            border: 1px solid #e2f8ff;
            color: #ffffff;
            font-size: 12px;
            font-weight: 900;
            padding: 8px 14px;
            background: linear-gradient(135deg, rgba(0, 243, 255, 0.35) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(6, 9, 19, 0.95) 100%);
            box-shadow: 0 0 20px rgba(0, 243, 255, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.4);
            text-shadow: 0 0 8px rgba(0, 243, 255, 0.8), 0 0 2px #ffffff;
            animation: platGlow 3s infinite alternate;
        }

        .crown-badge.plat svg {
            color: #ffffff;
            filter: drop-shadow(0 0 5px var(--primary-cyan));
        }

        @keyframes platGlow {
            0% {
                border-color: #a0f0ff;
                box-shadow: 0 0 12px rgba(0, 243, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.2);
            }
            100% {
                border-color: #ffffff;
                box-shadow: 0 0 22px rgba(0, 243, 255, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.6);
            }
        }

.modal-box {
    background: var(--card-bg);
    padding: 30px;
    border: 1px solid var(--primary-cyan);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-cyan);
    color: white;
    font-family: 'Orbitron';
    text-align: center;
    font-size: 16px;
    border-radius: 5px;
    outline: none;
}

#toast {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neon-green);
    color: #000;
    padding: 10px 25px;
    border-radius: 8px;
    font-family: 'Orbitron';
    font-weight: bold;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

#toast.show {
    opacity: 1;
}

#toast.toast-err {
    background: var(--primary-magenta);
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
}

/* ================= UI OVERLAYS (CROWNS, TOP BAR, FX) ================= */
#crowns-container {
    position: absolute;
    top: 10%;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
    pointer-events: none;
}

.crown-badge {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 12px 10px;
    border-radius: 5px;
    font-family: 'Orbitron';
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
    animation: fadeIn 0.5s;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

#top-bar {
    position: absolute;
    top: 70px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    border: 2px solid var(--text-muted);
    color: var(--text-muted);
    background: var(--card-bg);
}

.profile-icon.active {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

#flash-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 9999;
    pointer-events: none;
}

@keyframes flashAnim {
    0% {
        opacity: 1;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

body.massive-shake #container {
    animation: massiveShakeAnim 0.08s infinite !important;
}

@keyframes massiveShakeAnim {
    0% {
        transform: translate(15px, 15px) rotate(2deg);
    }

    25% {
        transform: translate(-15px, -15px) rotate(-2deg);
    }

    50% {
        transform: translate(15px, -15px) rotate(2deg);
    }

    75% {
        transform: translate(-15px, 15px) rotate(-2deg);
    }

    100% {
        transform: translate(15px, 15px) rotate(2deg);
    }
}

/* ================= GAMEPLAY ELEMENTS ================= */
#game-layout {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 14px;
    flex-wrap: wrap;
}

.player-area {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    min-width: 200px;
}

.play-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#stats-hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: 'Orbitron';
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#arrow-display {
    font-family: 'Orbitron';
    font-size: 90px;
    line-height: 1;
    margin: 10px 0 20px 0;
    color: var(--primary-cyan);
    text-shadow: 0 0 25px rgba(0, 243, 255, 0.6);
    transition: color 0.1s;
}

.theme-evil #arrow-display {
    color: var(--evil-purple);
    text-shadow: 0 0 35px rgba(157, 0, 255, 0.8);
}

.hit-glow {
    animation: glowGreen 0.2s ease-out;
}

@keyframes glowGreen {
    0% {
        color: var(--neon-green);
        text-shadow: 0 0 40px var(--neon-green);
        transform: scale(1.15);
    }

    100% {
        color: inherit;
        text-shadow: inherit;
        transform: scale(1);
    }
}

.screen-shake {
    animation: errShake 0.35s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes errShake {

    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);
    }
}

.pressure-container {
    width: 14px;
    height: 180px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.pressure-bar {
    width: 100%;
    height: 50%;
    background: var(--neon-amber);
    border-radius: 10px;
    transition: height 0.1s linear, background 0.2s;
}

#countdown-number {
    font-family: 'Orbitron';
    font-size: 90px;
    color: var(--primary-cyan);
    text-shadow: 0 0 30px var(--primary-cyan);
    animation: pulseCount 0.8s infinite;
}

@keyframes pulseCount {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

#attack-alert {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron';
    font-size: 24px;
    font-weight: 900;
    color: var(--evil-purple);
    text-shadow: 0 0 20px #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}

@keyframes alertPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -30%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -70%);
    }
}

#power-indicator {
    margin-top: 15px;
    font-family: 'Orbitron';
    font-size: 12px;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold);
    animation: pulseCount 0.8s infinite;
    display: none;
}

/* ================= RANKING TABLES ================= */
.rank-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    margin-top: 15px;
    font-family: 'Rajdhani';
}

.rank-table th {
    border-bottom: 1px solid var(--primary-cyan);
    padding: 5px;
    color: var(--primary-cyan);
    font-size: 14px;
}

.rank-table td {
    padding: 8px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rank-first {
    font-size: 1.25em;
    font-weight: 900;
    background: rgba(255, 215, 0, 0.08);
}

.rank-first td {
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

/* ================= MULTIPLAYER ================= */
#opponents-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.opponent-area {
    opacity: 0.6;
    filter: grayscale(30%);
    transition: opacity 0.3s;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.op-title {
    font-family: 'Orbitron';
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.player-status {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 5px 0;
    border-radius: 5px;
    gap: 20px
}

.ready {
    color: var(--neon-green);
}

.waiting {
    color: var(--neon-amber);
}

.duel-layout {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.duel-card {
    flex: 1;
    min-width: 120px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    transition: all 0.3s;
}

.duel-name {
    font-family: 'Orbitron';
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 15px;
    letter-spacing: 1px;
    word-break: break-all;
}

.duel-stat {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.duel-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.duel-stat-val {
    font-family: 'Orbitron';
    font-size: 28px;
    font-weight: 900;
}

.text-green {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.text-red {
    color: var(--primary-magenta);
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

#duel-winner-banner {
    font-family: 'Orbitron';
    font-size: 24px;
    padding: 15px;
    margin-top: 10px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    transform: translateY(20px);
}

#duel-winner-banner.show {
    opacity: 1;
    transform: translateY(0);
}