/* style.css - Stylizacja gry edukacyjnej Rainbow Colors */

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --bg-gradient: linear-gradient(135deg, #f0f7ff 0%, #fff6e5 100%);
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 14px 30px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* Konfetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.game-container {
    width: 100%;
    max-width: 960px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Pasek górny */
.game-header {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chameleon-wrapper {
    width: 75px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chameleon-wrapper:hover {
    transform: scale(1.08) rotate(-3deg);
}

.chameleon-icon {
    width: 100%;
    height: 100%;
    overflow: visible;
}

#chameleon-body, #chameleon-head, #chameleon-tail {
    transition: fill 0.35s ease;
}

.brand-text h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(45deg, #e74c3c, #f1c40f, #2ecc71, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.brand-text .subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-pill {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 50px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 700;
}

.sound-btn {
    background: #edf2f7;
    border: none;
    border-radius: 50px;
    padding: 8px 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
}

.sound-btn:hover {
    background: #e2e8f0;
}

.sound-btn.muted {
    background: #fed7d7;
    color: #c53030;
}

/* Zakładki nawigacji */
.game-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 14px;
    border-radius: 40px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tab-icon {
    font-size: 1.2rem;
}

/* Główne sekcje */
main {
    flex: 1;
}

.game-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-intro {
    text-align: center;
    margin-bottom: 24px;
}

.section-intro h2 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

.section-intro p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================
   TRYB 1: SŁOWNIK / EXPLORE
   ========================================== */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.color-card {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 2px solid #edf2f7;
    transition: all 0.25s ease;
    user-select: none;
}

.color-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}

.color-blob {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.15), 0 6px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.color-card:hover .color-blob {
    transform: scale(1.06);
}

.listen-btn {
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    pointer-events: none;
}

.color-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.color-en {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.color-phonetic {
    font-size: 0.82rem;
    color: #94a3b8;
    font-family: monospace;
}

.color-pl {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pop-anim {
    animation: popBounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ==========================================
   TRYB 2: QUIZ
   ========================================== */
.quiz-header {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.quiz-progress {
    background: #edf2f7;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.quiz-card {
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
    padding: 20px;
}

.quiz-prompt {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.quiz-target-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    padding: 10px 24px;
    border-radius: 30px;
    margin-bottom: 18px;
}

.target-word {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #1e293b;
}

.audio-replay-btn {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.audio-replay-btn:hover {
    transform: scale(1.1);
    background: #f8fafc;
}

.quiz-feedback {
    min-height: 32px;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.feedback-success {
    color: #27ae60;
}

.feedback-tryagain {
    color: #e67e22;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 400px;
    margin: 0 auto;
}

.quiz-option-btn {
    height: 90px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.quiz-option-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.option-border {
    border: 3px solid #cbd5e1;
}

.correct-answer {
    animation: correctPulse 0.4s ease;
    outline: 4px solid #2ecc71;
}

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

.wrong-shake {
    animation: shake 0.4s ease;
}

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

.quiz-result {
    text-align: center;
    padding: 30px;
}

.trophy-icon {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: popBounce 0.6s ease;
}

.action-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.3);
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4);
}

/* ==========================================
   TRYB 3: BALONIKI / BALLOON POP
   ========================================== */
.balloon-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.balloon-task {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
}

.balloon-target-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.target-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.audio-replay-btn-small {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}

.balloon-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.balloon-sky-container {
    height: 480px;
    background: linear-gradient(180deg, #bbf2f6 0%, #e0f2fe 100%);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    user-select: none;
    touch-action: none;
    border: 3px solid #bae6fd;
}

.cloud {
    position: absolute;
    font-size: 3rem;
    opacity: 0.6;
    pointer-events: none;
}

.cloud-1 { top: 20px; left: 15%; animation: floatCloud 25s infinite linear; }
.cloud-2 { top: 70px; right: 20%; animation: floatCloud 32s infinite linear reverse; }
.cloud-3 { top: 160px; left: 55%; animation: floatCloud 28s infinite linear; }

@keyframes floatCloud {
    0% { transform: translateX(0); }
    50% { transform: translateX(25px); }
    100% { transform: translateX(0); }
}

.floating-balloon {
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    will-change: transform;
    touch-action: manipulation;
}

.balloon-body {
    width: 60px;
    height: 75px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    position: relative;
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.2), inset 4px 4px 10px rgba(255,255,255,0.4), 0 8px 15px rgba(0,0,0,0.15);
    transition: transform 0.1s;
}

.balloon-shine {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 14px;
    height: 22px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    transform: rotate(-30deg);
}

.balloon-string {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 24px;
    background: #94a3b8;
}

.balloon-body::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 4px;
    background: inherit;
    border-radius: 2px;
}

.balloon-popped {
    animation: balloonPop 0.25s forwards ease-out;
}

@keyframes balloonPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ==========================================
   TRYB 4: MEMORY
   ========================================== */
.memory-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.memory-status-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.action-btn-small {
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 20px;
    padding: 6px 14px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-small:hover {
    background: #e2e8f0;
}

.memory-instructions {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    max-width: 620px;
    margin: 0 auto;
    perspective: 1000px;
}

.memory-card {
    height: 100px;
    cursor: pointer;
    user-select: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.4s;
    transform-style: preserve-3d;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-back, .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 1.8rem;
    border: 3px solid #ffffff;
}

.card-front {
    background: #ffffff;
    transform: rotateY(180deg);
    border: 2px solid #e2e8f0;
}

.memory-card.matched .card-inner {
    opacity: 0.85;
    box-shadow: 0 0 0 3px #2ecc71;
}

.memory-color-blob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: inset 0 -3px 6px rgba(0,0,0,0.2), 0 3px 6px rgba(0,0,0,0.1);
}

.memory-word-label {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.5px;
}

/* ==========================================
   TRYB 5: ZDANIA / UZUPEŁNIANIE
   ========================================== */
.sentences-header {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.sentences-progress {
    background: #edf2f7;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.sentence-card {
    text-align: center;
    max-width: 580px;
    margin: 0 auto;
    padding: 10px 20px 20px;
}

.sentence-visual-box {
    margin-bottom: 16px;
}

.sentence-emoji {
    font-size: 4.2rem;
    display: inline-block;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12));
    animation: popBounce 0.4s ease;
}

.sentence-prompt-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 30px;
    margin-bottom: 8px;
    max-width: 100%;
    flex-wrap: wrap;
}

.sentence-display {
    font-size: 1.55rem;
    font-weight: 700;
    color: #1e293b;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.sentence-gap {
    border-bottom: 3px dashed #94a3b8;
    min-width: 85px;
    display: inline-block;
    text-align: center;
    padding: 2px 8px;
    color: #64748b;
    transition: all 0.25s ease;
}

.sentence-gap.gap-filled {
    border-bottom: 3px solid currentColor;
    font-weight: 800;
    animation: popBounce 0.35s ease;
}

.sentence-hint-pl {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 6px;
}

.sentences-feedback {
    min-height: 32px;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.sentence-options-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
}

.sentence-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 420px;
    margin: 0 auto;
}

.word-chip-btn {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 40px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.word-chip-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.chip-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.chip-word {
    text-transform: capitalize;
}

.chip-correct {
    border-color: #2ecc71;
    background: #f0fdf4;
    color: #166534;
    outline: 3px solid #2ecc71;
    animation: correctPulse 0.4s ease;
}

.sentences-result {
    text-align: center;
    padding: 30px;
}

/* Stopka */
.game-footer {
    text-align: center;
    padding: 20px 0 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsywność */
@media (max-width: 650px) {
    .game-container {
        padding: 12px;
    }

    .game-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 14px;
    }

    .brand {
        flex-direction: column;
    }

    .game-nav {
        flex-wrap: wrap;
        border-radius: var(--radius-md);
    }

    .tab-btn {
        flex-basis: calc(33.33% - 6px);
        font-size: 0.85rem;
        padding: 8px;
    }

    .explore-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .memory-card {
        height: 85px;
    }

    .balloon-sky-container {
        height: 380px;
    }

    .sentence-options-grid {
        grid-template-columns: 1fr;
    }

    .sentence-display {
        font-size: 1.3rem;
    }
}
