:root {
    --primary: #58a6ff;
    --success: #238636;
    --error: #f85149;
    --accent: #f59e0b;
    --bg: #0d1117;
    --card: rgba(22, 27, 34, 0.65);
    --text: #c9d1d9;
    --text-dim: #8b949e;
}

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

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

/* Matar scanlines y líneas intrusas */
body::after, body::before {
    display: none !important;
}

/* Glassmorphism utility */
.glass {
    background: var(--card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Screens overlays */
.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.card {
    width: 90%;
    max-width: 500px;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.overlay-screen.active .card {
    transform: translateY(0);
}

.flags-madness {
    width: 100%;
    height: 140px;
    overflow: hidden;
    margin-bottom: 25px;
    perspective: 1200px;
    mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    position: relative;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    pointer-events: auto !important;
    z-index: 100; /* Aseguramos que esté por encima del fondo de la card */
}

.flags-wall {
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: rotateX(15deg) rotateZ(-3deg) scale(1.05);
    transform-style: preserve-3d;
    width: 150%;
    margin-left: -25%;
    pointer-events: auto !important;
}

.flags-track-v2 {
    display: flex;
    gap: 15px;
    width: max-content;
    white-space: nowrap;
    pointer-events: auto !important;
    transform-style: preserve-3d;
}

.flags-track-v2.t1 { animation: scrollLeft 80s linear infinite; }
.flags-track-v2.t2 { animation: scrollRight 110s linear infinite; }

.flags-track-v2 img {
    height: 50px;
    width: 75px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    filter: brightness(0.8) contrast(1.1);
    transition: all 0.3s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
}

@keyframes scrollLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.33%); }
}

@keyframes scrollRight {
    0% { transform: translateX(-33.33%); }
    100% { transform: translateX(0); }
}

.icon-header {
    font-size: 3rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px var(--primary));
    display: none; /* Ocultamos el antiguo globo */
}

h1 { 
    font-size: 2.5rem; 
    margin-bottom: 15px; 
    color: rgba(56, 189, 248, 0.85); /* Azul con transparencia */
    font-weight: 700;
}
p { font-size: 1.1rem; line-height: 1.6; margin-bottom: 25px; color: var(--text-dim); }

.how-to {
    list-style: none;
    text-align: left;
    margin-bottom: 30px;
}

.how-to li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.how-to i { color: var(--accent); width: 20px; text-align: center; }

.btn-main {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #fff;
    border: none;
    padding: 18px 36px;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.4), 
                inset 0 1px 1px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-main:hover {
    background: linear-gradient(135deg, #7dd3fc 0%, #0ea5e9 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 35px -10px rgba(2, 132, 199, 0.6);
}

.btn-main:active {
    transform: translateY(-2px) scale(0.98);
}

/* Map area */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #000;
}

/* HUD */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    padding: 20px;
    display: flex; /* Volvemos al estado original */
    flex-direction: column;
    justify-content: space-between;
}

.hud-top {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.hud-item {
    pointer-events: auto;
    padding: 10px 20px;
    border-radius: 12px;
    text-align: center;
    min-width: 120px;
}

.hud-item .label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.hud-item .val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* Dashboard Reset Button */
.btn-icon-only {
    min-width: 50px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--card);
}

.btn-icon-only:hover {
    color: var(--error);
    background: rgba(248, 81, 73, 0.1);
    transform: rotate(180deg);
    border-color: rgba(248, 81, 73, 0.4);
}

.btn-icon-only.confirming {
    color: #fff !important;
    background: var(--error) !important;
    border-color: var(--error) !important;
    animation: btn-pulse 1s infinite;
}

.btn-icon-only.confirming:hover {
    transform: none;
}

@keyframes btn-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(248, 81, 73, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(248, 81, 73, 0); }
}

.question-card {
    pointer-events: auto;
    align-self: center;
    width: 95%;
    max-width: 600px;
    margin-bottom: 40px;
    padding: 24px;
    border-radius: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.question-card.shake-error {
    animation: shake 0.4s ease-in-out;
    border-color: rgba(248, 81, 73, 0.5) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-8px); }
    30%, 60%, 90% { transform: translateX(8px); }
}

/* Timer */
.timer-container {
    position: relative;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1.4rem;
}

.question-body { flex: 1; }
.question-body h2 { font-size: 1.25rem; margin-bottom: 12px; line-height: 1.4; }
.question-body h2 b { color: var(--primary); }

.clues-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.5s;
    margin-top: 10px;
}

.flag-container {
    margin-bottom: 10px;
}

.flag-container img {
    height: 60px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.clues-container img {
    height: 48px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.clue-text {
    background: rgba(255,255,255,0.08);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    border-left: 3px solid var(--accent);
}

/* Feedback Integrated */
.feedback-icon-mini {
    width: 70px;
    height: 70px;
    display: none;
    font-size: 2.5rem;
    text-align: center;
    line-height: 70px;
    flex-shrink: 0;
}
.feedback-icon-mini.correct::before { content: "✅"; }
.feedback-icon-mini.wrong::before { content: "❌"; }
.feedback-icon-mini.timeout::before { content: "⏰"; }

.feedback-title-compact {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: none;
    text-align: center;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.correct-info-mini {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    margin-top: 10px;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.3s ease;
}

.correct-info-mini img { height: 35px; border-radius: 3px; }
.correct-info-mini h4 { font-size: 1rem; margin: 0 0 2px 0; color: #fff; }
.correct-info-mini p { font-size: 0.8rem; color: var(--text-dim); margin: 0; line-height: 1.2; }
.correct-info-mini .pop-tag { 
    margin-top: 4px; 
    color: var(--accent); 
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.correct-info-mini .rank-tag { 
    margin-top: 2px; 
    color: var(--primary); 
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

/* Activación por Clase */
#questionCard.is-feedback .feedback-title-compact { display: block; }
#questionCard.is-feedback .correct-info-mini { display: flex; }
#questionCard.is-feedback .btn-next-coupled { display: flex; }
#questionCard.is-feedback .question-text { display: none; }
#questionCard.is-feedback .feedback-icon-mini { display: none !important; }
#questionCard.is-feedback .flag-container { display: none; }

.btn-next-coupled {
    display: none;
    position: absolute;
    right: 15px;
    top: 15px;
    bottom: 15px;
    width: 65px;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-next-coupled:hover {
    background: linear-gradient(135deg, #7dd3fc 0%, #0ea5e9 100%);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.4);
}

.btn-next-coupled i {
    transition: transform 0.3s ease;
}

.btn-next-coupled:hover i {
    transform: translateX(5px);
}

/* State Transitions */
.question-card.is-feedback #timerWrapper,
.question-card.is-feedback .feedback-icon-mini { display: none !important; }
.question-card.is-feedback .feedback-title-compact { display: block; }
.question-card.is-feedback .btn-next-coupled { display: flex; }
.question-card.is-feedback #txtQuestion, 
.question-card.is-feedback .clues-container,
.question-card.is-feedback #targetFlagImg { display: none !important; }

/* --- Pantalla de Resultados Final --- */
.results-visual {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 20px auto;
}

.results-visual svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.results-visual circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.results-visual circle.bg {
    stroke: rgba(255,255,255,0.1);
}

.results-visual circle.progress {
    stroke: var(--primary);
    stroke-dasharray: 283; /* 2 * PI * 45 */
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s ease-out;
    filter: drop-shadow(0 0 8px var(--primary));
}

.score-data {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-data span {
    display: block;
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.score-data small {
    font-size: 1.2rem;
    opacity: 0.7;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.btn-atlas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

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

.btn-atlas i { color: #facc15; }

/* Score Circle */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
}

.score-circle small { font-size: 1.5rem; color: var(--text-dim); margin-left: 5px; }

/* Custom Leaflet overrides */
.leaflet-control-zoom { border: none !important; box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; }
.leaflet-control-zoom a { background: var(--card) !important; color: white !important; border: 1px solid rgba(255,255,255,0.1) !important; }
.leaflet-container { background: #000 !important; }

/* Mobile adjustments */
@media (max-width: 600px) {
    .question-card { flex-direction: column; text-align: center; gap: 15px; }
    .hud-item { min-width: 100px; }
    .card { padding: 30px 20px; }
}

/* Language Selector Mini */
.lang-selector-mini {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    gap: 12px;
}
.lang-selector-mini a {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    filter: grayscale(0.4) opacity(0.8);
}
.lang-selector-mini a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lang-selector-mini a:hover, 
.lang-selector-mini a.active { 
    filter: grayscale(0) opacity(1);
    transform: scale(1.15);
}
.lang-selector-mini a.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
}

@media (max-width: 600px) {
    .lang-selector-mini {
        top: 15px;
        right: 15px;
        gap: 10px;
    }
}

/* --- Feedback Visual en el Mapa V2 --- */
.click-feedback-v2 {
    position: absolute;
    pointer-events: none;
    font-size: 1.6rem;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0,0,0,0.8), 2px 2px 0px rgba(0,0,0,1);
    white-space: nowrap;
    animation: floatUpV2 4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

.click-feedback-v2.correct { 
    color: #ffffff; 
    text-shadow: 0 0 10px #facc15, 0 0 20px #eab308, 0 0 30px #d97706, 2px 2px 2px #000; 
}

.click-feedback-v2.error { 
    color: #800000; /* Maroon */
    text-shadow: 0 0 5px rgba(255,0,0,0.5), 2px 2px 2px #000; 
}

@keyframes floatUpV2 {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    20% { transform: translate(-50%, -90%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -160%) scale(1); opacity: 0; }
}

#map {
    cursor: pointer !important;
}

/* Fix: La línea fantasma del centro era el modal vacío */
.modal-content.profile-card {
    display: none !important; /* Oculto por defecto */
}
.modal-content.profile-card.active {
    display: flex !important; /* Solo visible si está activo */
}
