:root {
    --primary: #6c5ce7;
    --secondary: #a29bfe;
    --accent: #fd79a8;
    --light: #f8f9fa;
    --dark: #343a40;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    color: var(--dark);
    touch-action: manipulation;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeIn 1s ease;
    width: 100%;
    padding: 0 1rem;
}

h1 {
    font-size: clamp(2rem, 8vw, 3rem);
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    word-break: break-word;
    font-weight: 700;
}


#wd{
    display: none;
}

.subtitle {
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    color: var(--dark);
    opacity: 0.8;
    font-weight: 600;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease;
    margin-bottom: 1rem;
    border: 2px solid rgba(108, 92, 231, 0.1);
    justify-items: center;
}

.level-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: clamp(0.9rem, 4vw, 1rem);
    color: var(--primary);
    font-weight: 600;
    background: rgba(108, 92, 231, 0.05);
    padding: 0.8rem;
    border-radius: 10px;
}

.progress-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: progressStripes 1s linear infinite;
}

.puzzle-container {
    margin-bottom: 1.5rem;
    text-align: center;
}

.hint {
    font-size: clamp(0.9rem, 4vw, 1rem);
    color: var(--dark);
    opacity: 0.7;
    margin-bottom: 1.5rem;
    font-style: italic;
    min-height: 1.5em;
    background: rgba(253, 121, 168, 0.05);
    padding: 0.8rem;
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.word-display {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
    font-weight: bold;
    letter-spacing: 0.2rem;
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    line-height: 1.4;
    padding: 1rem;
    background: rgba(108, 92, 231, 0.05);
    border-radius: 15px;
}

.missing-letter {
    color: var(--accent);
    display: inline-block;
    min-width: 1.5em;
    border-bottom: 3px solid var(--accent);
    margin: 0 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.missing-letter.selected {
    transform: translateY(-5px);
    border-bottom-color: var(--primary);
    animation: bounce 0.5s infinite alternate;
}

.missing-letter.correct {
    color: var(--success);
    border-bottom-color: var(--success);
}

.missing-letter.incorrect {
    color: var(--danger);
    border-bottom-color: var(--danger);
}

.letter-bank {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.letter-tile {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

.letter-tile.used {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.9);
    box-shadow: none;
}

.letter-tile.available {
    animation: pulse 1s infinite;
}

.letter-tile.correct {
    background: var(--success);
    box-shadow: 0 4px 8px rgba(0, 184, 148, 0.3);
}

.letter-tile.incorrect {
    background: var(--danger);
    box-shadow: 0 4px 8px rgba(214, 48, 49, 0.3);
}

.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 100;
    max-width: 90%;
    display: none;
    animation: fadeIn 0.3s ease;
    border: 2px solid rgba(108, 92, 231, 0.1);
    justify-items: center;
}

.message h2 {
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.8rem;
}

.message p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 99;
    display: none;
}

.btn-primary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: clamp(0.9rem, 4vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
    min-width: 120px;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-retry {
    background: var(--danger);
    margin-top: 1rem;
}

.btn-next {
    background: var(--success);
}

.stars-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.star {
    font-size: 2rem;
    color: #FFD700;
    margin: 0 0.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.level-badge {
    background: var(--primary);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.3rem;
    display: inline-block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

@keyframes progressStripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

.shake {
    animation: shake 0.5s;
}

.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    background-color: var(--accent);
    opacity: 0;
    z-index: 101;
    animation: confettiFall 5s ease-in-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}


/* Menu Screen Styles */
.menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.menu-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.menu-subtitle {
    font-size: 1.2rem;
    color: var(--dark);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.btn-start {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    margin-bottom: 1.5rem;
}

.menu-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-sound {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.05);
}

.btn-menu {
    background: var(--primary);
    margin-top: 1rem;
}

.game-screen {
    width: 100%;
    justify-items: center;
}

@media (max-width: 500px) {
    .letter-tile {
        width: 3rem;
        height: 3rem;
        font-size: 1.3rem;
    }
    
    .word-display {
        font-size: clamp(1.3rem, 6vw, 2rem);
    }
}