/* ==============================================
   RUNNER 3D - Estilos principales
   ============================================== */

/* --- Reset y base --- */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    margin: 0;
    padding: 0;
}

#contenedor {
    margin: 0;
    padding: 0;
    position: absolute;
    left: 0;
    top: 0;
    border: 0;
}

#myCanvas {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

#canvasOculto {
    display: none;
}

/* --- Animaciones --- */
.floatingComic {
    animation-name: floatingComic;
    -webkit-animation-name: floatingComic;
    animation-duration: 2.5s;
    -webkit-animation-duration: 2.5s;
    animation-iteration-count: infinite;
    -webkit-animation-iteration-count: infinite;
}

@keyframes floatingComic {
    0%   { transform: translateY(0%) scaleY(.95) scaleX(.95); }
    50%  { transform: translateY(-2%) scaleY(1.05) scaleX(1.05); }
    100% { transform: translateY(0%) scaleY(.95) scaleX(.95); }
}

@-webkit-keyframes floatingComic {
    0%   { -webkit-transform: translateY(0%) scaleY(.95) scaleX(.95); }
    50%  { -webkit-transform: translateY(-2%) scaleY(1.05) scaleX(1.05); }
    100% { -webkit-transform: translateY(0%) scaleY(.95) scaleX(.95); }
}

@keyframes crecerYMover {
    0%   { font-size: 0; transform: translate(0, 0); opacity: .6; }
    75%  { font-size: 3em; opacity: 1; }
    100% { font-size: 5em; transform: translate(var(--move-x, 0), -20px); opacity: 0; }
}

@keyframes crecerYDesvanecer {
    0%   { font-size: 3em; opacity: 0; transform: translate(-50%, -50%); }
    50%  { font-size: 4em; opacity: 1; transform: translate(-50%, -50%); }
    100% { font-size: 5em; opacity: 0; transform: translate(-50%, -50%); }
}

#feedbackTick.animate-tick {
    font-size: 25em !important;
    transition: font-size 1s ease-out;
}

#acierto.animate-acierto {
    animation: crecerYDesvanecer 4s ease-out forwards;
}

/* --- Botones de control --- */
.btn-control {
    position: absolute;
    border-radius: 50%;
    color: white;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

#botonFrena {
    background: rgba(0, 0, 0, 0.3);
}

#botonComienza {
    background: rgba(50, 220, 50, 0.9);
}

#botonAcelera {
    display: none;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, .8);
}

/* --- Coins feedback --- */
#coinsText {
    position: absolute;
    animation-duration: 0.5s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    font-weight: bolder;
    color: yellow;
    text-shadow: 1px 1px 2px black;
}

/* --- Panel de trivia (pregunta) --- */
#divTrivia {
    cursor: default;
    border-radius: 5px;
    background-color: rgba(7, 7, 7, .25);
    display: none;
}

#divImgTrivia {
    cursor: default;
    border-radius: 5px;
    border: 1px solid white;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: none;
}

#divTextTrivia {
    cursor: default;
    border-radius: 5px;
    align-items: center;
    display: flex;
    justify-content: center;
    text-align: center;
}

#spanTextTrivia {
    font-family: 'Carter One', cursive;
    font-weight: 400;
    line-height: 110%;
    display: none;
    color: #FFFFFF;
    text-shadow: -1px -1px 1px #000000, 1px 1px 1px #000000, 
                 -1px 1px 1px #000000, 1px -1px 1px #000000;
}

/* --- Paneles HUD (score, progreso, energía) --- */
.panel-hud {
    position: absolute;
    border-radius: 10px;
    background-color: rgba(0, 51, 153, 0.5);
    color: white;
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

#scoreText,
#progresoText {
    margin: 0;
    text-shadow: 1px 1px 2px black;
}

/* --- Barra de energía --- */
#barraEnergia {
    position: absolute;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

#energia {
    height: 100%;
    background-color: rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'Arial', sans-serif;
}

/* --- Feedback visual (tick de acierto) --- */
#feedbackDiv {
    width: 85vw;
    height: 100vw;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#feedbackTick {
    color: green;
    font-size: 0;
    font-weight: bolder;
}

/* --- Panel acierto (hits múltiples) --- */
#acierto {
    position: absolute;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 47%;
    font-family: 'Comic Sans MS', cursive;
    font-weight: bolder;
    color: blue;
    text-shadow: 2px 2px 4px #FFFFFF;
    display: none;
}

/* --- Paneles overlay (menú, final, game over, etc) --- */
.panel-overlay {
    position: absolute;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.panel-overlay h1 {
    margin: 0;
    font-family: Arial, sans-serif;
}

.panel-overlay p {
    margin: 10px 0;
    font-family: Arial, sans-serif;
}

/* --- Botones de acción en paneles --- */
.btn-panel {
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    text-align: center;
}

.btn-panel-primary {
    background-color: #4CAF50;
}

.btn-panel-secondary {
    background-color: #2196F3;
}

.btn-panel-danger {
    background-color: #FF0000;
}

.btn-panel-warning {
    background-color: #FF9800;
}

.btn-panel-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Inputs en paneles --- */
.panel-overlay input[type="text"] {
    width: 70%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

/* --- Botón volver --- */
.btn-volver {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

/* --- Tabla de ranking multiplayer --- */
#areaJugadores {
    overflow-y: auto;
    text-align: left;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, Helvetica, sans-serif;
}

.ranking-table tr {
    border-bottom: 1px solid #ddd;
}

.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* --- Panel touch (control móvil) --- */
#panelTouch {
    position: absolute;
    border: 0;
}

/* --- Coins panel --- */
#coinsPanel {
    position: absolute;
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}