:root {
    --primary-orange: #f26522;
    --secondary-orange: #f7941e;
    --green-light: #8dc63f;
    --green-dark: #006837;
    --bg-dark: #0b1a27;
    --text-light: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: -webkit-fill-available; /* iOS Safari fix: altura real sin barra de navegación */
    overflow: hidden; /* Prohibir scroll global */
    position: fixed; /* Evitar el "bounce" en móviles/tablets */
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation; /* Evitar doble-tap zoom en iOS */
}

body {
    font-family: 'Outfit', sans-serif;
    /* iOS no soporta background-attachment:fixed en móvil, usamos ::after como capa fija */
    background: var(--bg-dark);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Safe area para iPhones con notch */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Capa de fondo con imagen (div real, compatible iOS Safari) */
.bg-image-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('page_bg.png') no-repeat center center;
    background-size: cover;
    z-index: 0;
}

/* Capa de oscurecimiento sobre el fondo para legibilidad */
.bg-overlay-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.game-container {
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    z-index: 10;
    -webkit-backdrop-filter: blur(15px); /* Safari/iOS */
    backdrop-filter: blur(15px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 40px;
    padding: 20px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7);
    text-align: center;
    overflow: hidden; /* Sin scroll interno */
}

.logo-container {
    width: 320px;
    margin: 0 auto -5px auto;
    display: flex;
    justify-content: center;
}

.gold-logo {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.3));
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -1.5px;
    text-transform: uppercase;
}

header .highlight {
    color: var(--primary-orange);
    text-shadow: 0 0 20px rgba(242, 101, 34, 0.4);
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.roulette-wrapper {
    position: relative;
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.roulette-ring {
    width: 100%;
    height: 100%;
    /* Transición súper veloz al inicio con parada lenta */
    transition: transform 4s cubic-bezier(0.1, 0, 0, 1);
    filter: drop-shadow(0 0 15px rgba(0,0,0,0.5));
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
    -webkit-mask-image: radial-gradient(circle, black 90%, transparent 91%);
    mask-image: radial-gradient(circle, black 98%, transparent 100%);
}

.roulette-ring.fast-spinning {
    filter: blur(4px) drop-shadow(0 0 15px rgba(0,0,0,0.5));
}

.roulette-ring img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fito-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px; /* Tamaño del FITO central */
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    -webkit-mask-image: radial-gradient(circle, black 65%, transparent 70%);
    mask-image: radial-gradient(circle, black 65%, transparent 70%);
}

.fito-center img {
    width: 100%;
    transition: filter 0.3s ease;
}

.fito-center img.blur-effect {
    filter: blur(8px);
}

.controls {
    margin-top: 20px;
}

.spin-btn {
    background: linear-gradient(135deg, var(--primary-orange), var(--secondary-orange));
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 1.5rem;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(242, 101, 34, 0.3), inset 0 2px 2px rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

.spin-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(242, 101, 34, 0.5);
}

.spin-btn:active {
    transform: translateY(2px);
}

.spin-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: all 0.4s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.modal-content {
    background: #fff;
    color: var(--bg-dark);
    padding: 50px;
    border-radius: 40px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--green-dark);
}

.question-box {
    margin: 30px 0;
    padding: 30px;
    background: #f8f9fa;
    border-left: 10px solid var(--primary-orange);
    border-radius: 15px;
}

#question-number {
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary-orange);
    line-height: 1;
    display: block;
    margin-bottom: 10px;
}

#question-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.close-btn {
    background: var(--green-dark);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 15px;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    background: var(--green-light);
}

/* ===== TIMER CIRCULAR ===== */
.timer-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px auto;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Empieza desde arriba */
}

.timer-circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 8;
}

.timer-circle-progress {
    fill: none;
    stroke: #28a745;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73; /* 2 * PI * 52 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 1s ease;
}

.timer-count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    color: #006837;
    transition: color 1s ease;
}

.timer-wrapper.danger .timer-circle-progress {
    stroke: #dc3545;
}

.timer-wrapper.danger .timer-count {
    color: #dc3545;
    animation: pulse-count 0.5s ease infinite alternate;
}

.timer-wrapper.warning .timer-circle-progress {
    stroke: #f7941e;
}

.timer-wrapper.warning .timer-count {
    color: #f7941e;
}

@keyframes pulse-count {
    from { transform: translate(-50%, -50%) scale(1); }
    to   { transform: translate(-50%, -50%) scale(1.15); }
}

/* BG Blobs */
.blob-bg, .blob-bg-2 {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-orange);
    filter: blur(150px);
    border-radius: 50%;
    opacity: 0.2;
    z-index: 1;
}

.blob-bg { top: -200px; right: -200px; }
.blob-bg-2 { bottom: -200px; left: -200px; background: var(--green-light); }

/* Responsive */
/* Desktop */
@media (min-width: 1200px) {
    .roulette-wrapper { width: 450px; height: 450px; }
    .fito-center { width: 160px; }
}

/* Tablet */
@media (max-width: 1024px) {
    .game-container { width: 85vw !important; height: 85vh !important; border-radius: 30px; }
    .roulette-wrapper { width: 55vmin; height: 55vmin; max-width: 420px; max-height: 420px; }
    .fito-center { width: 20vmin; max-width: 150px; }
    header h1 { font-size: 2.2rem; }
    .logo-container { width: 240px; }
}

/* Mobile */
@media (max-width: 768px) {
    .game-container { 
        width: 100vw !important; 
        height: 100vh !important;
        height: -webkit-fill-available !important; /* iOS Safari fix */
        border-radius: 0; 
        border: none;
        padding: 15px;
        padding-top: calc(15px + env(safe-area-inset-top));
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        justify-content: center;
        gap: 15px;
    }
    .roulette-wrapper { width: 75vmin; height: 75vmin; max-width: 310px; max-height: 310px; }
    .fito-center { width: 25vmin; max-width: 110px; }
    header h1 { font-size: 1.7rem; }
    .logo-container { width: 190px; }
    .spin-btn { padding: 12px 35px; font-size: 1.1rem; }
}

/* Fix para pantallas cortas o modo horizontal */
@media (max-height: 650px) {
    .game-container { padding: 8px; justify-content: center; gap: 10px; }
    main { gap: 8px; }
    .roulette-wrapper { width: 50vmin; height: 50vmin; }
    .fito-center { width: 18vmin; }
    header h1 { font-size: 1.4rem; }
    .logo-fitex { height: 25px; }
    .spin-btn { padding: 10px 30px; font-size: 1rem; }
    .subtitle { margin-top: 5px; }
}

/* ===== ESTILOS PANTALLA DE EVALUACIÓN ===== */
.eval-content {
    text-align: center;
    max-width: 600px !important;
}

.eval-subtitle {
    color: #666;
    font-size: 1rem;
    margin-bottom: 35px;
}

.eval-options {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.eval-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 35px 45px;
    border: 3px solid transparent;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 180px;
}

.eval-btn:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.correct-btn {
    background: linear-gradient(135deg, #e8f8f0, #d4edda);
    border-color: #28a745;
    color: #155724;
    box-shadow: 0 10px 25px rgba(40,167,69,0.2);
}

.correct-btn:hover {
    background: linear-gradient(135deg, #28a745, #20c25a);
    color: white;
    border-color: #28a745;
    box-shadow: 0 20px 40px rgba(40,167,69,0.4);
}

.incorrect-btn {
    background: linear-gradient(135deg, #fff5f5, #fde8e8);
    border-color: #dc3545;
    color: #721c24;
    box-shadow: 0 10px 25px rgba(220,53,69,0.2);
}

.incorrect-btn:hover {
    background: linear-gradient(135deg, #dc3545, #e55360);
    color: white;
    border-color: #dc3545;
    box-shadow: 0 20px 40px rgba(220,53,69,0.4);
}

.eval-icon {
    font-size: 3rem;
}

.eval-label {
    text-align: center;
    line-height: 1.4;
    text-transform: uppercase;
}

/* ===== ESTILOS PANTALLA DE FEEDBACK FINAL ===== */
.feedback-content {
    text-align: center;
}

.feedback-icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 20px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.feedback-content.correct-feedback {
    border-top: 8px solid #28a745;
}

.feedback-content.incorrect-feedback {
    border-top: 8px solid #dc3545;
}


/* ===== OPCIONES DE RESPUESTA MULTIPLE ===== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    text-align: left;
}

.option-btn {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 15px 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-dark);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.option-btn:hover {
    border-color: var(--primary-orange);
    background: #fff9f6;
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(242, 101, 34, 0.1);
}

.option-btn .option-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: #f8f9fa;
}

.option-btn:hover .option-check {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    background: white;
}

.option-btn span {
    line-height: 1.3;
}

/* Scrollbar para el modal en caso de que las opciones sean muchas */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
