:root {
    /* Colores pastel 3D kawaii */
    --pink-soft: #FFB7D5;
    --pink-light: #FFC9E0;
    --mint-soft: #B2E2D2;
    --mint-light: #D4F1E8;
    --yellow-soft: #FFF4C2;
    --purple-soft: #D4C5F9;
    --blue-soft: #C5E3F6;
    --peach-soft: #FFD4B8;

    /* Colores de texto */
    --text-dark: #6B5B8C;
    --text-medium: #8B7BA8;

    /* Sombras 3D */
    --shadow-3d: 0 8px 16px rgba(107, 91, 140, 0.15);
    --shadow-3d-hover: 0 12px 24px rgba(107, 91, 140, 0.2);
    --shadow-inset: inset 0 -4px 8px rgba(255, 255, 255, 0.6);

    --border-radius: 24px;
    --font-family: 'Fredoka', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #FFD1E3 0%, #B2E2D2 100%);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Elementos decorativos de fondo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(178, 226, 210, 0.3) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 244, 250, 0.95) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-3d);
    backdrop-filter: blur(10px);
    z-index: 1;
}

@media (min-width: 600px) {
    .app-container {
        height: 90vh;
        border-radius: var(--border-radius);
    }
}

/* Decoraciones flotantes - Nubes */
.screen::before,
.screen::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.screen::before {
    width: 80px;
    height: 50px;
    top: 15%;
    left: 5%;
    box-shadow:
        30px 0 0 -10px rgba(255, 255, 255, 0.7),
        -30px 0 0 -10px rgba(255, 255, 255, 0.7),
        0 -20px 0 -5px rgba(255, 255, 255, 0.7);
    animation: float 6s ease-in-out infinite;
}

.screen::after {
    width: 60px;
    height: 40px;
    top: 25%;
    right: 8%;
    box-shadow:
        20px 0 0 -8px rgba(255, 255, 255, 0.7),
        -20px 0 0 -8px rgba(255, 255, 255, 0.7);
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
    z-index: 10;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    position: relative;
    z-index: 20;
}

.language-selector {
    display: flex;
    gap: 10px;
}

.lang-btn {
    background: linear-gradient(145deg, #ffffff, #f5f0ff);
    border: 3px solid var(--pink-light);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow:
        0 6px 0 var(--pink-soft),
        var(--shadow-3d);
}

.kawaii-flag {
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lang-btn.active {
    border-color: var(--pink-soft);
    background: linear-gradient(145deg, var(--pink-light), var(--pink-soft));
    transform: translateY(-3px);
    box-shadow:
        0 8px 0 #FF9EC5,
        var(--shadow-3d-hover);
}

.lang-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #FF9EC5,
        var(--shadow-3d);
}

.sound-btn {
    background: linear-gradient(145deg, #ffffff, #f0f8ff);
    border: 3px solid var(--blue-soft);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow:
        0 6px 0 #A5D3E8,
        var(--shadow-3d);
    transition: all 0.3s;
}

.sound-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #A5D3E8,
        var(--shadow-3d);
}

/* Logo & Menu */
.logo-container {
    text-align: center;
    margin-top: 20px;
    position: relative;
    z-index: 15;
}

.game-title {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--pink-soft), var(--purple-soft));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 4px 0px rgba(255, 244, 194, 0.8));
    margin-bottom: 20px;
    font-weight: 700;
}

.kawaii-character {
    margin: 20px auto;
    filter: drop-shadow(0 8px 12px rgba(107, 91, 140, 0.2));
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.difficulty-selection {
    text-align: center;
    margin: 30px 0;
    position: relative;
    z-index: 15;
}

.difficulty-selection h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 600;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-difficulty {
    padding: 12px 18px;
    border: none;
    border-radius: 18px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 5px 0 rgba(107, 91, 140, 0.2),
        var(--shadow-3d);
    position: relative;
}

.btn-difficulty::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 10%;
    right: 10%;
    height: 40%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    filter: blur(8px);
}

.btn-difficulty.easy {
    background: linear-gradient(145deg, var(--mint-light), var(--mint-soft));
    color: #5A9B85;
}

.btn-difficulty.medium {
    background: linear-gradient(145deg, #FFF9D0, var(--yellow-soft));
    color: #B8A04C;
}

.btn-difficulty.hard {
    background: linear-gradient(145deg, var(--pink-light), var(--pink-soft));
    color: #C75B8A;
}

.btn-difficulty.selected {
    transform: scale(1.1) translateY(-3px);
    box-shadow:
        0 8px 0 rgba(107, 91, 140, 0.3),
        var(--shadow-3d-hover),
        0 0 0 4px rgba(212, 197, 249, 0.5);
}

.btn-difficulty:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 rgba(107, 91, 140, 0.2),
        var(--shadow-3d);
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(145deg, #FF9EC5, var(--pink-soft));
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    margin: 20px auto;
    box-shadow:
        0 8px 0 #E87BA8,
        var(--shadow-3d);
    transition: all 0.3s ease;
    width: 80%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 15%;
    right: 15%;
    height: 35%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    filter: blur(10px);
    z-index: 0;
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-primary:active {
    box-shadow:
        0 3px 0 #E87BA8,
        var(--shadow-3d);
    transform: translateY(5px);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    position: relative;
    z-index: 20;
}

.btn-icon {
    background: linear-gradient(145deg, #ffffff, #fff5f8);
    border: 2px solid var(--pink-light);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-3d);
    transition: all 0.3s ease;
}

.btn-icon:active {
    transform: scale(0.95);
}

.game-info {
    background: linear-gradient(145deg, #ffffff, #fff9fc);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-3d);
    font-weight: 600;
    color: var(--text-dark);
}

#game-score {
    background: linear-gradient(145deg, var(--yellow-soft), #FFF9D0);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-3d);
    font-weight: 700;
    color: #B8A04C;
}

.hangman-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    position: relative;
    z-index: 15;
}

#hangman-svg {
    filter: drop-shadow(0 6px 10px rgba(107, 91, 140, 0.15));
}

.hangman-part {
    display: none;
}

.hangman-part.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Word Display - Optimizado para móviles */
.word-display {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
    padding: 0 15px;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    z-index: 15;
    /* Prevenir scroll en móviles */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.word-display::-webkit-scrollbar {
    display: none;
}

.letter-slot {
    width: 35px;
    height: 45px;
    background: linear-gradient(145deg, #ffffff, #fff9fc);
    border: none;
    border-bottom: 4px solid var(--pink-soft);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--pink-soft);
    text-transform: uppercase;
    transition: all 0.3s;
    box-shadow:
        0 4px 8px rgba(255, 183, 213, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.letter-slot.reveal {
    animation: jump 0.4s ease;
    background: linear-gradient(145deg, var(--mint-light), var(--mint-soft));
    border-bottom-color: #92D1BC;
    color: #5A9B85;
}

@keyframes jump {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-15px) scale(1.2);
    }
}

/* Responsive para palabras largas en móviles */
@media (max-width: 480px) {
    .word-display {
        gap: 5px;
        padding: 0 10px;
    }

    .letter-slot {
        height: 40px;
        border-bottom-width: 3px;
    }
}

@media (max-width: 380px) {
    .letter-slot {
        height: 36px;
        border-bottom-width: 3px;
    }

    .word-display {
        gap: 4px;
        padding: 0 8px;
    }
}

.keyboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 0 10px 20px;
    position: relative;
    z-index: 15;
}

.key {
    width: 38px;
    height: 45px;
    background: linear-gradient(145deg, #ffffff, #fff9fc);
    border: 2px solid var(--pink-light);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 0 var(--pink-soft),
        var(--shadow-3d);
    position: relative;
}

.key::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 20%;
    right: 20%;
    height: 30%;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    filter: blur(4px);
}

.key:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 var(--pink-soft),
        var(--shadow-3d-hover);
}

.key:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 var(--pink-soft),
        var(--shadow-3d);
}

.key.correct {
    background: linear-gradient(145deg, var(--mint-light), var(--mint-soft));
    border-color: #92D1BC;
    box-shadow:
        0 4px 0 #7BC4A8,
        var(--shadow-3d);
    color: #5A9B85;
    pointer-events: none;
}

.key.wrong {
    background: linear-gradient(145deg, #FFD4D8, #FFC0C7);
    border-color: #FFB0B8;
    box-shadow:
        0 4px 0 #FF9AA5,
        var(--shadow-3d);
    color: #C75B6A;
    opacity: 0.7;
    pointer-events: none;
}

/* Result Screen Overlay */
.overlay {
    background: linear-gradient(135deg, rgba(255, 209, 227, 0.95), rgba(178, 226, 210, 0.95));
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.result-card {
    background: linear-gradient(145deg, #ffffff, #fff9fc);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: var(--shadow-3d-hover);
    width: 85%;
    max-width: 350px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10%;
    right: 10%;
    height: 30%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    filter: blur(20px);
    z-index: -1;
}

@keyframes popIn {
    0% {
        transform: scale(0.5) rotate(-5deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

#result-title {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--pink-soft), var(--purple-soft));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.result-emoji {
    font-size: 4rem;
    margin: 20px 0;
    filter: drop-shadow(0 4px 8px rgba(107, 91, 140, 0.2));
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.btn-secondary {
    background: linear-gradient(145deg, var(--blue-soft), #B5D8EC);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow:
        0 5px 0 #9AC8E0,
        var(--shadow-3d);
    transition: all 0.3s ease;
    position: relative;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 15%;
    right: 15%;
    height: 35%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    filter: blur(8px);
}

.btn-secondary:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #9AC8E0,
        var(--shadow-3d);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(107, 91, 140, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: linear-gradient(145deg, #ffffff, #fff9fc);
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    width: 80%;
    max-width: 400px;
    box-shadow: var(--shadow-3d-hover);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn-danger {
    background: linear-gradient(145deg, #FF8B8B, #FF6B6B);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow:
        0 5px 0 #E85555,
        var(--shadow-3d);
    transition: all 0.3s ease;
}

.btn-danger:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #E85555,
        var(--shadow-3d);
}

/* Confetti effect */
.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    top: -10px;
    z-index: 150;
    animation: confetti-fall 3s linear forwards;
    box-shadow: var(--shadow-3d);
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Ensure game elements are above decorations */
.hangman-container,
.word-display,
.keyboard {
    position: relative;
    z-index: 15;
}

/* Estrellas decorativas */
@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}











/* Ensure game elements are above decorations */
.hangman-container,
.word-display,
.keyboard {
    position: relative;
    z-index: 10;
}
