@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;800;900&display=swap');

:root {
    --bg-color: #f0f7ff;
    --primary: #FF6188;
    --secondary: #FC9867;
    --accent: #FFD866;
    --green-cool: #A9DC76;
    --blue-cool: #78DCE8;
    --purple-cool: #AB9DF2;
    --text-main: #2D3748;
    --card-bg: #FFFFFF;
    --shadow-soft: 0 10px 25px rgba(120, 220, 232, 0.2);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 97, 136, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(120, 220, 232, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(255, 216, 102, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(169, 220, 118, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    text-align: center;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    padding: 30px 20px;
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo {
    height: 90px;
    width: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.1));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    color: var(--text-main);
    font-size: 2.8em;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary), var(--purple-cool));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeDown 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

main {
    padding: 0 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    font-size: 2em;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Letters Grid - Duolingo / Premium Kid App Style */
#letters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 24px;
    padding: 15px;
}

.letter-btn {
    background: var(--card-bg);
    border: 3px solid rgba(255,255,255,0.6);
    border-radius: 30px;
    padding: 30px 10px;
    font-size: 4em;
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 0 #E2E8F0, 0 15px 20px rgba(0, 0, 0, 0.05); /* Soft Neumorphic / 3D effect */
    position: relative;
    top: 0;
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Playful repeating colors for buttons */
.letter-btn:nth-child(5n+1) { color: var(--primary); }
.letter-btn:nth-child(5n+2) { color: var(--blue-cool); }
.letter-btn:nth-child(5n+3) { color: var(--green-cool); }
.letter-btn:nth-child(5n+4) { color: var(--secondary); }
.letter-btn:nth-child(5n+5) { color: var(--purple-cool); }

@keyframes popIn {
    to { opacity: 1; transform: scale(1); }
    from { opacity: 0; transform: scale(0.8); }
}

.letter-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 0 #CBD5E1, 0 20px 25px rgba(0, 0, 0, 0.1);
}

.letter-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #E2E8F0, 0 5px 10px rgba(0, 0, 0, 0.05);
}

/* Details Section */
#words-section {
    position: relative;
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.back-btn {
    background: white;
    color: var(--text-main);
    border: 2px solid #E2E8F0;
    border-radius: 100px;
    padding: 12px 28px;
    font-size: 1.2em;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 4px 0 #E2E8F0;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #CBD5E1;
}

.back-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #E2E8F0;
}

.letter-display {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 4px solid white;
    border-radius: 50px;
    padding: 40px;
    margin: 20px auto 40px;
    max-width: 300px;
    box-shadow: var(--shadow-soft);
}

#current-letter {
    font-size: 8em;
    font-weight: 900;
    margin: 0;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.1));
}

/* Words Slider */
#words-container {
    padding: 10px 0;
    width: 100%;
    margin: 0 auto;
}

#words-slider {
    display: flex;
    gap: 24px;
    padding: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    /* Hide scrollbar for a cleaner look */
    scrollbar-width: none; 
}

#words-slider::-webkit-scrollbar {
    display: none;
}

.word-item {
    flex: 0 0 auto;
    width: 240px;
    background: white;
    border-radius: 32px;
    padding: 25px;
    scroll-snap-align: center;
    box-shadow: 0 8px 0 #E2E8F0, 0 15px 30px rgba(0,0,0,0.06); /* Premium Card Apperance */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(0);
}

.word-item:hover {
    transform: translateY(-10px) rotate(2deg);
    box-shadow: 0 18px 0 #CBD5E1, 0 25px 40px rgba(0,0,0,0.12);
}

.word-item:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #E2E8F0;
    transition: all 0.1s;
}

.word-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain; /* Using contain works best for placeholders/icons */
    border-radius: 20px;
    background: #F8FAFC;
    margin-bottom: 20px;
    border: 3px solid #F1F5F9;
}

.word-item p {
    font-size: 1.6em;
    font-weight: 900;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.5px;
}

/* Highlight style when word is being pronounced */
.active-highlight {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 0 0 4px var(--primary), 0 15px 30px rgba(255, 97, 136, 0.4) !important;
    background: #FFF5F7 !important;
    animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 4px var(--primary), 0 15px 30px rgba(255, 97, 136, 0.4);
    }
    100% {
        box-shadow: 0 0 0 8px var(--primary), 0 20px 40px rgba(255, 97, 136, 0.6);
    }
}

.hidden {
    display: none !important;
}

/* Smooth Responsive Adjustments */
@media (max-width: 768px) {
    h1 { font-size: 2.2em; }
    .logo { height: 70px; }
    #letters-grid { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .letter-btn { padding: 20px 10px; font-size: 3.2em; border-radius: 24px; box-shadow: 0 6px 0 #E2E8F0; }
    .letter-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #E2E8F0; }
    #current-letter { font-size: 6.5em; }
    .letter-display { padding: 30px; border-radius: 35px; }
    .word-item { width: 180px; padding: 18px; border-radius: 26px; box-shadow: 0 6px 0 #E2E8F0; }
    .word-item:hover { transform: translateY(-5px); box-shadow: 0 10px 0 #CBD5E1; }
    .word-item:active { transform: translateY(6px); box-shadow: 0 0 0 #E2E8F0; }
    .word-item p { font-size: 1.4em; }
    .back-btn { padding: 10px 20px; font-size: 1em; }
}