/* Game Styles - Shared across all word search games */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: #fafaf8;
    min-height: 100vh;
}

/* Media query for responsive design */
@media (max-width: 520px) {
    .game-container {
        width: 100% !important;
        padding: 10px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Order elements: word-list, selected-letters, grid-container */
    .word-list {
        order: 1 !important;
        margin-bottom: 5px !important;
    }
    
    .selected-letters-container {
        order: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .grid-container {
        order: 3 !important;
    }
    
    .header {
        max-width: 100% !important;
        padding: 10px 15px !important;
    }
    
    .header-left {
        font-size: 22px !important;
    }
    
    .timer {
        font-size: 20px !important;
        margin: 0 10px !important;
    }
    
    .grid-container, .word-list {
        padding: 10px !important;
    }
    
    .grid {
        grid-template-columns: repeat(10, 28px) !important;
        grid-template-rows: repeat(10, 28px) !important;
        gap: 0 !important;
    }
    
    .grid.grid-12 {
        grid-template-columns: repeat(12, 28px) !important;
        grid-template-rows: repeat(12, 28px) !important;
    }
    
    .grid.grid-14 {
        grid-template-columns: repeat(12, 28px) !important;
        grid-template-rows: repeat(12, 28px) !important;
    }
    
    .cell {
        font-size: 21px !important;
        font-weight: 700 !important;
    }
    
    .word-item {
        padding: 5px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
    }
    
    /* Thicker highlight line for mobile */
    .highlight {
        border-radius: 12px !important;
    }
    
    /* Smaller gap for word list on mobile */
    .word-list {
        gap: 8px !important;
    }
    
    .icon-button {
        width: 40px !important;
        height: 40px !important;
    }
    
    .icon-button svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .settings-content {
        width: 90% !important;
        max-width: 300px !important;
    }
    
    .settings-option label {
        font-size: 18px !important;
    }
    
    .checkbox {
        width: 28px !important;
        height: 28px !important;
    }
    
    .selected-letters-container {
        font-size: 20px !important;
        height: 30px !important;
        padding: 2px !important;
        margin: 2px auto !important;
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fafaf8;
    color: #333;
    padding: 10px 20px;
    font-weight: bold;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    box-sizing: border-box;
    border-bottom: none;
}

.header-left {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left::before {
    content: "";
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: #62d76b;
    border-radius: 4px;
}

.game-number {
    color: #888;
    font-weight: normal;
    font-size: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0;
}

.icon-button {
    background: none;
    border: none;
    color: #333;
    font-size: 22px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.game-mode {
    font-size: 18px;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    width: 390px;
    margin: 0 auto;
    box-sizing: border-box;
}

.game-container.wide {
    width: 530px;
    max-width: 530px;
}

.grid-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 9px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 35px);
    grid-template-rows: repeat(10, 35px);
    position: relative;
    user-select: none;
    gap: 0;
}

.grid.grid-12 {
    grid-template-columns: repeat(12, 35px);
    grid-template-rows: repeat(12, 35px);
}

.grid.grid-14 {
    grid-template-columns: repeat(14, 35px);
    grid-template-rows: repeat(14, 35px);
}

.cell {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 25px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.highlight {
    position: absolute;
    border-radius: 20px;
    opacity: 0.6;
    z-index: 1;
    pointer-events: none;
    transform-origin: left center;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.word-item {
    padding: 5px 5px;
    border-radius: 4px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    font-size: 18px;
}

.word-item.found {
    text-decoration: line-through;
    /* color property will be set dynamically in JavaScript with the highlight color */
}

.new-game-btn {
    background-color: #4c5fd7;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    font-size: 16px;
}

.timer {
    font-size: 24px;
    font-weight: bold;
    margin: 0 20px;
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

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

.settings-content {
    background-color: #f5f5f5;
    border-radius: 12px;
    width: 300px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-title {
    font-size: 20px;
    font-weight: bold;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
}

.settings-option {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.settings-option label {
    font-size: 16px;
    margin-left: 10px;
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: white;
}

.checkbox.checked {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.checkbox.checked::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.selected-letters-container {
    padding: 5px;
    margin: 0 auto 5px auto;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px auto;
    max-width: 500px;
    letter-spacing: 4px;
}

.intro-section {
    max-width: 700px;
    margin: 20px auto;
    padding: 0 20px;
    text-align: center;
}

.intro-section h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 700;
}

.intro-section .intro {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
}

/* Toast notification styling */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(76, 95, 215, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    text-align: center;
    max-width: 90%;
}

.toast-notification.show {
    opacity: 1;
}
