:root {
    /* Professional Light Theme */
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-hover: #2563eb;
    /* Blue 600 */
    --primary-subtle: rgba(59, 130, 246, 0.1);

    --secondary: #f1f5f9;
    /* Slate 100 */
    --secondary-hover: #e2e8f0;
    /* Slate 200 */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */

    --surface: #ffffff;
    --bg-app: #f8fafc;
    /* Slate 50 */
    --border: #e2e8f0;
    /* Slate 200 */

    --success: #10b981;
    /* Emerald 500 */
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    /* Red 500 */
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    /* Amber 500 */

    /* Softer shadows for light mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;

    --font-stack: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

input,
button,
textarea,
select {
    font-family: inherit;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-app);
    background-image: none;
    /* Removed gradients */
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    line-height: 1.5;
}

.app-shell {
    width: 100%;
    max-width: 680px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    /* Subtle shadow for professionalism */
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: auto;
    /* Let content dictate height mostly */
    padding: 40px;
}

/* Header Section */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
    background: none;
    -webkit-text-fill-color: initial;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.5rem;
    margin-top: 4px;
    font-weight: 400;
}



/* View Containers */
.active-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.3s ease-out forwards;
}

.hidden-view {
    display: none;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.progress-info {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
    color: var(--text-muted);
    min-width: 60px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: var(--secondary);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: none;
    border-radius: 99px;
}



/* Question Area */
.question-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}





#question-text {
    font-size: 1.5rem;
    line-height: 1.5;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-main);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.option-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 18px 22px;
    border-radius: var(--radius-md);
    text-align: left;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-subtle);
    transform: none;
    /* No movement on hover for pro look */
    box-shadow: none;
}

.option-btn:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.option-btn.selected {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--primary);
    /* subtle ring */
}

.option-btn.correct {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
    /* darker green text */
    box-shadow: none;
    transform: none;
}

.option-btn.correct::after {
    content: "✓";
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
    margin-left: 12px;
    background: none;
    -webkit-text-fill-color: initial;
}

.option-btn.wrong {
    border-color: var(--error);
    background: var(--error-bg);
    color: var(--error);
    box-shadow: none;
}

.option-btn.wrong::after {
    content: "✕";
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--error);
    margin-left: 12px;
}

.option-btn:disabled {
    cursor: default;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Footer & Buttons */
.quiz-footer,
.results-footer {
    display: flex;
    justify-content: flex-end;
    /* Right align buttons usually looks cleaner */
    gap: 12px;
    margin-top: auto;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.btn {
    border: 1px solid transparent;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: normal;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--secondary);
    border-color: #cbd5e1;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--secondary);
    color: var(--text-muted);
    box-shadow: none;
}

/* Results Screen */
.results-card {
    text-align: center;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--percent, 0%), var(--secondary) 0);
    margin: 0 auto 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: none;
    /* Flat */
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 142px;
    height: 142px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: none;
}

.score-circle span {
    position: relative;
    z-index: 1;
}

#final-score {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--text-main);
}

.score-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

#final-percent {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

#feedback-message {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-bottom: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--border);
    padding: 1px;
    /* Gap effect */
    overflow: hidden;
}

.stat-item {
    background: var(--surface);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 0;
    border: none;
}

.stat-val {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* Review Section */
.review-section {
    text-align: left;
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.review-section h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

.review-item {
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-summary {
    padding: 16px 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    transition: background 0.15s;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
}

.review-summary:hover {
    background: var(--secondary);
}

.review-status {
    font-size: 1rem;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    margin-left: 12px;
    text-transform: capitalize;
    font-weight: 600;
    letter-spacing: normal;
}

.status-correct {
    background: var(--success-bg);
    color: var(--success);
}

.status-wrong {
    background: var(--error-bg);
    color: var(--error);
}

.status-skipped {
    background: var(--secondary);
    color: var(--text-muted);
}

.review-details {
    padding: 12px 12px 24px;
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.review-correct-ans {
    color: var(--success);
    font-weight: 600;
}

/* Utilities */
.aria-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.key-hint {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-muted);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 640px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}