/* ==================== VARIABLES Y ESTILOS GLOBALES ==================== */
:root {
    --primary-color: #1a1f36;
    --secondary-color: #3498db;
    --accent-color: #2ecc71;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 15px 40px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ocultar scrollbar en navegadores basados en WebKit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    display: none;
}

/* Ocultar scrollbar en Firefox */
* {
    scrollbar-width: none;      /* Oculta el scrollbar */
    -ms-overflow-style: none;   /* IE y Edge legacy */
}

/* Asegurar que el scroll siga funcionando */
html, body {
    overflow: auto;
}

body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-image: url('img/bg1.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

body.gameScreen-active,
body.endScreen-active {
    background-image: url('img/bg2.jpg');
}

/* Contenedor principal: limitar ancho del proyecto */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* Focus visible para mejor accesibilidad */
*:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Ayuda genérica para ocultar elementos */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==================== HEADER ==================== */
header {
    background: transparent !important;
    padding: 20px 0 !important;
    border-radius: 10px !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-family: 'Bebas Neue', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 6.5rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: 400;
    word-spacing: 6px;
    letter-spacing: 4px !important;
    color: white;
    -webkit-text-fill-color: white;
    -webkit-text-stroke: 0;
    text-stroke: 0;
}

body.gameScreen-active header,
body.endScreen-active header {
    display: none;
}

body.startScreen-active header {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 10px !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

body.startScreen-active header h1 {
    text-shadow: none !important;
    color: white;
    -webkit-text-fill-color: white;
    -webkit-text-stroke: 0;
    text-stroke: 0;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ==================== PANTALLAS (SCREENS) ==================== */
.screen {
    display: none;
    background: var(--card-bg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    overflow: visible;
}

.screen.active {
    display: block;
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    box-shadow: none;
    z-index: 10;
}

#startScreen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 90vw;
}

#gameScreen.active {
    background: transparent !important;
    box-shadow: none !important;
}

#gameScreen.active.showing-results {
    background: var(--card-bg) !important;
    box-shadow: var(--shadow-lg) !important;
}

#gameScreen.active.waiting-results {
    background: transparent !important;
    box-shadow: none !important;
}

#gameScreen.active.waiting-results.showing-results {
    background: transparent !important;
    box-shadow: none !important;
}

#gameScreen.active.waiting-results.showing-results .scoreboard,
#gameScreen.active.waiting-results.showing-results .move-selection,
#gameScreen.active.waiting-results.showing-results .round-result,
#gameScreen.active.waiting-results.showing-results .scoreboard,
#gameScreen.active.waiting-results.showing-results .move-selection {
    background: var(--card-bg) !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: 10px !important;
}

#endScreen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Usar altura calculada para compensar el padding del body y evitar scroll de página */
    height: calc(100vh - 40px);
    padding: 0 20px;
    background: transparent !important;
    box-shadow: none !important;
    overflow: hidden;
}

body.gameScreen-active #startScreen,
body.endScreen-active #startScreen {
    display: none !important;
}

/* ==================== BOTONES ==================== */
.btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:focus {
    outline: 3px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--text-color) 0%, #1a252f 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: #1a252f;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#findMatchBtn {
    margin: 0;
}

/* ==================== PANTALLA DE INICIO ==================== */
.start-content {
    background: transparent !important;
    box-shadow: none !important;
    display: flex;
    text-align: center;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.start-content .btn {
    flex: 0 0 auto;
}

#playerName {
    flex: 0 0 320px;
    width: auto;
    max-width: none;
    padding: 12px 14px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    margin: 0;
    transition: border-color 0.3s;
}

#playerName:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ==================== PANTALLA DE ESPERA ==================== */
#waitingScreen {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 35, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 0;
    animation: none !important;
}

#waitingScreen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.waiting-content {
    text-align: center;
    padding: 40px 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    color: white;
}

.waiting-content p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.waiting-container {
    width: 100%;
    order: -1;
}

.waiting-opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.waiting-opponent.hidden {
    display: none;
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== PANTALLA DE JUEGO - HEADER Y SCOREBOARD ==================== */
.game-header {
    margin-bottom: 30px;
}

.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    background: white;
    border: 2px solid var(--success-color);
}

.player-score {
    flex: 1;
    text-align: center;
}

.player-name {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

.player-name .user-icon {
    margin-right: 6px;
    color: var(--secondary-color);
}

.user-icon {
    margin-left: 6px;
    color: var(--secondary-color);
    font-size: 0.85em;
}

.player-name .player-name-text {
    font-weight: 700;
}

.score {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin: 0 20px;
}

.round-info {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-color);
}

.scoreboard .round-info {
    flex-basis: 100%;
    order: 3;
    text-align: center;
    margin-top: 8px;
}

/* ==================== PANTALLA DE JUEGO - CONTENIDO ==================== */
#gameScreen .game-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
    box-shadow: none !important;
}

#gameScreen .game-content.show-results {
    flex-direction: column;
    align-items: center;
}

/* ==================== SELECCIÓN DE MOVIMIENTOS ==================== */
.move-selection {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--success-color);
}

.move-selection h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    text-align: center;
}

.selection-groups-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
}

.selection-group {
    flex: 1;
    padding: 20px;
    border-radius: 10px;
    overflow: visible;
}

.selection-group h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
    text-align: center;
}

.instruction {
    margin-bottom: 15px;
    color: var(--text-color);
    font-style: italic;
    text-align: center;
    font-size: 0.9rem;
}

/* ==================== SELECCIÓN DE ZONA (PORTERÍA) ==================== */
.goal-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
    overflow: visible;
}

.goal-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
    overflow: visible;
}

.goal-image {
    max-width: 100%;
    width: auto;
    height: auto;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    display: block;
    aspect-ratio: 1120 / 562;
    object-fit: contain;
}

.zone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.zone-overlay .zone {
    position: absolute;
    border: 1px solid rgba(52,152,219,0.12);
    transition: background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    pointer-events: none;
    background: rgba(52,152,219,0.02);
    cursor: pointer;
}

.zone-overlay .zone.selected {
    background: rgba(52,152,219,0.45) !important;
    border-color: var(--secondary-color) !important;
    border-width: 3px !important;
    box-shadow: 0 0 18px rgba(52,152,219,0.65);
    z-index: 5;
}

.zone-overlay .zone.hover {
    background: rgba(52,152,219,0.25);
    border-color: rgba(52,152,219,0.45);
    box-shadow: 0 0 10px rgba(52,152,219,0.35);
    z-index: 4;
}

.zone-overlay .zone:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    background: rgba(52,152,219,0.3);
    border-color: var(--secondary-color);
    box-shadow: 0 0 12px rgba(52,152,219,0.5);
    z-index: 6;
}

.zone-overlay .zone:focus:not(.selected) {
    background: rgba(52,152,219,0.3);
}

.zone-overlay .zone:focus.selected {
    background: rgba(52,152,219,0.55) !important;
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.selected-zone {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-25%);
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    min-width: 150px;
    text-align: center;
    z-index: 10;
    display: none !important;
}

.selected-zone:empty {
    display: none;
}

/* ==================== OPCIONES DE SELECCIÓN (RADIOS) ==================== */
.options {
    display: grid;
    gap: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-group label:first-child {
    font-weight: 600;
    color: var(--text-color);
}

.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 100px;
    justify-content: center;
}

.radio-label:hover {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.05);
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--secondary-color);
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.1);
}

.radio-label:focus-within {
    outline: 3px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

#submitMoveBtn {
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0;
    padding: 15px;
    font-size: 1.1rem;
    display: block;
}

/* ==================== RESULTADO DE RONDA ==================== */
.round-result {
    padding: 20px;
    flex: 1;
    width: 100%;
    border: 2px solid var(--success-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.round-result.hidden {
    display: none;
}

.round-result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.round-result-header h3 {
    margin: 0;
    text-align: center;
    color: var(--primary-color);
}

/* ==================== ANIMACIONES DE RESULTADO ==================== */
.animation-container {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-in;
}

.animation-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.animation-item {
    text-align: center;
    padding: 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.animation-item h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.goal-animation-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 300px;
    width: 100%;
    border-radius: 10px;
    padding: 20px;
    justify-content: center;
}

.ball {
    position: absolute;
    width: 6%;
    height: auto;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    pointer-events: none;
    z-index: 6;
    transform-origin: center center;
}

.ball.animate {
    animation: ballMove 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes ballMove {
    0% {
        transform: translate(-50%, calc(-50% - 0.8%)) scale(0.225);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.95;
    }
}

.goal-result-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.goal-result-image {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1120 / 562;
    object-fit: contain;
}

.zone-indicator {
    position: absolute;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    transition: opacity 0.5s ease-in, transform 2.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 5;
    transform-origin: center center;
    transform: translate(-50%, -50%) scale(0.22);
}

.zone-indicator.show {
    opacity: 1;
}

/* Animaciones específicas para cada zona */
.zone-indicator.zone-top {
    animation: porterJump 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-bottom {
    animation: porterDive 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-left {
    animation: porterMoveLeft 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-right {
    animation: porterMoveRight 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-top-left {
    animation: porterJumpLeft 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-top-right {
    animation: porterJumpRight 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-bottom-left {
    animation: porterDiveLeft 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zone-indicator.zone-bottom-right {
    animation: porterDiveRight 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes porterJump {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(-50%, calc(-50% - 0.8%)) scale(0.225);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterDive {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(-50%, calc(-50% + 0.8%)) scale(0.215);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterMoveLeft {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% - 0.8%), -50%) scale(0.225);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterMoveRight {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% + 0.8%), -50%) scale(0.225);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterJumpLeft {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% - 0.8%), calc(-50% - 0.8%)) scale(0.225);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterJumpRight {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% + 0.8%), calc(-50% - 0.8%)) scale(0.225);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterDiveLeft {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% - 0.8%), calc(-50% + 0.8%)) scale(0.215);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

@keyframes porterDiveRight {
    0% {
        transform: translate(-50%, -50%) scale(0.22);
    }
    50% {
        transform: translate(calc(-50% + 0.8%), calc(-50% + 0.8%)) scale(0.215);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.22);
    }
}

/* ==================== DETALLES Y PUNTUACIÓN DE RESULTADO ==================== */
.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.result-item {
    padding: 15px;
    background: white;
    border-radius: 0;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.result-item strong {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.result-item p {
    margin: 5px 0;
    color: var(--text-color);
    text-align: center;
    width: 100%;
}

.result-item .points {
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.hit-explanation {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-color);
    font-style: italic;
    padding: 5px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

/* Indicadores de acierto */
.hit-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hit-badge.total {
    background-color: var(--success-color);
    color: white;
}

.hit-badge.partial {
    background-color: var(--warning-color);
    color: white;
}

.hit-badge.miss {
    background-color: var(--danger-color);
    color: white;
}

.scoring-explanation {
    background: rgba(52, 152, 219, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary-color);
}

.scoring-explanation p {
    margin-bottom: 10px;
    color: var(--text-color);
}

.scoring-explanation ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.scoring-explanation li {
    margin-bottom: 5px;
    color: var(--text-color);
}

.total-scores {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    font-size: 1.2rem;
}

.total-scores strong {
    color: var(--secondary-color);
    font-size: 1.5rem;
}

.result-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.result-actions button {
    display: none;
    flex: 0 0 auto;
    min-width: 180px;
    padding: 12px 24px;
}

/* ==================== PANTALLA FINAL ==================== */
#endScreen .end-content {
    background: var(--card-bg);
    border-radius: 10px;
    border: 2px solid var(--success-color);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    /* Evitar que el contenido empuje la página: limitar altura interna y permitir scroll interno si hace falta */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.end-content {
    text-align: center;
    padding: 40px 20px;
}

.end-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--primary-color);
}

/* End screen actions: colocar en columna y botones del mismo tamaño */
#endScreen .end-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

/* Botones de la pantalla final: mismo ancho/alto (responsivos) */
#endScreen .end-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    height: 56px;
    padding: 12px 20px;
    min-width: unset;
    box-sizing: border-box;
}

/* Reducir tamaño de iconos Font Awesome dentro de la pantalla final */

/* Reducir tamaño de iconos Font Awesome dentro de la pantalla final */
#endScreen .fa,
#endScreen .fas,
#endScreen .far,
#endScreen .fal {
    font-size: 0.9rem;
    line-height: 1;
}

/* Reducir tamaño de las cadenas que contienen el icono (paréntesis) dentro de la pantalla final */
#endScreen .user-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* También aplica el estilo a la clase genérica .end-actions (por si se usa sin #endScreen) */
.end-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}
.end-actions .btn {
    width: 100%;
    max-width: 320px;
    height: 56px;
}

.end-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.winner-text {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 1px;
}

.winner-text.win {
    color: var(--success-color);
}

.winner-text.lose {
    color: var(--danger-color);
}

.winner-text.tie {
    color: var(--warning-color);
}

.final-scores {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.08) 0%, rgba(46, 204, 113, 0.08) 100%);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.final-score-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 1.2rem;
}

.final-score-item span:first-child {
    font-weight: 600;
    color: var(--text-color);
}

.final-score-item span:last-child {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Estadísticas finales */
.final-stats {
    margin-top: 20px;
    background: white;
    padding: 15px;
    border-radius: 10px;
}

.stats-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.stat-block {
    background: var(--bg-color);
    padding: 12px;
    border-radius: 10px;
    min-width: 200px;
    text-align: left;
}

.stat-block strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}

/* ==================== MODAL DE INFORMACIÓN ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 0;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.close-modal-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-modal-btn:hover {
    background-color: var(--bg-color);
}

.modal-body {
    padding: 20px;
}

.modal-body ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.modal-body li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.modal-body li:last-child {
    border-bottom: none;
}

.modal-body p {
    margin: 0;
    color: var(--text-color);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
    background: var(--bg-color);
    border-radius: 0 0 15px 15px;
}

.info-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s;
}

#viewStatsBtn {
    margin-top: 15px;
}

#viewStatsBtn.hidden {
    display: none !important;
}

/* ==================== ESTADÍSTICAS MODAL ==================== */
.stats-grid-modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.stat-block-modal {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(52, 152, 219, 0.1) 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--secondary-color);
    text-align: left;
}

.stat-block-modal strong {
    display: block;
    margin-bottom: 16px;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(52, 152, 219, 0.2);
}

.stat-row:last-of-type {
    border-bottom: none;
}

.stat-row.accent {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 2px solid var(--secondary-color);
    background: rgba(52, 152, 219, 0.08);
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 6px;
    font-weight: 600;
}

.stat-label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 4px 12px;
    border-radius: 6px;
    min-width: 50px;
    text-align: center;
}

.stat-value.success {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success-color);
}

.stat-value.warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning-color);
}

.stat-value.danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger-color);
}

.stat-value-large {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--secondary-color);
}

/* ==================== NOTIFICACIONES ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: var(--text-color);
    color: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification.hidden {
    display: none;
}

/* ==================== ANIMACIONES GLOBALES ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==================== FOOTER ==================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9rem;
    opacity: 1;
    z-index: 5;
    display: none;
    width: 100%;
}

body.startScreen-active footer {
    display: block;
}

body:not(.startScreen-active) footer {
    display: none !important;
}

footer p {
    margin: 0;
    letter-spacing: 0.5px;
}

