/* ==========================================================================
   CSS CORE DESIGN SYSTEM & UTILITIES
   ========================================================================== */

:root {
    /* Main Theme Gradients & Solid Colors */
    --bg-dark: #0f0a1c;
    --bg-light: #161026;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Interactive Colors */
    --color-primary: #8b5cf6;
    --color-primary-glow: rgba(139, 92, 246, 0.4);
    --color-secondary: #06b6d4;
    --color-secondary-glow: rgba(6, 182, 212, 0.4);
    
    --color-success: #10b981;
    --color-success-glow: rgba(16, 185, 129, 0.4);
    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.4);
    --color-warning: #eab308;
    
    /* Category Theme Colors */
    --cat-bts: #8b5cf6;
    --cat-blackpink: #f43f5e;
    --cat-straykids: #ef4444;
    --cat-twice: #f59e0b;
    --cat-seventeen: #93c5fd;
    --cat-newjeans: #3b82f6;
    --cat-aespa: #10b981;
    --cat-ive: #06b6d4;
    --cat-exo: #94a3b8;
    --cat-nct: #84cc16;

    /* Difficulty Colors */
    --diff-easy: #10b981;
    --diff-medium: #f59e0b;
    --diff-hard: #ef4444;

    /* Styling Properties */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    --glow-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.25);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(22, 16, 38, 0.65);
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   DYNAMIC BACKGROUND GRAPHICS
   ========================================================================== */

.mesh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #1a0f30 0%, var(--bg-dark) 100%);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    mix-blend-mode: screen;
    animation: float-blob 20s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 80%);
    top: -10%;
    left: -10%;
    animation-duration: 25s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--color-secondary) 0%, transparent 80%);
    bottom: -15%;
    right: -10%;
    animation-duration: 30s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #f43f5e 0%, transparent 80%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 22s;
    opacity: 0.25;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */

.app-container {
    width: 100%;
    max-width: 900px;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

/* Screen Management */
.screen {
    width: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* ==========================================================================
   REUSABLE POLISHED COMPONENT: GLASS CARD
   ========================================================================== */

.card {
    background: var(--glass-bg);
    border: var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    opacity: 0.8;
}

/* ==========================================================================
   BUTTON DESIGN SYSTEM
   ========================================================================== */

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 700;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
    color: var(--text-main);
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: var(--glass-border);
    color: var(--text-main);
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--color-danger);
    color: var(--text-main);
}

/* ==========================================================================
   SCREEN 1: SETUP SCREEN & LOGOS
   ========================================================================== */

.welcome-card {
    text-align: center;
    max-width: 600px;
}

/* K-Pop Concert Lightstick Animated Logo */
.logo-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.setup-row {
    display: flex;
    gap: 20px;
    width: 100%;
    margin-bottom: 10px;
}

.setup-row .setup-step {
    flex: 1;
    margin-bottom: 0;
}

.lightstick-logo {
    position: relative;
    width: 120px;
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.lightstick-head {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 70%),
                linear-gradient(135deg, #f43f5e 0%, #8b5cf6 50%, #06b6d4 100%);
    background-size: 200% 200%;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 35px rgba(244, 63, 94, 0.6),
                inset 0 0 15px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
    animation: shift-colors 6s ease infinite, pulse-head 2s ease-in-out infinite alternate;
}

.lightstick-core {
    font-size: 2.2rem;
    animation: heart-beat 1.5s infinite ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
    user-select: none;
}

.lightstick-handle {
    width: 14px;
    height: 35px;
    background: linear-gradient(180deg, #f8fafc 0%, rgba(148, 163, 184, 0.6) 100%);
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    margin-top: -3px;
}

/* Glowing Neon Aura Rings representing "Rush" */
.glow-ring {
    position: absolute;
    top: 15px;
    width: 100px;
    height: 45px;
    border: 3px solid #06b6d4;
    border-radius: 50%;
    box-shadow: 0 0 20px #06b6d4, inset 0 0 10px #06b6d4;
    transform: rotateX(70deg) rotateY(-15deg);
    animation: spin-ring 3s linear infinite;
    z-index: 1;
    opacity: 0.8;
}

/* Orbiting sparkles */
.orbit-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 4;
}

.orbit-sparkle.pink {
    background: #f43f5e;
    box-shadow: 0 0 10px #f43f5e;
    animation: orbit-pink 4s linear infinite;
}

.orbit-sparkle.purple {
    background: #a855f7;
    box-shadow: 0 0 10px #a855f7;
    animation: orbit-purple 4s linear infinite;
}

/* Animations */
@keyframes shift-colors {
    0% { background-position: 0% 50%; box-shadow: 0 0 35px rgba(244, 63, 94, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.5); border-color: rgba(244, 63, 94, 0.6); }
    33% { background-position: 50% 100%; box-shadow: 0 0 35px rgba(6, 182, 212, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.5); border-color: rgba(6, 182, 212, 0.6); }
    66% { background-position: 100% 50%; box-shadow: 0 0 35px rgba(16, 185, 129, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.5); border-color: rgba(16, 185, 129, 0.6); }
    100% { background-position: 0% 50%; box-shadow: 0 0 35px rgba(244, 63, 94, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.5); border-color: rgba(244, 63, 94, 0.6); }
}

@keyframes pulse-head {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes spin-ring {
    0% { transform: rotateX(70deg) rotateY(-15deg) rotateZ(0deg); }
    100% { transform: rotateX(70deg) rotateY(-15deg) rotateZ(360deg); }
}

@keyframes orbit-pink {
    0% { transform: rotate(0deg) translate(55px) rotate(0deg); }
    100% { transform: rotate(360deg) translate(55px) rotate(-360deg); }
}

@keyframes orbit-purple {
    0% { transform: rotate(180deg) translate(55px) rotate(-180deg); }
    100% { transform: rotate(540deg) translate(55px) rotate(-540deg); }
}

.game-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-main);
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-title span {
    color: var(--color-primary);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 30px;
}

/* Steps and player selection styling */
.setup-step {
    margin-bottom: 30px;
    text-align: left;
}

.setup-step h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 15px;
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
}

/* Counters */
.player-count-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    width: fit-content;
    margin: 0 auto;
    overflow: hidden;
}

.btn-counter {
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    color: var(--text-main);
    background: transparent;
}

.btn-counter:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-primary);
}

.counter-display {
    width: 80px;
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    border-left: var(--glass-border);
    border-right: var(--glass-border);
    color: var(--text-main);
}

/* Dynamic Configuration Form */
.inputs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 5px;
}

@media (min-width: 769px) {
    .inputs-grid {
        grid-template-columns: repeat(2, 1fr);
        max-height: 350px;
    }
}

/* Customize modern thin scrollbar */
.inputs-grid::-webkit-scrollbar,
.next-players-grid::-webkit-scrollbar {
    width: 6px;
}
.inputs-grid::-webkit-scrollbar-thumb,
.next-players-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.player-config-row {
    background: rgba(255, 255, 255, 0.03);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slide-up var(--transition-normal);
}

.player-config-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    position: relative;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
}

.player-config-avatar:hover {
    transform: scale(1.1);
}

.player-config-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
}

.player-config-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary-glow);
}

/* Avatar Selection Dropdown Drawer */
.player-config-avatar:has(.avatar-popover.active) {
    z-index: 20;
}

.avatar-popover {
    position: absolute;
    top: 55px;
    left: 0;
    z-index: 10;
    background: #161026; /* Fondo sólido del tema */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 10px;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    width: 180px;
}

.avatar-popover.active {
    display: grid;
    animation: pop var(--transition-normal);
}

.popover-emoji {
    font-size: 1.4rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.popover-emoji:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.15);
}

/* Topic / Section Picker Grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.topic-grid::-webkit-scrollbar {
    width: 6px;
}
.topic-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.topic-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    text-align: left;
    transition: var(--transition-fast);
}

.topic-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: var(--topic-color, var(--color-primary));
}

.topic-card.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--topic-color, var(--color-primary));
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05), inset 0 0 0 1px var(--topic-color, var(--color-primary));
}

.topic-icon {
    font-size: 1.4rem;
}

.topic-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.setup-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.setup-actions button {
    width: 100%;
}

/* ==========================================================================
   SCREEN 2: GAME ARENA SCREEN
   ========================================================================== */

#game-arena {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 140px; /* Allocate space for sticky footer bar */
}

#game-arena.active {
    display: flex;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.turn-indicator {
    display: flex;
    flex-direction: column;
}

.turn-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.active-player-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.player-avatar-mini {
    font-size: 1.4rem;
}

.player-name-mini {
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
}

.game-main {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 380px;
}

/* Panels */
.game-panel {
    display: none;
    width: 100%;
    will-change: opacity, transform;
}

.game-panel.active {
    display: flex;
    flex-direction: column;
    animation: fade-in var(--transition-normal);
}

.panel-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 8px;
    text-align: center;
}

.panel-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 25px;
}

/* DIFFICULTY CHOOSER CARDS */
.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.diff-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 24px 15px;
    text-align: center;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.diff-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0.6;
}

/* Easy themes */
.diff-card.easy::before { background: var(--diff-easy); }
.diff-card.easy:hover {
    border-color: var(--diff-easy);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}
.diff-card.easy .diff-stars, .diff-card.easy .diff-points { color: var(--diff-easy); }

/* Medium themes */
.diff-card.medium::before { background: var(--diff-medium); }
.diff-card.medium:hover {
    border-color: var(--diff-medium);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.2);
}
.diff-card.medium .diff-stars, .diff-card.medium .diff-points { color: var(--diff-medium); }

/* Hard themes */
.diff-card.hard::before { background: var(--diff-hard); }
.diff-card.hard:hover {
    border-color: var(--diff-hard);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.2);
}
.diff-card.hard .diff-stars, .diff-card.hard .diff-points { color: var(--diff-hard); }

.diff-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.06);
}

.diff-stars {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.diff-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
}

.diff-points {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
}

.diff-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* CATEGORY SPLASH REVEAL */
.splash-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.splash-spinner-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.splash-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px dashed var(--color-primary);
    animation: spin 5s linear infinite;
    opacity: 0.6;
}

.splash-icon {
    font-size: 3.5rem;
    animation: heart-beat 1.5s infinite ease-in-out;
}

.splash-category-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.splash-loading-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 1px;
}

/* TRIVIA QUESTION CARD */
.question-card {
    min-height: 350px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* PREMIUM QUESTION TIMER */
.question-timer-container {
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.question-timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.timer-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.timer-icon {
    font-size: 1.1rem;
    animation: heart-beat 2s infinite ease-in-out;
}

.timer-countdown {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    color: var(--color-secondary);
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px var(--color-secondary-glow);
    transition: var(--transition-fast);
}

.question-timer-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.question-timer-progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    border-radius: 10px;
    transition: width 0.1s linear, background 0.3s ease;
    box-shadow: 0 0 8px var(--color-primary-glow);
}

/* DANGER STATE (LAST 10 SECONDS) */
.question-timer-container.danger-state .timer-countdown {
    color: var(--color-danger);
    text-shadow: 0 0 12px var(--color-danger-glow);
    animation: heart-beat 0.8s infinite ease-in-out;
}

.question-timer-container.danger-state .question-timer-progress-fill {
    background: linear-gradient(90deg, #f87171 0%, var(--color-danger) 100%) !important;
    box-shadow: 0 0 12px var(--color-danger-glow) !important;
    animation: pulse-danger 0.8s infinite alternate ease-in-out;
}

@keyframes pulse-danger {
    0% {
        opacity: 0.8;
        filter: brightness(0.9);
    }
    100% {
        opacity: 1;
        filter: brightness(1.25);
    }
}

.badge-category {
    font-size: 0.85rem;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 20px;
    color: #fff;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.badge-difficulty {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    color: #fff;
}

.question-image-container {
    width: 100%;
    max-height: 320px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
    border: var(--glass-border);
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.question-image-container img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
}

.question-body {
    margin-bottom: 30px;
    min-height: 80px;
    display: flex;
    align-items: center;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 18px 24px;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.option-prefix {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-muted);
}

.option-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* Answer Evaluation Styles */
.option-btn.correct-eval {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: var(--color-success) !important;
    box-shadow: 0 0 15px var(--color-success-glow) !important;
    opacity: 1 !important;
}

.option-btn.correct-eval .option-prefix {
    background: var(--color-success) !important;
    color: #fff !important;
}

.option-btn.incorrect-eval {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 15px var(--color-danger-glow) !important;
    opacity: 1 !important;
    animation: shake 0.5s ease-in-out;
}

.option-btn.incorrect-eval .option-prefix {
    background: var(--color-danger) !important;
    color: #fff !important;
}

/* TURN FEEDBACK & NEXT PLAYER SELECTION */
.feedback-card {
    text-align: center;
    padding-top: 40px;
}

.feedback-icon-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 3px solid transparent;
}

.feedback-card.correct-feedback .feedback-icon-container {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
}

.feedback-card.incorrect-feedback .feedback-icon-container {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
}

.feedback-emoji {
    font-size: 2.8rem;
}

.feedback-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.feedback-card.correct-feedback .feedback-title { color: var(--color-success); }
.feedback-card.incorrect-feedback .feedback-title { color: var(--color-danger); }

/* Score rise floating element styles */
.score-addition-popup {
    background: linear-gradient(135deg, var(--color-success), #059669);
    color: #fff;
    padding: 6px 16px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 20px;
    width: fit-content;
    margin: 8px auto 12px;
    font-family: 'Fredoka', sans-serif;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.feedback-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 20px;
}

.feedback-answer-reveal {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 450px;
    margin: 0 auto 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.feedback-answer-reveal::before { display: none; } /* Remove gradient top accent line */

.reveal-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.reveal-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-success);
}

.feedback-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 25px 0;
}

/* Next Router */
.next-player-section h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.next-player-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.next-players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 4px;
}

.btn-next-player {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-next-player:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--player-color, var(--color-primary));
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ==========================================================================
   PERSISTENT BOTTOM PLAYER STATUS BAR
   ========================================================================== */

.player-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 10, 28, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: var(--glass-border);
    padding: 15px 20px;
    z-index: 10;
}

.player-bar {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 5px 0;
    scroll-behavior: smooth;
}

/* Custom scrollbar for horizontal status bar */
.player-bar::-webkit-scrollbar {
    height: 5px;
}
.player-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Player cards */
.player-card {
    flex: 1;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

/* Floating animated +Points score popup */
.floating-points {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-success);
    font-family: 'Fredoka', sans-serif;
    pointer-events: none;
    z-index: 10;
    animation: floatUp 1.2s forwards cubic-bezier(0.25, 1, 0.5, 1);
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.player-avatar-bar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--player-color, var(--color-primary));
}

.player-info-bar {
    display: flex;
    flex-direction: column;
}

.player-name-bar {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score-bar {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Highlighted Active turn player card */
.player-card.active-turn {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--player-color, var(--color-primary));
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05), inset 0 0 0 1px var(--player-color);
    transform: translateY(-3px) scale(1.05);
}

.player-card.active-turn .player-score-bar {
    color: var(--text-main);
}

/* ==========================================================================
   SCREEN 3: LEADERBOARD OVERSCREEN
   ========================================================================== */

.leaderboard-card {
    text-align: center;
    max-width: 600px;
}

.screen-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--color-warning) 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.screen-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

/* Podium Standings (1st, 2nd, 3rd) styling */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 30px;
    height: 180px;
    padding-bottom: 5px;
}

.podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    perspective: 1000px;
}

.podium-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
    border: 3px solid var(--player-color);
    animation: heart-beat 2.5s infinite ease-in-out;
}

.podium-name {
    font-size: 0.85rem;
    font-weight: 700;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.podium-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: var(--glass-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: rise-bar var(--transition-normal) forwards;
}

/* Height configurations & gradients */
.podium-bar.first {
    height: 110px !important;
    background: linear-gradient(0deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.3) 100%) !important;
    border-color: rgba(234, 179, 8, 0.5) !important;
}
.podium-bar.first .podium-num { color: #fef08a; font-size: 1.4rem; }

.podium-bar.second {
    height: 80px !important;
    background: linear-gradient(0deg, rgba(148, 163, 184, 0.1) 0%, rgba(148, 163, 184, 0.3) 100%) !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}
.podium-bar.second .podium-num { color: #e2e8f0; font-size: 1.2rem; }

.podium-bar.third {
    height: 60px !important;
    background: linear-gradient(0deg, rgba(180, 83, 9, 0.1) 0%, rgba(180, 83, 9, 0.3) 100%) !important;
    border-color: rgba(180, 83, 9, 0.4) !important;
}
.podium-bar.third .podium-num { color: #fed7aa; font-size: 1.1rem; }

/* Leaderboard Rankings List */
.rankings-table-container {
    background: rgba(0, 0, 0, 0.15);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 30px;
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
}

.rankings-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 18px;
    text-align: left;
    border-bottom: var(--glass-border);
}

.rankings-table td {
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.rankings-table tr:last-child td {
    border-bottom: none;
}

.rankings-player-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rankings-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.05);
}

.rankings-medal {
    font-size: 1.1rem;
    font-weight: 800;
}

.leaderboard-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.leaderboard-actions button {
    flex: 1;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS SYSTEM
   ========================================================================== */

@keyframes float-blob {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    50% {
        transform: translate(10%, 15%) scale(1.15) rotate(180deg);
    }
    100% {
        transform: translate(-10%, -5%) scale(0.9) rotate(360deg);
    }
}

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

@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.7);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70px) scale(0.9);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

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

@keyframes fade-in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes rise-bar {
    0% { transform: scaleY(0); transform-origin: bottom; }
    100% { transform: scaleY(1); transform-origin: bottom; }
}

/* Entrance classes */
.animate-pop {
    animation: pop var(--transition-normal) forwards;
}

.animate-slide-in {
    animation: fade-in var(--transition-normal) forwards;
}

.animate-scale {
    animation: pop var(--transition-normal) forwards;
}

.animate-bounce {
    animation: heart-beat 3s infinite ease-in-out;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .card {
        padding: 20px 15px;
    }

    .game-title {
        font-size: 2.2rem;
    }
    
    .difficulty-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .diff-card {
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px 20px;
        gap: 20px;
        text-align: left;
    }
    
    .diff-card::before {
        width: 4px;
        height: 100%;
        left: 0;
        top: 0;
        right: auto;
    }

    .diff-stars {
        display: none;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .option-btn {
        padding: 14px 18px;
        font-size: 0.95rem;
    }

    .leaderboard-actions {
        flex-direction: column;
        gap: 10px;
    }

    /* Mobile-specific enhancements */
    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
        max-height: 200px;
    }
    
    .question-image-container {
        max-height: 220px;
        margin-bottom: 15px;
    }
    
    .question-image-container img {
        max-height: 220px;
    }
    
    .game-header {
        margin-bottom: 12px;
    }
    
    #game-arena {
        padding-bottom: 110px;
    }
    
    .player-bar-container {
        padding: 10px 12px;
    }
    
    .player-card {
        min-width: 120px;
        padding: 8px 10px;
    }
    
    .player-avatar-bar {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .player-name-bar {
        font-size: 0.85rem;
        max-width: 70px;
    }
    
    .player-score-bar {
        font-size: 0.85rem;
    }
    
    .btn-danger-outline {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 580px) {
    .setup-row {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        gap: 12px;
        margin-bottom: 15px;
    }
    .lightstick-logo {
        width: 85px;
        height: 100px;
        margin-bottom: 10px;
    }
    .lightstick-head {
        width: 55px;
        height: 55px;
    }
    .lightstick-core {
        font-size: 1.6rem;
    }
    .glow-ring {
        width: 75px;
        height: 30px;
        top: 12px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .topic-grid {
        grid-template-columns: 1fr;
        max-height: 160px;
    }
    
    .option-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .panel-title {
        font-size: 1.5rem;
    }
    
    .panel-desc {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .splash-card {
        padding: 20px;
    }
    
    .splash-category-name {
        font-size: 1.8rem;
    }
    
    .feedback-title {
        font-size: 1.6rem;
    }
    
    .feedback-emoji {
        font-size: 2.2rem;
    }
    
    .feedback-icon-container {
        width: 70px;
        height: 70px;
        margin-bottom: 15px;
    }
    
    .feedback-answer-reveal {
        padding: 10px 14px;
        margin-bottom: 15px;
        font-size: 0.9rem;
    }
    
    .leaderboard-card {
        padding: 20px 10px;
    }
    
    .screen-title {
        font-size: 2rem;
    }
    
    .podium-container {
        height: 160px;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .podium-slot {
        width: 80px;
    }
    
    .podium-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    
    .podium-name {
        font-size: 0.75rem;
        max-width: 70px;
    }
    
    .podium-bar.first {
        height: 90px !important;
    }
    
    .podium-bar.second {
        height: 65px !important;
    }
    
    .podium-bar.third {
        height: 50px !important;
    }
}

/* ==========================================================================
   ESTILOS PREMIUM DEL DADO 3D (Fase de dados)
   ========================================================================== */

.dice-rolling-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
}

.dice-3d-wrapper {
    width: 120px;
    height: 120px;
    perspective: 800px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
}

.dice-3d {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.3, 1.15);
}

.dice-3d.rolling {
    animation: spin-dice 0.8s infinite linear;
}

.face {
    position: absolute;
    width: 100px;
    height: 100px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 12px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Planos del núcleo para rellenar las esquinas redondeadas del dado */
.dice-core-plane {
    position: absolute;
    width: 96px;
    height: 96px;
    left: 2px;
    top: 2px;
    background: #f8fafc;
    border-radius: 20px;
    pointer-events: none;
}
.plane-xy {
    transform: translateZ(0);
}
.plane-yz {
    transform: rotateY(90deg) translateZ(0);
}
.plane-zx {
    transform: rotateX(90deg) translateZ(0);
}

.dot {
    width: 15px;
    height: 15px;
    background-color: #0f0a1c;
    border-radius: 50%;
    align-self: center;
    justify-self: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Rotaciones en 3D para posicionamiento de caras */
.face.front  { transform: rotateY(0deg) translateZ(50px); }
.face.back   { transform: rotateY(180deg) translateZ(50px); }
.face.right  { transform: rotateY(90deg) translateZ(50px); }
.face.left   { transform: rotateY(-90deg) translateZ(50px); }
.face.top    { transform: rotateX(90deg) translateZ(50px); }
.face.bottom { transform: rotateX(-90deg) translateZ(50px); }

/* Rotaciones para mostrar la cara seleccionada de frente */
.dice-3d.show-1 { transform: rotateX(0deg) rotateY(0deg); }
.dice-3d.show-6 { transform: rotateX(180deg) rotateY(0deg); }
.dice-3d.show-3 { transform: rotateX(0deg) rotateY(-90deg); }
.dice-3d.show-4 { transform: rotateX(0deg) rotateY(90deg); }
.dice-3d.show-5 { transform: rotateX(-90deg) rotateY(0deg); }
.dice-3d.show-2 { transform: rotateX(90deg) rotateY(0deg); }

/* Animación rápida de lanzamiento de dados */
@keyframes spin-dice {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

/* Resultados del lanzamiento */
.dice-results-row {
    background: rgba(255, 255, 255, 0.03);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    animation: slide-up var(--transition-normal);
}

.dice-results-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dice-results-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--player-color);
}

.dice-results-name {
    font-weight: 700;
}

.dice-results-val {
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--player-color);
}

/* ==========================================================================
   ESTILOS PREMIUM DEL MODO SOLITARIO (Solo Mode Stats)
   ========================================================================== */
.solo-stats-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin: 20px 0 30px;
    animation: fade-in var(--transition-normal);
}

.solo-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

.solo-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.solo-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--color-primary));
    opacity: 0.8;
}

.solo-stat-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.solo-stat-card .stat-icon {
    font-size: 1.8rem;
    margin-bottom: 2px;
}

.solo-stat-card .stat-value {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.solo-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lifetime Records Card */
.solo-records-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 22px 25px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.01);
}

.solo-records-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-warning), var(--color-primary));
}

.solo-records-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 18px;
    text-align: center;
    letter-spacing: 0.5px;
}

.solo-records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.solo-record-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--row-accent, var(--color-secondary));
}

.solo-record-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.solo-record-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.solo-record-val {
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-main);
}

.solo-record-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.solo-record-achievement {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* New Record Badge */
.solo-new-record-badge {
    background: linear-gradient(135deg, var(--color-warning) 0%, #f97316 100%);
    color: #fff;
    padding: 3px 10px;
    font-size: 0.72rem;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
    animation: pulse-record 1.2s infinite alternate;
}

@keyframes pulse-record {
    0% { transform: scale(1); box-shadow: 0 0 6px rgba(234, 179, 8, 0.3); }
    100% { transform: scale(1.05); box-shadow: 0 0 12px rgba(234, 179, 8, 0.6); }
}

@media (max-width: 768px) {
    .solo-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .solo-stat-card {
        padding: 15px;
    }
    
    .solo-stat-card .stat-value {
        font-size: 1.8rem;
    }
}

/* Persistent Audio Control Button styling */
.btn-audio-control {
    position: fixed;
    top: 85px;
    right: 20px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(22, 16, 38, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-fast);
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
}

.btn-audio-control:hover {
    transform: scale(1.08) translateY(-2px);
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--color-primary);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

.btn-audio-control:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .btn-audio-control {
        top: 80px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* Persistent Language Control Button styling */
.btn-lang-control {
    position: fixed;
    top: 25px;
    right: 20px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(22, 16, 38, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-fast);
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
}

.btn-lang-control:hover {
    transform: scale(1.08) translateY(-2px);
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--color-primary);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

.btn-lang-control:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .btn-lang-control {
        top: 25px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }
}

/* Posicionamiento horizontal de los botones flotantes debajo de 'Finalizar Juego' en la arena */
body.screen-arena .btn-lang-control {
    position: absolute;
    top: 76px;
    right: 20px;
    left: auto;
    bottom: auto;
}
body.screen-arena .btn-audio-control {
    position: absolute;
    top: 76px;
    right: 78px; /* 20px + 48px width + 10px gap */
    left: auto;
    bottom: auto;
}

/* Soporte responsivo para móviles */
@media (max-width: 768px) {
    body.screen-arena .btn-lang-control {
        top: 68px;
        right: 15px;
        left: auto;
        bottom: auto;
    }
    body.screen-arena .btn-audio-control {
        top: 68px;
        right: 65px; /* 15px + 40px width + 10px gap */
        left: auto;
        bottom: auto;
    }
}

/* ==========================================================================
   ESTILOS PARA PANTALLA DE ACCESO (PASSCODE)
   ========================================================================== */
.passcode-card {
    text-align: center;
    max-width: 600px;
}

.passcode-inputs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0 15px 0;
}

.passcode-digit {
    width: 60px;
    height: 65px;
    font-size: 2.2rem;
    text-align: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    color: var(--text-main);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    outline: none;
    transition: var(--transition-fast);
}

.passcode-digit:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px var(--color-primary-glow);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.passcode-feedback {
    min-height: 24px;
    color: var(--color-danger);
    font-size: 0.95rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    text-shadow: 0 0 8px var(--color-danger-glow);
}

/* Animación de error (Sacudida horizontal) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.shake-card {
    animation: shake 0.4s ease-in-out;
}

/* ==========================================================================
   MODAL DE CONFIRMACIÓN DE FIN DE JUEGO PERSONALIZADO
   ========================================================================== */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-modal.active {
    display: flex;
}

.confirm-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 10, 28, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.confirm-modal-card {
    max-width: 450px;
    z-index: 2001;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 35px 30px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}

.confirm-modal-icon {
    font-size: 3.5rem;
    animation: heart-beat 2s infinite ease-in-out;
    filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.6));
    margin-bottom: 5px;
}

.confirm-modal-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.confirm-modal-desc {
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.confirm-modal-actions {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.confirm-modal-actions button {
    flex: 1;
    font-size: 1rem;
    padding: 12px 24px;
}

.btn-modal-yes {
    background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%) !important;
    box-shadow: 0 8px 24px var(--color-danger-glow) !important;
}

.btn-modal-yes:hover {
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.6) !important;
    transform: translateY(-3px) scale(1.02);
}



