/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Topic Selection Styles */
#topic-selection {
    text-align: center;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#topic-selection h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 300;
}

#topic-selection p {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.topics-container {
    margin-bottom: 30px;
}

.topic-group {
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    background: #f8f9fa;
}

.subtopics {
    margin-left: 20px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topic-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.parent-topic {
    background: #e3f2fd !important;
    border-color: #2196f3 !important;
    font-weight: 600 !important;
}

.parent-topic:hover {
    background: #bbdefb !important;
}

.subtopic {
    background: #f5f5f5 !important;
    border-color: #bdbdbd !important;
    margin-left: 10px;
}

.subtopic:hover {
    background: #eeeeee !important;
    border-color: #2196f3 !important;
}

.topic-option:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.topic-option input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.topic-option input[type="checkbox"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.topic-option:has(input:checked) {
    background: #e3f2fd;
    border-color: #667eea;
}

.parent-topic:has(input:checked) {
    background: #c8e6c9 !important;
    border-color: #4caf50 !important;
}

.subtopic:has(input:checked) {
    background: #e8f5e8 !important;
    border-color: #4caf50 !important;
}

/* Contact Section */
.contact-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.contact-section p {
    margin: 5px 0;
    color: #6c757d;
    font-size: 0.9em;
}

.contact-section a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.contact-section a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* Game Screen Styles */
#game-screen {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.progress-info {
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
}

/* Card Container */
.card-container {
    perspective: 1000px;
    margin: 40px 0;
    display: flex;
    justify-content: center;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
    padding: 30px;
    width: 100%;
}

.card-topic {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.card-content h2 {
    font-size: 1.8em;
    line-height: 1.4;
    font-weight: 400;
}

/* Card Controls */
.card-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    #topic-selection, #game-screen {
        padding: 20px;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .card-controls {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0 10px;
    }
    
    .card-controls .btn {
        flex: 1;
        min-width: 0;
        padding: 10px 8px;
        font-size: 0.9em;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .flashcard {
        height: 250px;
    }
    
    .card-content h2 {
        font-size: 1.4em;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .card-controls {
        gap: 6px;
        padding: 0 5px;
    }
    
    .card-controls .btn {
        padding: 8px 4px;
        font-size: 0.8em;
    }
}
