:root {
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --btn-primary: #007AFF;
    --btn-primary-text: #ffffff;
    --btn-option: #f9fafb;
    
    --color-exact: #10b981;
    --color-fail: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body {
    background: linear-gradient(135deg, #f6f8fd 0%, #f1f5f9 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
body.no-scroll {
    overflow: hidden;
    touch-action: none;
}

.app-container {
    width: 100%; max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 150, 0.05), 0 0 15px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
    min-height: auto;
    display: flex; flex-direction: column;
}

.screen {
    display: none; flex-direction: column; align-items: center; justify-content: flex-start;
    width: 100%; height: auto; padding: 40px 24px 24px 24px;
    background: var(--bg-card);
    flex-grow: 1;
}
.screen.show { display: flex; animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

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

/* Progress Bar */
.progress-container {
    width: 100%; height: 6px; background: #e2e8f0;
    border-radius: 10px; margin-bottom: 10px; overflow: hidden;
}
.progress-bar {
    height: 100%; background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%); border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress-text { font-size: 0.85rem; font-weight: 800; color: #94a3b8; margin-bottom: 25px; text-transform: uppercase; letter-spacing: 1.5px; }

h1 { font-size: 2.2rem; font-weight: 900; color: var(--text-main); text-align: center; line-height: 1.1; margin-bottom: 5px; }
h2 { font-size: 1.6rem; font-weight: 800; color: #334155; margin-bottom: 15px; text-align: center; }

.question-box {
    text-align: center; font-size: 1.6rem; font-weight: 800; line-height: 1.3;
    margin-bottom: 40px; min-height: 80px; display: flex; align-items: center; justify-content: center;
    color: #0f172a; width: 100%;
}

.options-grid {
    display: flex; flex-direction: column; width: 100%; gap: 15px; margin-bottom: 0;
}

.btn-option {
    width: 100%; padding: 22px; border-radius: 20px; border: none;
    font-size: 1.3rem; font-weight: 800; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 8px 15px -5px rgba(0,0,0,0.1); color: white;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.btn-option:active { transform: scale(0.95); }

/* Colores llamativos y dinámicos para los botones de opciones (controlados por JS) */
#btn-guess-a, #btn-vote-a { 
    background: linear-gradient(135deg, var(--color-a-start, #8B5CF6) 0%, var(--color-a-end, #A78BFA) 100%); 
    box-shadow: 0 8px 20px var(--color-a-shadow, rgba(139, 92, 246, 0.3)); 
}
#btn-guess-b, #btn-vote-b { 
    background: linear-gradient(135deg, var(--color-b-start, #4ECDC4) 0%, var(--color-b-end, #55E6DC) 100%); 
    box-shadow: 0 8px 20px var(--color-b-shadow, rgba(78, 205, 196, 0.3)); 
    color: white; /* Force white text for all dynamic palettes */
}

.btn-primary {
    width: 100%; padding: 20px; border-radius: 20px; border: none;
    background: var(--btn-primary); color: var(--btn-primary-text);
    font-size: 1.15rem; font-weight: 800; cursor: pointer; transition: 0.2s;
    text-transform: uppercase; margin-top: auto; box-shadow: 0 8px 15px rgba(0, 122, 255, 0.3);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.btn-primary:active { transform: scale(0.97); }

.icon-pulse { font-size: 4rem; margin-bottom: 20px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.score-box {
    font-size: 1.8rem; font-weight: 900; margin-bottom: 12px; color: var(--text-main); text-align: center; line-height:1.1;
}

.results-list {
    width: 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px;
}
.result-item {
    background: var(--bg-card); padding: 10px 15px; border-radius: 12px; font-size: 0.9rem;
    border: 2px solid #e2e8f0; position: relative; overflow: hidden;
}

/* Background percentage bar inside the result item */
.result-bg-bar {
    position: absolute; top: 0; left: 0; height: 100%; z-index: 0;
    opacity: 0.15; transition: 1s ease-out;
}
/* Ahora la barra de fondo tomará el color de la opción ganadora dinámicamente mediante JS */

.result-content { position: relative; z-index: 10; }
.result-q { font-weight: 800; margin-bottom: 8px; font-size: 1.05rem; }
.result-stats { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }
.result-stats span { font-weight: 800; color: var(--text-main); font-size: 1rem; }

.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    background: #111827; color: white; padding: 12px 24px; border-radius: 30px;
    font-weight: 700; opacity: 0; transition: 0.3s; z-index: 1000; box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Modal de Instrucciones */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-content {
    background: var(--bg-card); width: 90%; max-width: 360px;
    border-radius: 24px; padding: 30px 20px; text-align: center;
    transform: translateY(30px) scale(0.95); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
.modal-overlay.show .modal-content { transform: translateY(0) scale(1); }
.modal-content h2 { color: #FF6B6B; font-size: 1.8rem; margin-bottom: 15px; }
.modal-content p { color: var(--text-muted); font-size: 1rem; line-height: 1.5; margin-bottom: 15px; text-align: left; }
.modal-content p strong { color: var(--text-main); }
