/* Stile generale */
body {
    font-family: 'Lora', serif;
    background-color: #f4e9d8;
    background-image: url('texture-carta.jpg');
    background-size: cover;
    margin: 0;
    padding: 0;
    color: #3e2c1a;
    touch-action: manipulation;
    padding-top: 60px;
    overflow-x: hidden;
}

.container {
    width: 95%;
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    border: 2px solid #6b4f3a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    text-align: center;
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: #3e2c1a;
    text-align: center;
    margin-bottom: 15px;
}

/* Menu styles */
.menu-container {
    background-color: #6b4f3a;
    padding: 10px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.menu-toggle {
    position: absolute;
    top: 10px;
    left: 15px;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 1001;
    transition: transform 0.3s;
    display: block !important;
}

.menu-toggle.active {
    transform: rotate(90deg);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #6b4f3a;
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100vh;
    padding-top: 60px;
    transition: left 0.3s;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    z-index: 1002;
}

.nav-menu.active {
    left: 0;
}

.nav-menu li {
    padding: 0;
    margin: 0;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    padding: 15px 20px;
    display: block;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: #8b7355;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.menu-overlay.active {
    display: block;
}

/* Game styles */
.game-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    gap: 10px;
}

.current-word {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background-color: rgba(139, 115, 85, 0.1);
    border-radius: 8px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
}

.puzzle-container {
    width: 100%;
    margin-bottom: 15px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.puzzle-grid {
    display: grid;
    grid-gap: 0;
    border: 2px solid #6b4f3a;
    background-color: white;
    justify-content: center;
}

.grid-cell {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    box-sizing: border-box;
}

.grid-cell.selected {
    background-color: rgba(139, 115, 85, 0.3);
}

.grid-cell.found {
    background-color: rgba(76, 175, 80, 0.3);
}

.grid-cell.hint {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { background-color: rgba(255, 255, 0, 0.3); }
    50% { background-color: rgba(255, 255, 0, 0.7); }
    100% { background-color: rgba(255, 255, 0, 0.3); }
}

.found-words {
    margin: 20px 0;
    text-align: left;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 8px;
}

.found-words h3 {
    margin-top: 0;
    color: #3e2c1a;
    font-family: 'Cinzel', serif;
}

.found-words ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    columns: 2;
}

.found-words li {
    padding: 3px 0;
    font-size: 0.9rem;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.btn {
    padding: 10px 20px;
    background-color: #8b7355;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    transition: background-color 0.3s ease;
    font-size: 1rem;
    min-width: 120px;
}

.btn:hover {
    background-color: #6b4f3a;
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 1.2rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    text-align: center;
    max-width: 80%;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .puzzle-grid {
        grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
    }
    
    .grid-cell {
        width: 8vw;
        height: 8vw;
        min-width: 30px;
        min-height: 30px;
        font-size: 4vw;
    }
    
    .found-words ul {
        columns: 1;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .grid-cell {
        min-width: 25px;
        min-height: 25px;
        font-size: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .current-word {
        font-size: 1.2rem;
    }
}

@media screen and (orientation: landscape) and (max-width: 768px) {
    .grid-cell {
        width: 6vh;
        height: 6vh;
        font-size: 3vh;
    }
}