@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700&display=swap');
:root {
    /* Default to Classic Palette */
    --primary: #FF6B6B; /* Original Red-Pink */
    --secondary: #4ECDC4; /* Original Cyan */
    --accent: #FFD166; /* A matching yellow */
    --background: #FFF5F5; /* Original light pink background */
    --text: #5D4037; /* A deep brown for text */
    --card-bg-1: #FF6B6B;
    --primary-rgb: 255, 107, 107;
    --card-bg-2: #4ECDC4;
    --secondary-rgb: 78, 205, 196;
    --card-bg-3: #FF8E8E; /* Lighter red-pink */
    --card-bg-4: #A7EEEB; /* Lighter cyan */
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);

    --current-bg: inherit;
    --current-color: inherit;
}

body[data-palette="sunset"] {
    --primary: #FF9F43;
    --secondary: #3498DB;
    --accent: #F1C40F;
    --background: #FEFBF6;
    --text: #34495E;
    --card-bg-1: #FF9F43;
    --primary-rgb: 255, 159, 67;
    --card-bg-2: #3498DB;
    --secondary-rgb: 52, 152, 219;
    --card-bg-3: #F1C40F;
    --card-bg-4: #5DADE2;
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body[data-palette="ocean"] {
    --primary: #00A8CC;
    --secondary: #007BFF;
    --accent: #F8D49D;
    --background: #F0F8FF;
    --text: #00334E;
    --card-bg-1: #00A8CC;
    --primary-rgb: 0, 168, 204;
    --card-bg-2: #007BFF;
    --secondary-rgb: 0, 123, 255;
    --card-bg-3: #92D5E6;
    --card-bg-4: #66B2FF;
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body[data-palette="forest"] {
    --primary: #2ECC71;
    --secondary: #A0522D;
    --accent: #F39C12;
    --background: #F5F5DC;
    --text: #2F4F4F;
    --card-bg-1: #2ECC71;
    --primary-rgb: 46, 204, 113;
    --card-bg-2: #A0522D;
    --secondary-rgb: 160, 82, 45;
    --card-bg-3: #58D68D;
    --card-bg-4: #C3987F;
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body[data-palette="rose"] {
    --primary: #DB7093; /* PaleVioletRed */
    --secondary: #48D1CC; /* MediumTurquoise */
    --accent: #FFD700; /* Gold */
    --background: #FFF5EE; /* SeaShell */
    --text: #2F4F4F; /* DarkSlateGray */
    --card-bg-1: #DB7093;
    --primary-rgb: 219, 112, 147;
    --card-bg-2: #48D1CC;
    --secondary-rgb: 72, 209, 204;
    --card-bg-3: #F08080; /* LightCoral */
    --card-bg-4: #7FFFD4; /* Aquamarine */
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body[data-palette="lavender"] {
    --primary: #9370DB; /* MediumPurple */
    --secondary: #3CB371; /* MediumSeaGreen */
    --accent: #FFA07A; /* LightSalmon */
    --background: #F8F8FF; /* GhostWhite */
    --text: #483D8B; /* DarkSlateBlue */
    --card-bg-1: #9370DB;
    --primary-rgb: 147, 112, 219;
    --card-bg-2: #3CB371;
    --secondary-rgb: 60, 179, 113;
    --card-bg-3: #BA55D3; /* MediumOrchid */
    --card-bg-4: #66CDAA; /* MediumAquaMarine */
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body[data-palette="classic"] {
    --primary: #FF6B6B; /* Original Red-Pink */
    --secondary: #4ECDC4; /* Original Cyan */
    --accent: #FFD166; /* A matching yellow */
    --background: #FFF5F5; /* Original light pink background */
    --text: #5D4037; /* A deep brown for text */
    --card-bg-1: #FF6B6B;
    --primary-rgb: 255, 107, 107;
    --card-bg-2: #4ECDC4;
    --secondary-rgb: 78, 205, 196;
    --card-bg-3: #FF8E8E; /* Lighter red-pink */
    --card-bg-4: #A7EEEB; /* Lighter cyan */
    --nav-gradient: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
    --footer-bg: var(--primary);
}

body {
    font-family: 'Baloo 2', cursive;    
    background-color: var(--background);
    background-image: url('background.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
}

.letter-card {
    background-color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 280px;
    transform-style: preserve-3d;
    position: relative;
    outline: none;
}

.letter-card:focus {
    outline: none;
}
.letter-card:hover, .letter-card.focused {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.letter-card.focused {
    outline: none;
}
.maximized {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transform: none !important;
    margin: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: inherit !important;
    padding: 2rem;
    box-shadow: none !important;
}

.maximized-card-inner {
    background: var(--current-bg);
    color: var(--current-color);
    border-radius: 2rem;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    position: relative;
    cursor: default;
    animation: pop-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.nav-right .maximized-card-inner {
    animation: slide-in-right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

body.nav-left .maximized-card-inner {
    animation: slide-in-left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slide-in-right {
    0% { opacity: 0; transform: translateX(50px) scale(0.95); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slide-in-left {
    0% { opacity: 0; transform: translateX(-50px) scale(0.95); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slide-out-left {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50px) scale(0.95); }
}

@keyframes slide-out-right {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    100% { opacity: 0; transform: translateX(50px) scale(0.95); }
}

.maximized-card-inner .maximized-content {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    width: 100%;
}

.maximized-card-inner .letter-display {
    font-size: 15vw;
    margin-bottom: 0;
    animation: bounce-letter 3s ease-in-out infinite;
}

.maximized-card-inner .letter-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.letter-image-container {
    width: 100%;
    max-width: 600px;
    margin: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    aspect-ratio: 16 / 9;
}
.letter-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* Maximized view: image + Telugu word stacked */
.maximized-image-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.maximized-telugu-word {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    text-align: center;
    letter-spacing: 0.03em;
}

/* Card face: thumbnail image + Telugu word */
.card-image-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
    flex: 1;
}

.card-thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.6rem;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.telugu-word-label {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 0.02em;
}

.maximized-card-inner .letter-info {
    font-size: 2rem;
    padding: 1rem 2rem;
    width: 50%;
    border-top: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.maximized-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.maximized-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.maximized-nav.prev {
    left: 20px;
}

.maximized-nav.next {
    right: 20px;
}

.maximized-nav i {
    width: 24px;
    height: 24px;
}
.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
}
.close-btn:hover { transform: scale(1.1) rotate(90deg); }
.letter-card:nth-child(4n+1) {
    background: var(--card-bg-1);
    color: white;
}

.letter-card:nth-child(4n+2) {
    background: var(--card-bg-2);
    color: white;
}

.letter-card:nth-child(4n+3) {
    background: var(--card-bg-3);
    color: white;
}

.letter-card:nth-child(4n+4) {
    background: var(--card-bg-4);
    color: white; /* Changed from black for better contrast */
}
.letter-display {
    font-weight: bold;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.letter-card:hover .letter-display {
    transform: scale(1.2) rotate(5deg);
}

.letter-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.5);
}

.pronunciation {
    font-size: 1.25rem;
    font-weight: 500;
}

.play-btn {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.play-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.nav-btn {
    transition: all 0.2s ease;
}

.nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pop-in {
    animation: pop-in 0.5s ease-out forwards;
}

@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-up {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-left {
    0% { opacity: 0; transform: translateX(-50px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in-rotate {
    0% { opacity: 0; transform: rotate(-15deg) scale(0.8); }
    100% { opacity: 1; transform: rotate(0) scale(1); }
}

.letter-card:nth-child(4n+1) {
    animation: pop-in 0.5s ease-out forwards;
}
.letter-card:nth-child(4n+2) {
    animation: slide-in-up 0.5s ease-out forwards;
}
.letter-card:nth-child(4n+3) {
    animation: slide-in-left 0.5s ease-out forwards;
}
.letter-card:nth-child(4n+4) {
    animation: fade-in-rotate 0.5s ease-out forwards;
}

@keyframes bounce-letter {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

.palette-switcher {
    padding: 1rem;
    text-align: center;
}
.palette-switcher h4 {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: white;
}
.palette-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.palette-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.palette-btn:hover {
    transform: scale(1.1);
}

.rhyme-card {
    background: radial-gradient(circle at 100% 100%, rgba(var(--primary-rgb), 0.08) 0%, white 60%);
}
