/* ================= CONTAINERS & BASE ================= */
body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 40px;
    overflow-x: hidden;
}

#container {
    position: relative;
    background: var(--card-bg, rgba(13, 20, 36, 0.88));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.15);
    padding: 30px 40px;
    width: 480px;
    max-width: 95vw;
    text-align: center;
    transition: width 0.3s ease;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ================= TELAS E TEXTOS ================= */
.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    margin: 0 0 5px 0;
    color: var(--neon-green);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
    margin-bottom: 2px;
}

/* ================= BOTÕES (Estilo Letrinhas) ================= */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.btn {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 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: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.btn-gold {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--gold);
    color: var(--gold);
    margin-top: 15px;
}

.btn-hc {
    border-color: var(--primary-magenta);
    color: var(--primary-magenta);
}

.btn-hc:hover {
    background: rgba(255, 0, 85, 0.15);
    box-shadow: 0 0 15px rgba(255, 0, 85, 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(--primary-cyan);
    color: var(--primary-cyan);
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

/* ================= INPUTS & MODALS ================= */
input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-green);
    color: white;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    font-size: 16px;
    border-radius: 5px;
    outline: none;
    box-sizing: border-box;
}

.modal-box {
    background: var(--card-bg, rgba(13, 20, 36, 0.95));
    padding: 30px;
    border: 1px solid var(--neon-green);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 auto;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

/* ================= RANKINGS ================= */
.rank-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    margin-top: 15px;
    font-family: 'Rajdhani', sans-serif;
}

.rank-table th {
    border-bottom: 1px solid var(--neon-green);
    padding: 5px;
    color: var(--neon-green);
    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);
}

/* ================= GAMEPLAY ================= */
#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;
    width: 100%;
    box-sizing: border-box;
}

#local-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
}

#stats-hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#letters-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 34px;
    font-weight: 900;
    color: var(--primary-cyan);
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    margin: 20px 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 80px;
    overflow: visible;
    white-space: nowrap;
    padding: 5px 10px;
    box-sizing: border-box;
}

.letter-typed {
    color: var(--text-muted);
    text-shadow: none;
    opacity: 0.3;
}

.letter-current {
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green);
    transform: scale(1.2);
    display: inline-block;
}

.heart-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-magenta);
}

.heart-broken {
    color: rgba(255, 0, 85, 0.3);
}

.pressure-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    margin-bottom: 15px;
}

.pressure-bar {
    height: 100%;
    background: var(--neon-amber);
    transition: width 0.1s linear, background 0.2s;
}

#countdown-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 90px;
    color: var(--neon-green);
    text-shadow: 0 0 30px var(--neon-green);
    animation: pulseCount 0.8s infinite;
}

@keyframes pulseCount {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ================= MULTIPLAYER ================= */
#opponents-container {
    display: flex;
    gap: 15px;
    flex-direction: column;
    justify-content: center;
}

.opponent-area {
    opacity: 0.6;
    filter: grayscale(30%);
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.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;
    width: 100%;
    box-sizing: border-box;
    gap: 20px
}

.ready { color: var(--neon-green); font-weight: bold; }
.waiting { color: var(--text-muted); font-weight: bold; }

.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;
}

.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); }
}

/* =========================================================
   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;
    gap: 10px;
}

/* 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;
}