:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5a623;
    --background-color: #f0f4f8;
    --card-bg-color: #ffffff;
    --text-color: #333;
    --correct-color: #50e3c2;
    --incorrect-color: #e35050;
    --border-radius: 12px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

#app-container {
    width: 100%;
    max-width: 900px;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

main {
    padding: 2rem;
}

.screen {
    display: none;
}

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

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

h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

#alphabet-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 1rem;
}

.letter-btn {
    background-color: var(--card-bg-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.letter-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}

#game-screen {
    position: relative;
}

#back-button {
    position: absolute;
    top: -1rem;
    left: 0;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
}

#image-cards-container,
#syllable-cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    min-height: 150px;
}

.card {
    width: 120px;
    height: 120px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.image-card {
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.image-card img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none; /* Important for drag and drop */
}

.syllable-card {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary-color);
    border: 3px dashed #ddd;
    transition: background-color 0.2s, border-color 0.2s;
}

.syllable-card.drag-over {
    background-color: #eaf2fd;
    border-color: var(--primary-color);
}

.card.matched {
    opacity: 0;
    visibility: hidden;
    cursor: default;
    pointer-events: none;
}