/* ===== CSS Variables & Base Styles ===== */
:root {
    /* Color Palette - Clean White & Soft Pink */
    --primary: #e91e63;
    --primary-light: #f48fb1;
    --primary-dark: #c2185b;
    --primary-glow: rgba(233, 30, 99, 0.2);

    --accent: #ff6b9d;
    --accent-light: #ff8fab;
    --accent-glow: rgba(255, 107, 157, 0.3);

    --success: #4caf50;
    --success-light: #81c784;
    --success-bg: rgba(76, 175, 80, 0.1);

    --error: #f44336;
    --error-light: #e57373;
    --error-bg: rgba(244, 67, 54, 0.1);

    --bg-cream: #fefcfb;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.8);

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;

    --border: rgba(233, 30, 99, 0.15);
    --border-hover: rgba(233, 30, 99, 0.3);

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(233, 30, 99, 0.08);
    --shadow-md: 0 4px 20px rgba(233, 30, 99, 0.1);
    --shadow-lg: 0 8px 40px rgba(233, 30, 99, 0.15);
    --shadow-glow: 0 0 30px var(--primary-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-cream);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Pattern */
.background-pattern {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(244, 143, 177, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255, 107, 157, 0.1), transparent),
        radial-gradient(circle at 50% 50%, var(--bg-cream), var(--bg-cream));
}

@keyframes bgShift {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.9;
    }

    100% {
        opacity: 1;
    }
}

/* ===== Screen Management ===== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.4s ease-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Home Screen ===== */
#home-screen {
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 40px 20px;
}

.hero {
    text-align: center;
    animation: heroEnter 0.8s ease-out;
}

@keyframes heroEnter {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    color: var(--primary);
    filter: drop-shadow(0 0 20px var(--primary-glow));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Quiz Selection */
.quiz-selection {
    width: 100%;
    max-width: 700px;
}

.quiz-selection h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

.quiz-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.quiz-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quiz-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-glow), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quiz-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.quiz-card:hover::before {
    opacity: 1;
}

.quiz-card:active {
    transform: translateY(-2px) scale(0.98);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.quiz-card h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.quiz-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.question-count {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.home-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: fadeIn 1s ease-out 0.5s both;
}

/* ===== Quiz Screen ===== */
#quiz-screen {
    max-width: 800px;
    margin: 0 auto;
    gap: 24px;
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.quiz-info {
    flex: 1;
}

.quiz-info h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    background: var(--success-bg);
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-display span {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

.score-display small {
    font-size: 0.7rem;
    color: var(--success-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Question Container */
.question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-number {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
    padding: 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-glass);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(233, 30, 99, 0.08);
}

.option-btn:disabled {
    cursor: not-allowed;
}

.option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--border);
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    padding-top: 4px;
}

.option-btn:hover:not(:disabled) .option-label {
    background: var(--primary);
    color: white;
}

/* Option States */
.option-btn.selected {
    border-color: var(--primary);
    background: rgba(233, 30, 99, 0.1);
}

.option-btn.selected .option-label {
    background: var(--primary);
    color: white;
}

.option-btn.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.option-btn.correct .option-label {
    background: var(--success);
    color: white;
}

.option-btn.incorrect {
    border-color: var(--error);
    background: var(--error-bg);
}

.option-btn.incorrect .option-label {
    background: var(--error);
    color: white;
}

/* Feedback */
.feedback-container {
    display: none;
    padding: 20px;
    border-radius: var(--radius-md);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-container.show {
    display: block;
}

.feedback-container.correct {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.feedback-container.incorrect {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.feedback-icon {
    font-size: 1.5rem;
}

.feedback-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
}

.feedback-container.correct .feedback-title {
    color: var(--success);
}

.feedback-container.incorrect .feedback-title {
    color: var(--error);
}

.feedback-explanation {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Quiz Footer */
.quiz-footer {
    display: flex;
    justify-content: flex-end;
    padding: 20px 0;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* ===== Results Screen ===== */
#results-screen {
    justify-content: center;
    align-items: center;
}

.results-content {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.results-header {
    margin-bottom: 32px;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.trophy-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
}

.results-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Score Card */
.score-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    margin-bottom: 24px;
}

.score-circle {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 24px;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.score-progress {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.score-value span {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
}

.score-value small {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    align-self: flex-end;
    margin-bottom: 8px;
}

.score-percentage {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.score-message {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Stats */
.results-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 32px;
    border-radius: var(--radius-md);
}

.stat.correct {
    background: var(--success-bg);
}

.stat.incorrect {
    background: var(--error-bg);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
}

.stat.correct .stat-value {
    color: var(--success);
}

.stat.incorrect .stat-value {
    color: var(--error);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Actions */
.results-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 28px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ===== Review Screen ===== */
#review-screen {
    max-width: 800px;
    margin: 0 auto;
    gap: 24px;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.review-header h2 {
    flex: 1;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
}

.review-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

#review-progress {
    min-width: 60px;
    text-align: center;
    color: var(--text-secondary);
}

.review-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    width: fit-content;
}

.review-status.correct {
    background: var(--success-bg);
    color: var(--success);
}

.review-status.incorrect {
    background: var(--error-bg);
    color: var(--error);
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
}

.review-option.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.review-option.user-answer {
    border-color: var(--error);
    background: var(--error-bg);
}

.review-option.correct.user-answer {
    border-color: var(--success);
    background: var(--success-bg);
}

.review-explanation {
    padding: 20px;
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(13, 148, 136, 0.3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    line-height: 1.6;
}

.review-explanation strong {
    color: var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .quiz-header {
        flex-wrap: wrap;
    }

    .quiz-info {
        order: 3;
        width: 100%;
        margin-top: 12px;
    }

    .score-display {
        margin-left: auto;
    }

    .question-text {
        padding: 18px;
        font-size: 1.05rem;
    }

    .option-btn {
        padding: 14px 16px;
    }

    .results-stats {
        gap: 16px;
    }

    .stat {
        padding: 12px 24px;
    }

    .score-circle {
        width: 140px;
        height: 140px;
    }

    .score-value span {
        font-size: 2.5rem;
    }
}