/* Reset e variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --bg-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
.game-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content h1 {
    font-size: 2rem;
    margin: 0;
}

.game-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-selector label {
    font-weight: 500;
}

.game-selector select {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

/* Container */
.game-container {
    min-height: 100vh;
}

.game-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 30px;
}

/* Info do jogo */
.game-info {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.game-info h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.game-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.badge-facil {
    background-color: #4CAF50;
    color: white;
}

.badge-medio {
    background-color: #ff9800;
    color: white;
}

.badge-dificil {
    background-color: #f44336;
    color: white;
}

.timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
}

/* Tabuleiro */
.game-board {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

#crossword-grid {
    display: grid;
    gap: 2px;
    background-color: #333;
    padding: 2px;
    border-radius: 4px;
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.grid-cell {
    position: relative;
    aspect-ratio: 1;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell.blocked {
    background-color: #333;
}

.grid-cell.active {
    background-color: white;
}

.grid-cell.highlighted {
    background-color: #e3f2fd;
}

.grid-cell.selected {
    background-color: #bbdefb;
}

.grid-cell.correct {
    background-color: #c8e6c9;
}

.grid-cell.incorrect {
    background-color: #ffcdd2;
}

.grid-cell.hint {
    animation: hintPulse 0.5s ease-in-out;
}

@keyframes hintPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); background-color: #fff9c4; }
}

.grid-cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    background: transparent;
    outline: none;
    cursor: pointer;
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #666;
    pointer-events: none;
}

/* Controles */
.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #e0e0e0;
    color: var(--text-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

/* Painel de dicas */
.clues-panel {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-height: 80vh;
    overflow-y: auto;
}

.clues-section {
    margin-bottom: 30px;
}

.clues-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

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

.clue-item {
    padding: 10px 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.clue-item:hover {
    background-color: #e3f2fd;
    border-left-color: #2196F3;
}

.clue-item.active {
    background-color: #bbdefb;
    border-left-color: #1976D2;
    font-weight: 600;
}

.clue-item strong {
    color: #667eea;
    margin-right: 8px;
}

/* Estado vazio */
.empty-state {
    max-width: 600px;
    margin: 100px auto;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.empty-state h2 {
    color: #667eea;
    margin-bottom: 15px;
}

/* Responsividade */
@media (max-width: 1200px) {
    .game-content {
        grid-template-columns: 1fr;
    }

    .game-info,
    .clues-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.5rem;
    }

    /* Melhorar experiência mobile do jogo */
    .game-content {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    #crossword-grid {
        max-width: 100%;
        /* Centralizar a grade */
        margin: 0 auto;
    }

    .grid-cell {
        /* Células maiores em mobile para facilitar toque */
        min-width: 35px;
        min-height: 35px;
    }

    .grid-cell input {
        font-size: 1.1rem;
        /* Prevenir zoom automático no iOS */
        font-size: 16px !important;
    }

    /* Painel de dicas fixo na parte inferior em mobile */
    .clues-panel {
        position: sticky;
        bottom: 0;
        max-height: 200px;
        overflow-y: auto;
        background: white;
        z-index: 100;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
        border-radius: 12px 12px 0 0;
        padding: 15px;
        /* Prevenir scroll indesejado */
        overscroll-behavior: contain;
    }

    .clue-item {
        padding: 12px;
        margin-bottom: 8px;
        /* Prevenir que a dica ativa cause scroll */
        scroll-margin-top: 10px;
    }

    .clue-item.active {
        /* Visual mais discreto em mobile */
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
        border-left-width: 3px;
    }

    .game-info {
        /* Informações do jogo mais compactas */
        position: sticky;
        top: 60px;
        background: white;
        z-index: 99;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .game-controls {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevenir zoom no iOS */
    }

    /* Prevenir scroll ao focar em inputs */
    .grid-cell input:focus {
        /* Não fazer scroll automático */
        scroll-margin: 0;
    }

    /* Ajustar seletor de jogos em mobile */
    .game-selector-section {
        position: sticky;
        top: 0;
        background: white;
        z-index: 101;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .game-select {
        font-size: 16px; /* Prevenir zoom no iOS */
        width: 100%;
    }
}

/* Scrollbar customizada */
.clues-panel::-webkit-scrollbar {
    width: 8px;
}

.clues-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.clues-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.clues-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Seção de compartilhamento */
.share-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.share-section h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.1rem;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-share {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-facebook {
    background: #1877f2;
}

.btn-twitter {
    background: #1da1f2;
}

.btn-whatsapp {
    background: #25d366;
}

.btn-link {
    background: #666;
}

.btn-share span:first-child {
    font-size: 1.2rem;
}

/* Notificação de cópia */
.copy-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.copy-notification.show {
    opacity: 1;
    transform: translateY(0);
}
