/* Maturio.sk - Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0a0e1a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-solid: #1e293b;
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: rgba(71, 85, 105, 0.5);
    --border-light: rgba(148, 163, 184, 0.2);
    --success: #4ade80;
    --error: #f87171;
}

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

/* Improved focus states for all interactive elements */
:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-gradient {
        animation: none;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Background Decoration */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    animation: bgFloat 20s ease-in-out infinite;
    will-change: transform;
    contain: strict;
}

.bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, 2%) rotate(1deg); }
    50% { transform: translate(0, 4%) rotate(0deg); }
    75% { transform: translate(-2%, 2%) rotate(-1deg); }
}

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

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

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

.screen-content {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow:
        0 10px 40px -10px var(--primary-glow),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.logo h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 span {
    background: linear-gradient(135deg, var(--primary-light), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .tagline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 500;
}

.logo-small .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.logo-small .logo-text span {
    color: var(--primary-light);
}

/* Landing Content */
.landing-content {
    justify-content: center;
    padding: 2rem 1rem;
}

/* Options Wrapper */
.options-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.option-group {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 1.25rem;
    padding: 1.25rem 1.5rem;
}

.option-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.option-group-title svg {
    opacity: 0.7;
}

.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.options-row.subjects,
.options-row.test-types {
    gap: 1rem;
}

/* Option Pill (for language) */
.option-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.option-pill:hover:not(.disabled):not(.selected) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.option-pill.selected {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 20px -4px var(--primary-glow);
}

.option-pill.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flag-img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.option-pill .coming-soon {
    background: var(--warning);
    color: #1a1a1a;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Option Card (for subjects & test types) */
.option-card {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.option-card:hover:not(.selected) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
}

.option-card.selected {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border-color: var(--primary);
    box-shadow:
        0 0 0 1px var(--primary) inset,
        0 8px 30px -8px var(--primary-glow);
}

.card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.875rem;
    color: var(--primary-light);
    transition: all 0.25s ease;
}

.option-card:hover .card-icon,
.option-card.selected .card-icon {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 20px -4px var(--primary-glow);
}

.card-icon.flash {
    background: rgba(250, 204, 21, 0.1);
    border-color: rgba(250, 204, 21, 0.2);
    color: #fbbf24;
}

.option-card:hover .card-icon.flash,
.option-card.selected .card-icon.flash {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: white;
    box-shadow: 0 4px 20px -4px rgba(245, 158, 11, 0.4);
}

.card-icon.full {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.option-card:hover .card-icon.full,
.option-card.selected .card-icon.full {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    box-shadow: 0 4px 20px -4px rgba(34, 197, 94, 0.4);
}

.card-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 1rem;
}

.card-meta svg {
    opacity: 0.7;
}

/* Toggle Switch */
.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toggle-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(71, 85, 105, 0.6);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: all 0.3s ease;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-color: transparent;
    box-shadow: 0 2px 10px -2px var(--primary-glow);
}

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Back Button */
.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Primary Button */
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    border-radius: 0.875rem;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 1rem;
    box-shadow:
        0 4px 20px -4px var(--primary-glow),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 8px 30px -4px var(--primary-glow),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

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

.primary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-card-solid);
    box-shadow: none;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

/* Quiz Screen */
.quiz-content {
    justify-content: flex-start;
    padding-top: 1rem;
}

.quiz-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 1rem 0;
}

.quiz-progress {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border-light);
}

.quiz-progress #current-question {
    color: var(--primary-light);
    font-weight: 700;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border-light);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-card-solid);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Answered Tracker */
.answered-tracker {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.75rem 0;
}

.answered-tracker span {
    color: var(--primary-light);
    font-weight: 600;
}

/* Question Container */
.question-container {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 1.25rem;
    padding: 2rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.question-source {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    font-style: italic;
}

/* Answers */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-btn:hover:not(.selected):not(.correct):not(.wrong) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.answer-btn .answer-letter {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.answer-btn .answer-text {
    font-size: 1rem;
    color: var(--text-primary);
}

.answer-btn.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.answer-btn.selected .answer-letter {
    background: var(--primary);
    color: white;
}

.answer-btn.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

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

.answer-btn.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

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

/* Quiz Actions */
.quiz-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Results Screen */
.results-container {
    text-align: center;
    width: 100%;
    max-width: 480px;
}

.results-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.results-header p {
    color: var(--text-secondary);
}

/* Score Circle */
.score-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 2rem auto;
}

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

.score-circle .score-bg {
    fill: none;
    stroke: var(--bg-card-solid);
    stroke-width: 8;
}

.score-circle .score-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.score-circle .score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-circle .score-percent {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-circle .score-label {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Results Stats */
.results-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat {
    text-align: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    min-width: 100px;
}

.stat svg {
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.stat.correct svg {
    color: var(--success);
}

.stat.correct .stat-value {
    color: var(--success);
}

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

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

.stat.time svg {
    color: var(--primary-light);
}

.stat.time .stat-value {
    color: var(--primary-light);
}

/* Results Message */
.results-message {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    margin: 1.5rem 0;
}

.results-message p {
    font-size: 1rem;
    color: var(--text-primary);
}

.results-message .grade {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.results-message.excellent .grade {
    color: var(--success);
}

.results-message.good .grade {
    color: var(--primary-light);
}

.results-message.average .grade {
    color: var(--warning);
}

.results-message.poor .grade {
    color: var(--error);
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Question Image */
.question-image {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 0.75rem;
    margin: 1rem 0 1.5rem 0;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.05);
    display: block;
}

/* Answer Image */
.answer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.answer-image {
    max-width: 200px;
    max-height: 120px;
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--border-light);
    margin-top: 0.5rem;
}

.answer-btn:has(.answer-image) {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
}

.answer-btn:has(.answer-image) .answer-letter {
    margin-bottom: 0.5rem;
}

/* Short Answer Input Styles */
.short-answer-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-input-label {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

.answer-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.answer-input::placeholder {
    color: var(--text-muted);
}

.answer-input.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.answer-input.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.answer-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.answer-input.submitted {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.submit-answer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    border-radius: 0.75rem;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    align-self: flex-start;
    box-shadow: 0 4px 15px -4px var(--primary-glow);
}

.submit-answer-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -4px var(--primary-glow);
}

.submit-answer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Answer Feedback */
.answer-feedback {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.answer-feedback.correct {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.answer-feedback.wrong {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

/* 5-option answers (A-E) */
.answers-container:has(.answer-btn:nth-child(5)) .answer-btn {
    padding: 0.875rem 1rem;
}

/* Footer */
.app-footer {
    position: relative;
    z-index: 1;
    padding: 2rem 1.5rem;
    margin-top: auto;
    border-top: 1px solid var(--border-light);
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.footer-disclaimer {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.footer-contact {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.footer-contact a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-contact a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Ad Placements */

/* Side Ads - Desktop only */
.side-ad {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    min-height: 600px;
    z-index: 100;
    background: transparent;
}

.side-ad-left {
    left: 10px;
}

.side-ad-right {
    right: 10px;
}

/* Show side ads only on large screens with enough space */
@media (min-width: 1400px) {
    .side-ad {
        display: block;
    }

    .app-container {
        max-width: calc(100% - 360px);
        margin: 0 auto;
    }
}

@media (min-width: 1600px) {
    .side-ad {
        width: 200px;
    }

    .side-ad-left {
        left: 20px;
    }

    .side-ad-right {
        right: 20px;
    }
}

/* Quiz Ad Banner */
.quiz-ad-banner {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 0 auto 1rem auto;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-ad-banner .adsbygoogle {
    width: 100%;
}

/* Hide quiz ad on very small screens for better UX */
@media (max-width: 480px) {
    .quiz-ad-banner {
        min-height: 50px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .screen {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 2.25rem;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
    }

    .options-row.subjects,
    .options-row.test-types {
        flex-direction: column;
    }

    .option-card {
        flex-direction: row;
        text-align: left;
        padding: 1rem 1.25rem;
        gap: 1rem;
    }

    .card-icon {
        width: 48px;
        height: 48px;
    }

    .card-icon svg {
        width: 24px;
        height: 24px;
    }

    .option-group {
        padding: 1rem 1.25rem;
    }

    .quiz-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .question-container {
        padding: 1.5rem;
    }

    .question-text {
        font-size: 1.125rem;
    }

    .results-stats {
        gap: 0.75rem;
    }

    .stat {
        padding: 0.875rem 1rem;
        min-width: 80px;
    }

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

    .results-actions button {
        width: 100%;
    }

    .question-image {
        max-height: 200px;
    }

    .answer-image {
        max-width: 150px;
        max-height: 80px;
    }

    .answer-input {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .submit-answer-btn {
        width: 100%;
    }

    .quiz-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-actions .secondary-btn,
    .quiz-actions .primary-btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 1rem;
    }

    .formula-sheet-img {
        max-height: 70vh;
    }
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-actions .primary-btn,
.quiz-actions .secondary-btn {
    flex: 1;
    max-width: 220px;
    margin-top: 0;
}

/* Formula Sheet Button */
.formula-sheet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 300px;
}

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

.formula-sheet-btn svg {
    opacity: 0.7;
}

.formula-sheet-btn:hover svg {
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card-solid);
    border-radius: 1rem;
    border: 1px solid var(--border);
    max-width: 900px;
    max-height: 85vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.8);
}

.modal-title {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

/* Formula Sheet Styles */
.formula-modal-content {
    max-width: 1000px;
}

.formula-modal-content .modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.formula-modal-content .modal-title svg {
    color: var(--primary-light);
}

.formula-modal-content .modal-body {
    display: block;
    padding: 1.5rem;
}

.formula-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.formula-section {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.formula-section:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.formula-section-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}

.formula-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary-light);
    margin: 0;
}

.formula-section-body {
    padding: 1rem;
}

.formula-item {
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

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

.formula-item:first-child {
    padding-top: 0;
}

.formula-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.formula-expression {
    font-family: 'Cambria Math', 'Times New Roman', serif;
    font-size: 1.0625rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    display: inline-block;
    letter-spacing: 0.5px;
}

/* Trig table styles */
.trig-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.trig-table th,
.trig-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
}

.trig-table th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    font-weight: 600;
    font-size: 0.8125rem;
}

.trig-table td {
    background: rgba(0, 0, 0, 0.2);
    font-family: 'Cambria Math', 'Times New Roman', serif;
}

/* Solids grid */
.solids-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.solid-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.solid-name {
    font-weight: 600;
    color: var(--primary-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.solid-formulas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.solid-formula {
    font-family: 'Cambria Math', 'Times New Roman', serif;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.solid-formula span {
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    margin-right: 0.25rem;
}

@media (max-width: 768px) {
    .formula-sections {
        grid-template-columns: 1fr;
    }

    .formula-modal-content .modal-body {
        padding: 1rem;
    }

    .formula-expression {
        font-size: 0.9375rem;
    }
}

/* Premium Explanation Button */
.explanation-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-top: 1.25rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    border-radius: 0.75rem;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px -4px rgba(245, 158, 11, 0.4);
    width: 100%;
}

.explanation-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -4px rgba(245, 158, 11, 0.5);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.explanation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.explanation-btn .premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Explanation Container */
.explanation-container {
    margin-top: 1.25rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.875rem;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.1));
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.explanation-header svg {
    color: #fbbf24;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.explanation-header span {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #fbbf24;
}

.explanation-close-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.explanation-close-btn:hover {
    background: rgba(239, 68, 68, 0.6);
    color: white;
}

.explanation-close-btn svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

.explanation-content {
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    text-align: center;
}

/* Typewriter Cursor */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: #fbbf24;
    margin-left: 2px;
    animation: blink 0.7s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Explanation text styling */
.explanation-content strong,
.explanation-content b {
    color: #fbbf24;
    font-weight: 600;
}

/* Hide explanation button after showing explanation */
.explanation-btn.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .explanation-btn {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .explanation-content {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* Cookie Consent Banner */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card-solid);
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-banner.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    min-width: 280px;
}

.cookie-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cookie-text p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.cookie-text a {
    color: var(--primary-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-text a:hover {
    color: var(--primary);
}

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cookie-btn-accept {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    box-shadow: 0 4px 15px -4px var(--primary-glow);
}

.cookie-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -4px var(--primary-glow);
}

.cookie-btn-reject {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-actions {
        width: 100%;
        justify-content: center;
    }

    .cookie-btn {
        flex: 1;
        max-width: 160px;
    }
}

/* Privacy Modal */
.privacy-modal-content {
    max-width: 700px;
}

.privacy-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.privacy-body section {
    margin-bottom: 1.5rem;
}

.privacy-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.privacy-body p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.privacy-body ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.privacy-body li {
    margin-bottom: 0.25rem;
}

.privacy-body a {
    color: var(--primary-light);
    text-decoration: underline;
}

.privacy-body a:hover {
    color: var(--primary);
}

.privacy-updated {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}
