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

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 3em;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.3em;
    opacity: 0.95;
}

.admin-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 8px 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Main Menu */
.level-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.level-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px solid #dee2e6;
    border-radius: 15px;
    padding: 25px 30px;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.level-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.level-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #5568d3;
    color: white;
}

.level-icon {
    font-size: 2em;
}

.level-name {
    font-size: 1.3em;
    font-weight: bold;
}

.level-desc {
    font-size: 0.9em;
    opacity: 0.8;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.menu-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 40px 20px;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.menu-btn .icon {
    font-size: 2em;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 20px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #5a6268;
}

h2 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
}

.instruction {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
}

/* Flashcards */
.category-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.category-btn {
    background: #e9ecef;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    background: #dee2e6;
}

.category-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
}

.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.flashcard {
    width: 100%;
    max-width: 400px;
    height: 300px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

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

.word-display {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 20px;
}

.emoji-display {
    font-size: 4em;
    margin-bottom: 20px;
}

.hint {
    font-size: 1em;
    opacity: 0.8;
}

.flashcard-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.control-btn {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:hover {
    background: #45a049;
}

.card-counter {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

/* Matching Game */
.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.reset-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #ee5a52;
}

.matching-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.matching-item {
    background: #f8f9fa;
    border: 3px solid transparent;
    border-radius: 10px;
    padding: 20px;
    font-size: 1.3em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.matching-item:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.matching-item.selected {
    border-color: #667eea;
    background: #e7eaf6;
}

.matching-item.matched {
    background: #d4edda;
    border-color: #28a745;
    cursor: default;
    opacity: 0.7;
}

/* Quiz */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.question-text {
    font-size: 1.5em;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-weight: bold;
}

.answer-options {
    display: grid;
    gap: 15px;
}

.answer-btn {
    background: #f8f9fa;
    border: 3px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateX(5px);
}

.answer-btn.correct {
    background: #d4edda;
    border-color: #28a745;
}

.answer-btn.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.quiz-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.quiz-feedback.correct {
    background: #d4edda;
    color: #155724;
}

.quiz-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

.next-question-btn {
    display: block;
    margin: 20px auto 0;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 40px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background 0.2s;
}

.next-question-btn:hover {
    background: #45a049;
}

.next-question-btn.hidden {
    display: none;
}

/* Memory Game */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    padding: 10px;
    text-align: center;
}

.memory-card.hidden {
    background: linear-gradient(135deg, #a8b3f5 0%, #b99dd4 100%);
    color: transparent;
}

.memory-card.flipped {
    background: #fff;
    color: #333;
    border: 3px solid #667eea;
}

.memory-card.matched {
    background: #d4edda;
    color: #28a745;
    cursor: default;
    border: 3px solid #28a745;
}

.memory-card:hover:not(.matched):not(.flipped) {
    transform: scale(1.05);
}

/* Admin Styles */
.admin-login-container {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.admin-login-container input {
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1.1em;
}

.error-message {
    color: #dc3545;
    margin-top: 10px;
    font-weight: bold;
}

.success-message {
    color: #28a745;
    margin-top: 15px;
    padding: 10px;
    background: #d4edda;
    border-radius: 8px;
    font-weight: bold;
    display: none;
}

.success-message.show {
    display: block;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.admin-tab {
    background: #e9ecef;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-tab:hover {
    background: #dee2e6;
}

.admin-tab.active {
    background: #667eea;
    color: white;
    border-color: #5568d3;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-form {
    max-width: 500px;
    margin: 0 auto 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
}

.word-list {
    max-width: 600px;
    margin: 0 auto;
}

.word-item {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.word-info {
    flex: 1;
}

.word-info strong {
    color: #667eea;
    font-size: 1.2em;
}

.word-actions {
    display: flex;
    gap: 10px;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: #c82333;
}

.edit-btn {
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.edit-btn:hover {
    background: #e0a800;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.category-item {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.category-item h4 {
    margin-bottom: 10px;
    color: #333;
}

.category-item .word-count {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

h3 {
    color: #333;
    margin-bottom: 20px;
}

/* Footer */
.app-footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 30px;
    font-size: 1.1em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.app-footer p {
    margin: 0;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .admin-btn {
        position: static;
        margin-top: 15px;
        display: inline-block;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .matching-container {
        grid-template-columns: 1fr;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .word-display {
        font-size: 2em;
    }

    .word-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
