:root {
    /* Paleta inspirada en Studio Ghibli (Naturaleza mágica, diversión) */
    --clr-sky: #a2d2ff;
    --clr-grass: #b5e48c;
    --clr-primary: #52b788;
    --clr-primary-dark: #40916c;
    --clr-secondary: #ffb703;
    --clr-secondary-dark: #fb8500;
    --clr-accent: #ff006e;
    --clr-text: #1b4332;

    --clr-card-back: #4ecdc4;

    --font-heading: 'Fredoka One', cursive;
    --font-text: 'Nunito', sans-serif;

    --shadow-soft: 0 10px 25px rgba(27, 67, 50, 0.15);
    --shadow-float: 0 20px 40px rgba(27, 67, 50, 0.25);
    --border-radius-large: 30px;
    --border-radius-med: 15px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-text);
    background-color: var(--clr-sky);
    background-image: radial-gradient(var(--clr-grass) 15%, transparent 16%), radial-gradient(var(--clr-grass) 15%, transparent 16%);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    color: var(--clr-text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* APP CONTAINER */
.app-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* SCREENS */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease-in-out, transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.9) translateY(20px);
    overflow-y: auto;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

.hidden {
    display: none !important;
}

/* TOP BAR */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--clr-primary-dark);
    text-align: center;
    margin: 0;
}

.title-glow {
    text-shadow: 2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white;
}

/* ANIMACIONES */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.float-anim {
    animation: float 4s ease-in-out infinite;
}

.bouncy {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s !important;
}

.bouncy:hover {
    transform: scale(1.05) translateY(-3px) !important;
}

.bouncy:active {
    transform: scale(0.95) !important;
}

/* BOTONES */
button {
    font-family: var(--font-heading);
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1.2rem;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    box-shadow: 0 6px 0px rgba(0, 0, 0, 0.2);
}

button:active {
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.2);
    margin-top: 6px;
    margin-bottom: -6px;
}

.btn-primary {
    background-color: var(--clr-primary);
    color: white;
}

.btn-secondary {
    background-color: var(--clr-secondary);
    color: white;
}

.btn-back,
.btn-info {
    font-size: 1.1rem;
    padding: 10px 20px;
    background-color: white;
    color: var(--clr-primary-dark);
    box-shadow: 0 4px 0px #ccc;
}

/* MENÚ PRINCIPAL */
#screen-menu {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
}

.menu-box {
    background: white;
    padding: 50px 40px;
    border-radius: var(--border-radius-large);
    text-align: center;
    box-shadow: var(--shadow-float);
    z-index: 10;
    max-width: 90%;
    width: 480px;
    border: 5px solid var(--clr-primary);
}

.logo-emoji {
    font-size: 5rem;
    margin-bottom: -15px;
}

.menu-box h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    color: var(--clr-secondary-dark);
    margin-bottom: 15px;
    line-height: 1.1;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.menu-box .subtitle {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--clr-primary-dark);
    margin-bottom: 35px;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* FORMS GENERAL */
.form-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    flex-grow: 1;
}

.form-card {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-float);
    width: 100%;
    max-width: 550px;
    border: 5px solid var(--clr-primary);
    position: relative;
}

.form-header-icon {
    font-size: 4rem;
    text-align: center;
    margin-top: -70px;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.form-subtitle {
    text-align: center;
    font-weight: 800;
    color: var(--clr-primary-dark);
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--clr-secondary-dark);
    margin-bottom: 10px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 3px solid #e9ecef;
    border-radius: var(--border-radius-med);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.2s;
    outline: none;
    background-color: #f8f9fa;
    color: var(--clr-text);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--clr-primary);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(82, 183, 136, 0.2);
}

.names-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ROLE REVEAL & PUNTAJES */
.player-name-banner {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: white;
    background: var(--clr-secondary);
    padding: 15px;
    border-radius: var(--border-radius-med);
    margin-top: 10px;
    box-shadow: 0 5px 0px rgba(0, 0, 0, 0.2);
}

.role-reveal {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    padding: 30px;
    border: 4px dashed var(--clr-secondary-dark);
    border-radius: var(--border-radius-med);
    background: #f8f9fa;
    margin-top: 10px;
}

.player-score {
    display: flex;
    justify-content: space-between;
    background: #f1f3f5;
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--border-radius-med);
    align-items: center;
    border: 3px solid #ddd;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.score-btn {
    width: 45px;
    height: 45px;
    padding: 0;
    font-size: 24px;
    border-radius: 50%;
    margin-left: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tag {
    font-family: var(--font-text);
    font-weight: 900;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 10px;
    color: white;
    vertical-align: middle;
}

/* GRID CATEGORÍAS */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    padding: 40px 30px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.category-card {
    background: white;
    border-radius: var(--border-radius-large);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: 4px solid #fff;
    position: relative;
    overflow: hidden;
    opacity: 0.6;
    filter: grayscale(80%);
    transition: all 0.3s;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 183, 3, 0.2) 0%, transparent 100%);
}

.category-card.selected {
    opacity: 1;
    filter: grayscale(0%);
    border-color: var(--clr-secondary);
    box-shadow: var(--shadow-float);
    transform: scale(1.05);
}

.category-icon {
    font-size: 4.5rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.category-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--clr-primary-dark);
}

.category-badge {
    background: var(--clr-secondary);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 0.9rem;
    box-shadow: 0 3px 0px rgba(0, 0, 0, 0.1);
}

.word-tag {
    background: #f1f3f5;
    color: var(--clr-text);
    font-weight: 800;
    font-size: 1.1rem;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #ddd;
}

/* CARGA DE IMÁGENES CUSTOM */
.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.image-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--border-radius-med);
    border: 3px dashed var(--clr-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #f8f9fa;
    color: var(--clr-primary-dark);
    font-weight: 800;
    font-size: 1rem;
    align-self: flex-start;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* RESPONSIVE DESIGN */
@media (max-width: 600px) {
    .menu-box {
        padding: 40px 20px;
        border-width: 4px;
    }

    .logo-emoji {
        font-size: 4rem;
        margin-bottom: -10px;
    }

    .menu-box h1 {
        font-size: 2.2rem;
    }

    .top-bar h2 {
        font-size: 1.2rem;
    }

    .top-bar button {
        font-size: 0.8rem;
        padding: 10px;
    }

    .form-card {
        padding: 30px 20px;
    }

    .player-name-banner {
        font-size: 1.8rem;
    }

    .role-reveal {
        font-size: 1.6rem;
        padding: 20px;
    }
}