body {
    position: relative;
    min-height: 100vh;
}

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -10;
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #030712, #1e3a8a, #0a192f);
    background-size: 400% 400%;
    animation: gradient 20s ease infinite;
    overflow: hidden;
}

.animated-bg .tile {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 20%;
    animation: move 25s linear infinite;
}

.animated-bg .tile-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -150px;
    animation-delay: -5s;
}

.animated-bg .tile-2 {
    width: 300px;
    height: 300px;
    bottom: -150px;
    right: -100px;
    animation-duration: 30s;
}

.animated-bg .tile-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    animation-duration: 35s;
    animation-delay: -10s;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes move {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    100% {
        transform: translateX(calc(100vw - 150px)) translateY(calc(100vh - 150px)) rotate(360deg);
    }
}

/* Glassmorphism utility classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass-panel {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 3D Flashcard Flip & Ambient Glow Styling */
.card-perspective {
    perspective: 1400px;
}

.flashcard-container {
    position: relative;
    width: 100%;
    height: 310px;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.flashcard-container:hover {
    transform: translateY(-4px);
}

.flashcard-container.flipped {
    transform: rotateY(180deg) translateY(-4px);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.75rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
}

/* Front Card (Question Side) - Frosted Obsidian + Indigo Mesh */
.flashcard-front {
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.25) 0%, transparent 50%),
                radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.25) 0%, transparent 50%),
                linear-gradient(145deg, #0f172a 0%, #1e1b4b 100%);
    border: 1.5px solid rgba(129, 140, 248, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7),
                0 0 35px -5px rgba(99, 102, 241, 0.35);
    color: #ffffff;
}

/* Back Card (Answer Side) - Frosted Emerald + Teal Mesh */
.flashcard-back {
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.25) 0%, transparent 50%),
                radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.25) 0%, transparent 50%),
                linear-gradient(145deg, #022c22 0%, #0f172a 100%);
    border: 1.5px solid rgba(52, 211, 153, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7),
                0 0 35px -5px rgba(16, 185, 129, 0.35);
    color: #ffffff;
    transform: rotateY(180deg);
}

/* Inner Glow Orbs */
.flashcard-front::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    filter: blur(40px);
    pointer-events: none;
}

.flashcard-back::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    filter: blur(40px);
    pointer-events: none;
}

/* Quiz Option States */
.quiz-option {
    transition: all 0.2s ease;
}

.quiz-option.selected {
    border-color: #6366f1 !important;
    background-color: rgba(99, 102, 241, 0.1) !important;
}

.quiz-option.correct {
    border-color: #22c55e !important;
    background-color: rgba(34, 197, 94, 0.15) !important;
    color: #15803d !important;
}

.dark .quiz-option.correct {
    color: #4ade80 !important;
}

.quiz-option.incorrect {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #b91c1c !important;
}

.dark .quiz-option.incorrect {
    color: #f87171 !important;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.8);
}
