:root {
    --bg-dark: #8B0000;
    --bg-gradient-start: #CC1A1A;
    --bg-gradient-end: #7A0000;
    --primary: #FFD700;
    --primary-dark: #E6B800;
    --secondary: #FFFFFF;
    --text-main: #ffffff;
    --text-muted: #ffcccc;
    --glass-bg: rgba(0, 0, 0, 0.2);
    --glass-border: rgba(255, 255, 255, 0.15);
    --accent-red: #D41920;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x pan-y;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    animation: fadeIn 0.5s ease;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.content-center {
    width: 90%;
    max-width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* ================= LOGOS ================= */
.logo-top {
    width: 60vw;
    margin-bottom: 2vh;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
    z-index: 10;
}
.logo-activity {
    width: 80vw;
    margin-bottom: 1vh;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
    z-index: 10;
}

/* ================= TYPOGRAPHY ================= */
.main-title {
    font-size: 13vw;
    font-weight: 900;
    position: relative;
    color: var(--primary);
    text-shadow:
        0 0 30px rgba(255,215,0,0.6),
        0 0 60px rgba(255,215,0,0.3),
        0 4px 0 #B8860B,
        0 6px 0 #8B6914;
    margin-bottom: 2vh;
    line-height: 1.1;
    text-transform: uppercase;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.subtitle {
    font-size: 4vw;
    color: rgba(255,255,255,0.9);
    margin-bottom: 6vh;
    text-transform: uppercase;
    letter-spacing: 0.3vw;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 10;
    position: relative;
    font-weight: 300;
}

h2 {
    font-size: 7vw;
    margin-bottom: 3vh;
    color: var(--primary);
    text-shadow:
        0 0 20px rgba(255,215,0,0.5),
        0 3px 0 #B8860B;
}

/* ================= MAIN CTA BUTTON ================= */
.pulse-button {
    display: inline-block;
    padding: 3.5vh 10vw;
    font-size: 5vw;
    font-weight: 900;
    color: var(--accent-red);
    background: linear-gradient(180deg, #FFE44D 0%, #FFD700 40%, #E6B800 100%);
    border-radius: 60px;
    border: 4px solid rgba(255,255,255,0.5);
    box-shadow:
        0 0 40px rgba(255,215,0,0.6),
        0 0 80px rgba(255,215,0,0.3),
        inset 0 2px 0 rgba(255,255,255,0.4),
        0 8px 0 #B8860B;
    cursor: pointer;
    animation: megaPulse 2s infinite, floatButton 3s ease-in-out infinite;
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.3vw;
    z-index: 10;
    position: relative;
    text-shadow: none;
}
.pulse-button:active {
    transform: scale(0.93) translateY(4px);
    box-shadow:
        0 0 20px rgba(255,215,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.2),
        0 2px 0 #B8860B;
}

@keyframes megaPulse {
    0% { box-shadow: 0 0 40px rgba(255,215,0,0.6), 0 0 80px rgba(255,215,0,0.3), inset 0 2px 0 rgba(255,255,255,0.4), 0 8px 0 #B8860B, 0 0 0 0 rgba(255,215,0,0.5); }
    50% { box-shadow: 0 0 60px rgba(255,215,0,0.8), 0 0 120px rgba(255,215,0,0.4), inset 0 2px 0 rgba(255,255,255,0.4), 0 8px 0 #B8860B, 0 0 0 30px rgba(255,215,0,0); }
    100% { box-shadow: 0 0 40px rgba(255,215,0,0.6), 0 0 80px rgba(255,215,0,0.3), inset 0 2px 0 rgba(255,255,255,0.4), 0 8px 0 #B8860B, 0 0 0 0 rgba(255,215,0,0.5); }
}

@keyframes floatButton {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ================= GENERIC BUTTONS ================= */
.btn {
    padding: 2.5vh 5vw;
    font-size: 3.5vw;
    font-weight: 700;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    margin: 0 2vw;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(180deg, #FFE44D, #FFD700, #E6B800);
    color: var(--accent-red);
    font-weight: 900;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 0 #B8860B, 0 0 20px rgba(255,215,0,0.3);
}
.btn-secondary {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.4);
    color: var(--text-main);
}
.btn:active { transform: scale(0.95) translateY(2px); }
.large-btn { width: 100%; margin: 3vh 0; font-size: 3.5vw; padding: 3vh 0; }

/* ================= FORMS & GLASSMORPHISM ================= */
#screen-registro .content-center {
    width: 85%;
    justify-content: flex-start;
    padding-top: 5vh;
    height: 100%;
}

#registro-form {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 4vh 4vw;
    backdrop-filter: blur(10px);
    margin-bottom: 3vh;
    width: 100%;
}

.input-group {
    margin-bottom: 2.5vh;
    text-align: left;
}
.input-group label {
    display: block;
    margin-bottom: 1vh;
    color: var(--primary);
    font-size: 3.2vw;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.virtual-input {
    width: 100%;
    padding: 2vh 2vw;
    font-size: 3.5vw;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,215,0,0.3);
    color: #fff;
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.virtual-input:focus, .virtual-input.active-input {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.action-buttons {
    display: flex;
    width: 100%;
    gap: 3vw;
    justify-content: center;
}
.action-buttons .btn {
    flex: 1;
    padding: 2.5vh 0;
    font-size: 3.5vw;
}

/* ================= HABEAS DATA ================= */
.habeas-data-group {
    margin-top: 1vh;
    text-align: left;
}
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 2vw;
    cursor: pointer;
    position: relative;
    padding-left: 8vw;
}
.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: absolute;
    left: 0;
    top: 0.3vh;
    width: 6vw;
    height: 6vw;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,215,0,0.4);
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.checkbox-container input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}
.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 1.8vw;
    top: 0.5vw;
    width: 1.5vw;
    height: 3vw;
    border: solid var(--accent-red);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}
.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}
.habeas-text {
    font-size: 2.2vw;
    color: rgba(255,255,255,0.7);
    line-height: 1.4;
}
.habeas-text a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 700;
}

/* ---- HABEAS MODAL ---- */
#habeas-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5vh 5vw;
}
#habeas-modal.hidden { display: none !important; }

.habeas-modal-content {
    background: linear-gradient(135deg, #2a0a0a, #1a0505);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 20px;
    padding: 4vh 4vw;
    max-height: 80vh;
    overflow-y: auto;
    width: 100%;
}
.habeas-modal-content h3 {
    color: var(--primary);
    font-size: 4.5vw;
    margin-bottom: 3vh;
    text-align: center;
}
.habeas-body {
    color: rgba(255,255,255,0.8);
    font-size: 2.8vw;
    line-height: 1.6;
}
.habeas-body p { margin-bottom: 2vh; }
.habeas-body ul { padding-left: 4vw; }
.habeas-body li { margin-bottom: 1.5vh; }
.habeas-body strong { color: #fff; }

/* ================= RULES SCREEN ================= */
#screen-reglas .content-center {
    width: 85%;
    padding: 3vh 0;
}

.rules-container {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 20px;
    padding: 3vh 3vw;
    width: 100%;
    backdrop-filter: blur(5px);
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 3vw;
    padding: 2.5vh 0;
    border-bottom: 1px solid rgba(255,215,0,0.1);
}
.rule-item:last-child { border-bottom: none; }

.rule-icon {
    font-size: 8vw;
    flex-shrink: 0;
    width: 12vw;
    text-align: center;
}
.rule-text {
    font-size: 3.2vw;
    color: rgba(255,255,255,0.9);
    line-height: 1.4;
}
.rule-text strong { color: var(--primary); }

/* ================= GAME AREA ================= */
.game-header {
    width: 100%;
    padding: 2.5vh 3vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 3.5vw;
    background: rgba(0,0,0,0.4);
    border-bottom: 3px solid var(--primary);
    z-index: 10;
}
.player-info { font-weight: 700; color: #fff; }
.score-board { color: var(--primary); font-weight: bold; font-size: 5vw; text-shadow: 0 0 10px rgba(255,215,0,0.5); }
.timer-board { color: #fff; font-weight: bold; font-size: 5vw; }

#game-area {
    flex-grow: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 1.2vw;
    padding: 1.2vw;
    background: url('/static/img/game_bg.png') center/cover no-repeat;
}

.game-cell {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

#countdown-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(139,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
}
#countdown-overlay.active { display: flex; }
#countdown-text {
    font-size: 40vw;
    color: var(--primary);
    font-weight: 900;
    text-shadow:
        0 0 50px rgba(255,215,0,0.8),
        0 6px 0 #B8860B;
    animation: zoomIn 1s infinite;
}

@keyframes zoomIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

.target-circle {
    width: 110%;
    height: 110%;
    background: url('/static/img/logo_muneca.png') center/contain no-repeat;
    cursor: pointer;
    animation: targetSuperAnim 1.2s infinite;
    transition: transform 0.1s, filter 0.1s;
    position: relative;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    left: -5%;
    top: -5%;
}
.target-circle:active {
    transform: scale(0.5) rotate(-20deg) !important;
    filter: drop-shadow(0 0 40px #fff) brightness(1.8) !important;
}

@keyframes targetSuperAnim {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; filter: drop-shadow(0 0 0px var(--primary)); }
    20% { transform: scale(1.2) rotate(15deg); opacity: 1; filter: drop-shadow(0 0 20px var(--primary)); }
    40% { transform: scale(0.9) rotate(-10deg); }
    60% { transform: scale(1.1) rotate(5deg); filter: drop-shadow(0 0 30px var(--primary)); }
    80% { transform: scale(0.95) rotate(-5deg); }
    100% { transform: scale(1.05) rotate(0deg); filter: drop-shadow(0 0 15px var(--primary)); }
}

/* ---- ENERGY BURST ON TAP ---- */
.energy-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,215,0,0) 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 30;
    animation: burstExpand 0.5s ease-out forwards;
}

@keyframes burstExpand {
    0% { width: 0; height: 0; opacity: 1; }
    50% { width: 300%; height: 300%; opacity: 0.6; }
    100% { width: 500%; height: 500%; opacity: 0; }
}

.energy-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    border: 3px solid var(--primary);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    z-index: 30;
    animation: ringExpand 0.4s ease-out forwards;
}

@keyframes ringExpand {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; border-width: 4px; }
    100% { transform: translate(-50%, -50%) scale(4); opacity: 0; border-width: 1px; }
}

/* ---- SCREEN SHAKE ---- */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-4px, 2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-3px, -3px); }
    40% { transform: translate(3px, 3px); }
    50% { transform: translate(-2px, 1px); }
    60% { transform: translate(2px, -1px); }
    70% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
    90% { transform: translate(-1px, 1px); }
}

#game-area.shake {
    animation: screenShake 0.4s ease-out;
}

/* ---- COMBO BANNER ---- */
.combo-banner {
    position: absolute;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%) scale(0);
    z-index: 100;
    font-size: 8vw;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(255,215,0,0.8), 0 4px 0 #B8860B;
    pointer-events: none;
    opacity: 0;
    transition: none;
}
.combo-banner.show {
    animation: comboPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes comboPop {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    30% { transform: translateX(-50%) scale(1.3); opacity: 1; }
    60% { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

/* ---- GAME LIGHTNING (activado por rachas) ---- */
.game-lightning-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}
.game-lightning-container.active {
    opacity: 1;
}
.game-lightning-container .lightning {
    animation-duration: 0.6s !important;
}

/* ---- POINT POPUP ---- */
.point-popup {
    position: absolute;
    font-size: 5vw;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(255,215,0,0.8), 0 2px 0 #B8860B;
    pointer-events: none;
    z-index: 60;
    animation: pointFloat 0.8s ease-out forwards;
}
.point-popup.bonus {
    color: #fff;
    font-size: 7vw;
    text-shadow: 0 0 20px #fff, 0 0 40px var(--primary);
}

@keyframes pointFloat {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-8vh) scale(1.5); opacity: 0; }
}

/* ================= RESULTS ================= */
#screen-resultados .content-center {
    width: 90%;
}

/* Rayos de resultados parpadean mucho más rápido */
.results-lightning .lightning {
    animation-duration: 1.5s !important;
}

.results-title {
    font-size: 6vw;
    margin: 1vh 0;
    animation: resultsGlow 1.5s ease-in-out infinite alternate;
}

@keyframes resultsGlow {
    0% { text-shadow: 0 0 20px rgba(255,215,0,0.5), 0 3px 0 #B8860B; }
    100% { text-shadow: 0 0 60px rgba(255,215,0,1), 0 0 120px rgba(255,215,0,0.5), 0 3px 0 #B8860B; }
}

.results-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin: 3vh 0;
}
.player-result {
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 215, 0, 0.3);
    padding: 2.5vh 2vw;
    border-radius: 20px;
    width: 42%;
    animation: resultSlideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.player-result h3 { font-size: 3.5vw; color: rgba(255,255,255,0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-display {
    font-size: 8vw;
    font-weight: bold;
    color: var(--primary);
    margin-top: 1vh;
    text-shadow: 0 0 20px rgba(255,215,0,0.5), 0 3px 0 #B8860B;
}

@keyframes resultSlideIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

.vs-animated {
    font-size: 5vw;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(255,215,0,0.8), 0 3px 0 #B8860B;
    animation: vsPulse 0.8s ease-in-out infinite alternate;
}

@keyframes vsPulse {
    0% { transform: scale(1); text-shadow: 0 0 30px rgba(255,215,0,0.8); }
    100% { transform: scale(1.3); text-shadow: 0 0 60px rgba(255,215,0,1), 0 0 100px rgba(255,215,0,0.5); }
}

.winner-announcement {
    font-size: 5vw;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
    margin-bottom: 2vh;
    animation: winnerEntrance 0.8s ease-out;
}

@keyframes winnerEntrance {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.winner-text {
    color: var(--primary);
    font-size: 8vw;
    font-weight: 900;
    display: block;
    text-shadow: 0 0 30px rgba(255,215,0,0.6), 0 4px 0 #B8860B;
    animation: winnerGlow 1s ease-in-out infinite alternate;
}

@keyframes winnerGlow {
    0% { text-shadow: 0 0 30px rgba(255,215,0,0.6), 0 4px 0 #B8860B; transform: scale(1); }
    100% { text-shadow: 0 0 80px rgba(255,215,0,1), 0 0 150px rgba(255,215,0,0.5), 0 4px 0 #B8860B; transform: scale(1.05); }
}

/* ================= TOAST ================= */
#toast-container {
    position: fixed;
    top: 2vh;
    right: 3vw;
    z-index: 1000;
}
.toast {
    background: linear-gradient(135deg, #FFE44D, #FFD700);
    color: var(--accent-red);
    padding: 2vh 4vw;
    border-radius: 10px;
    margin-bottom: 1vh;
    font-weight: bold;
    font-size: 3vw;
    animation: slideIn 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ================= ADMIN AREA ================= */
#secret-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 120px;
    z-index: 999;
}

#admin-pin-modal {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(100,0,0,0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}
#admin-pin-modal.hidden { display: none !important; }

.pin-container {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255,215,0,0.3);
    padding: 5vh 6vw;
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    width: 70%;
}
.pin-container h3 { color: var(--primary); font-size: 5vw; margin-bottom: 2vh; }
.pin-container p { color: rgba(255,255,255,0.7); font-size: 3.5vw; margin-bottom: 3vh; }

#admin-pin-input {
    width: 100%;
    padding: 2vh;
    font-size: 6vw;
    text-align: center;
    letter-spacing: 2vw;
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--primary);
    color: #fff;
    border-radius: 10px;
    margin-bottom: 3vh;
    outline: none;
    font-family: inherit;
}

.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2vw;
}

.pin-key {
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 10px;
    padding: 3vh;
    font-size: 5vw;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.pin-key:active { background: var(--primary); color: var(--accent-red); }
.pin-key.action { background: var(--primary); color: var(--accent-red); font-weight: bold; }

/* ================= LIGHTNING ANIMATIONS ================= */
.lightning-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    mix-blend-mode: screen;
}
.lightning {
    position: absolute;
    opacity: 0;
    animation: flashRealistic 3s infinite;
}
.main-bolt {
    fill: #FFE44D;
    filter: drop-shadow(0 0 15px var(--primary)) drop-shadow(0 0 30px rgba(255,215,0,0.6));
}
.branch {
    fill: none;
    stroke: #FFE44D;
    stroke-width: 2;
    filter: drop-shadow(0 0 10px var(--primary));
}

.l1 { top: -5%; left: 10%; height: 60vh; width: 30vw; animation-delay: 0.1s; animation-duration: 4.2s; transform: rotate(15deg); }
.l2 { top: -10%; right: 10%; height: 80vh; width: 40vw; animation-delay: 1.7s; animation-duration: 5.5s; transform: rotate(-15deg); }
.l3 { top: 40%; left: -10%; height: 50vh; width: 25vw; animation-delay: 2.3s; animation-duration: 3.8s; transform: rotate(100deg); }
.l4 { bottom: -5%; right: -5%; height: 70vh; width: 35vw; animation-delay: 0.9s; animation-duration: 4.9s; transform: rotate(-140deg); }
.l5 { top: 20%; right: -15%; height: 60vh; width: 45vw; animation-delay: 3.1s; animation-duration: 6.1s; transform: rotate(-80deg); }

@keyframes flashRealistic {
    0%, 90% { opacity: 0; }
    91% { opacity: 1; }
    92% { opacity: 0.2; }
    93% { opacity: 1; }
    94% { opacity: 0; }
    95% { opacity: 0.8; }
    96%, 100% { opacity: 0; }
}

/* ================= DECORATIVE LINES (brand stripes) ================= */
.brand-stripes {
    position: absolute;
    left: 0;
    top: 0;
    width: 6vw;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: flex;
    gap: 0.8vw;
    padding-left: 1vw;
}
.brand-stripes .stripe {
    width: 1.2vw;
    height: 100%;
    border-radius: 0 0 5px 5px;
}
.brand-stripes .stripe:nth-child(1) { background: #FFD700; opacity: 0.7; }
.brand-stripes .stripe:nth-child(2) { background: #FF8C00; opacity: 0.5; }
.brand-stripes .stripe:nth-child(3) { background: #FFD700; opacity: 0.3; }

/* ==========================================================
   v2.0 — DUELO EN TIEMPO REAL (2 pantallas)
   ========================================================== */

/* Tag de duelo en standby */
.duelo-tag {
    font-size: 2.2vh;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--primary);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 50px;
    padding: 1vh 3vw;
    margin: 1.5vh 0;
}

/* Badge de conectividad (esquina inferior del standby) */
.conexion-badge {
    margin-top: 3vh;
    font-size: 1.6vh;
    font-weight: 500;
    padding: 0.8vh 2vw;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}
.conexion-badge.bien { color: #9fffb0; border-color: rgba(120, 255, 150, 0.4); }
.conexion-badge.medio { color: #ffe28a; border-color: rgba(255, 220, 120, 0.4); }
.conexion-badge.mal { color: #ffb0b0; border-color: rgba(255, 120, 120, 0.5); }

/* Pantalla de invitación */
.invite-title {
    font-size: 6vh;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    margin: 2vh 0 1vh;
    animation: pulseTitle 1.2s infinite alternate;
}
.invite-sub {
    font-size: 2.6vh;
    line-height: 1.5;
    color: var(--text-main);
    margin-bottom: 4vh;
    text-align: center;
}
@keyframes pulseTitle {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

/* Pantalla de espera */
.espera-spinner {
    width: 9vh;
    height: 9vh;
    border: 0.9vh solid rgba(255, 215, 0, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: girar 1s linear infinite;
    margin: 3vh auto;
}
@keyframes girar { to { transform: rotate(360deg); } }
.espera-sub {
    font-size: 2.2vh;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Header del duelo: TÚ | tiempo | RIVAL */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1vw;
}
.ph-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 22vw;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.6vh 1.5vw;
}
.ph-col.rival { border-color: rgba(255, 255, 255, 0.25); }
.ph-label {
    font-size: 1.5vh;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    max-width: 24vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ph-score {
    font-size: 3.4vh;
    font-weight: 900;
    color: var(--text-main);
    transition: color 0.2s, text-shadow 0.2s;
}
.ph-score.ganando {
    color: var(--primary);
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.8);
}

/* Tarjeta del ganador en resultados */
.player-result.ganador-card {
    border: 2px solid var(--primary);
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.45);
    transform: scale(1.05);
}

/* ==========================================================
   v2.1 — ESPECTÁCULO: stats, dorada, urgencia, récord, confeti
   ========================================================== */

.hidden { display: none !important; }

/* Récord del día en standby */
.record-badge {
    margin-top: 2vh;
    font-size: 2.1vh;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: var(--primary);
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid var(--primary);
    border-radius: 50px;
    padding: 1.2vh 3vw;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
    animation: recordGlow 2s ease-in-out infinite alternate;
}
@keyframes recordGlow {
    from { box-shadow: 0 0 8px rgba(255, 215, 0, 0.25); }
    to { box-shadow: 0 0 28px rgba(255, 215, 0, 0.6); }
}

/* Barra de tiempo */
#time-bar-wrap {
    height: 1.2vh;
    background: rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
#time-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--primary), #FFA500);
    transition: width 0.12s linear;
}
#time-bar.urgente {
    background: linear-gradient(90deg, #FF3B30, #FF6B63);
    animation: barraPulso 0.5s ease-in-out infinite;
}
@keyframes barraPulso {
    50% { filter: brightness(1.6); }
}

/* Urgencia en los últimos 5 segundos */
#game-area.urgencia {
    box-shadow: inset 0 0 12vw rgba(255, 40, 30, 0.55);
    animation: urgenciaPulso 1s ease-in-out infinite;
}
@keyframes urgenciaPulso {
    50% { box-shadow: inset 0 0 18vw rgba(255, 40, 30, 0.8); }
}

/* Flash blanco al arrancar el duelo */
#flash-inicio {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 40;
}
#flash-inicio.activo {
    animation: flashInicio 0.45s ease-out;
}
@keyframes flashInicio {
    0% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* Muñeca Dorada */
.target-circle.dorada {
    filter: drop-shadow(0 0 22px #FFD700) drop-shadow(0 0 45px rgba(255, 200, 0, 0.9)) saturate(1.6) brightness(1.25);
    animation: targetSuperAnim 0.8s infinite, doradaGiro 0.8s linear infinite;
}
@keyframes doradaGiro {
    50% { filter: drop-shadow(0 0 34px #FFF3B0) drop-shadow(0 0 60px rgba(255, 215, 0, 1)) saturate(1.8) brightness(1.45); }
}
.point-popup.dorada-pop {
    color: #FFD700;
    font-size: 4.2vh;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
}
.point-popup.fallo {
    color: #FF6B63;
    text-shadow: 0 0 10px rgba(255, 60, 50, 0.8);
}

/* Toque en falso */
.game-cell.fallo-flash {
    animation: falloFlash 0.35s ease-out;
}
@keyframes falloFlash {
    0% { background: rgba(255, 40, 30, 0.55); border-color: #FF3B30; }
    100% { background: rgba(255, 215, 0, 0.05); }
}

/* Punch del marcador con cada cambio */
.ph-score.punch {
    animation: scorePunch 0.25s ease-out;
}
@keyframes scorePunch {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Banner de nuevo récord */
.nuevo-record {
    font-size: 2.6vh;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #2b1500;
    background: linear-gradient(90deg, #FFD700, #FFF3B0, #FFD700);
    border-radius: 50px;
    padding: 1.2vh 3.5vw;
    margin-bottom: 1vh;
    animation: recordEntrada 0.6s cubic-bezier(0.2, 1.6, 0.4, 1), recordBrillo 1.2s linear infinite;
    background-size: 200% 100%;
}
@keyframes recordEntrada {
    0% { transform: scale(0) rotate(-8deg); }
    100% { transform: scale(1) rotate(0); }
}
@keyframes recordBrillo {
    to { background-position: 200% 0; }
}

/* Confeti */
#confeti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
}

/* Tabla de estadísticas */
.stats-tabla {
    width: 88vw;
    max-width: 900px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 2vh 3vw;
    margin-top: 1.5vh;
}
.stats-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2vw;
    padding-bottom: 1.2vh;
    border-bottom: 2px solid rgba(255, 215, 0, 0.35);
    margin-bottom: 0.8vh;
}
.stats-nombre {
    font-size: 2.4vh;
    font-weight: 900;
    color: var(--primary);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stats-nombre.rival { text-align: left; color: var(--text-main); }
.stats-vs { font-size: 2.4vh; }
.stat-row {
    display: grid;
    grid-template-columns: 1fr minmax(34vw, auto) 1fr;
    align-items: center;
    gap: 2vw;
    padding: 1.1vh 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 2.3vh;
    font-weight: 700;
}
.stat-row:last-child { border-bottom: none; }
.stat-row span:first-child { text-align: right; font-variant-numeric: tabular-nums; }
.stat-row span:last-child { text-align: left; font-variant-numeric: tabular-nums; }
.stat-row .stat-label {
    text-align: center;
    font-size: 1.7vh;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.stat-row.destacada { font-size: 3.2vh; }
.stat-row span.mejor {
    color: var(--primary);
    text-shadow: 0 0 14px rgba(255, 215, 0, 0.8);
}
.stat-row span.mejor::after {
    content: ' ★';
    font-size: 0.7em;
}

/* ==========================================================
   v2.2 — JUICE: golpe, fiebre, líder, clímax, dominio
   ========================================================== */

/* Barra tira-y-afloja (dominio del duelo, legible a 10 metros) */
#dominio-wrap {
    height: 1.4vh;
    background: rgba(255, 255, 255, 0.28);
    overflow: hidden;
}
#dominio-mio {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #E6B800, var(--primary));
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Golpe con peso: el objetivo se congela brillante y colapsa */
.target-circle.golpeada {
    animation: targetHit 140ms cubic-bezier(0.55, 0, 1, 0.45) forwards !important;
}
@keyframes targetHit {
    0% { transform: scale(1.15); filter: brightness(2.2) drop-shadow(0 0 40px #FFFFFF); }
    38% { transform: scale(1.15); filter: brightness(2.2) drop-shadow(0 0 40px #FFFFFF); }
    100% { transform: scale(0) rotate(-25deg); opacity: 0; }
}

/* Objetivo perdido: cae "muerto" en gris — el error se entiende al instante */
.target-circle.perdida {
    animation: targetMiss 260ms cubic-bezier(0.55, 0, 1, 0.45) forwards !important;
}
@keyframes targetMiss {
    0% { transform: scale(1); filter: grayscale(0); opacity: 1; }
    100% { transform: translateY(14vh) scale(0.6) rotate(20deg); opacity: 0; filter: grayscale(1) brightness(0.6); }
}

/* Flash radial en el punto exacto del toque (nodo único, cero churn de GC) */
#hit-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 55;
    opacity: 0;
    background: radial-gradient(circle at var(--tx, 50%) var(--ty, 50%), rgba(255, 244, 180, 0.4), transparent 22%);
}
#hit-flash.activo { animation: hitFlash 130ms linear; }
@keyframes hitFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Fiebre de racha: viñeta dorada-roja que enmarca al jugador en llamas */
#fever {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 45;
    opacity: 0;
    transition: opacity 0.35s ease-out;
    background: radial-gradient(ellipse at center, transparent 52%, rgba(255, 183, 0, 0.45) 82%, rgba(212, 25, 32, 0.35) 100%);
}
#fever.fever-1 { opacity: 0.35; }
#fever.fever-2 { opacity: 0.6; }
#fever.fever-3 { opacity: 0.8; }
#fever.fever-4 { opacity: 1; animation: feverPulse 1.2s ease-in-out infinite alternate; }
@keyframes feverPulse {
    from { opacity: 0.75; }
    to { opacity: 1; }
}

/* Golpe de líder: flash de borde dorado en toda la pantalla */
#lider-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
}
#lider-flash.activo { animation: liderFlash 0.68s ease-out; }
@keyframes liderFlash {
    0% { opacity: 1; box-shadow: inset 0 0 0 1.5vw #FFD700; }
    100% { opacity: 0; box-shadow: inset 0 0 0 0.2vw #FFD700; }
}

/* Racha perdida / te alcanzaron: banner en blanco apagado (el dorado es solo para lo bueno) */
.combo-banner.rota {
    color: rgba(255, 255, 255, 0.85) !important;
    text-shadow: 0 0 14px rgba(212, 25, 32, 0.9) !important;
}

/* Clímax de los últimos 10 segundos: la pantalla se calienta */
#screen-juego.climax {
    background: radial-gradient(ellipse at center, #E62020 0%, #4A0000 100%);
    transition: background 1.5s ease;
}

/* Cifra gigante coreable de los últimos 5 segundos (detrás de la cuadrícula) */
#cifra-gigante {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 45vh;
    font-weight: 900;
    color: rgba(255, 215, 0, 0);
    pointer-events: none;
    z-index: 1;
}
#cifra-gigante.zoom { animation: cifraZoom 0.9s ease-out; }
@keyframes cifraZoom {
    0% { color: rgba(255, 215, 0, 0.3); transform: scale(0.6); }
    100% { color: rgba(255, 215, 0, 0); transform: scale(1.25); }
}

/* QR del ranking en el standby */
.qr-standby {
    position: absolute;
    top: 2vh;
    right: 2.2vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6vh;
    z-index: 15;
}
.qr-standby img {
    width: 11vh;
    height: 11vh;
    background: #fff;
    border-radius: 10px;
    padding: 0.6vh;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.qr-standby span {
    font-size: 1.4vh;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.35);
    padding: 0.3vh 1.2vw;
    border-radius: 50px;
}
