/* ==========================================
   English Adventure - Kids Learning Game
   ========================================== */

/* CSS Variables */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #FF9800;
    --secondary-dark: #F57C00;
    --accent-color: #2196F3;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --text-dark: #333;
    --text-light: #fff;
    --border-radius: 20px;
    --border-radius-sm: 12px;
    --font-title: 'Fredoka One', cursive;
    --font-body: 'Nunito', sans-serif;
}

/* ==========================================
   Fun Animations for Game Items
   ========================================== */

/* Floating animation for shelf items */
.shelf-item {
    animation: itemFloat 3s ease-in-out infinite;
    animation-delay: calc(var(--item-index, 0) * 0.2s);
}

.shelf-item:nth-child(1) {
    --item-index: 0;
}

.shelf-item:nth-child(2) {
    --item-index: 1;
}

.shelf-item:nth-child(3) {
    --item-index: 2;
}

.shelf-item:nth-child(4) {
    --item-index: 3;
}

.shelf-item:nth-child(5) {
    --item-index: 4;
}

.shelf-item:nth-child(6) {
    --item-index: 5;
}

@keyframes itemFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(-2deg);
    }

    75% {
        transform: translateY(-5px) rotate(2deg);
    }
}

/* Wiggle animation on hover */
.shelf-item:hover,
.drag-item:hover,
.theme-card:hover .theme-emoji {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg) scale(1.1);
    }

    50% {
        transform: rotate(0deg) scale(1.15);
    }

    75% {
        transform: rotate(10deg) scale(1.1);
    }
}

/* Sparkle effect for correct answers */
.shelf-item.correct::before,
.shelf-item.correct::after,
.drag-item.matched::before {
    content: '✨';
    position: absolute;
    font-size: 1.5rem;
    animation: sparkle 0.6s ease-out forwards;
}

.shelf-item.correct::before {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.shelf-item.correct::after {
    top: 50%;
    right: -20px;
    animation-delay: 0.1s;
}

@keyframes sparkle {
    0% {
        opacity: 0;
        transform: scale(0) translateY(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.2) translateY(-10px);
    }

    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
}

/* Bounce animation for collected items */
.cart-item {
    animation: cartBounce 0.5s ease-out;
}

@keyframes cartBounce {
    0% {
        transform: scale(0) rotate(-180deg);
    }

    50% {
        transform: scale(1.3) rotate(10deg);
    }

    70% {
        transform: scale(0.9) rotate(-5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Pulse animation for theme cards */
.theme-card {
    animation: cardPulse 4s ease-in-out infinite;
    animation-delay: calc(var(--card-index, 0) * 0.3s);
}

.theme-card:nth-child(1) {
    --card-index: 0;
}

.theme-card:nth-child(2) {
    --card-index: 1;
}

.theme-card:nth-child(3) {
    --card-index: 2;
}

.theme-card:nth-child(4) {
    --card-index: 3;
}

.theme-card:nth-child(5) {
    --card-index: 4;
}

.theme-card:nth-child(6) {
    --card-index: 5;
}

@keyframes cardPulse {

    0%,
    100% {
        box-shadow: var(--card-shadow);
    }

    50% {
        box-shadow: 0 8px 40px rgba(76, 175, 80, 0.3);
    }
}

/* Star shine animation */
.user-stars,
.theme-stars,
.earned-stars,
.game-stars span {
    animation: starShine 2s ease-in-out infinite;
}

@keyframes starShine {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3) drop-shadow(0 0 5px gold);
    }
}

/* User avatar bounce on card hover */
.user-card:hover .user-avatar {
    animation: avatarBounce 0.6s ease;
}

@keyframes avatarBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-15px);
    }

    50% {
        transform: translateY(-5px);
    }

    70% {
        transform: translateY(-10px);
    }
}

/* Celebration confetti effect */
.celebration-content::before,
.celebration-content::after {
    content: '🎊';
    position: absolute;
    font-size: 2rem;
    animation: confetti 1s ease-out forwards;
}

.celebration-content::before {
    top: 10%;
    left: 10%;
    animation-delay: 0.2s;
}

.celebration-content::after {
    content: '🎈';
    top: 15%;
    right: 10%;
    animation-delay: 0.4s;
}

@keyframes confetti {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Shopping cart bounce when items added */
.cart-drop-zone.drag-over .cart-icon {
    animation: cartExcited 0.3s ease infinite;
}

@keyframes cartExcited {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(-5deg);
    }
}

/* Rainbow border for completed themes */
.theme-card.completed {
    animation: rainbowBorder 3s linear infinite;
    background-size: 200% 200%;
}

@keyframes rainbowBorder {
    0% {
        border-color: #4CAF50;
    }

    33% {
        border-color: #2196F3;
    }

    66% {
        border-color: #FF9800;
    }

    100% {
        border-color: #4CAF50;
    }
}

/* Instruction text attention animation */
.word-highlight {
    animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes highlightPulse {

    0%,
    100% {
        color: var(--secondary-color);
        transform: scale(1);
    }

    50% {
        color: #E65100;
        transform: scale(1.05);
    }
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--background-gradient);
    color: var(--text-dark);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#app {
    height: 100%;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* ==========================================
   Screen Management
   ========================================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(180deg, #87CEEB 0%, #98D8C8 50%, #7CB342 100%);
}

.screen.active {
    display: flex;
}

/* ==========================================
   Welcome Screen
   ========================================== */
.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.game-title {
    margin-bottom: 10px;
}

.title-word {
    display: block;
    font-family: var(--font-title);
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

.title-english {
    font-size: 3rem;
    color: #fff;
    animation: bounceIn 0.8s ease-out;
}

.title-adventure {
    font-size: 2.5rem;
    color: #FFD700;
    animation: bounceIn 0.8s ease-out 0.2s both;
}

.subtitle {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 40px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.user-selection {
    width: 100%;
    max-width: 500px;
}

.user-selection h2 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* User Type Sections for Multi-User Support */
.user-type-section {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
}

.user-type-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.user-type-emoji {
    font-size: 2rem;
}

.user-type-title {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.user-type-age {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-left: auto;
}

.user-cards {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-height: 60px;
}

.user-cards:empty::after {
    content: 'No players yet';
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    padding: 20px;
    width: 100%;
    text-align: center;
}

/* Add User Button */
.add-user-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-user-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.02);
}

.add-user-btn:active {
    transform: scale(0.98);
}

.add-user-icon {
    font-size: 1.2rem;
}

/* Delete User Button */
.delete-user-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(244, 67, 54, 0.8);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0;
}

.user-card:hover .delete-user-btn {
    opacity: 1;
}

.delete-user-btn:hover {
    background: var(--danger-color);
    transform: scale(1.15);
}

.user-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 25px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    min-width: 150px;
}

.user-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.user-card:active {
    transform: scale(0.98);
}

/* Edit Profile Button */
.edit-profile-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.edit-profile-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.user-card {
    position: relative;
}

.user-avatar {
    font-size: 4rem;
    margin-bottom: 10px;
}

.user-name {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.user-stars {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.user-age {
    font-size: 0.9rem;
    color: #666;
}

#settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
}

/* ==========================================
   Screen Header
   ========================================== */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 20px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

.current-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: 700;
}

.total-stars {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: 700;
}

.screen-title {
    font-family: var(--font-title);
    font-size: 2rem;
    color: #fff;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

/* ==========================================
   Theme Grid
   ========================================== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

.theme-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.theme-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.theme-card:active {
    transform: scale(0.98);
}

.theme-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.theme-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
}

.theme-card.completed {
    border: 3px solid var(--success-color);
}

.theme-emoji {
    font-size: 3rem;
    margin-bottom: 10px;
}

.theme-name {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.theme-stars {
    font-size: 0.9rem;
    color: #666;
}

.theme-progress {
    margin-top: 10px;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.theme-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ==========================================
   Game Screen
   ========================================== */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.theme-title {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
}

.game-stars {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 1.2rem;
}

/* Scene Area */
.scene-area {
    flex: 1;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    min-height: 200px;
    max-height: 50vh;
}

/* On smaller screens, allow more space */
@media (max-height: 700px) {
    .scene-area {
        max-height: 40vh;
    }
}

.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Supermarket Scene */
.supermarket-scene .scene-sky {
    height: 30%;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 100%);
    position: relative;
}

.supermarket-scene .scene-sky::before {
    content: '☁️';
    position: absolute;
    font-size: 2rem;
    top: 20%;
    left: 10%;
    animation: floatCloud 10s ease-in-out infinite;
}

.supermarket-scene .scene-sky::after {
    content: '☁️';
    position: absolute;
    font-size: 1.5rem;
    top: 30%;
    right: 15%;
    animation: floatCloud 12s ease-in-out infinite reverse;
}

.supermarket-scene .scene-store {
    flex: 1;
    background: linear-gradient(180deg, #FFF8DC 0%, #F5DEB3 100%);
    position: relative;
    padding: 20px;
}

.store-sign {
    background: var(--secondary-color);
    color: #fff;
    font-family: var(--font-title);
    font-size: 1.2rem;
    padding: 10px 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.store-shelf {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 15px;
    background: rgba(139, 90, 43, 0.3);
    border-radius: 10px;
    min-height: 120px;
}

.shelf-item {
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
}

.shelf-item:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 1);
}

.shelf-item.correct {
    animation: correctPulse 0.5s ease;
    background: rgba(76, 175, 80, 0.3);
}

.shelf-item.wrong {
    animation: wrongShake 0.5s ease;
    background: rgba(244, 67, 54, 0.3);
}

.shelf-item.collected {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* Shopping Cart */
.shopping-cart {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 3rem;
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cart-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 100px;
    font-size: 1.5rem;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: #fff;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Character */
.character {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 4rem;
    animation: characterBounce 2s ease-in-out infinite;
}

/* Instruction Area */
.instruction-area {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--card-shadow);
}

.speak-btn {
    background: var(--accent-color);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speak-btn:hover {
    transform: scale(1.1);
    background: #1976D2;
}

.speak-btn:active {
    transform: scale(0.95);
}

.speak-btn.speaking {
    animation: speakPulse 0.5s ease infinite;
}

.instruction-text {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
}

.word-highlight {
    color: var(--secondary-color);
    font-family: var(--font-title);
}

/* Interaction Area */
.interaction-area {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    min-height: 80px;
}

.option-btn {
    background: #fff;
    border: 3px solid #ddd;
    border-radius: var(--border-radius-sm);
    padding: 15px 25px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-btn:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

.option-emoji {
    font-size: 2rem;
}

.option-text {
    font-weight: 700;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 700;
    color: var(--text-dark);
    min-width: 40px;
}

/* ==========================================
   Overlays & Modals
   ========================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.celebration-content {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: celebrationPop 0.5s ease;
}

.celebration-emoji {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: celebrationBounce 1s ease infinite;
}

.celebration-title {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.earned-stars {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.celebration-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 25px;
}

.celebration-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Feedback Overlay */
.feedback-content {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 30px 50px;
    text-align: center;
    animation: feedbackPop 0.3s ease;
}

.feedback-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
}

.feedback-text {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--success-color);
}

.feedback-content.wrong .feedback-text {
    color: var(--danger-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    font-family: var(--font-title);
    margin-bottom: 25px;
    text-align: center;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.setting-row label {
    font-weight: 600;
}

.setting-row select {
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
    font-family: var(--font-body);
    font-size: 1rem;
}

.modal-close {
    margin-top: 25px;
    width: 100%;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--text-dark);
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    border-color: var(--accent-color);
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.icon-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.icon-btn-small {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-left: 10px;
}

.icon-btn-small:hover {
    transform: scale(1.1);
    background: #fff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   Drag and Drop Styles
   ========================================== */
/* Collect Items Activity - Cart */
.collect-activity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 10px;
}

.drag-items-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

.cart-drop-zone {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 4px dashed var(--primary-color);
    border-radius: 20px;
    padding: 20px;
    min-width: 250px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.cart-drop-zone.drag-over {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    transform: scale(1.05);
}

.cart-drop-zone.wrong {
    border-color: var(--error-color);
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    animation: shake 0.3s ease;
}

.cart-icon {
    font-size: 3rem;
}

.cart-label {
    font-family: var(--font-title);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.cart-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.cart-item {
    font-size: 2rem;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Drag and Drop Container */
.drag-drop-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    padding: 10px;
}

.drag-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    min-height: 80px;
}

.drag-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border: 3px solid var(--accent-color);
    border-radius: var(--border-radius-sm);
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    /* Prevent browser handling of touch events */
    -webkit-touch-callout: none;
    /* Disable callout on iOS */
}

.drag-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.drag-item.dragging {
    cursor: grabbing;
    opacity: 0.7;
    transform: scale(1.1);
    z-index: 100;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.drag-item.matched {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.drag-emoji {
    font-size: 2rem;
}

.drag-label {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--text-dark);
}

.drop-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.drop-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    min-height: 80px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border: 3px dashed #aaa;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.drop-target.drag-over {
    border-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.05);
}

.drop-target.matched {
    border-style: solid;
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.drop-target.wrong {
    border-color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
    animation: wrongShake 0.5s ease;
}

.target-label {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: #666;
}

.target-hint {
    font-size: 2rem;
    opacity: 0.5;
}

.matched-emoji {
    font-size: 2rem;
}

.matched-label {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--success-color);
}

/* ==========================================
   Match Pairs Memory Game Styles
   ========================================== */
.match-pairs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.match-card {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 3px solid #ddd;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.5rem;
    font-family: var(--font-title);
}

.match-card:hover:not(.matched):not(.selected) {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.match-card.selected {
    border-color: var(--secondary-color);
    background: rgba(255, 152, 0, 0.1);
    transform: scale(1.05);
}

.match-card.matched {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.2);
    cursor: default;
}

.match-card span {
    text-align: center;
    word-break: break-word;
    padding: 5px;
}

@media (max-width: 400px) {
    .match-pairs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================
   RTL Support for Hebrew
   ========================================== */
html[dir="rtl"] .back-btn {
    direction: ltr;
}

html[dir="rtl"] .instruction-area {
    flex-direction: row-reverse;
}

html[dir="rtl"] .screen-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .setting-row {
    flex-direction: row-reverse;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes floatCloud {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(20px);
    }
}

@keyframes characterBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

@keyframes speakPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes celebrationPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes celebrationBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes feedbackPop {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes starEarn {
    0% {
        transform: scale(0) rotate(-180deg);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 600px) {
    .title-english {
        font-size: 2.5rem;
    }

    .title-adventure {
        font-size: 2rem;
    }

    .user-card {
        padding: 20px;
        min-width: 130px;
    }

    .user-avatar {
        font-size: 3rem;
    }

    .screen-title {
        font-size: 1.5rem;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .instruction-text {
        font-size: 1.1rem;
    }

    .shelf-item {
        font-size: 2rem;
    }

    .option-btn {
        padding: 10px 15px;
    }

    .celebration-content {
        padding: 30px 20px;
    }
}

@media (max-width: 400px) {
    .theme-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .theme-card {
        padding: 15px;
    }

    .theme-emoji {
        font-size: 2.5rem;
    }
}

/* ==========================================
   Profile Setup Modal
   ========================================== */
.profile-setup {
    max-width: 450px;
}

.profile-setup h2 {
    text-align: center;
    font-family: var(--font-title);
    font-size: 1.8rem;
    margin-bottom: 25px;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-weight: 700;
    font-size: 1.1rem;
}

.form-group input[type="text"] {
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid #ddd;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    text-align: center;
}

.form-group input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.avatar-option {
    font-size: 2rem;
    padding: 8px;
    border: 3px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-option:hover {
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.1);
}

.age-picker {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.age-option {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    border: 3px solid #ddd;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-title);
}

.age-option:hover {
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.age-option.selected {
    border-color: var(--secondary-color);
    background: rgba(255, 152, 0, 0.2);
    transform: scale(1.1);
}

.profile-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

@media (max-width: 400px) {
    .avatar-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================
   Enhanced Reward Animations (Confetti, Streaks)
   ========================================== */

/* Confetti container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Flying stars animation */
.flying-star {
    position: fixed;
    font-size: 2rem;
    pointer-events: none;
    z-index: 1000;
    animation: flyStar 1s ease-out forwards;
}

@keyframes flyStar {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(360deg) translateY(-100px);
        opacity: 0;
    }
}

/* Streak counter */
.streak-indicator {
    position: fixed;
    top: 20%;
    right: 20px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-family: var(--font-title);
    font-size: 1.2rem;
    z-index: 100;
    animation: streakPop 0.5s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

@keyframes streakPop {
    0% {
        transform: scale(0) rotate(-10deg);
    }

    50% {
        transform: scale(1.2) rotate(5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Character celebration dance */
.character.dancing {
    animation: characterDance 0.5s ease infinite;
}

@keyframes characterDance {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    25% {
        transform: translateY(-15px) rotate(5deg);
    }

    50% {
        transform: translateY(0) rotate(-5deg);
    }

    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* Enhanced celebration overlay */
.celebration-content.enhanced {
    animation: celebrationEnhanced 0.6s ease;
}

@keyframes celebrationEnhanced {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    75% {
        transform: scale(0.95) rotate(-2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Correct answer burst effect */
.correct-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.correct-burst::before,
.correct-burst::after {
    content: '✨';
    position: absolute;
    font-size: 2rem;
    animation: burstOut 0.6s ease-out forwards;
}

.correct-burst::before {
    animation-delay: 0s;
}

.correct-burst::after {
    content: '⭐';
    animation-delay: 0.1s;
}

@keyframes burstOut {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: scale(1) translate(var(--x, 50px), var(--y, -50px));
        opacity: 0;
    }
}

/* ==========================================
   Hint Button System
   ========================================== */
.hint-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
    transition: all 0.3s ease;
    z-index: 50;
    animation: hintPulse 2s ease-in-out infinite;
}

.hint-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.6);
}

.hint-btn:active {
    transform: scale(0.95);
}

@keyframes hintPulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(255, 165, 0, 0.8);
    }
}

/* Hint visual indicators */
.hint-hand {
    position: absolute;
    font-size: 3rem;
    pointer-events: none;
    z-index: 100;
    animation: tapHint 1s ease-in-out infinite;
}

@keyframes tapHint {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.9;
    }

    50% {
        transform: translateY(10px) scale(0.9);
        opacity: 1;
    }
}

.hint-arrow {
    position: absolute;
    width: 60px;
    height: 20px;
    pointer-events: none;
    z-index: 100;
}

.hint-arrow::after {
    content: '➡️';
    font-size: 2rem;
    animation: arrowBounce 0.8s ease-in-out infinite;
    display: block;
}

@keyframes arrowBounce {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(15px);
    }
}

@keyframes arrowBounceDown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(15px);
    }
}

/* Pulsing hint on target item */
.hint-pulse {
    animation: hintTargetPulse 0.8s ease-in-out infinite !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8) !important;
}

@keyframes hintTargetPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1);
    }
}

/* ==========================================
   Checkbox Toggle Switch
   ========================================== */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    height: 28px;
    background: #ddd;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="checkbox"]:checked {
    background: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    left: 25px;
}

/* ==========================================
   Parent Dashboard Styles
   ========================================== */
#dashboard-btn {
    position: absolute;
    top: 20px;
    left: 20px;
}

.dashboard-content {
    background: #fff;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    animation: celebrationPop 0.3s ease;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.dashboard-header h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--text-dark);
}

.close-dashboard-btn {
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-dashboard-btn:hover {
    background: #eee;
    transform: scale(1.1);
}

.dashboard-tabs {
    display: flex;
    gap: 5px;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #eee;
}

.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
}

.tab-content {
    padding: 20px 25px;
}

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

/* User Progress Cards */
.user-progress-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-progress-card {
    background: #f9f9f9;
    border-radius: var(--border-radius-sm);
    padding: 20px;
    border: 1px solid #eee;
}

.user-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.user-avatar-large {
    font-size: 3rem;
}

.user-info h3 {
    font-family: var(--font-title);
    font-size: 1.3rem;
    margin-bottom: 3px;
}

.user-info p {
    color: #666;
    font-size: 0.9rem;
}

.user-total-stars {
    margin-left: auto;
    text-align: center;
}

.star-count {
    font-size: 2rem;
    font-family: var(--font-title);
    color: var(--secondary-color);
}

.progress-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.progress-stat {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
}

.progress-stat .stat-value {
    display: block;
    font-size: 1.5rem;
    font-family: var(--font-title);
    color: var(--primary-color);
}

.progress-stat .stat-label {
    font-size: 0.8rem;
    color: #666;
}

.themes-progress h4 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.themes-grid-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.theme-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
    border: 2px solid #eee;
    min-width: 60px;
}

.theme-progress-item.completed {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.theme-emoji-mini {
    font-size: 1.5rem;
}

.theme-stars-mini {
    font-size: 0.7rem;
}

/* Statistics */
.stats-overview {
    margin-bottom: 25px;
}

.stats-overview h3,
.vocabulary-learned h3,
.learning-tips h3 {
    font-family: var(--font-title);
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
    border-radius: var(--border-radius-sm);
    padding: 20px;
    text-align: center;
    border: 1px solid #eee;
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-family: var(--font-title);
    color: var(--primary-color);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #666;
}

.vocabulary-learned {
    margin-bottom: 25px;
}

.words-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
}

.no-data {
    color: #999;
    font-style: italic;
}

.learning-tips ul {
    list-style: none;
    padding: 0;
}

.learning-tips li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.learning-tips li:last-child {
    border-bottom: none;
}

/* Certificates */
.certificates-intro {
    text-align: center;
    margin-bottom: 25px;
}

.certificates-intro h3 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.user-certificates {
    margin-bottom: 25px;
}

.user-certificates h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.certificate-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.certificate-card {
    background: linear-gradient(135deg, #fff9c4 0%, #fff 100%);
    border: 2px solid #ffd54f;
    border-radius: var(--border-radius-sm);
    padding: 15px;
    text-align: center;
}

.cert-theme {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.cert-name {
    font-family: var(--font-title);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.cert-stars {
    margin-bottom: 10px;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.no-certificates {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .progress-summary {
        flex-wrap: wrap;
    }

    .dashboard-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 80px;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* ==========================================
   Level Selection Modal
   ========================================== */
.level-select-content {
    position: relative;
    padding-top: 50px;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-close-btn:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.modal-close-btn:active {
    transform: scale(0.95);
}

.modal-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.level-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.level-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 3px solid #ddd;
    border-radius: var(--border-radius-sm);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.level-btn:hover:not(.locked) {
    border-color: var(--primary-color);
    transform: translateX(5px);
    background: rgba(76, 175, 80, 0.1);
}

.level-btn.locked {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

.level-btn.completed {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.05);
}

.level-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.level-info {
    flex: 1;
}

.level-name {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.level-stars {
    font-size: 1rem;
    color: var(--secondary-color);
}

/* ==========================================
   Sticker Book
   ========================================== */
.sticker-grid-container {
    flex: 1;
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    overflow-y: auto;
    position: relative;
    background-image: radial-gradient(#f0f0f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
}

.sticker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: popIn 0.5s ease backwards;
}

.sticker-item:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.empty-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
    font-family: var(--font-title);
    font-size: 1.5rem;
    width: 100%;
}

.empty-message.hidden {
    display: none;
}

.bounce {
    animation: bounce 0.6s ease;
}

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

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }
}

.earned-sticker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 235, 59, 0.2);
    border-radius: 15px;
}

.earned-sticker {
    font-size: 4rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Sticker Selection - Let kids choose their reward! */
.sticker-selection-container {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 182, 193, 0.2) 100%);
    border-radius: 20px;
    border: 3px dashed var(--primary-color);
}

.sticker-selection-title {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
}

.sticker-choices {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sticker-choice-btn {
    width: 80px;
    height: 80px;
    font-size: 3rem;
    border: 4px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sticker-choice-btn:hover {
    transform: scale(1.15) rotate(5deg);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.sticker-choice-btn:active {
    transform: scale(1.05);
}

.sticker-choice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.sticker-choice-btn:hover::before {
    transform: translateX(100%);
}

.sticker-choice-btn.chosen {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(129, 199, 132, 0.3) 100%);
    animation: chosenPop 0.5s ease forwards;
    pointer-events: none;
}

.sticker-choice-btn.not-chosen {
    opacity: 0.3;
    transform: scale(0.8);
    pointer-events: none;
    filter: grayscale(1);
}

@keyframes chosenPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

.sticker-complete-msg {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0.1) 100%);
    border-radius: 15px;
    margin: 20px 0;
}

.sticker-complete-msg p {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: #f9a825;
}

/* ==========================================
   Letter Block Styling for Alphabet Theme
   ========================================== */
.letter-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2em;
    height: 2em;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: #fff;
    font-family: var(--font-title);
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Different colors for variety */
.shelf-item:nth-child(5n+1) .letter-block { background: linear-gradient(135deg, #E53935 0%, #B71C1C 100%); }
.shelf-item:nth-child(5n+2) .letter-block { background: linear-gradient(135deg, #1E88E5 0%, #0D47A1 100%); }
.shelf-item:nth-child(5n+3) .letter-block { background: linear-gradient(135deg, #43A047 0%, #1B5E20 100%); }
.shelf-item:nth-child(5n+4) .letter-block { background: linear-gradient(135deg, #FB8C00 0%, #E65100 100%); }
.shelf-item:nth-child(5n+5) .letter-block { background: linear-gradient(135deg, #8E24AA 0%, #4A148C 100%); }

/* Larger letter blocks in shelf */
.shelf-item .letter-block {
    width: 2.2em;
    height: 2.2em;
    font-size: 1.1em;
}

/* Letter blocks with word hint */
.letter-with-word {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.letter-word-hint {
    font-size: 0.6em;
    color: #666;
    font-family: var(--font-body);
}

/* ==========================================
   User Migration Modal (Parent Dashboard)
   ========================================== */
.migrate-modal-content {
    max-width: 450px;
    text-align: center;
}

.migrate-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.migrate-avatar {
    font-size: 4rem;
    margin-bottom: 10px;
}

.migrate-name {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--text-dark);
}

.migrate-direction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
}

.migrate-from,
.migrate-to {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.migrate-type-emoji {
    font-size: 2.5rem;
}

.migrate-type-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.migrate-arrow {
    font-size: 2rem;
}

.migrate-info {
    text-align: left;
    background: rgba(0, 0, 0, 0.02);
    padding: 15px 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.migrate-info h4 {
    font-size: 1rem;
    margin: 10px 0 8px 0;
    color: var(--text-dark);
}

.migrate-info h4:first-child {
    margin-top: 0;
}

.migrate-info ul {
    margin: 0;
    padding-left: 25px;
}

.migrate-info li {
    font-size: 0.9rem;
    color: #666;
    margin: 5px 0;
}

.migrate-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.user-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
}
