@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg-1: #0a1122;
    --bg-2: #0c1a33;
    --bg-3: #14254a;
    --surface: rgba(10, 22, 44, 0.55);
    --surface-strong: rgba(12, 26, 52, 0.75);
    --border: rgba(255, 255, 255, 0.12);
    --accent: #4bb4ff;
    --accent-2: #6c7cff;
    --text: #e9f2ff;
    --muted: rgba(233, 242, 255, 0.7);
}

body {
    background-color: var(--bg-1);
    color: var(--text);
    font-family: "Space Grotesk", "Sora", sans-serif;
    margin: 0;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    position: relative;
    isolation: isolate;
    overflow-x: hidden;
}
body::before {
    content: "";
    position: fixed;
    inset: -30%;
    background:
        radial-gradient(60% 50% at 18% 18%, rgba(75, 180, 255, 0.2), transparent 62%),
        radial-gradient(55% 45% at 78% 22%, rgba(108, 124, 255, 0.18), transparent 62%),
        radial-gradient(50% 45% at 35% 80%, rgba(54, 210, 180, 0.14), transparent 65%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    background-size: 220% 220%;
    animation: shader-drift 60s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
    will-change: background-position, transform;
}
body::after {
    content: "";
    position: fixed;
    inset: -35%;
    background:
        radial-gradient(50% 40% at 70% 70%, rgba(64, 160, 255, 0.12), transparent 60%),
        radial-gradient(45% 35% at 25% 60%, rgba(78, 96, 200, 0.12), transparent 58%),
        radial-gradient(40% 35% at 50% 30%, rgba(120, 200, 140, 0.1), transparent 60%);
    background-size: 240% 240%;
    animation: shader-drift-alt 90s ease-in-out infinite;
    z-index: 0;
    opacity: 0.75;
    pointer-events: none;
    will-change: background-position, transform;
}

@keyframes shader-drift {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 60%;
    }
    100% {
        background-position: 0% 100%;
    }
}

@keyframes shader-drift-alt {
    0% {
        background-position: 100% 0%;
    }
    50% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 100% 0%;
    }
}
.container {
    max-width: 1350px;
    margin: 0 auto;
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}
h1 {
    text-align: center;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.mode-links {
    display: flex;
    justify-content: center;
    margin: -8px 0 16px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #07101f;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.page-link:hover {
    transform: translateY(-1px);
}

pre {
    background: rgba(6, 14, 32, 0.65);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--muted);
    overflow-x: auto;
}
textarea {
    width: 100%;
    height: 200px;
    background: rgba(7, 16, 36, 0.7);
    color: var(--text);
    border: 1px solid rgba(75, 180, 255, 0.35);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    resize: vertical;
    outline: none;
}

textarea:focus {
    border-color: rgba(108, 124, 255, 0.65);
}
button {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #07101f;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0;
    transition: transform 0.2s ease;
}
button:hover {
    transform: translateY(-1px);
}

.mcq-stats {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(8, 18, 40, 0.46);
}

.mcq-stats-title {
    margin: 0 0 6px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.mcq-stats-line {
    margin: 2px 0;
    color: var(--text);
    font-size: 14px;
}

.mcq-stats-status {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}
#back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: var(--surface-strong);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease, background 0.2s ease;
    z-index: 2;
}
#back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
#back-to-top.is-hiding {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}
#back-to-top:hover {
    background: rgba(12, 26, 52, 0.95);
    transform: translateY(0);
}
#quiz {
    margin: 24px auto 0;
    max-width: 720px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 12px;
}
.card {
    width: 300px;
    height: 400px;
    perspective: 1000px;
    margin: 14px;
    cursor: pointer;
}
.card:focus {
    outline: 3px solid rgba(75, 180, 255, 0.8);
}
.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}
.card.flipped .card-inner {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    padding: 15px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    overflow-y: auto;
}
.card-front {
    background: linear-gradient(160deg, rgba(12, 28, 60, 0.55), rgba(8, 18, 40, 0.35));
}
.card-back {
    background: linear-gradient(160deg, rgba(75, 180, 255, 0.25), rgba(108, 124, 255, 0.25));
    transform: rotateY(180deg);
}
.question h3 {
    color: var(--accent);
    margin-bottom: 10px;
}
.options {
    list-style-type: none;
    padding: 0;
}
.options li {
    margin-bottom: 5px;
}
.option-item {
    width: 100%;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    display: block;
    user-select: none;
}
.option-item:hover,
.option-item:focus-visible {
    background: rgba(220, 220, 220, 0.2);
}
.card.flash-green .card-front::after,
.card.flash-green .card-back::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(70, 200, 120, 0.75);
    animation: card-flash-green 1s ease-out forwards;
    pointer-events: none;
}

@keyframes card-flash-green {
    0% {
        opacity: 0.95;
    }
    60% {
        opacity: 0.95;
    }
    100% {
        opacity: 0;
    }
}
.correct {
    font-size: 18px;
    text-align: center;
    margin-top: 40%;
}
.instructions {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    margin-top: 10px;
}
