@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Poppins:wght@400;600&display=swap');

:root {
    --bg-dark: #1a1a2e;
    --bg-medium: #16213e;
    --bg-light: #0f3460;
    --primary: #e94560;
    --secondary: #ffc107;
    --success: #28a745;
    --cta: #17a2b8;
    --text-light: #ffffff;
    --text-dark: #1a1a2e;
    --correct: #28a745;
    --incorrect: #dc3545;
    --auura-green: #27ae60;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
}

#vastu-kbc-game-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(45deg, var(--bg-dark), var(--bg-medium), var(--bg-light), var(--bg-dark));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    position: relative;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: auto;
    padding: 1rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary);
    margin-bottom: 0.5rem;
}

.header .subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    opacity: 0.8;
}

.welcome-screen, .result-screen {
    background: rgba(15, 52, 96, 0.5);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeIn 0.5s ease-in-out;
}

/* Text visibility fixes */
.result-screen, .result-screen h2, .result-screen p, .result-screen h4 { color: var(--text-light); }
.victory-content p, .victory-content h3, .victory-content h2 { color: var(--text-light); }
#congrats-content h2, #congrats-content h3, #congrats-content p { color: var(--text-light); }

.welcome-screen h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.welcome-screen p {
    font-size: 1.1rem;
    color: var(--text-light);
    opacity: 0.9;
    margin-bottom: 2rem;
}

.cta-section { margin: 2rem 0; }
.cta-section h3 { font-size: 1.5rem; color: var(--secondary); margin-bottom: 1.5rem; }
.cta-buttons { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.start-btn, .btn {
    background: linear-gradient(45deg, var(--primary), #c93048);
    color: var(--text-light);
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
    margin: 5px;
    text-decoration: none;
    display: inline-block;
}

.start-btn:hover, .btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.6);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.cta-btn {
    background: linear-gradient(45deg, var(--auura-green), #1e8449);
    padding: 10px 22px;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.cta-btn:hover { box-shadow: 0 4px 15px rgba(39, 174, 96, 0.5); }

.quiz-layout {
    display: grid;
    grid-template-areas: "lifelines prize" "quiz quiz";
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease-in-out;
    align-items: start;
}

.main-quiz-section { grid-area: quiz; }
.prize-section { grid-area: prize; }
.lifelines-section { grid-area: lifelines; }

.lifelines, .prize-ladder {
    background: rgba(15, 52, 96, 0.5);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.lifelines h3, .prize-ladder h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--secondary);
    font-weight: 600;
}

.lifelines { height: auto; }
.prize-ladder { height: 300px; }
#prize-list { flex-grow: 1; overflow-y: auto; max-height: 250px; }

.question-section {
    background: rgba(15, 52, 96, 0.5);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
#question-number { font-size: 1.1rem; font-weight: 600; color: var(--secondary); }
.question-text { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 600; margin-bottom: 1.5rem; text-align: center; line-height: 1.4; color: var(--text-light); }
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.question-actions { text-align: center; }

.answer-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    text-align: left;
    color: var(--text-light);
}
.answer-option:hover:not(.eliminated):not(.selected) { background: rgba(255, 255, 255, 0.1); border-color: var(--secondary); transform: translateY(-2px); }
.answer-option.selected { background: var(--secondary); color: var(--text-dark); font-weight: 600; border-color: var(--secondary); transform: scale(1.02); }
.answer-option.correct { background: var(--correct) !important; border-color: #1f8135 !important; color: white !important; }
.answer-option.incorrect { background: var(--incorrect) !important; border-color: #a52834 !important; color: white !important; }
.answer-option.eliminated { opacity: 0.3; pointer-events: none; transform: scale(0.95); }

.lifeline-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}
.lifeline-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); transform: translateY(-2px); border-color: var(--secondary); }
.lifeline-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.lifeline-icon { font-size: 1.2rem; width: 24px; text-align: center; }

.prize-item { padding: 8px 12px; border-radius: 8px; margin-bottom: 5px; transition: all 0.3s ease; display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; color: var(--text-light); }
.prize-item.current { background: var(--secondary); color: var(--text-dark); font-weight: bold; transform: scale(1.05); box-shadow: 0 0 15px var(--secondary); animation: pulse 2s infinite; }
.prize-item.safe { color: var(--secondary); font-weight: bold; border: 1px solid var(--secondary); }
.prize-item.completed { background: rgba(40, 167, 69, 0.5); color: #90ee90; }

#personal-records { margin: 2rem 0; padding: 1rem; background: rgba(0, 0, 0, 0.2); border-radius: 10px; }
#personal-records h3 { color: var(--secondary); margin-bottom: 1rem; }
#personal-records p { margin: 0.5rem 0; font-size: 0.95rem; color: var(--text-light); }

.modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--bg-medium);
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.modal-content h3 { color: var(--secondary); margin-bottom: 1rem; }
#answer-feedback-modal .modal-content { background: transparent; border: none; box-shadow: none; backdrop-filter: none; }
#feedback-text { font-family: 'Cinzel', serif; font-size: 4rem; text-shadow: 0 0 15px; }
#feedback-text.correct { color: var(--success); text-shadow: 0 0 20px var(--success); }
#feedback-text.incorrect { color: var(--incorrect); text-shadow: 0 0 20px var(--incorrect); }

.victory-content { max-width: 600px; padding: 3rem; }
.trophy-animation { font-size: 4rem; animation: bounce 1s infinite; margin-bottom: 1rem; }

@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-20px); } 60% { transform: translateY(-10px); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

.poll-bar-container { display: flex; align-items: center; margin-bottom: 15px; gap: 10px; }
.poll-option-label { flex-shrink: 0; width: 60px; font-weight: 600; color: var(--secondary); }
.poll-bar-wrapper { flex-grow: 1; background: rgba(0,0,0,0.2); border-radius: 5px; height: 25px; position: relative; }
.poll-bar { height: 100%; background: linear-gradient(45deg, var(--primary), #c93048); border-radius: 5px; transition: width 1s ease-in-out; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.8rem; }

.sound-toggle-wrapper { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 2rem; }
.sound-label { font-size: 1rem; font-weight: 600; color: var(--text-light); }
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #3c3c5c; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--auura-green); }
input:focus + .slider { box-shadow: 0 0 1px var(--auura-green); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.cta-wrapper { width: 100%; max-width: 1400px; margin: 2rem auto 0 auto; padding: 2rem; background: rgba(15, 52, 96, 0.5); border-radius: 20px; text-align: center; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1); }
.cta-wrapper h3 { color: var(--secondary); margin-bottom: 1rem; font-size: 1.5rem; }
.cta-wrapper p { margin-bottom: 1.5rem; font-size: 1.1rem; opacity: 0.9; color: var(--text-light); }

.powered-by { margin-top: 1rem; font-size: 0.9rem; opacity: 0.9; color: var(--text-light); }
.powered-by a { color: var(--secondary); text-decoration: none; font-weight: bold; }
.powered-by a:hover { text-decoration: underline; }

@media (max-width: 992px) {
    .quiz-layout { grid-template-areas: "lifelines" "quiz" "prize"; grid-template-columns: 1fr; grid-template-rows: auto; gap: 1rem; align-items: stretch; }
    .lifelines, .prize-ladder { height: auto; }
    .answers-grid { grid-template-columns: 1fr; }
    .lifelines { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}
@media (max-width: 600px) {
    .lifelines { grid-template-columns: 1fr; }
    .cta-buttons { flex-direction: column; align-items: center; }
}