/* ============================================
   SIMULATORE QUIZ LOGICA — Design System
   Neo-Glassmorphism Dark Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #10102a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-card-border: rgba(255, 255, 255, 0.08);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0c0;
    --text-muted: #6b6b8d;

    --accent-start: #7c3aed;
    --accent-end: #3b82f6;
    --accent-glow: rgba(124, 58, 237, 0.3);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;

    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background noise texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Screens --- */
.screen {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 28px 24px;
    box-shadow: var(--shadow-card);
}

/* ============================================
   SCREEN 1: CONFIGURAZIONE
   ============================================ */

.config-header {
    text-align: center;
    padding: 40px 0 32px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.config-header h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 420px;
    margin: 0 auto;
}

.config-card {
    margin-bottom: 24px;
}

.config-card h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* --- Category Chips --- */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 32px;
}

.category-chip {
    cursor: pointer;
    position: relative;
}

.category-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--bg-card-border);
    background: var(--bg-card);
    transition: all var(--transition-normal);
    user-select: none;
}

.category-chip input:checked + .chip-content {
    border-color: var(--accent-start);
    background: rgba(124, 58, 237, 0.1);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.1);
}

.category-chip:hover .chip-content {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.category-chip input:checked:hover + .chip-content {
    border-color: var(--accent-end);
}

.chip-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-normal);
}

.category-chip input:checked + .chip-content .chip-icon {
    color: var(--accent-start);
}

.chip-icon svg {
    width: 100%;
    height: 100%;
}

.chip-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-normal);
}

.category-chip input:checked + .chip-content .chip-label {
    color: var(--text-primary);
}

/* --- Slider --- */
.question-count-section {
    margin-bottom: 28px;
}

.slider-container {
    position: relative;
    margin: 12px 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    cursor: pointer;
    box-shadow: 0 0 12px var(--accent-glow);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    cursor: pointer;
    border: none;
    box-shadow: 0 0 12px var(--accent-glow);
}

.slider-value-wrapper {
    text-align: center;
    margin-top: 8px;
}

.slider-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Quick Pick Buttons --- */
.quick-picks, .timer-options {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.quick-pick-btn {
    padding: 8px 18px;
    border: 1.5px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-pick-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.quick-pick-btn.active {
    border-color: var(--accent-start);
    background: rgba(124, 58, 237, 0.12);
    color: var(--text-primary);
}

/* --- Timer Toggle --- */
.timer-section {
    margin-bottom: 28px;
    padding-top: 4px;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 4px 0;
}

.toggle-label span {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: white;
}

/* --- Primary Button --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 28px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: white;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
}

/* --- Secondary Button --- */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: 1.5px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: 1.5px solid var(--error);
    border-radius: var(--radius-md);
    background: var(--error-bg);
    color: var(--error);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.error-msg {
    color: var(--error);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
}

.config-footer {
    text-align: center;
    padding: 16px 0 32px;
}

.config-footer p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ============================================
   SCREEN 2: QUIZ
   ============================================ */

.quiz-container {
    padding-top: 16px;
    padding-bottom: 32px;
}

.quiz-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.quiz-progress-info {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.quiz-progress-info #quiz-current {
    color: var(--text-primary);
    font-size: 1.2rem;
}

.progress-separator {
    margin: 0 4px;
    color: var(--text-muted);
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
}

.quiz-timer svg {
    width: 16px;
    height: 16px;
}

.quiz-timer.warning {
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--warning-bg);
}

.quiz-timer.danger {
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
    background: var(--error-bg);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Progress Bar */
.progress-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    border-radius: 2px;
    transition: width var(--transition-normal);
}

/* Question Card */
.question-card {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

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

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-start);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.question-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-btn:hover:not(.disabled) {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.option-btn .option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.option-btn:hover:not(.disabled) .option-letter {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-start);
}

.option-btn.selected {
    border-color: var(--accent-start);
    background: rgba(124, 58, 237, 0.08);
}

.option-btn.selected .option-letter {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: white;
}

.option-btn.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.option-btn.correct .option-letter {
    background: var(--success);
    color: white;
}

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

.option-btn.wrong .option-letter {
    background: var(--error);
    color: white;
}

.option-btn.disabled {
    cursor: default;
    opacity: 0.6;
}

.option-btn.disabled.correct,
.option-btn.disabled.wrong {
    opacity: 1;
}

/* Explanation Box */
.explanation-box {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    animation: fadeIn 0.3s ease;
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-end);
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.explanation-header svg {
    width: 16px;
    height: 16px;
}

.explanation-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Quiz Nav */
.quiz-nav {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.quiz-nav .btn-primary {
    flex: 1;
}

.quiz-nav .btn-secondary {
    flex: 0 0 auto;
}

/* ============================================
   SCREEN 3: RISULTATI
   ============================================ */

.results-header {
    text-align: center;
    padding: 32px 0 24px;
}

.score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease;
}

.score-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-percent {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
}

.results-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Results Stats */
.results-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    text-align: center;
    margin-bottom: 20px;
}

.stat-item {
    padding: 16px 8px;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 4px;
}

.stat-value.stat-wrong {
    color: var(--error);
}

.stat-value.stat-skipped {
    color: var(--warning);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Category Breakdown */
.category-breakdown {
    margin-bottom: 20px;
}

.category-breakdown h2,
.review-section h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.cat-bar-item {
    margin-bottom: 16px;
}

.cat-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cat-bar-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.cat-bar-score {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cat-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.cat-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    transition: width 1s ease;
}

.cat-bar-fill.good {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.cat-bar-fill.medium {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.cat-bar-fill.bad {
    background: linear-gradient(90deg, var(--error), #f87171);
}

/* Review Section */
.review-section {
    margin-bottom: 20px;
}

.review-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--bg-card-border);
}

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

.review-question {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.review-answer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.review-answer.your-answer {
    color: var(--error);
}

.review-answer.correct-answer {
    color: var(--success);
}

.review-answer-label {
    font-weight: 600;
    min-width: 100px;
}

.review-explanation {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 12px;
    padding-bottom: 40px;
}

.results-actions .btn-primary,
.results-actions .btn-secondary {
    flex: 1;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-primary);
    z-index: 100;
    transition: opacity var(--transition-slow);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-start);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.modal h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Mobile Small (Phones < 400px) */
@media (max-width: 400px) {
    .container {
        padding: 16px 12px;
    }

    .glass-card {
        padding: 16px 12px;
    }

    .config-header {
        padding-top: 20px;
        padding-bottom: 24px;
    }

    .config-header h1 {
        font-size: 1.6rem;
    }
    
    .logo-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .chip-content {
        padding: 12px;
    }
    
    .chip-label {
        font-size: 0.8rem;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }

    .quick-pick-btn, .timer-options .quick-pick-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }
    
    .quick-picks, .timer-options {
        flex-wrap: wrap;
    }

    .btn-primary {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .question-text {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .option-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
        gap: 10px;
    }

    .quiz-timer {
        font-size: 0.9rem;
        padding: 4px 8px;
    }

    .score-ring {
        width: 110px;
        height: 110px;
    }
    
    .score-percent {
        font-size: 1.6rem;
    }
    
    .results-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .stat-item {
        padding: 12px 4px;
        background: rgba(255,255,255,0.02);
        border-radius: var(--radius-sm);
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
}

/* Mobile Medium (Phones <= 600px) */
@media (max-width: 600px) {
    .config-header h1 {
        font-size: 2rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .slider-value {
        font-size: 1.8rem;
    }

    .quiz-nav {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .quiz-nav .btn-secondary {
        width: 100%;
    }

    .results-actions {
        flex-direction: column;
    }

    .glass-card {
        padding: 20px 16px;
    }
    
    .modal {
        max-width: 90%;
        padding: 20px 16px;
    }
    
    .modal-actions {
        flex-direction: column-reverse;
    }
}

/* Tablet (Portait & Landscape > 600px and < 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
    .container {
        padding: 32px 24px;
    }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .container {
        padding: 40px 24px;
        max-width: 760px;
    }

    .config-header {
        padding-top: 60px;
    }

    .config-header h1 {
        font-size: 3rem;
    }

    .question-text {
        font-size: 1.4rem;
    }
    
    .option-btn:hover:not(.disabled) {
        transform: translateX(4px);
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Focus visible for keyboard nav --- */
:focus-visible {
    outline: 2px solid var(--accent-start);
    outline-offset: 2px;
}

button:focus:not(:focus-visible) {
    outline: none;
}
