:root {
  --background: oklch(0.9821 0 0);
  --foreground: oklch(0.2435 0 0);
  --card: oklch(0.9911 0 0);
  --card-foreground: oklch(0.2435 0 0);
  --popover: oklch(0.9911 0 0);
  --popover-foreground: oklch(0.2435 0 0);
  --primary: oklch(0.4341 0.0392 41.9938);
  --primary-foreground: oklch(1.0000 0 0);
  --secondary: oklch(0.9200 0.0651 74.3695);
  --secondary-foreground: oklch(0.3499 0.0685 40.8288);
  --muted: oklch(0.9521 0 0);
  --muted-foreground: oklch(0.5032 0 0);
  --accent: oklch(0.9310 0 0);
  --accent-foreground: oklch(0.2435 0 0);
  --destructive: oklch(0.6271 0.1936 33.3390);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.8822 0 0);
  --input: oklch(0.8822 0 0);
  --ring: oklch(0.4341 0.0392 41.9938);
  --chart-1: oklch(0.4341 0.0392 41.9938);
  --chart-2: oklch(0.9200 0.0651 74.3695);
  --chart-3: oklch(0.9310 0 0);
  --chart-4: oklch(0.9367 0.0523 75.5009);
  --chart-5: oklch(0.4338 0.0437 41.6746);
  --success: oklch(0.5 0.15 145);
  --sidebar: oklch(0.9881 0 0);
  --sidebar-foreground: oklch(0.2645 0 0);
  --sidebar-primary: oklch(0.3250 0 0);
  --sidebar-primary-foreground: oklch(0.9881 0 0);
  --sidebar-accent: oklch(0.9761 0 0);
  --sidebar-accent-foreground: oklch(0.3250 0 0);
  --sidebar-border: oklch(0.9401 0 0);
  --sidebar-ring: oklch(0.7731 0 0);
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius: 0.5rem;
  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.1;
  --shadow-color: oklch(0 0 0);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
  --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
  --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
  --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
  --tracking-normal: 0em;
  --spacing: 0.25rem;
}

.dark {
  --background: oklch(0.1776 0 0);
  --foreground: oklch(0.9491 0 0);
  --card: oklch(0.2134 0 0);
  --card-foreground: oklch(0.9491 0 0);
  --popover: oklch(0.2134 0 0);
  --popover-foreground: oklch(0.9491 0 0);
  --primary: oklch(0.9247 0.0524 66.1732);
  --primary-foreground: oklch(0.2029 0.0240 200.1962);
  --secondary: oklch(0.3163 0.0190 63.6992);
  --secondary-foreground: oklch(0.9247 0.0524 66.1732);
  --muted: oklch(0.2520 0 0);
  --muted-foreground: oklch(0.7699 0 0);
  --accent: oklch(0.2850 0 0);
  --accent-foreground: oklch(0.9491 0 0);
  --destructive: oklch(0.6271 0.1936 33.3390);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.2351 0.0115 91.7467);
  --input: oklch(0.4017 0 0);
  --ring: oklch(0.9247 0.0524 66.1732);
  --chart-1: oklch(0.9247 0.0524 66.1732);
  --chart-2: oklch(0.3163 0.0190 63.6992);
  --chart-3: oklch(0.2850 0 0);
  --chart-4: oklch(0.3481 0.0219 67.0001);
  --chart-5: oklch(0.9245 0.0533 67.0855);
  --success: oklch(0.75 0.15 145);
  --sidebar: oklch(0.2103 0.0059 285.8852);
  --sidebar-foreground: oklch(0.9674 0.0013 286.3752);
  --sidebar-primary: oklch(0.4882 0.2172 264.3763);
  --sidebar-primary-foreground: oklch(1.0000 0 0);
  --sidebar-accent: oklch(0.2739 0.0055 286.0326);
  --sidebar-accent-foreground: oklch(0.9674 0.0013 286.3752);
  --sidebar-border: oklch(0.2739 0.0055 286.0326);
  --sidebar-ring: oklch(0.8711 0.0055 286.2860);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    min-height: 100vh;
    color: var(--foreground);
    background: var(--background);
    display: flex;
    flex-direction: column;
    padding: 0;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(var(--primary-rgb), 0.03) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(var(--primary-rgb), 0.02) 0%, transparent 50%);
    animation: smoothWave 15s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}

@keyframes smoothWave {
    0% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(3%, -3%) scale(1.05);
        opacity: 0.7;
    }
    100% { 
        transform: translate(-3%, 3%) scale(0.95);
        opacity: 0.5;
    }
}

/* Layout */
.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    flex: 1;
}

/* Cards (Glass Panel replacement) */
.glass-panel {
    background: var(--card);
    color: var(--card-foreground);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 2.5rem;
    box-shadow: 0 25px 80px -15px rgba(0, 0, 0, 0.6),
                0 12px 30px -8px rgba(0, 0, 0, 0.4),
                0 1px 0 0 rgba(255, 255, 255, 0.12) inset;
    padding: 3rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover::before {
    left: 100%;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
    background: var(--card);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 2.5rem;
    box-shadow: 0 12px 50px 0 rgba(0, 0, 0, 0.5),
                0 1px 0 0 rgba(255, 255, 255, 0.12) inset;
    position: sticky;
    top: 1rem;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 20px 60px 0 rgba(0, 0, 0, 0.6),
                0 1px 0 0 rgba(255, 255, 255, 0.18) inset;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.logo h1 {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--foreground);
    letter-spacing: -0.025em;
}

.stats-container {
    display: flex;
    gap: 0.5rem;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: var(--secondary);
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--secondary-foreground);
}

.stat-pill.success { color: var(--success); background: color-mix(in oklch, var(--success), transparent 85%); }
.stat-pill.error { color: var(--destructive); background: oklch(0.6271 0.1936 33.3390 / 0.1); }

/* Upload Section */
.upload-section {
    text-align: center;
    padding: 4rem 2rem;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
}

.upload-section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--foreground);
    letter-spacing: -0.025em;
}

.upload-section p {
    color: var(--muted-foreground);
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px; /* iOS minimum touch target */
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover {
    background: var(--muted);
}

.btn-next {
    background: var(--foreground);
    color: var(--background);
}

.btn-next:hover {
    opacity: 0.9;
}

.btn-full { 
    width: 100%; 
    justify-content: center; 
    padding: 1rem; 
    font-size: 1rem; 
}

.file-upload-wrapper input {
    display: none;
}

/* Quiz Section */
.progress-container {
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--secondary);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
    border-radius: 9999px;
    box-shadow: 0 0 15px var(--primary);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: flowShimmer 2.5s infinite;
}

@keyframes flowShimmer {
    0% { 
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% { 
        transform: translateX(100%);
        opacity: 0;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right {
    margin-left: auto;
}

/* Toggle Button for Auto Next */
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: var(--muted-foreground);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.875rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toggle-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toggle-btn.active:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px) scale(1.02);
}

.toggle-btn i {
    font-size: 0.9rem;
}

.toggle-label {
    font-weight: 600;
}

/* Auto Next Countdown */
.auto-next-countdown {
    margin-top: 1rem;
    padding: 0.875rem 1.25rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 0.875rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    animation: pulse 1s ease-in-out infinite;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auto-next-countdown i {
    font-size: 1rem;
}

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

.badge {
    background: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.question-content {
    font-size: 1.35rem;
    line-height: 1.85;
    color: var(--foreground);
    margin-bottom: 2.5rem;
    font-weight: 500;
    padding: 2.5rem 3rem;
    background: var(--card);
    border-radius: 2rem;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-left: 5px solid var(--primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-content:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35);
    border-left-width: 6px;
}

.question-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin-top: 1rem;
    border: 1px solid var(--border);
    background: white;
    padding: 0.5rem;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.answer-option {
    padding: 1.75rem 2.5rem;
    background: var(--card);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 1.1rem;
    color: var(--card-foreground);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    min-height: 72px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
                0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
}

.answer-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    border-radius: 1.5rem 0 0 1.5rem;
    transition: all 0.3s ease;
}

.answer-option:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.answer-option:hover:not(.disabled)::before {
    background: var(--primary);
    width: 4px;
}

.answer-option.selected {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.answer-option.correct {
    border-color: var(--success);
    background: rgba(255, 255, 255, 0.08);
    color: var(--success);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: subtleSuccess 0.4s ease-out;
}

.answer-option.correct::before {
    background: var(--success);
    width: 3px;
}

.answer-option.wrong {
    border-color: var(--destructive);
    background: rgba(255, 255, 255, 0.08);
    color: var(--destructive);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: subtleError 0.4s ease-out;
}

.answer-option.wrong::before {
    background: var(--destructive);
    width: 3px;
}

@keyframes subtleSuccess {
    0% { 
        opacity: 0;
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.01);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes subtleError {
    0%, 100% { 
        transform: translateX(0);
    }
    25% {
        transform: translateX(-6px);
    }
    50% {
        transform: translateX(6px);
    }
    75% {
        transform: translateX(-3px);
    }
}

.answer-option.disabled {
    cursor: default;
    opacity: 0.7;
}

.answer-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--secondary);
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary-foreground);
    flex-shrink: 0;
}

.answer-option.selected .answer-key {
    background: var(--primary);
    color: var(--primary-foreground);
}

.answer-option.correct .answer-key {
    background: var(--success);
    color: var(--background);
}

.answer-option.wrong .answer-key {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.answer-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: var(--secondary);
    border: 2px solid transparent;
    border-radius: 1rem;
    font-size: 1.125rem;
    color: var(--foreground);
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: none;
}

.answer-input:hover {
    background: var(--muted);
}

.answer-input:focus {
    outline: none;
    background: var(--card);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--secondary);
    transform: translateY(-1px);
}

.answer-input:disabled {
    background: var(--muted);
    cursor: not-allowed;
    opacity: 0.8;
}

.answer-input::placeholder {
    color: var(--muted-foreground);
    font-weight: 400;
}

/* Answer Textarea for Essay Questions */
.answer-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-sans);
    line-height: 1.6;
}

/* Answer Hint */
.answer-hint {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--muted);
    border-left: 3px solid var(--primary);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.answer-hint i {
    color: var(--primary);
}

/* Feedback Area */
.feedback-area {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 1.25rem;
    background: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.feedback-message {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-message.correct { color: var(--success); }
.feedback-message.wrong { color: var(--destructive); }

.explanation {
    font-size: 0.95rem;
    color: var(--muted-foreground);
    line-height: 1.6;
}

.card-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

/* Controls Bar */
.controls-bar {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* Result Section */
.result-section {
    text-align: center;
    padding: 3rem 1.5rem;
}

.trophy-icon {
    font-size: 4rem;
    color: var(--chart-4);
    margin-bottom: 1.5rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.result-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.result-card .label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.result-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1;
}

.result-card.success .value { 
    color: var(--success);
}
.result-card.error .value { 
    color: var(--destructive);
}
.result-card.score .value { 
    color: var(--primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    margin-bottom: 1rem;
}

.modal-header i {
    font-size: 3rem;
    color: var(--chart-4);
    margin-bottom: 1rem;
    display: block;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.modal-actions .btn {
    min-width: 100px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pop-in {
    animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered animation for answers */
.answer-option {
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.answer-option:nth-child(1) { animation-delay: 0.05s; }
.answer-option:nth-child(2) { animation-delay: 0.1s; }
.answer-option:nth-child(3) { animation-delay: 0.15s; }
.answer-option:nth-child(4) { animation-delay: 0.2s; }
.answer-option:nth-child(5) { animation-delay: 0.25s; }
.answer-option:nth-child(6) { animation-delay: 0.3s; }

/* Success/Error animations */
@keyframes successShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.answer-option.correct {
    animation: successShake 0.5s ease;
}

.answer-option.wrong {
    animation: errorShake 0.5s ease;
}

/* Feedback Animation */
.feedback-area {
    animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Typography Helpers */
sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

/* Responsive */

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 1.5rem 2rem;
        gap: 1.75rem;
    }
    
    header {
        padding: 1.25rem 1.75rem;
        border-radius: 2rem;
    }
    
    .glass-panel {
        padding: 2rem;
        border-radius: 2rem;
    }
    
    .card-header {
        gap: 0.75rem;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .question-content {
        font-size: 1.2rem;
        padding: 2rem 2.25rem;
        border-radius: 1.75rem;
    }
    
    .answer-option {
        padding: 1.5rem 2rem;
        font-size: 1.05rem;
        min-height: 64px;
        gap: 1.25rem;
        border-radius: 1.5rem;
    }
    
    .answer-key {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    .answers-container {
        gap: 1rem;
    }
    
    .quiz-layout {
        gap: 2rem;
    }
    
    .quiz-sidebar {
        width: 320px;
        padding: 2rem;
        border-radius: 2rem;
    }
}

/* Desktop Small (1025px - 1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        max-width: 1400px;
        padding: 2rem 2.5rem;
    }
    
    .glass-panel {
        padding: 2.5rem;
    }
    
    .question-content {
        font-size: 1.3rem;
        padding: 2.25rem 2.75rem;
    }
    
    .answer-option {
        padding: 1.65rem 2.25rem;
        font-size: 1.08rem;
        min-height: 68px;
    }
    
    .answer-key {
        width: 40px;
        height: 40px;
        font-size: 1.02rem;
    }
    
    .quiz-sidebar {
        width: 360px;
    }
}

/* Desktop Large (1441px+) */
@media (min-width: 1441px) {
    .container {
        max-width: 1600px;
        padding: 2.5rem 3rem;
    }
    
    .glass-panel {
        padding: 3rem;
    }
    
    .question-content {
        font-size: 1.35rem;
        padding: 2.5rem 3rem;
    }
    
    .answer-option {
        padding: 1.75rem 2.5rem;
        font-size: 1.1rem;
        min-height: 72px;
    }
    
    .answer-key {
        width: 42px;
        height: 42px;
        font-size: 1.05rem;
    }
    
    .quiz-sidebar {
        width: 380px;
    }
}

/* Mobile (max-width: 640px) */
@media (max-width: 640px) {
    body { 
        padding: 0.5rem; 
        align-items: flex-start; 
    }
    
    .container { 
        gap: 1rem; 
        max-width: 100%;
        padding: 0.5rem;
        position: relative;
        z-index: 1;
    }
    
    header { 
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        border-radius: 1.5rem;
        position: sticky;
        top: 0.5rem;
        z-index: 100;
        margin-bottom: 0.5rem;
    }
    
    .logo h1 {
        font-size: 0.95rem;
    }
    
    .logo i {
        font-size: 1.1rem;
    }
    
    .stats-container {
        flex-wrap: wrap;
        gap: 0.375rem;
        width: 100%;
    }
    
    .stat-pill {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }
    
    .stat-pill i {
        font-size: 0.75rem;
    }
    
    .result-grid { 
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
    
    .result-card {
        padding: 1.25rem;
    }
    
    .result-card .value {
        font-size: 1.75rem;
    }
    
    .action-buttons { 
        flex-direction: column; 
        gap: 0.5rem;
        width: 100%;
    }
    
    .btn { 
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        gap: 0.375rem;
    }
    
    .btn i {
        font-size: 0.875rem;
    }
    
    .glass-panel { 
        padding: 1rem;
        border-radius: 1.5rem;
        position: relative;
        z-index: 1;
        margin-bottom: 0.5rem;
    }
    
    .upload-section {
        padding: 1.5rem 1rem;
        position: relative;
        z-index: 1;
    }
    
    .upload-section h2 {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }
    
    .upload-section p {
        font-size: 0.875rem;
        margin-bottom: 1.25rem;
    }
    
    .question-content {
        font-size: 1.05rem;
        line-height: 1.65;
        padding: 1.25rem 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 1.25rem;
        position: relative;
        z-index: 2;
    }
    
    .answers-container {
        gap: 0.75rem;
        position: relative;
        z-index: 2;
    }
    
    .answer-option {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        min-height: 56px;
        gap: 1rem;
        border-radius: 1.25rem;
        position: relative;
        z-index: 2;
        margin-bottom: 0.25rem;
    }
    
    .answer-key {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .answer-input,
    .answer-textarea {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .card-footer {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1.25rem;
        position: relative;
        z-index: 2;
    }
    
    .card-footer .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .feedback-area {
        position: relative;
        z-index: 2;
        margin-top: 1rem;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.55rem;
    }
    
    .toggle-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
        gap: 0.35rem;
    }
    
    .toggle-btn i {
        font-size: 0.75rem;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    
    /* Show mobile action buttons on mobile */
    .mobile-action-btn {
        display: flex !important;
        width: 32px;
        height: 32px;
        padding: 0;
        background: var(--secondary);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0.5rem;
    }
    
    .mobile-action-btn:active {
        transform: scale(0.95);
    }
    
    .toggle-label {
        display: none;
    }
    
    .card-header {
        flex-wrap: nowrap;
        gap: 0.5rem;
        margin-bottom: 0.875rem;
        justify-content: space-between;
    }
    
    .header-left {
        flex-shrink: 0;
    }
    
    .header-right {
        display: flex;
        gap: 0.375rem;
        margin-left: auto;
        flex-shrink: 0;
    }
}

/* Quiz Layout */
.quiz-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

.quiz-main {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
    position: relative;
    z-index: 2;
}

.quiz-sidebar {
    width: 380px;
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    background: var(--card);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 2.5rem;
    box-shadow: 0 25px 80px -15px rgba(0, 0, 0, 0.6),
                0 12px 30px -8px rgba(0, 0, 0, 0.4),
                0 1px 0 0 rgba(255, 255, 255, 0.12) inset;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--foreground);
}

.sidebar-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.icon-btn-sm:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* Hide mobile action buttons on desktop */
.mobile-action-btn {
    display: none;
}

.question-palette-container {
    flex: 1;
    overflow-y: auto;
    /* Adjusted margins to prevent clipping */
    margin-right: -1rem;
    padding-right: 1rem;
    padding-left: 2px; /* Add space for focus rings */
    padding-top: 2px;
}

.question-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
}

.palette-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: var(--muted);
    color: var(--secondary-foreground);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.palette-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: var(--foreground);
}

.palette-btn.current {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.palette-btn.answered {
    background: var(--muted);
    color: var(--muted-foreground);
}

.palette-btn.correct {
    background: var(--success);
    color: var(--background);
}

.palette-btn.wrong {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.palette-section-title {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted-foreground);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.palette-section-title:first-child {
    margin-top: 0;
}

.palette-legend {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.current { border: 2px solid var(--primary); background: transparent; }
.dot.answered { background: var(--muted-foreground); }
.dot.correct { background: var(--success); }
.dot.wrong { background: var(--destructive); }

/* Responsive Sidebar */
@media (max-width: 1024px) {
    .quiz-layout {
        flex-direction: column;
        position: relative;
        z-index: 1;
    }
    
    .quiz-sidebar {
        width: 100%;
        position: static;
        max-height: 350px;
        order: 2;
        margin-top: 1.5rem;
        padding: 1.75rem;
        border-radius: 2rem;
        z-index: 2;
    }
    
    .question-palette {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
        gap: 0.5rem;
    }
    
    .palette-btn {
        font-size: 0.85rem;
    }
    
    .sidebar-header h3 {
        font-size: 1.05rem;
    }
    
    .palette-legend {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .quiz-sidebar {
        display: none;
    }
    
    .question-palette {
        grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
        gap: 0.4rem;
    }
    
    .palette-btn {
        font-size: 0.8rem;
        border-radius: 0.5rem;
    }
    
    .sidebar-header {
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .sidebar-header h3 {
        font-size: 0.95rem;
    }
    
    .palette-legend {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        gap: 0.4rem;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
    
    .icon-btn-sm {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}



/* New Quiz Type Grid Layout - Added for WOW effect */
.quiz-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

.quiz-type-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease backwards;
    animation-delay: var(--delay, 0s);
}

.quiz-type-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.quiz-type-card:active {
    transform: scale(0.98);
}

.quiz-type-card.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.quiz-type-card.full-width .card-icon {
    margin-bottom: 0;
}

.quiz-type-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Icon Colors */
.color-1 { color: #FF6B6B; background: rgba(255, 107, 107, 0.1); }
.color-2 { color: #4ECDC4; background: rgba(78, 205, 196, 0.1); }
.color-3 { color: #FFE66D; background: rgba(255, 230, 109, 0.1); }
.color-4 { color: #1A535C; background: rgba(26, 83, 92, 0.1); }
.color-5 { color: #FF9F1C; background: rgba(255, 159, 28, 0.1); }
.color-all { color: var(--primary); background: rgba(var(--primary), 0.1); }

.card-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--foreground);
}

.card-info p {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.count-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced Upload Section */
.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: float 6s ease-in-out infinite;
}

.upload-section {
    text-align: center;
    padding: 3rem 2rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .quiz-type-grid {
        grid-template-columns: 1fr 1fr;
    }
    .quiz-type-card.full-width {
        flex-direction: column;
        gap: 0.5rem;
    }
    .quiz-type-card.full-width .card-icon {
        margin-bottom: 0.5rem;
    }
}

/* Extra Polish */
.logo {
    transition: transform 0.3s ease;
    cursor: pointer;
}

.logo:hover {
    transform: scale(1.05);
}

.stat-pill {
    transition: all 0.3s ease;
}

.stat-pill:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

/* Smooth scrolling for the whole page */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Professional List Layout - Replaces Grid */
.quiz-type-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 600px; /* Limit width for better readability */
    margin-left: auto;
    margin-right: auto;
}

.quiz-type-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease backwards;
    animation-delay: var(--delay, 0s);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.quiz-type-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s;
}

.quiz-type-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.quiz-type-item:hover::before {
    left: 100%;
}

.quiz-type-item:active {
    transform: translateX(2px) scale(0.99);
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.quiz-type-item:hover .item-icon {
    background: var(--primary);
    color: var(--primary-foreground);
}

.item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.15rem;
}

.item-content p {
    font-size: 0.85rem;
    color: var(--muted-foreground);
    margin: 0;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--muted-foreground);
}

.item-meta .fa-chevron-right {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.quiz-type-item:hover .item-meta .fa-chevron-right {
    transform: translateX(3px);
    opacity: 1;
    color: var(--primary);
}

.count-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    color: var(--muted-foreground);
    font-weight: 500;
}

.quiz-type-item:hover .count-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--foreground);
}

/* Special styling for "All Questions" */
.quiz-type-item.special-item {
    margin-top: 0.5rem;
    border-color: rgba(var(--primary), 0.2);
    background: rgba(var(--primary), 0.05);
}

.quiz-type-item.special-item:hover {
    background: rgba(var(--primary), 0.1);
}

.quiz-type-item.special-item .item-icon {
    color: var(--primary);
    background: rgba(var(--primary), 0.1);
}

.quiz-type-item.special-item:hover .item-icon {
    background: var(--primary);
    color: var(--primary-foreground);
}
