/* Importació de fonts de Google */
@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

/* Estils generals amb colors més vius i infantils per tots els jocs */
:root {
    --color-primary: #4e7cff;
    --color-secondary: #4cd3c2;
    --color-tertiary: #ff9a3c;
    --color-quaternary: #ff6b6b;
    --color-background: linear-gradient(135deg, #a7e9ff 0%, #f3c4fb 100%);
    --font-sans: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    --border-gradient: linear-gradient(to right, #ffcc5c, #ff9eb5, #a7e9ff, #96f7d2, #ffde7a);
}

/* Nou fons més infantil i divertit */
body {
    background-image: url("data:image/svg+xml,%3Csvg width='52' height='26' viewBox='0 0 52 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffccdd' fill-opacity='0.4'%3E%3Cpath d='M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: var(--font-title);
    margin: 0;
    padding: 0;
    overflow: auto;
    min-height: 100vh;
}

/* Estils generals del contenidor de joc */
.game-container {
    margin: 0 auto;
    padding: 1rem;
    max-width: 1200px;
}

/* Estils generals del contenidor de joc */
.game-container {
    margin: 0 auto;
    position: relative;

}

/* Títols amb estil més divertit */
.game-title {
    font-size: 2.5rem;
    color: #3b82f6;
    font-weight: bold;
    margin-bottom: 1rem;
}

.step-title {
    font-size: 1.5rem;
    color: #4b5563;
}

/* Botons estàndard */
.game-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.game-button:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.game-button:active {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #3a5ecc;
}

.game-button.secondary {
    background-color: var(--color-secondary);
    box-shadow: 0 8px 0 #3aa99e;
}

.game-button.secondary:hover {
    box-shadow: 0 13px 0 #3aa99e;
}

.game-button.secondary:active {
    box-shadow: 0 6px 0 #3aa99e;
}

.game-button.tertiary {
    background-color: var(--color-tertiary);
    box-shadow: 0 8px 0 #e67e22;
}

.game-button.tertiary:hover {
    box-shadow: 0 13px 0 #e67e22;
}

.game-button.tertiary:active {
    box-shadow: 0 6px 0 #e67e22;
}

/* Indicadors de pas */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.step {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background-color: #ffde59;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    border: 3px solid #ff9a3c;
    margin: 0 10px;
    box-shadow: 0 4px 0 #ff9a3c;
    transition: all 0.3s ease;
    font-family: var(--font-title);
}

.step.active {
    background-color: #ff9a3c;
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 9px 0 #e67e22;
}

.step.completed {
    background-color: var(--color-secondary);
    color: white;
    border-color: #3aa99e;
    box-shadow: 0 4px 0 #3aa99e;
}

/* Estrella flotant decorativa */
.floating-star {
    position: absolute;
    color: #ffde59;
    font-size: 2rem;
    pointer-events: none;
    animation-name: floating;
    animation-duration: 3s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

.floating-star:nth-child(odd) {
    color: #ff9eb5;
}

.floating-star:nth-child(3n) {
    color: #96f7d2;
}

.floating-star:nth-child(4n) {
    color: #b1c5ff;
}

@keyframes floating {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10px, -20px) rotate(10deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* Missatge de felicitació */
.completion-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.completion-message.show {
    opacity: 1;
    pointer-events: auto;
}

.completion-message-content {
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    border: 8px solid transparent;
    border-image: var(--border-gradient) 1;
    animation: celebration 0.5s ease-in-out;
}

.completion-message-title {
    font-family: var(--font-title);
    font-size: 3rem;
    color: var(--color-quaternary);
    margin-bottom: 1rem;
}

@keyframes celebration {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Estil per a mitjans mòbils */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }

    .step-title {
        font-size: 1.2rem;
    }

    .game-button {
        padding: 0.8rem 1.5rem;
        font-size: 1.2rem;
    }

    .step {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.2rem;
    }
}

.welcome-title {
    font-family: var(--font-title);
    font-size: 3rem;
    color: var(--color-quaternary);
    text-align: center;
    text-shadow: 3px 3px 0 #ffde59;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
    position: relative;
    z-index: 10;
}

.welcome-subtitle {
    font-family: var(--font-title);
    font-size: 2.5rem;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 10;
}

.games-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    position: relative;
    z-index: 10;
    flex-wrap: wrap; /* Permet que els elements passin a la següent línia */
}

.game-card {
    border: 5px solid #e5e7eb;
    border-radius: 2rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 220px;
    width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-shadow: 0 8px 0 #e5e7eb;
}

.game-card:hover {
    border-color: #4e7cff;
    transform: translateY(-8px);
    box-shadow: 0 16px 0 #4e7cff;
}

.game-card.selected {
    border-color: #4cd3c2;
    background-color: rgba(76, 211, 194, 0.1);
    box-shadow: 0 16px 0 #4cd3c2;
    transform: translateY(-8px);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1.6rem;
}

.game-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 5px solid #f0f0f0;
    transition: transform 0.3s ease;
}

.game-card:hover .game-card-image {
    transform: scale(1.05);
}

.game-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 200px;
}

.game-card-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    color: var(--color-primary);
    margin-bottom: 10px;
    text-align: center;
}

.game-card-description {
    font-family: var(--font-title);
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    flex-grow: 1;
}

.game-card-button {
    display: inline-block;
    padding: 1.25rem 2.5rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    background-color: #4e7cff;
    color: white;
}

.game-card-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 13px 0 rgba(0, 0, 0, 0.2);
}

.game-card-button:active {
    transform: translateY(3px);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
}

/* S'han eliminat les estrelles flotants per evitar recarregues */
.decoration {
    position: absolute;
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .welcome-title {
        font-size: 2.5rem;
    }

    .welcome-subtitle {
        font-size: 1.8rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}


h2.step-title {
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    font-size: 2rem;
    color: #4e7cff;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Estils per als passos */
.steps-container {
    margin-bottom: 2rem;
}

.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.step {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background-color: #ffde59;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    border: 3px solid #ff9a3c;
    margin: 0 10px;
    box-shadow: 0 4px 0 #ff9a3c;
    transition: all 0.3s ease;
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

.step.active {
    background-color: #ff9a3c;
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 9px 0 #e67e22;
}

.step.completed {
    background-color: #4cd3c2;
    color: white;
    border-color: #3aa99e;
    box-shadow: 0 4px 0 #3aa99e;
}

/* Estils per a la selecció de tema amb icones més grans */
.theme-options {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.theme-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.theme-card {
    border: 5px solid #e5e7eb;
    border-radius: 2rem;
    padding: 0.1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 220px;
    width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-shadow: 0 8px 0 #e5e7eb;
}

.theme-card:hover {
    border-color: #4e7cff;
    transform: translateY(-8px);
    box-shadow: 0 16px 0 #4e7cff;
}

.theme-card.selected {
    border-color: #4cd3c2;
    background-color: rgba(76, 211, 194, 0.1);
    box-shadow: 0 16px 0 #4cd3c2;
    transform: translateY(-8px);
}

.theme-icon {
    font-size: 6rem;
    margin-bottom: 1.5rem;
}

/* Estils per a la selecció de dificultat amb botons més grans i divertits */
.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.difficulty-card {
    border: 5px solid #e5e7eb;
    border-radius: 2rem;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 180px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-shadow: 0 10px 0 #e5e7eb;
}

.difficulty-card:hover {
    border-color: #4e7cff;
    transform: translateY(-10px);
    box-shadow: 0 20px 0 #4e7cff;
}

.difficulty-card.selected {
    border-color: #4cd3c2;
    background-color: rgba(76, 211, 194, 0.1);
    box-shadow: 0 20px 0 #4cd3c2;
    transform: translateY(-10px);
}

.difficulty-level {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    color: #ff6b6b;
}

.difficulty-description {
    color: #6b7280;
    font-size: 1.25rem;
    font-weight: bold;
}

/* Estils per al tauler de joc amb cartes més grans */
.memory-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin: 0 auto;
    max-width: 800px;
}

.memory-board-container {
    padding: 20px;
    margin: 20px 0;
    border-radius: 15px;
}

/* Estils específics per a dispositius mòbils */
@media only screen and (max-width: 768px) {
    .difficulty-options {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .difficulty-card {
        padding: 1rem;
        width: 120px;
        min-height: 120px;
        border-radius: 1.5rem;
        border-width: 4px;
    }

    .difficulty-level {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .difficulty-description {
        font-size: 1rem;
    }

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

    .theme-row {
        flex-direction: column;
        align-items: center;
    }

    .theme-card {
        width: 100%;
        max-width: 250px;
    }
}

.memory-card {
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    box-sizing: border-box;
}

.memory-card-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

/* Quan la carta està girada */
.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

/* Quan la carta fa parella */
.memory-card.matched {
    cursor: default;
    border: 5px solid #2ecc71;
    border-radius: 15px;
}

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

.memory-card-front,
.memory-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.memory-card-front {
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    color: white;
    font-size: 4rem;
    font-weight: bold;
}

.memory-card-back {
    background: white;
    transform: rotateY(180deg);
}

.memory-card-back img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* Estils per a la informació del joc */
.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 1rem;
    border: 3px dashed #ff9a3c;
}

.game-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;

}

.game-stat-label {
    font-weight: 600;
    color: #4b5563;
    font-size: 1.1rem;
}

.game-stat-value {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.8rem;
    background-color: #ffde59;
    padding: 5px 15px;
    border-radius: 15px;
    box-shadow: 0 3px 0 #ff9a3c;
}

/* Botons més divertits i grans per nens */
.btn {
    display: inline-block;
    padding: 1.25rem 2.1rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 13px 0 rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: #4e7cff;
    color: white;
}

.btn-primary:hover {
    background-color: #3b5fe8;
}

.btn-success {
    background-color: #4cd3c2;
    color: white;
}

.btn-success:hover {
    background-color: #3aa99e;
}

.btn-danger {
    background-color: #ff6b6b;
    color: white;
}

.btn-danger:hover {
    background-color: #e74c3c;
}

.btn-secondary {
    background-color: #8c8c9c;
    color: white;
}

.btn-secondary:hover {
    background-color: #6b7280;
}

/* Animacions i efectes */
.rotate-y-180 {
    transform: rotateY(180deg);
}

/* Estrella de celebració per cada parella trobada */
.celebration-star {
    position: absolute;
    z-index: 10;
    font-size: 5rem;
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    animation: celebrate 1s ease-out forwards;
    pointer-events: none;
}

@keyframes celebrate {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1.5) rotate(360deg);
        opacity: 0;
    }
}

/* Missatge de victòria més vistós */
.victory-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.victory-content {
    background: linear-gradient(135deg, #a7e9ff 0%, #f3c4fb 100%);
    border-radius: 2rem;
    padding: 3rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    border: 10px solid #ffde59;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.victory-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 1.5rem;
    font-family: 'Pacifico', cursive, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    text-shadow: 3px 3px 0 #ffde59;
}

.victory-stats {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: #4e7cff;
    font-weight: bold;
}

/* Confeti per a la victòria */
.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #f00;
    opacity: 0.7;
    animation: confetti-fall 5s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        transform: translateY(calc(100vh + 100px)) rotate(360deg);
    }
}

/* Indicador visual quan s'està esperant */
.memory-board.waiting {
    pointer-events: none; /* Desactiva els clics però no mostra cap indicador visual */
}

/* Efecte de sacsejada per cartes que no coincideixen */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-card {
    animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

/* Estil per l'efecte de sacsejada */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-card {
    animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

/* Estil per l'animació quan es troba una parella */
@keyframes matched-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.matched-animation {
    animation: matched-pulse 0.6s ease-in-out;
}

/* Assegurem que les cartes emparellades tinguin un estil distintiu */
.memory-card.matched .memory-card-inner {
    box-shadow: 0 0 0 5px #4cd3c2, 0 12px 0 rgba(0, 0, 0, 0.2);
}

/* Modifica el CSS para forzar mostrar la imagen */
.memory-card.always-show .memory-card-inner {
    transform: rotateY(180deg) !important;
}

/* Para asegurar que la imagen es visible */
.memory-card.always-show .memory-card-back {
    z-index: 1 !important;
}

/* Contorno verde para las parejas */
.memory-card.matched {
    box-shadow: 0 0 0 5px #4cd3c2, 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Elements decoratius flotants */
.memory-container::before,
.memory-container::after {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    z-index: 0;
}

.memory-container::before {
    top: -100px;
    left: -100px;
    background: radial-gradient(circle, rgba(255, 222, 121, 0.2) 0%, rgba(255, 222, 121, 0) 70%);
}

.memory-container::after {
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, rgba(151, 247, 211, 0.2) 0%, rgba(151, 247, 211, 0) 70%);
}

/* Afegim elements decoratius per als nens */
.decoration {
    position: absolute;
    z-index: 1;
    font-size: 2rem;
    animation: float 3s ease-in-out infinite alternate;
}

.decoration:nth-child(1) {
    top: 20px;
    left: 20px;
    font-size: 2.5rem;
    animation-delay: 0s;
}

.decoration:nth-child(2) {
    top: 40px;
    right: 40px;
    font-size: 3rem;
    animation-delay: 0.5s;
}

.decoration:nth-child(3) {
    bottom: 30px;
    left: 50px;
    font-size: 2.2rem;
    animation-delay: 1s;
}

.decoration:nth-child(4) {
    bottom: 40px;
    right: 60px;
    font-size: 2.8rem;
    animation-delay: 1.5s;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* Estils per a la selecció de temes en 2 columnas */
.theme-container {
    max-width: 800px;
    margin: 0 auto;
}

.theme-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.theme-card {
    border: 5px solid #e5e7eb;
    border-radius: 2rem;
    padding: 0.4rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    width: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-shadow: 0 8px 0 #e5e7eb;
}

.theme-card:hover {
    border-color: #4e7cff;
    transform: translateY(-8px);
    box-shadow: 0 16px 0 #4e7cff;
}

.theme-card.selected {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
    box-shadow: 0 16px 0 #10b981;
    transform: translateY(-8px);
}

.theme-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* Responsiu per a mòbils */
@media (max-width: 768px) {
    .theme-row {
        flex-direction: column;
        align-items: center;
    }

    .theme-card {
        width: 100%;
        max-width: 220px;
    }
}

/* Estil per a l'indicador d'espera */
.dots-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.dots-loading .dot {
    width: 15px;
    height: 15px;
    background-color: #10b981;
    border-radius: 50%;
    margin: 0 5px;
    animation: dots-bounce 1.5s infinite ease-in-out;
}

.dots-loading .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dots-loading .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dots-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Estil específic per a les cartes que fan parella */
.memory-card.matched .memory-card-back {
    backface-visibility: visible !important;
    z-index: 10 !important;
    transform: none !important;
    border: 3px solid #2ecc71;
}

.memory-card.matched .memory-card-front {
    display: none !important;
}

.theme-selection-container {
    max-width: 900px;
    margin: 0 auto;
}

.game-board {
    max-width: 1000px;
    margin: 0 auto;
}

.game-button {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #f0f9ff;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.game-button:hover {
    background-color: #3b82f6;
    color: white;
}

.large-game-button {
    background-color: #4ade80;
    color: white;
    padding: 12px 30px;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.large-game-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.origin-items, .destination-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px; /* Augmentem la separació entre elements */
}

.draggable-item, .droppable-item {
    width: 150px; /* Augmentem la mida de les caselles */
    height: 150px; /* Augmentem la mida de les caselles */
    border-radius: 12px;
    padding: 6px; /* Més padding */
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.draggable-item {
    touch-action: none; /* Important per evitar gestos de zoom */
}

.draggable-item.dragging {
    opacity: 0.6;
    transform: scale(0.95);
}

.destination-element.drag-over {
    border: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}


/* Responsive layout pels contenidors */
@media (max-width: 640px) {
    .items-container {
        flex-direction: column;
    }

    .origin-items-container,
    .destination-items-container {
        width: 100%;
        margin-bottom: 1rem;
        max-height: 40vh;
        overflow-y: auto;
    }

    .draggable-item,
    .droppable-item {
        width: 7rem;  /* 80px en lloc de 128px */
        height: 7rem;
        padding: 0px;
    }

    .origin-items,
    .destination-items {
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

.draggable-item:hover {
    transform: scale(1.05);
}

.droppable-item {
    border: 2px dashed #d1d5db;
}

.droppable-item.drag-over {
    background-color: #f0f9ff;
    border: 2px dashed #3b82f6;
}

.droppable-item.matched {
    border: 3px solid #4ade80;
    background-color: #f0fff4;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
    position: relative;
}

.droppable-item.matched::after {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background-color: #4ade80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.correct-match {
    animation: correctMatch 1s ease;
}

@keyframes correctMatch {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(74, 222, 128, 0);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(74, 222, 128, 0);
    }
}

.incorrect-match {
    animation: incorrectMatch 0.5s ease;
}

@keyframes incorrectMatch {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    50% {
        transform: translateX(10px);
    }
    75% {
        transform: translateX(-10px);
    }
}

.game-completed {
    text-align: center;
    padding: 40px 0;
}

.fireworks {
    position: relative;
    margin: 0 auto;
    width: 100%;
    height: 200px;
    background-image: url('/images/fireworks.gif');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.score-container {
    background-color: #f0f9ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 8px 16px;
    color: #3b82f6;
    font-weight: bold;
}

/* Estils per a la notificació d'encert */
.success-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 200px;
    height: 200px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    pointer-events: none;
    opacity: 0;
}

.success-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.success-notification-content {
    text-align: center;
}

.success-icon {
    font-size: 50px;
    color: #4ade80;
    margin-bottom: 10px;
}

.success-message {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* Estils per al confeti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #4ade80;
    opacity: 0.7;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}
.seo-content{
    margin-top: 20px;
    background-color: #f0f9ff;
    border-radius: 12px;
    padding: 20px;

   /* Estils per a les cites/testimonis */
.testimoni-container {
    margin: 2rem 0;
  }

  .testimoni {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 5px solid #4e7cff;
    overflow: hidden;
  }

  .testimoni:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  }

  .testimoni::before {
    content: '"';
    position: absolute;
    top: -15px;
    left: 10px;
    font-size: 5rem;
    color: rgba(78, 124, 255, 0.1);
  }

  .testimoni p {
    position: relative;
    font-style: italic;
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    z-index: 2;
  }

  .testimoni-autor {
    display: block;
    text-align: right;
    font-weight: 600;
    color: #4e7cff;
    margin-top: 0.75rem;
    font-size: 0.9rem;
  }

  /* Variants de colors per diferents testimonis */
  .testimoni-primary {
    border-left-color: #4e7cff;
  }
  .testimoni-primary::before {
    color: rgba(78, 124, 255, 0.1);
  }
  .testimoni-primary .testimoni-autor {
    color: #4e7cff;
  }

  .testimoni-success {
    border-left-color: #10b981;
  }
  .testimoni-success::before {
    color: rgba(16, 185, 129, 0.1);
  }
  .testimoni-success .testimoni-autor {
    color: #10b981;
  }

  /* Versió específica per a nens */
  .testimoni-infantil {
    border-radius: 1.5rem;
    border-left: none;
    border: 3px solid #ffde59;
    background: white;
  }

  .testimoni-infantil::before {
    content: '✨';
    font-size: 2rem;
    color: #ffde59;
    top: 10px;
    left: 10px;
  }

  /* Estils responsive */
  @media (max-width: 768px) {
    .testimoni {
      padding: 1.2rem;
    }

    .testimoni::before {
      font-size: 3.5rem;
    }
  }
}
.victory-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.victory-content {
    background: linear-gradient(135deg, #a7e9ff 0%, #f3c4fb 100%);
    border-radius: 2rem;
    padding: 3rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    border: 10px solid #ffde59;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.victory-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 1.5rem;
    text-shadow: 3px 3px 0 #ffde59;
}

.victory-stats {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: #4e7cff;
    font-weight: bold;
}

/* Confeti per a la victòria */
.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #f00;
    opacity: 0.7;
    animation: confetti-fall 5s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        transform: translateY(calc(100vh + 100px)) rotate(360deg);
    }
}

/* Estils específics pel joc de sons */
body.playing-sound-game nav.navbar {
    display: none;
}

body.playing-sound-game footer {
    display: none;
}

body.playing-sound-game .game-container {
    min-height: 100vh;
    height: 100vh;
}

.game-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4e7cff;
    text-align: center;
    margin-bottom: 2rem;
}

.step-title {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

/* Estils per al contingut SEO */
.seo-content {
    margin: 40px auto;
    background-color: #f9f9f9;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.testimoni {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.testimoni-primary {
    border-left: 4px solid #4e7cff;
}

.testimoni-infantil {
    border-left: 4px solid #ff6b6b;
}

.testimoni-autor {
    display: block;
    text-align: right;
    font-weight: bold;
    margin-top: 10px;
}

/* Estils responsiu per a mòbils */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }

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

    .sound-image-container {
        width: 95%;
        margin: 0 auto;
    }
}

/* Estils específics per a pantalles molt petites */
@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
    }

    .step-title {
        font-size: 1.3rem;
    }
}

/* Estils específics pel joc de sons */
.sound-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.sound-game-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.sound-game-card:hover {
    transform: translateY(-5px);
}

.sound-game-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.sound-game-content {
    padding: 1.5rem;
}

.sound-game-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sound-game-description {
    color: #666;
    font-size: 0.875rem;
}

.sound-area {
    position: absolute;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sound-area:hover {
    background-color: rgba(78, 124, 255, 0.2);
    border-radius: 0.5rem;
}

/* Contenidor de la imatge del joc de sons */
.sound-image-container {
    position: relative;
    width: 100%;
    max-width: 90vw;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sound-image-wrapper {
    position: relative;
    display: inline-block;
}

.sound-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Contenidor de les àrees clicables */
.sound-areas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Àrea clicable individual */
.sound-area {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    background-color: rgba(78, 124, 255, 0.2);
    border: 3px solid rgba(78, 124, 255, 0.5);
    border-radius: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

/* Efectes visuals de l'àrea */
.sound-area:hover,
.sound-area:active {
    background-color: rgba(78, 124, 255, 0.5);
    border-color: rgba(78, 124, 255, 0.8);
    transform: scale(1.1);
}

/* Tooltip millorat */
.sound-area-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sound-area:hover .sound-area-tooltip {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sound-image-container {
        width: 100%;
        max-width: 100vw;
        padding: 1rem;
    }

    .sound-area-tooltip {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Suport per a diferents orientacions */
@media (orientation: landscape) and (max-width: 896px) {
    .sound-image {
        max-height: 70vh;
    }
}

/* Estils per al joc de sons */
#sound-game-container {
    position: relative;
    margin: 1rem auto;
}

.sound-area-direct {
    transition: all 0.3s ease;
}

.sound-area-direct:hover {
    transform: scale(1.1);
}

.sound-tooltip {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sound-area-direct:hover .sound-tooltip {
    opacity: 1;
}

/* Estils per al joc de traçat de lletres */
.letter-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff8e1, #fffde7);
    border: 3px solid #ffcc5c !important;
    box-shadow: 0 6px 0 #ffab2e, 0 8px 10px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.letter-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 0 #ffab2e, 0 12px 15px rgba(0, 0, 0, 0.15);
    border-color: #ffab2e !important;
}

.letter-btn:active {
    transform: translateY(4px) scale(0.95);
    box-shadow: 0 2px 0 #ffab2e, 0 4px 5px rgba(0, 0, 0, 0.1);
}

.letter-btn span {
    text-shadow: 1px 1px 0 #fff, 2px 2px 0 rgba(0, 0, 0, 0.1);
    color: #ff7043;
}

.letter-btn::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle at center, transparent 60%, rgba(255, 234, 167, 0.3) 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s ease;
    z-index: -1;
    border-radius: 50%;
}

.letter-btn:hover::before {
    opacity: 1;
    transform: scale(1.2);
}

/* Estil infantil per a la lletra seleccionada */
.letter-btn.selected {
    background: linear-gradient(135deg, #ffefba, #fff5d1);
    border-color: #ff9a3c !important;
    animation: wiggle 0.5s ease;
}

/* Animació d'oscil·lació */
@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-3deg) scale(1.05); }
    75% { transform: rotate(3deg) scale(1.05); }
}

/* Estil per a les caselles amb colors diferents */
.letter-btn:nth-child(5n+1) span { color: #ff7043; }
.letter-btn:nth-child(5n+2) span { color: #42a5f5; }
.letter-btn:nth-child(5n+3) span { color: #66bb6a; }
.letter-btn:nth-child(5n+4) span { color: #ab47bc; }
.letter-btn:nth-child(5n+5) span { color: #26c6da; }

/* Efecte especial al voltant de les lletres */
.letter-btn.rainbow-border {
    position: relative;
    z-index: 0;
    border-radius: 10px;
}

.letter-btn.rainbow-border::before {
    content: '';
    position: absolute;
    z-index: -2;
    left: -10px;
    top: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    background: linear-gradient(45deg,
        #ff0000, #ff7300, #fffb00, #48ff00,
        #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400%;
    border-radius: 15px;
    filter: blur(8px);
    animation: glowing 20s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.letter-btn:hover.rainbow-border::before {
    opacity: 1;
}

@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

/* Estil del botó "GO" */
#go-letter-btn {
    background-color: #ff7043;
    border: 3px solid #ff5722;
    box-shadow: 0 6px 0 #e64a19, 0 8px 10px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    transition: all 0.3s ease;
}

#go-letter-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 #e64a19, 0 12px 15px rgba(0, 0, 0, 0.15);
}

#go-letter-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #e64a19, 0 4px 5px rgba(0, 0, 0, 0.1);
}

/* Estil per a la guia de lletra al fons */
#letter-guide {
    opacity: 0.2;
    font-family: 'Arial Rounded MT Bold', sans-serif;
    color: #bdbdbd;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

#letter-guide:hover {
    opacity: 0.25;
}

/* Estils per al selector de color */
.color-btn {
    transform: translateY(0);
    transition: all 0.3s ease;
    border: 3px solid white;
}

.color-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Estil colorit per als botons de la barra d'eines */
#show-guide-btn, #clear-btn {
    border-radius: 15px;
    transition: all 0.3s ease;
}

#show-guide-btn {
    background-color: #42a5f5;
    border: 2px solid #1e88e5;
    box-shadow: 0 4px 0 #1565c0, 0 6px 10px rgba(0, 0, 0, 0.1);
}

#show-guide-btn:hover {
    background-color: #64b5f6;
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #1565c0, 0 8px 15px rgba(0, 0, 0, 0.15);
}

#clear-btn {
    background-color: #ef5350;
    border: 2px solid #e53935;
    box-shadow: 0 4px 0 #c62828, 0 6px 10px rgba(0, 0, 0, 0.1);
}

#clear-btn:hover {
    background-color: #e57373;
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #c62828, 0 8px 15px rgba(0, 0, 0, 0.15);
}
