@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&family=Fredoka+One&display=swap');

:root {
    --primary: #FF5A5F;
    --secondary: #08C2A8;
    --accent: #FFC043;
    --text: #2D3436;
    --bg: #F0F4F8;
    --success: #6BCB77;
    --error: #FF6B6B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg);
    /* Pattern giocoso per i bambini a pois leggeri */
    background-image: radial-gradient(#d3dbef 3px, transparent 3px);
    background-size: 40px 40px;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: none;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    margin-top: 20px;
}

h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-shadow: 3px 3px 0px rgba(0,0,0,0.1);
}

h2 {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 15px 35px;
    font-size: 1.5rem;
    font-family: 'Fredoka One', cursive;
    letter-spacing: 1px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    box-shadow: 0 8px 0 rgba(220, 50, 50, 1), 0 15px 20px rgba(0, 0, 0, 0.15);
    margin: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 0 rgba(220, 50, 50, 1), 0 18px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(220, 50, 50, 1), 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: var(--secondary);
    box-shadow: 0 8px 0 #059983, 0 15px 20px rgba(0, 0, 0, 0.15);
}

.btn-secondary:hover {
    box-shadow: 0 10px 0 #059983, 0 18px 25px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    box-shadow: 0 2px 0 #059983, 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-accent {
    background-color: var(--accent);
    color: var(--text);
    box-shadow: 0 8px 0 #d9a01e, 0 15px 20px rgba(0, 0, 0, 0.15);
}

.btn-accent:hover {
    box-shadow: 0 10px 0 #d9a01e, 0 18px 25px rgba(0, 0, 0, 0.2);
}

.btn-accent:active {
    box-shadow: 0 2px 0 #d9a01e, 0 5px 10px rgba(0, 0, 0, 0.1);
}

input[type="text"], input[type="number"], input[type="email"], input[type="password"], select {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid #E0E0E0;
    border-radius: 15px;
    margin-bottom: 20px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus {
    border-color: var(--secondary);
}

.image-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.image-item {
    width: 150px;
    height: 150px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    cursor: grab;
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
    background-color: white;
    border: 4px solid var(--accent);
    transition: transform 0.2s;
}

.image-item:hover {
    transform: scale(1.05);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    border-radius: 14px;
}

.image-item.dragging {
    opacity: 0.5;
    border: 3px dashed var(--primary);
}

.image-item.error {
    border: 4px solid var(--error);
    animation: shake 0.5s;
}

.image-item.success {
    border: 4px solid var(--success);
}

.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    margin-bottom: 20px;
}

.file-upload-wrapper input[type="file"] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.5s;
}

.result-card {
    background: #f1f2f6;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-correct {
    color: var(--success);
    font-weight: bold;
}

.result-wrong {
    color: var(--error);
    font-weight: bold;
}

.badge {
    background-color: var(--primary);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.links-box {
    background-color: #e8f4f8;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    word-break: break-all;
}

.links-box a {
    color: var(--secondary);
    font-weight: bold;
    text-decoration: none;
}

.links-box a:hover {
    text-decoration: underline;
}

/* Win Animations */
.win-animation {
    animation: bounceIn 1s cubic-bezier(0.28, 0.84, 0.42, 1) forwards;
    font-size: 3rem;
    text-shadow: 3px 3px 0px rgba(0,0,0,0.1);
}

.win-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #f39c12;
    animation: pulse 2s infinite;
}

@keyframes bounceIn {
    0% { transform: scale(0.1); opacity: 0; }
    60% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* Drag and Drop Sortable styles */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f4f4f4;
}

/* Loader */
.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Upload Progress */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-overlay h2 {
    color: var(--primary);
    margin-top: 20px;
}

.progress-container {
    width: 80%;
    max-width: 400px;
    height: 25px;
    background-color: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Large Image Item for Children */
.image-item-large {
    width: 280px;
    height: 280px;
}
@media (min-width: 768px) {
    .image-item-large {
        width: 350px;
        height: 350px;
    }
}
@media (min-width: 1024px) {
    .image-item-large {
        width: 400px;
        height: 400px;
    }
}

/* Number Badge */
.number-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent);
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 900;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 10;
    border: 3px solid white;
}
