/* ===== GOOGLE FONTS - Khmer + Emoji Support ===== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Quicksand:wght@700&family=Noto+Sans+Khmer:wght@400;700;900&family=Noto+Color+Emoji&display=swap');

/* ===== THEME VARIABLES ===== */
:root {
    /* Default Theme - Purple Dream */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --frame-color-1: #5dbbbb;
    --frame-color-2: #4a9d9d;
    --screen-bg-1: #e8f4f8;
    --screen-bg-2: #f0f8ff;
    --primary-color: #4a9d9d;
    --accent-color: #ff9800;
}

body[data-theme="ocean"] {
    /* Ocean Blue Theme */
    --bg-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --frame-color-1: #4facfe;
    --frame-color-2: #00b4d8;
    --screen-bg-1: #e0f7ff;
    --screen-bg-2: #f0fbff;
    --primary-color: #00b4d8;
    --accent-color: #ff6b6b;
}

body[data-theme="forest"] {
    /* Forest Green Theme */
    --bg-gradient: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    --frame-color-1: #66bb6a;
    --frame-color-2: #4caf50;
    --screen-bg-1: #e8f5e9;
    --screen-bg-2: #f1f8f4;
    --primary-color: #4caf50;
    --accent-color: #ff9800;
}

body[data-theme="sunset"] {
    /* Sunset Orange Theme */
    --bg-gradient: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    --frame-color-1: #ff8a65;
    --frame-color-2: #ff7043;
    --screen-bg-1: #fff3e0;
    --screen-bg-2: #fff8f0;
    --primary-color: #ff7043;
    --accent-color: #42a5f5;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', 'Noto Sans Khmer', 'Noto Color Emoji', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

/* ===== APP CONTAINER ===== */
.screen-content {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    background: linear-gradient(to bottom, var(--screen-bg-1) 0%, var(--screen-bg-2) 100%);
    border-radius: 0;
    padding: 14px 14px 28px;
    box-shadow: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    touch-action: pan-y;
}

.screen-content::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    height: 20px;
    background: linear-gradient(to top, var(--screen-bg-1), transparent);
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen-content.scrollable::after {
    opacity: 1;
}

/* Hidden scroll indicator */
.scroll-indicator {
    display: none;
}

/* ===== NAVIGATION BAR ===== */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 8px;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.animal-icons-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.animal-icons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
}

.animal-icons::-webkit-scrollbar {
    display: none;
}

.animal-icon {
    background: #f5f5f5;
    border: 2px solid #eee;
    border-radius: 14px;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
}

.animal-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.animal-icon.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color), 0.08);
    box-shadow: 0 0 0 3px rgba(var(--primary-color), 0.2);
}

.icon-emoji {
    font-size: 32px;
    font-family: 'Noto Color Emoji', sans-serif;
}

.nav-arrow {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    color: #555;
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.nav-arrow:active {
    transform: scale(0.94);
}

.nav-arrow-next {
    background: linear-gradient(135deg, #64b5f6, #42a5f5);
    border: none;
    color: white;
    box-shadow: 0 2px 6px rgba(66, 165, 245, 0.35);
}

.nav-arrow-next:hover {
    background: linear-gradient(135deg, #42a5f5, #2196f3);
    box-shadow: 0 3px 10px rgba(66, 165, 245, 0.45);
}
.media-container {
    position: relative;
    margin: 0;
}

.question-badge {
    position: absolute;
    top: -8px;
    left: 14px;
    background: linear-gradient(135deg, #64b5f6, #42a5f5);
    color: white;
    padding: 5px 14px;
    border-radius: 18px;
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border: 2px solid white;
}

.media-window {
    background: linear-gradient(135deg, #a8d5ba, #7cb89d);
    border: 3px dashed #5a8f7b;
    border-radius: 20px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.media-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.media-placeholder {
    text-align: center;
    color: #5a8f7b;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Quicksand', 'Noto Sans Khmer', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.placeholder-icon {
    color: #5a8f7b;
    opacity: 0.9;
}

.placeholder-icon svg {
    width: 64px;
    height: 64px;
}

/* ===== BILINGUAL TITLE ZONE ===== */
.title-container {
    text-align: center;
    margin: 8px 0 4px;
}

.title-english {
    font-family: 'Fredoka One', cursive;
    font-size: 38px;
    font-weight: 700;
    background: linear-gradient(90deg, 
        #ff6b6b 0%, 
        #ffa500 20%, 
        #ffd700 40%, 
        #4ecdc4 60%, 
        #6a5acd 80%, 
        #ee82ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    margin-bottom: 2px;
    line-height: 1.15;
}

.title-khmer {
    font-family: 'Noto Sans Khmer', sans-serif;
    font-size: 30px;
    font-weight: 900;
    color: #333;
    margin-top: 4px;
    line-height: 1.3;
    letter-spacing: 1px;
}

/* ===== INTERACTIVE AUDIO BUTTONS GRID ===== */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 6px 0 0;
}

.action-btn {
    border: none;
    border-radius: 20px;
    padding: 16px 10px;
    font-family: 'Fredoka One', cursive;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    min-height: 90px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.action-btn:hover::before {
    opacity: 1;
}

.action-btn:active {
    transform: scale(0.95);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.btn-text {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.green-btn {
    background: linear-gradient(135deg, #66bb6a, #4caf50);
}

.green-btn:hover {
    background: linear-gradient(135deg, #57ab5a, #43a047);
}

.orange-btn {
    background: linear-gradient(135deg, #ffa726, #ff9800);
}

.orange-btn:hover {
    background: linear-gradient(135deg, #fb8c00, #f57c00);
}

.purple-btn {
    background: linear-gradient(135deg, #ab47bc, #9c27b0);
}

.purple-btn:hover {
    background: linear-gradient(135deg, #9c27b0, #8e24aa);
}

.yellow-btn {
    background: linear-gradient(135deg, #ffeb3b, #fdd835);
}

.yellow-btn:hover {
    background: linear-gradient(135deg, #fdd835, #fbc02d);
}

.yellow-btn .btn-icon {
    color: #4caf50;
}

.yellow-btn .btn-text {
    color: #333;
    font-size: 16px;
}

/* ===== PHONICS FOOTER ===== */
.phonics-footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 14px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: auto;
}

.phonics-line {
    font-family: 'Quicksand', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.phonics-letters {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.letter {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    font-weight: 700;
    color: #ff6b6b;
}

.letter:nth-child(4n+1) { color: #ff6b6b; }
.letter:nth-child(4n+2) { color: #ffa500; }
.letter:nth-child(4n+3) { color: #4ecdc4; }
.letter:nth-child(4n+4) { color: #6a5acd; }

.separator {
    color: #999;
    font-size: 18px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 500px) {
    .screen-content {
        padding: 12px 10px 24px;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .nav-bar {
        padding: 5px 6px;
        border-radius: 12px;
    }
    
    .animal-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }
    
    .icon-emoji {
        font-size: 24px;
    }
    
    .nav-arrow {
        width: 32px;
        height: 32px;
    }
    
    .nav-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .animal-icons {
        gap: 6px;
    }
    
    .title-english {
        font-size: 28px;
    }
    
    .title-khmer {
        font-size: 22px;
    }
    
    .media-window {
        min-height: 150px;
        border-radius: 16px;
    }
    
    .action-btn {
        padding: 14px 8px;
        font-size: 12px;
        min-height: 80px;
        border-radius: 16px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .btn-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .btn-text {
        font-size: 11px;
    }
    
    .question-badge {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .phonics-footer {
        padding: 10px;
        border-radius: 12px;
    }
    
    .phonics-line {
        font-size: 13px;
    }
    
    .letter {
        font-size: 15px;
    }
    
    .separator {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .screen-content {
        padding: 10px 8px 20px;
    }
    
    .animal-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    
    .icon-emoji {
        font-size: 20px;
    }
    
    .nav-arrow {
        width: 30px;
        height: 30px;
    }
    
    .nav-arrow svg {
        width: 14px;
        height: 14px;
    }
    
    .animal-icons {
        gap: 5px;
    }
    
    .title-english {
        font-size: 24px;
    }
    
    .title-khmer {
        font-size: 18px;
    }
    
    .action-btn {
        font-size: 11px;
        padding: 12px 6px;
        min-height: 72px;
        border-radius: 14px;
    }
    
    .btn-icon {
        width: 28px;
        height: 28px;
    }
    
    .btn-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-text {
        font-size: 10px;
    }
    
    .media-window {
        min-height: 130px;
    }
    
    .phonics-line {
        font-size: 11px;
    }
    
    .letter {
        font-size: 13px;
    }
    
    .separator {
        font-size: 12px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.action-btn:active {
    animation: pulse 0.3s ease;
}

/* ===== ACCESSIBILITY ===== */
button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}
