* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

:root {
    --primary: #9d4edd;
    --secondary: #3c096c;
    --accent: #00f5d4;
    --bg-dark: #10101a;
    --text-light: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow: 0 0 20px rgba(157, 78, 221, 0.4);
}

body {
    background-color: var(--bg-dark);
    background-image: url("background.png");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at center,
        transparent 0%,
        var(--bg-dark) 90%
    );
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 600px;
    padding: 2rem;
    text-align: center;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header Styles */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, var(--text-light), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

/* Horizontal Selection */
.selector-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

.horizontal-picker-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.horizontal-picker {
    display: flex;
    gap: 15px;
    padding: 10px 20px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE */
    scroll-behavior: smooth;
}

.horizontal-picker::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.num-btn {
    min-width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.num-btn:hover {
    background: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--glow);
    border-color: var(--primary);
}

.num-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.num-btn.mixed {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.05);
}

/* Mode Switcher */
.mode-switcher-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.mode-switcher {
    position: relative;
    display: flex;
    width: 240px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
    opacity: 0.6;
}

.mode-btn.active {
    opacity: 1;
}

.glider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--primary);
    box-shadow: var(--glow);
    border-radius: 10px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mode-test.active ~ .glider {
    transform: translateX(100%);
}

/* Flashcard Styles */
.card-scene {
    width: 100%;
    height: 380px;
    perspective: 1000px;
    margin: 1rem 0 2rem 0;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
}

.card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
}

.card-front {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.02)
    );
}

.card-back {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transform: rotateY(180deg);
}

.question {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -2px;
}

.answer {
    font-size: 5rem;
    font-weight: 900;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hint {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Test Mode Area */
.test-area {
    margin-top: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.test-input {
    width: 120px;
    height: 80px;
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-light);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    transition: all 0.3s ease;
}

.test-input:focus {
    border-color: var(--primary);
    box-shadow: var(--glow);
    background: rgba(255, 255, 255, 0.1);
}

/* Hide spin buttons */
.test-input::-webkit-outer-spin-button,
.test-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.feedback {
    font-size: 1.25rem;
    font-weight: 700;
    min-height: 1.5rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.feedback.correct {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}

.feedback.wrong {
    color: #ff5d5d;
    text-shadow: 0 0 10px rgba(255, 93, 93, 0.5);
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.action-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 16px;
    background: var(--glass-bg);
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--glass-border);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn:active {
    transform: scale(0.98);
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-top: 2rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--primary);
}

/* Results Screen */
.results-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 450px;
    padding: 3rem 2rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp 0.5s ease;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: var(--glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

#score-value {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
}

.score-circle small {
    font-size: 1rem;
    opacity: 0.8;
}

.review-list {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-right: 5px;
}

.review-item {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.review-item .wrong {
    color: #ff5d5d;
    text-decoration: line-through;
    margin-right: 10px;
}

.review-item .correct {
    color: var(--accent);
    font-weight: 800;
}

/* Hidden elements */
.hidden {
    display: none !important;
}

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

.app-container {
    animation: fadeInUp 0.8s ease-out;
}

@media (max-width: 480px) {
    .grid-select {
        grid-template-columns: repeat(4, 1fr);
    }
    .question {
        font-size: 3rem;
    }
    .answer {
        font-size: 4rem;
    }
}
