/* Connections Game Styles */

.game-main {
    padding-top: 80px;
    min-height: 100vh;
}

.game-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.game-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    color: #888;
}

/* Mistakes indicator */
.mistakes-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #666;
}

.mistake-dots {
    display: flex;
    gap: 6px;
}

.mistake-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s ease;
}

.mistake-dots .dot.active {
    background: #5a5a5a;
}

/* Solved categories */
.solved-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.solved-category {
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    animation: slideDown 0.5s ease;
}

.solved-category.yellow {
    background: #f9df6d;
    color: #1a1a1a;
}

.solved-category.green {
    background: #a0c35a;
    color: #1a1a1a;
}

.solved-category.blue {
    background: #b0c4ef;
    color: #1a1a1a;
}

.solved-category.purple {
    background: #ba81c5;
    color: #1a1a1a;
}

.solved-category .category-name {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.solved-category .category-words {
    font-size: 0.9rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Game grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.word-tile {
    aspect-ratio: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #efefe6;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 8px 4px;
    word-break: break-word;
    text-align: center;
    line-height: 1.2;
}

.word-tile:hover {
    background: #e5e5dc;
    transform: scale(1.02);
}

.word-tile.selected {
    background: #5a5a5a;
    color: white;
}

.word-tile.shake {
    animation: shake 0.5s ease;
}

.word-tile.bounce {
    animation: bounce 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

@keyframes bounce {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Game controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.game-btn {
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #1a1a1a;
    background: white;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.game-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.submit-btn:not(:disabled) {
    background: #1a1a1a;
    color: white;
}

.submit-btn:not(:disabled):hover {
    background: #333;
}

/* Game messages */
.game-message {
    text-align: center;
    min-height: 24px;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

.game-message.error {
    color: #d32f2f;
}

.game-message.success {
    color: #388e3c;
}

.game-message.info {
    color: #1976d2;
}

/* Modal */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.modal-categories {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
}

.modal-category {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.modal-category.yellow { background: #f9df6d; }
.modal-category.green { background: #a0c35a; }
.modal-category.blue { background: #b0c4ef; }
.modal-category.purple { background: #ba81c5; }

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-actions .game-btn {
    justify-content: center;
    text-decoration: none;
}

.hint-link {
    background: transparent;
    color: #667eea;
    border-color: #667eea;
}

.hint-link:hover {
    background: #667eea;
    color: white;
}

/* How to Play section */
.how-to-play {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.how-to-play h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.instruction-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.instruction-number {
    width: 32px;
    height: 32px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 12px;
}

.instruction-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.instruction-card p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

/* Tips section */
.game-tips {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
}

.game-tips h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.game-tips ul {
    list-style: none;
    padding: 0;
}

.game-tips li {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.game-tips li strong {
    color: #667eea;
}

.game-tips a {
    color: #667eea;
    text-decoration: underline;
}

/* Difficulty explanation */
.difficulty-explanation {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px 40px;
}

.difficulty-explanation h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.difficulty-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.diff-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.diff-card .diff-label {
    font-weight: 700;
    min-width: 70px;
}

.diff-card .diff-desc {
    color: #333;
}

.diff-card.yellow { background: #f9df6d; }
.diff-card.green { background: #a0c35a; }
.diff-card.blue { background: #b0c4ef; }
.diff-card.purple { background: #ba81c5; }

/* Responsive */
@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }

    .game-header h1 {
        font-size: 1.5rem;
    }

    .word-tile {
        font-size: 0.7rem;
        padding: 6px 3px;
    }

    .game-controls {
        flex-wrap: wrap;
    }

    .game-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }

    .instructions-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .game-header h1 {
        color: #f0f0f0;
    }

    .word-tile {
        background: #3a3a3a;
        color: #f0f0f0;
    }

    .word-tile:hover {
        background: #4a4a4a;
    }

    .word-tile.selected {
        background: #667eea;
    }

    .game-btn {
        background: #2a2a2a;
        color: #f0f0f0;
        border-color: #f0f0f0;
    }

    .modal-content {
        background: #2a2a2a;
        color: #f0f0f0;
    }

    .instruction-card,
    .game-tips li {
        background: #2a2a2a;
    }

    .instruction-card p,
    .game-tips li {
        color: #ccc;
    }
}
