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

/* ========================================
   VARIABLES - Estética pizarra / chalk
   ======================================== */
:root {
    --chalk-white: rgba(255, 255, 255, 0.92);
    --chalk-white-soft: rgba(255, 255, 255, 0.78);
    --chalk-border: 2px solid var(--chalk-white);
    --chalk-border-soft: 2px solid var(--chalk-white-soft);
}

/* Tipografía: Caveat Brush para cuerpo, Cabin Sketch para títulos */
.chalk-font,
.chalk-font *,
.chalk-font input,
.chalk-font button,
.chalk-font p,
.chalk-font span,
.chalk-font div,
.chalk-font label,
.chalk-font a,
html,
body {
    font-family: 'Caveat Brush', cursive, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.chalk-font h1,
.chalk-font h2,
.chalk-font h3,
.chalk-font .chalk-title,
h1, h2, h3, .chalk-title {
    font-family: 'Cabin Sketch', cursive, sans-serif;
}

.chalk-font .chalk-body,
.chalk-body {
    font-family: 'Caveat Brush', cursive, sans-serif;
}

/* Efecto tiza para texto */
.chalk-font .chalk-texture,
.chalk-font h1,
.chalk-font h2,
.chalk-font .font-black,
.chalk-font .font-bold {
    text-shadow: 
        0 1px 1px rgba(255, 255, 255, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Chalkboard safe area - contenido dentro del área verde, lejos de los bordes marrones */
.chalkboard-safe-area {
    padding-top: clamp(1.6%, 2.4vh, 4.5%);
    padding-bottom: clamp(1.6%, 2.4vh, 4.5%);
    padding-left: clamp(0.6%, 1.3vw, 2.4%);
    padding-right: clamp(0.6%, 1.3vw, 2.4%);
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

@media (max-height: 700px) {
    .chalkboard-safe-area {
        padding-top: clamp(1.2%, 1.8vh, 3.2%);
        padding-bottom: clamp(1.2%, 1.8vh, 3.2%);
        padding-left: clamp(0.5%, 1.1vw, 2%);
        padding-right: clamp(0.5%, 1.1vw, 2%);
    }
}

html, body {
    width: 100%;
    max-width: 100vw;
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    background-color: #3d2318;
}

body {
    transition: background 0.5s ease;
    -webkit-font-smoothing: antialiased;
    background: url('assets/images/Pizarra%20.webp') center center / cover no-repeat fixed;
}

/* Category backgrounds - Pizarra background */
/* Playing screen - Pizarra background, sin fondos blancos */
#playingScreen {
    background: transparent !important;
    min-height: 0;
    overflow: hidden;
}

#playingScreen .chalk-header,
#playingScreen [class*="timer"],
#playingScreen #playersFooter,
#playingScreen #playersFooter > * {
    background: transparent !important;
}

#playingScreen .chalk-header {
    margin-left: clamp(8px, 1.1vw, 14px);
    margin-right: clamp(14px, 1.8vw, 22px);
}

#playingScreen .playing-main {
    min-height: 0;
    overflow: hidden;
}

#playingScreen .playing-question-block {
    min-height: 0;
    justify-content: flex-start !important;
    padding-top: clamp(0.45rem, 1.8vh, 1.1rem);
}

#playingScreen .playing-footer {
    flex-shrink: 0;
}
body.cat-science,
body.cat-mathematics,
body.cat-robotics,
body.cat-chemistry,
body.cat-technology,
body.cat-history,
body.cat-geography,
body.cat-default { 
    background: transparent;
    position: relative;
}

/* Chalk header/footer - sin fondo blanco, integrado con pizarra */
.chalk-header {
    background: transparent !important;
}

/* Timer bar - estilo chalk sobre pizarra, sin fondo blanco */
.timer-bar-container {
    position: relative;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.timer-bar,
#playingScreen .timer-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 14px;
    transition: background 0.3s ease;
}

/* Animación: la barra se vacía suavemente durante 20 segundos */
@keyframes timerEmpty {
    from { width: 100%; }
    to { width: 0%; }
}

.timer-bar.draining {
    animation: timerEmpty 20s linear forwards;
}

.timer-bar.draining.warning,
#playingScreen .timer-bar.draining.warning {
    background: rgba(255, 255, 255, 0.95) !important;
}

.timer-bar.draining.danger,
#playingScreen .timer-bar.draining.danger {
    background: rgba(255, 255, 255, 0.95) !important;
    animation: timerEmpty 20s linear forwards;
}

.timer-circle-standalone,
#playingScreen .timer-circle-standalone {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #0595AE; /* Verde/turquesa por defecto - JS actualiza según tiempo */
    border: 3px solid rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: white;
    box-shadow: 
        0 0 0 4px rgba(0, 0, 0, 0.25),
        0 4px 20px rgba(5, 149, 174, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

/* Colores por tiempo: verde >10s, amarillo 6-10s, rojo â‰¤5s (sin hover) */
.timer-circle-standalone.timer-warning,
#playingScreen .timer-circle-standalone.timer-warning {
    background: #FFA726 !important;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.25), 0 4px 20px rgba(255, 167, 38, 0.6), inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.timer-circle-standalone.timer-danger,
#playingScreen .timer-circle-standalone.timer-danger {
    background: #E53935 !important;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.25), 0 4px 20px rgba(229, 57, 53, 0.6), inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

/* Hover acorde al estado del timer (turquesa, naranja o rojo según segundos) */
.timer-circle-standalone:not(.timer-warning):not(.timer-danger):hover,
#playingScreen .timer-circle-standalone:not(.timer-warning):not(.timer-danger):hover {
    background: #07b8d9 !important;
    box-shadow: 
        0 0 0 4px rgba(0, 0, 0, 0.25),
        0 4px 24px rgba(5, 149, 174, 0.8),
        0 0 20px rgba(7, 184, 217, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.timer-circle-standalone.timer-warning:hover,
#playingScreen .timer-circle-standalone.timer-warning:hover {
    background: #ffb74d !important;
    box-shadow: 
        0 0 0 4px rgba(0, 0, 0, 0.25),
        0 4px 24px rgba(255, 167, 38, 0.8),
        0 0 20px rgba(255, 183, 77, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.timer-circle-standalone.timer-danger:hover,
#playingScreen .timer-circle-standalone.timer-danger:hover {
    background: #ef5350 !important;
    box-shadow: 
        0 0 0 4px rgba(0, 0, 0, 0.25),
        0 4px 24px rgba(229, 57, 53, 0.8),
        0 0 20px rgba(239, 83, 80, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Animated background particles - Soft colored blobs */
.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    opacity: 0.15;
    animation: floatParticle 25s infinite ease-in-out;
    will-change: transform;
    border-radius: 50%;
    filter: blur(40px);
}

.particle.icon-particle {
    font-size: clamp(2rem, 5vw, 3.5rem);
    opacity: 0.6;
}

@keyframes floatParticle {
    0%, 100% { 
        transform: translate(0, 0) scale(1); 
        opacity: 0.15;
    }
    25% { 
        transform: translate(50px, -50px) scale(1.2); 
        opacity: 0.25;
    }
    50% { 
        transform: translate(0, -100px) scale(1); 
        opacity: 0.15;
    }
    75% { 
        transform: translate(-50px, -50px) scale(1.2); 
        opacity: 0.25;
    }
}

/* Animated grid background - Subtle */
.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(5, 149, 174, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(5, 149, 174, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Wavy lines background */
.wavy-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.wavy-bg path {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    animation: wavyMove 8s ease-in-out infinite;
}

@keyframes wavyMove {
    0%, 100% { d: path('M0,50 Q25,25 50,50 T100,50'); }
    50% { d: path('M0,50 Q25,75 50,50 T100,50'); }
}

/* Category icon animations */
.category-icon {
    font-size: clamp(2.5rem, 6vw, 4rem);
    display: inline-block;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.category-icon-img {
    width: clamp(2.5rem, 6vw, 5rem);
    height: clamp(2.5rem, 6vw, 5rem);
    object-fit: contain;
    display: inline-block;
    transition: all 0.3s ease;
}

/* Unselected: iconos estilo tiza clara sobre pizarra */
.category-card:not(.selected) .category-icon-img {
    filter: brightness(0) invert(1) opacity(0.85) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Selected: iconos tiza blanca con brillo */
.category-card.selected .category-icon-img {
    filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

/* Tarjetas estilo chalk - sin background sólido, borde tipo tiza */
.category-card {
    position: relative;
    overflow: hidden;
    background: transparent;
    border: var(--chalk-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: clamp(0.5rem, 1.5vw, 1.5rem) !important;
    min-height: 0;
}

.category-card:not(.selected):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.category-card:not(.selected):hover .category-icon {
    transform: scale(1.08);
}

.category-card.selected {
    border-width: 3px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.category-card.selected .category-icon {
    animation: iconFloat 2s ease-in-out infinite;
}

/* Texto categoría: tiza sobre pizarra - más blanco, más grande */
.category-card .category-name {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: clamp(1rem, 4vw, 1.4rem) !important;
    font-family: 'Cabin Sketch', cursive, sans-serif !important;
}

.category-card.selected .category-name {
    color: rgba(255, 255, 255, 0.98) !important;
}

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

/* Scroll categorías - responsivo, min-height para flex.
   padding-top extra para que el hover (translateY -2px) no corte las primeras filas */
.category-scroll-container {
    padding-top: 10px;
    padding-bottom: 2px;
    min-height: 0;
    flex: 1 1 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
}

@media (max-width: 640px) {
    .category-scroll-container {
        padding-left: 2px;
        padding-right: 2px;
    }
}

/* Option cards (playing screen): estilo chalk, sin fondo sólido.
   Sin hover: el screen es display-only, no hay interacción con mouse. */
#optionsGrid {
    pointer-events: none;
}

.option-card {
    background: transparent !important;
    border: var(--chalk-border) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease !important;
    font-family: 'Caveat Brush', cursive, sans-serif !important;
    padding: clamp(10px, 1.5vw, 16px) clamp(10px, 1.8vw, 18px);
    min-height: clamp(66px, 8vh, 102px);
    max-height: clamp(82px, 16vh, 140px);
    align-items: center;
    overflow: hidden;
}

.option-card .option-text {
    font-size: clamp(1.15rem, 2.55vw, 1.78rem);
    line-height: 1.15;
    letter-spacing: 0.006em;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.option-card .option-text.option-text-long {
    font-size: clamp(1.04rem, 2.2vw, 1.5rem);
    -webkit-line-clamp: 3;
}

.option-card .option-text.option-text-xlong {
    font-size: clamp(0.95rem, 2vw, 1.34rem);
    -webkit-line-clamp: 3;
}

.option-card .option-badge {
    background: transparent !important;
    border-right: var(--chalk-border-soft) !important;
    color: var(--chalk-white) !important;
    transition: background 0.3s ease, border-color 0.3s ease !important;
    min-width: clamp(46px, 6vw, 68px);
    justify-content: center;
    font-size: clamp(1.35rem, 3.2vw, 2rem);
}

/* Option cards (playing screen): prevent top edge clipping */
.options-grid-spaced {
    padding-top: 4px;
}
.category-scroll-container::-webkit-scrollbar {
    width: 6px;
}
@media (max-width: 768px) {
    .category-scroll-container::-webkit-scrollbar {
        width: 4px;
    }
}
.category-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}
.category-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(5, 149, 174, 0.5);
    border-radius: 4px;
}
.category-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(5, 149, 174, 0.7);
}

/* Glow effect */
.glow {
    position: relative;
}

.glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow:hover::after {
    opacity: 0.5;
}

/* Power-up effect */
@keyframes powerUp {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.power-up {
    animation: powerUp 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Star burst effect */
.star-burst {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: burst 1s ease-out forwards;
}

@keyframes burst {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(20); opacity: 0; }
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.logo-gradient {
    background: linear-gradient(45deg, #0595AE, #AB3D8B, #EB8225, #73A03F);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 3s ease infinite;
}

@keyframes floatUp {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.float-up {
    animation: floatUp 0.8s ease-out forwards;
    display: block;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.pulse-anim {
    animation: pulse 2s ease infinite;
    display: inline-block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.timer-warning { animation: pulse 0.5s ease infinite; }
.timer-danger { animation: shake 0.3s ease infinite; }

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.option-correct { animation: correctPop 0.3s ease; }
.option-incorrect { animation: incorrectShake 0.3s ease; }

/* Estilo resultado: verde = correcta, rojo = incorrecta (mismo look que el hover, sin interacción) */
.option-card.option-correct {
    background: rgba(115, 160, 63, 0.35) !important;
    border-width: 3px !important;
    border-color: #73A03F !important;
    box-shadow: 0 0 24px rgba(115, 160, 63, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.option-card.option-correct .option-badge {
    background: rgba(115, 160, 63, 0.5) !important;
    border-right-color: #73A03F !important;
}

.option-card.option-incorrect {
    background: rgba(229, 57, 53, 0.35) !important;
    border-width: 3px !important;
    border-color: #E53935 !important;
    box-shadow: 0 0 24px rgba(229, 57, 53, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.option-card.option-incorrect .option-badge {
    background: rgba(229, 57, 53, 0.5) !important;
    border-right-color: #E53935 !important;
}

.option-card .answer-indicator {
    position: absolute;
    bottom: clamp(5px, 1.2vh, 8px);
    right: clamp(8px, 1.6vw, 12px);
    margin-top: 0 !important;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.18);
    font-size: clamp(0.72rem, 1.25vw, 0.9rem) !important;
    line-height: 1.05;
    max-width: min(48%, 210px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.option-card .answer-indicator.correct {
    color: #d8ffd8 !important;
}

.option-card .answer-indicator.wrong {
    color: #ffd4d4 !important;
}

@keyframes winnerBounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.winner-bounce { animation: winnerBounce 0.5s ease; }

@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
    will-change: transform;
}

/* Player avatar visual - responsive */
.player-avatar-visual {
    width: clamp(35px, 5vw, 50px);
    height: clamp(35px, 5vw, 50px);
    border-radius: clamp(7px, 1vw, 11px);
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.player-avatar-visual::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: clamp(7px, 1vw, 11px);
    background: rgba(255,255,255,0.35);
    border-radius: 6px 6px 0 0;
}

.player-avatar-visual-large {
    width: clamp(45px, 7vw, 70px);
    height: clamp(45px, 7vw, 70px);
    border-radius: clamp(9px, 1.5vw, 14px);
}

.player-avatar-visual-large::before {
    height: clamp(9px, 1.5vw, 14px);
    top: 4px;
    left: 4px;
    right: 4px;
    border-radius: 8px 8px 0 0;
}

.player-avatar-visual-small {
    width: clamp(24px, 3vw, 36px);
    height: clamp(24px, 3vw, 36px);
    border-radius: clamp(5px, 0.8vw, 8px);
}

.player-avatar-visual-small::before {
    height: clamp(5px, 0.8vw, 8px);
    top: 2px;
    left: 2px;
    right: 2px;
    border-radius: 4px 4px 0 0;
}

/* Responsive text */
#questionNumber {
    font-size: clamp(1.35rem, 2.8vw, 2rem) !important;
    letter-spacing: 0.015em;
}

.responsive-title {
    font-size: clamp(1.75rem, 5.5vw, 4rem);
    font-family: 'Cabin Sketch', cursive, sans-serif !important;
}

.responsive-question {
    font-size: clamp(1.68rem, 3.35vw, 2.65rem);
    line-height: 1.16;
    letter-spacing: 0.01em;
    font-family: 'Caveat Brush', cursive, sans-serif !important;
}

#questionText {
    max-width: min(99vw, 1380px) !important;
    margin-bottom: clamp(0.5rem, 1.8vh, 1rem) !important;
    overflow-wrap: anywhere;
}

#playingScreen .playing-question-text {
    max-width: min(99vw, 1380px) !important;
}

#playingScreen .playing-options-grid {
    max-width: min(99vw, 1380px) !important;
    margin-left: auto;
    margin-right: auto;
}

#questionText.question-medium {
    font-size: clamp(1.45rem, 2.75vw, 2.25rem) !important;
    line-height: 1.15;
}

#questionText.question-long {
    font-size: clamp(1.2rem, 2.25vw, 1.9rem) !important;
    line-height: 1.14;
}

/* Intro logo animation */
@keyframes logoScale {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    60% { transform: scale(1.05) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.logo-intro {
    animation: logoScale 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInFromBottom {
    0% { transform: translateY(50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.slide-in-bottom {
    animation: slideInFromBottom 0.8s ease-out forwards;
}

@keyframes shimmer {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.shimmer-text {
    animation: shimmer 3s ease-in-out infinite;
}

/* Barra de carga - Intro */
.loader-container {
    text-align: center;
}

.progress {
    background: rgba(255, 255, 255, 0.1);
    justify-content: flex-start;
    border-radius: 100px;
    align-items: center;
    position: relative;
    padding: 0 5px;
    display: flex;
    height: clamp(32px, 5vh, 40px);
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: progressTrackPulse 2s ease-in-out infinite;
}

.progress-value {
    border-radius: 100px;
    height: clamp(24px, 4vh, 30px);
    width: 0;
    background: linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0.95) 50%, #fff 100%);
    box-shadow: 0 10px 40px -10px rgba(255, 255, 255, 0.8);
    transition: width 0.15s ease-out;
    position: relative;
    overflow: hidden;
}

/* Shimmer animado sobre la barra de progreso */
.progress-value::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: progressShimmer 1.5s ease-in-out infinite;
}

@keyframes progressTrackPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1); }
    50% { box-shadow: 0 0 20px 2px rgba(255, 255, 255, 0.08); }
}

@keyframes progressShimmer {
    0% { left: -100%; opacity: 0; }
    50% { opacity: 1; }
    100% { left: 200%; opacity: 0; }
}

.loading-text {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 18px;
    font-family: 'Cabin Sketch', cursive, sans-serif;
    text-shadow:
        2px 2px 3px rgba(0, 0, 0, 0.5),
        0 0 5px rgba(255, 255, 255, 0.2);
    letter-spacing: 2px;
}

/* Puntos animados: aparecen uno a uno . â†’ .. â†’ ... luego desaparecen uno a uno */
.loading-dots {
    display: inline-block;
}

.loading-dots .dot {
    display: inline-block;
    opacity: 0;
    animation: dotWave 2s ease-in-out infinite;
}

.loading-dots .dot:nth-child(1) { animation-delay: 0s; }
.loading-dots .dot:nth-child(2) { animation-delay: 0.33s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0.66s; }

@keyframes dotWave {
    0% { opacity: 0; }
    15% { opacity: 1; }
    50% { opacity: 1; }
    65% { opacity: 0; }
    100% { opacity: 0; }
}

/* Glassmorphism card - Clean style */
.intro-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid transparent;
    border-radius: clamp(32px, 8vw, 56px);
    padding: clamp(32px, 8vw, 64px);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.04);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

/* Animated border - Simplified */
.intro-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, 
        #AB3D8B 0%, 
        #0595AE 100%);
    border-radius: clamp(32px, 8vw, 56px);
    z-index: -1;
    opacity: 0.3;
}

/* Shimmer effect - Subtle */
.intro-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 40%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 60%);
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.intro-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.12),
        0 12px 32px rgba(0, 0, 0, 0.06);
}

/* Canvas for animated icon network */
#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.education-icon {
    font-size: clamp(3rem, 8vw, 5rem);
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    cursor: pointer;
    position: relative;
}

.education-icon:hover {
    transform: scale(1.3) translateY(-12px) rotate(8deg);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}

.education-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 0.3s ease;
    z-index: -1;
    filter: blur(20px);
}

.education-icon:hover::before {
    opacity: 0.15;
    transform: translate(-50%, -50%) scale(1.3);
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-25px) rotate(-5deg); }
    50% { transform: translateY(0px) rotate(0deg); }
    75% { transform: translateY(-25px) rotate(5deg); }
}

.intro-edu-icon {
    animation: iconFloat 6s ease-in-out infinite;
}

.intro-edu-icon:nth-child(1) { animation-delay: 0s; }
.intro-edu-icon:nth-child(2) { animation-delay: 0.5s; }
.intro-edu-icon:nth-child(3) { animation-delay: 1s; }
.intro-edu-icon:nth-child(4) { animation-delay: 1.5s; }
.intro-edu-icon:nth-child(5) { animation-delay: 2s; }
.intro-edu-icon:nth-child(6) { animation-delay: 2.5s; }
.intro-edu-icon:nth-child(7) { animation-delay: 3s; }

.intro-title {
    font-family: 'Cabin Sketch', cursive, sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Chalk player cards - espera de jugadores */
.chalk-player-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: clamp(0.95rem, 2.6vw, 1.25rem);
}

.chalk-player-card .player-name {
    font-size: clamp(1rem, 3vw, 1.35rem);
    font-weight: 700;
}

.chalk-player-card .player-score {
    font-size: clamp(1rem, 3vw, 1.35rem);
    font-weight: 800;
}

/* Footer jugadores en playing - sin fondo blanco */
.chalk-footer-card {
    background: transparent !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: clamp(1rem, 3vw, 1.35rem);
}

#playersFooter {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

#playersFooter > * {
    flex: 0 0 auto;
}

/* Cajas genéricas estilo chalk */
.chalk-box {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   CHALLENGE HEADER - Banner de selección
   ======================================== */
.challenge-header {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.challenge-header-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.challenge-header-dots .dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    animation: chalkPulse 2s ease-in-out infinite;
}

.challenge-header-dots .dot:nth-child(1) { background: #EB8225; animation-delay: 0s; }
.challenge-header-dots .dot:nth-child(2) { background: #73A03F; animation-delay: 0.2s; }
.challenge-header-dots .dot:nth-child(3) { background: #AB3D8B; animation-delay: 0.4s; }

@keyframes chalkPulse {
    0%, 100% { opacity: 0.9; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.challenge-header-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.6rem, 2vw, 1rem);
    padding: clamp(0.75rem, 2.5vw, 1.25rem) clamp(2.125rem, 5.1vw, 3.125rem);
    background: transparent;
    border: 4px solid rgba(255, 255, 255, 0.95);
    border-radius: 9999px;
    box-shadow: 
        0 2px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: visible;
}

/* Pequeña “tiza” decorativa en las esquinas del banner */
.challenge-header-banner .challenge-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.challenge-header-banner .challenge-icon-img {
    width: clamp(2.1rem, 5.8vw, 3.15rem);
    height: clamp(2.1rem, 5.8vw, 3.15rem);
    object-fit: contain;
}

.challenge-header-banner .challenge-text {
    font-family: 'Cabin Sketch', cursive;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.98);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
    font-size: clamp(1.25rem, 4.4vw, 1.82rem);
}

.waiting-clock-icon {
    width: clamp(1.45rem, 3.9vw, 2rem);
    height: clamp(1.45rem, 3.9vw, 2rem);
    object-fit: contain;
    opacity: 0.95;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.sound-indicator-icon {
    width: clamp(2rem, 4.4vw, 2.7rem);
    height: clamp(2rem, 4.4vw, 2.7rem);
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.player-role-icon {
    width: 1.85rem;
    height: 1.85rem;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.player-disconnected-mark {
    font-family: 'Cabin Sketch', cursive, sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1;
    color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 640px) {
    .challenge-header-banner .challenge-text {
        white-space: normal;
        text-align: center;
    }
}

/* Timer bar - estilo chalk sobre pizarra */
.timer-bar-container {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Logo animation - Gaming style */
.intro-logo {
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

.intro-logo:hover {
    transform: scale(1.08) rotate(3deg);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.15));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-12px) rotate(-2deg); }
    50% { transform: translateY(0px) rotate(0deg); }
    75% { transform: translateY(-12px) rotate(2deg); }
}

.intro-logo img {
    animation: logoFloat 4s ease-in-out infinite;
}

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

.float-icon {
    animation: float 3s ease-in-out infinite;
}

/* Override intro-card for clean style */
.intro-card {
    background: white;
    border-radius: clamp(24px, 6vw, 40px);
    padding: clamp(32px, 8vw, 56px);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: visible;
    transition: all 0.4s ease;
}

.intro-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.06);
}

/* ========================================
   END SCREEN - Resultados con estilo chic
   ======================================== */
#endScreen {
    flex: 1 1 0;
    min-height: 0;
}

#endScreen .end-title {
    font-family: 'Cabin Sketch', cursive, sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#endScreen .chalk-body {
    font-family: 'Caveat Brush', cursive, sans-serif;
}

/* Medalla trofeo - oro grande para el ganador */
#endScreen .medal-trophy {
    width: clamp(80px, 20vw, 140px);
    height: clamp(80px, 20vw, 140px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: medalAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.medal-trophy {
    width: clamp(80px, 20vw, 140px);
    height: clamp(80px, 20vw, 140px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.medal-trophy .medal-icon {
    font-size: clamp(4rem, 18vw, 7rem) !important;
    filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.5));
}

.medal-slot {
    width: clamp(36px, 8vw, 48px);
    height: clamp(36px, 8vw, 48px);
    flex-shrink: 0;
}

.medal-slot .medal-icon {
    width: 100%;
    height: 100%;
}

@keyframes medalAppear {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.medal-avatar-wrap {
    animation: avatarPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s backwards;
}

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

/* Podium items - entrada escalonada */
.podium-item {
    animation: podiumSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.podium-item:nth-child(1) { animation-delay: 0.1s; }
.podium-item:nth-child(2) { animation-delay: 0.25s; }
.podium-item:nth-child(3) { animation-delay: 0.4s; }
.podium-item:nth-child(n+4) { animation-delay: 0.55s; }

@keyframes podiumSlideIn {
    0% { transform: translateX(-30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Título "Juego Terminado" con animación de entrada */
#endScreen.active .end-title {
    animation: titleReveal 0.6s ease-out forwards;
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Accesibilidad: foco visible para controles interactivos */
button:focus-visible,
[role="button"]:focus-visible,
.sound-toggle-btn:focus-visible,
.answer-btn:focus-visible,
.category-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.92);
    outline-offset: 2px;
}
