/* ============================================
   ZimLearn - ECD Playground Styles
   Bright, chunky, playful for ages 3-6
   ============================================ */

/* --- ECD Playground Landing --- */
.ecd-playground {
    padding: 16px;
    padding-bottom: 100px;
    min-height: 80vh;
    background: linear-gradient(180deg, #FFF8E1 0%, #E8F5E9 50%, #E3F2FD 100%);
}

.ecd-hero {
    text-align: center;
    padding: 20px 0 10px;
}

.ecd-hero-title {
    font-size: 32px;
    font-weight: 900;
    color: #FF6B35;
    text-shadow: 2px 2px 0 #FFD54F;
    margin: 0;
    letter-spacing: -0.5px;
}

.ecd-hero-sub {
    font-size: 15px;
    color: #666;
    margin: 6px 0 0;
    font-weight: 600;
}

.ecd-stars {
    font-size: 28px;
    letter-spacing: 4px;
    margin: 8px 0 0;
}

/* --- Game Cards on Landing --- */
.ecd-games-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.ecd-game-card {
    background: white;
    border-radius: 24px;
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.ecd-game-card:active {
    transform: scale(0.97);
}

.ecd-game-card.counting { border-color: #FF6B35; }
.ecd-game-card.shapes { border-color: #7C4DFF; }
.ecd-game-card.phonics { border-color: #00BFA5; }
.ecd-game-card.animals { border-color: #8D6E63; }
.ecd-game-card.colours { border-color: #E91E63; }

.ecd-game-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
}

.ecd-game-card.counting .ecd-game-icon { background: #FFF3E0; }
.ecd-game-card.shapes .ecd-game-icon { background: #EDE7F6; }
.ecd-game-card.phonics .ecd-game-icon { background: #E0F2F1; }
.ecd-game-card.animals .ecd-game-icon { background: #EFEBE9; }
.ecd-game-card.colours .ecd-game-icon { background: #FCE4EC; }

.ecd-game-info {
    flex: 1;
    min-width: 0;
}

.ecd-game-name {
    font-size: 20px;
    font-weight: 800;
    color: #333;
    margin: 0 0 4px;
}

.ecd-game-desc {
    font-size: 13px;
    color: #777;
    margin: 0;
    line-height: 1.3;
}

.ecd-game-progress {
    margin-top: 8px;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.ecd-game-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.ecd-game-card.counting .ecd-game-progress-bar { background: #FF6B35; }
.ecd-game-card.shapes .ecd-game-progress-bar { background: #7C4DFF; }
.ecd-game-card.phonics .ecd-game-progress-bar { background: #00BFA5; }
.ecd-game-card.animals .ecd-game-progress-bar { background: #8D6E63; }
.ecd-game-card.colours .ecd-game-progress-bar { background: #E91E63; }

.ecd-game-card .ecd-lock {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    opacity: 0.5;
}

/* --- Level Select Screen --- */
.ecd-level-select {
    padding: 16px;
    padding-bottom: 100px;
    min-height: 80vh;
    background: linear-gradient(180deg, #FFF8E1 0%, #E8F5E9 100%);
}

.ecd-level-title {
    text-align: center;
    font-size: 26px;
    font-weight: 900;
    margin: 12px 0 4px;
}

.ecd-level-title.counting { color: #FF6B35; }
.ecd-level-title.shapes { color: #7C4DFF; }
.ecd-level-title.phonics { color: #00BFA5; }

.ecd-level-subtitle {
    text-align: center;
    font-size: 14px;
    color: #888;
    margin: 0 0 20px;
}

.ecd-level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.ecd-level-btn {
    aspect-ratio: 1;
    border-radius: 20px;
    border: 3px solid #e0e0e0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
    position: relative;
    font-size: 24px;
    font-weight: 900;
    color: #333;
}

.ecd-level-btn:active {
    transform: scale(0.92);
}

.ecd-level-btn.locked {
    background: #f5f5f5;
    color: #ccc;
    cursor: default;
    border-color: #eee;
}

.ecd-level-btn.locked::after {
    content: '🔒';
    font-size: 16px;
    position: absolute;
    bottom: 4px;
}

.ecd-level-btn.completed {
    border-color: #4CAF50;
    background: #E8F5E9;
    color: #2E7D32;
}

.ecd-level-btn .ecd-level-stars {
    font-size: 10px;
    letter-spacing: 1px;
    margin-top: 2px;
    height: 14px;
}

.ecd-level-btn.available {
    animation: ecdPulse 2s infinite;
}

.ecd-level-btn.available.counting { border-color: #FF6B35; }
.ecd-level-btn.available.shapes { border-color: #7C4DFF; }
.ecd-level-btn.available.phonics { border-color: #00BFA5; }
.ecd-level-btn.available.animals { border-color: #8D6E63; }
.ecd-level-btn.available.colours { border-color: #E91E63; }

/* --- Game Play Screen --- */
.ecd-game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.ecd-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    z-index: 10;
}

.ecd-game-header-level {
    font-size: 16px;
    font-weight: 800;
    color: #333;
}

.ecd-game-header-progress {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ecd-game-header-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: background 0.3s, transform 0.3s;
}

.ecd-game-header-dot.done {
    background: #4CAF50;
    transform: scale(1.1);
}

.ecd-game-header-dot.wrong {
    background: #E74C3C;
}

.ecd-game-header-dot.current {
    background: #FFD54F;
    animation: ecdPulse 1.5s infinite;
}

.ecd-game-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Question Area --- */
.ecd-question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 24px;
}

.ecd-prompt {
    font-size: 22px;
    font-weight: 800;
    color: #333;
    text-align: center;
    line-height: 1.3;
    max-width: 320px;
}

.ecd-visual-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    width: 100%;
    max-width: 360px;
}

.ecd-visual-area svg {
    max-width: 100%;
    height: auto;
}

/* --- Answer Section --- */
.ecd-answer-section {
    background: rgba(255,255,255,0.7);
    border-top: 3px dashed #FFD54F;
    padding-top: 12px;
    margin-top: auto;
}

.ecd-tap-label {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #FF6B35;
    margin-bottom: 10px;
    animation: ecdFloat 1.5s ease-in-out infinite;
}

/* --- Answer Options --- */
.ecd-options {
    display: grid;
    gap: 14px;
    width: 100%;
    max-width: 380px;
    padding: 8px 16px 32px;
    margin: 0 auto;
}

.ecd-options.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.ecd-options.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.ecd-options.cols-4 {
    grid-template-columns: 1fr 1fr;
}

.ecd-option-btn {
    border-radius: 24px;
    border: 4px solid #FF6B35;
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF3E0 100%);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
    min-height: 90px;
    font-size: 36px;
    font-weight: 900;
    color: #333;
    box-shadow: 0 4px 12px rgba(255,107,53,0.2), 0 2px 4px rgba(0,0,0,0.08);
    -webkit-tap-highlight-color: rgba(255,107,53,0.3);
}

.ecd-option-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 6px rgba(255,107,53,0.3);
}

/* Each button gets a unique colour so they pop */
.ecd-option-btn:nth-child(1) { border-color: #FF6B35; background: linear-gradient(180deg, #FFF 0%, #FFF3E0 100%); }
.ecd-option-btn:nth-child(2) { border-color: #2196F3; background: linear-gradient(180deg, #FFF 0%, #E3F2FD 100%); }
.ecd-option-btn:nth-child(3) { border-color: #4CAF50; background: linear-gradient(180deg, #FFF 0%, #E8F5E9 100%); }
.ecd-option-btn:nth-child(4) { border-color: #9C27B0; background: linear-gradient(180deg, #FFF 0%, #F3E5F5 100%); }

.ecd-option-btn:nth-child(1) { box-shadow: 0 4px 12px rgba(255,107,53,0.25); }
.ecd-option-btn:nth-child(2) { box-shadow: 0 4px 12px rgba(33,150,243,0.25); }
.ecd-option-btn:nth-child(3) { box-shadow: 0 4px 12px rgba(76,175,80,0.25); }
.ecd-option-btn:nth-child(4) { box-shadow: 0 4px 12px rgba(156,39,176,0.25); }

.ecd-option-btn.correct {
    border-color: #4CAF50 !important;
    background: #C8E6C9 !important;
    box-shadow: 0 0 20px rgba(76,175,80,0.5) !important;
    animation: ecdBounce 0.4s;
}

.ecd-option-btn.wrong {
    border-color: #E74C3C !important;
    background: #FFCDD2 !important;
    box-shadow: 0 0 20px rgba(231,76,60,0.5) !important;
    animation: ecdShake 0.4s;
}

.ecd-option-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.ecd-option-label {
    font-size: 13px;
    font-weight: 600;
    color: #777;
}

/* --- Feedback Overlay --- */
.ecd-feedback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.ecd-feedback-icon {
    font-size: 120px;
    animation: ecdFeedbackPop 0.6s ease-out forwards;
}

/* --- Level Complete Screen --- */
.ecd-complete {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: linear-gradient(180deg, #FFF8E1 0%, #E8F5E9 100%);
}

.ecd-complete-emoji {
    font-size: 80px;
    animation: ecdBounce 0.6s;
}

.ecd-complete-title {
    font-size: 32px;
    font-weight: 900;
    margin: 16px 0 8px;
}

.ecd-complete-stars {
    font-size: 40px;
    letter-spacing: 8px;
    margin: 8px 0 24px;
}

.ecd-complete-score {
    font-size: 18px;
    color: #666;
    margin: 0 0 32px;
    font-weight: 600;
}

.ecd-complete-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.ecd-btn {
    padding: 16px 32px;
    border-radius: 20px;
    border: none;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s;
}

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

.ecd-btn-primary {
    background: #FF6B35;
    color: white;
}

.ecd-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.ecd-btn-shapes {
    background: #7C4DFF;
    color: white;
}

.ecd-btn-phonics {
    background: #00BFA5;
    color: white;
}

/* --- Speaker Button (TTS) --- */
.ecd-speaker-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid #FFD54F;
    background: #FFF8E1;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    animation: ecdPulse 2s infinite;
}

.ecd-speaker-btn:active {
    transform: scale(0.9);
}

/* --- Counting Objects Container --- */
.ecd-objects-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    max-width: 320px;
}

.ecd-object-item {
    animation: ecdPopIn 0.3s ease-out backwards;
}

.ecd-object-item svg {
    width: 56px;
    height: 56px;
}

/* Stagger pop-in animations */
.ecd-object-item:nth-child(1) { animation-delay: 0s; }
.ecd-object-item:nth-child(2) { animation-delay: 0.1s; }
.ecd-object-item:nth-child(3) { animation-delay: 0.2s; }
.ecd-object-item:nth-child(4) { animation-delay: 0.3s; }
.ecd-object-item:nth-child(5) { animation-delay: 0.4s; }
.ecd-object-item:nth-child(6) { animation-delay: 0.5s; }
.ecd-object-item:nth-child(7) { animation-delay: 0.6s; }
.ecd-object-item:nth-child(8) { animation-delay: 0.7s; }
.ecd-object-item:nth-child(9) { animation-delay: 0.8s; }
.ecd-object-item:nth-child(10) { animation-delay: 0.9s; }

/* --- Animations --- */
@keyframes ecdPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,53,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255,107,53,0); }
}

@keyframes ecdBounce {
    0% { transform: scale(0.3); }
    50% { transform: scale(1.15); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes ecdShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes ecdPopIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes ecdFeedbackPop {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

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

/* --- Shape Sorter Specific --- */
.ecd-sort-target {
    width: 100%;
    max-width: 360px;
    min-height: 80px;
    border: 3px dashed #ccc;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    flex-wrap: wrap;
    transition: border-color 0.3s, background 0.3s;
}

.ecd-sort-target.highlight {
    border-color: #7C4DFF;
    background: #EDE7F6;
}

.ecd-sort-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 16px;
}

.ecd-sort-item {
    cursor: pointer;
    transition: transform 0.15s;
}

.ecd-sort-item:active {
    transform: scale(0.9);
}

.ecd-sort-item.selected {
    transform: scale(1.15);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* --- Phonics Specific --- */
.ecd-phonics-image {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 16px;
}

.ecd-letter-option {
    font-size: 36px;
    font-weight: 900;
    font-family: 'Arial Rounded MT Bold', Arial, sans-serif;
}

/* --- Dark Mode Support --- */
@media (prefers-color-scheme: dark) {
    .ecd-playground,
    .ecd-level-select,
    .ecd-complete {
        background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    }
    .ecd-game-card,
    .ecd-level-btn,
    .ecd-option-btn {
        background: #2a2a3e;
        color: #eee;
    }
    .ecd-game-card {
        box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    }
    .ecd-hero-title { color: #FFB74D; }
    .ecd-game-name { color: #eee; }
    .ecd-game-desc { color: #aaa; }
    .ecd-prompt { color: #eee; }
    .ecd-game-header { background: #1a1a2e; }
    .ecd-level-btn.locked { background: #222; color: #555; }
    .ecd-phonics-image { background: #2a2a3e; }
}
