/* Word Blitz Cheat Styles */

/* General label styling */
label {
    font-size: 0.8em;
}

/* Grid container */
.blitz-grid {
    display: grid;
    gap: 8px;
    margin: 20px auto;
    max-width: 400px;
    padding: 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(238, 90, 36, 0.3);
}

.blitz-grid.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.blitz-grid.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.blitz-grid.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Grid cells */
.blitz-cell {
    aspect-ratio: 1;
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.blitz-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none !important;
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    border-radius: 15px;
    transition: all 0.3s ease;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.cell-input:focus {
    outline: none !important;
    background: #ffe5e5;
    box-shadow: inset 0 0 0 3px #ff6b6b;
    border: none !important;
}

/* Controls */
.blitz-controls {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-blitz {
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-blitz:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-solve {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    font-size: 18px;
    padding: 14px 40px;
}

.btn-solve:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e84118 100%);
    box-shadow: 0 8px 20px rgba(238, 90, 36, 0.4);
}

.btn-clear {
    background: #f39c12;
    color: white;
}

.btn-clear:hover {
    background: #e67e22;
}

.btn-random {
    background: #27ae60;
    color: white;
}

.btn-random:hover {
    background: #229954;
}

.btn-play {
    background: #3498db;
    color: white;
}

.btn-play:hover {
    background: #2980b9;
}

/* Loading spinner */
.loading-spinner {
    display: none;
    text-align: center;
    margin: 30px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6b6b;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.loading-spinner p {
    margin-top: 15px;
    color: #ff6b6b;
    font-weight: 600;
    font-size: 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Grid size selector */
.grid-size-selector {
    margin: 20px 0;
}

.grid-size-selector label {
    font-weight: 600;
    margin-right: 10px;
    color: #2c3e50;
}

.grid-size-selector select {
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid #ff6b6b;
    background: white;
    font-weight: 500;
}

/* Touch Game Mode Styles */
.blitz-cell.touch-mode {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: all 0.2s ease;
}

.blitz-cell.touch-mode:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.blitz-cell.selected {
    background: #ff6b6b !important;
    color: white !important;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(255, 107, 107, 0.4);
    border: 2px solid #ee5a24;
}

.blitz-cell.selected .cell-input {
    color: white !important;
}

.blitz-cell.selected.last-selected {
    background: #ee5a24 !important;
    border: 3px solid #c44569;
    box-shadow: 0 8px 16px rgba(238, 90, 36, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1.1);
    }
}

.blitz-cell.disabled-touch {
    opacity: 0.4;
    cursor: not-allowed;
}

.touch-instructions {
    background: #ffe5e5;
    padding: 12px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    font-size: 16px;
    border: 2px solid #ff6b6b;
}

.touch-instructions i {
    color: #ff6b6b;
    margin-right: 5px;
}

.current-word-display {
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    margin: 15px 0;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid #ff6b6b;
}

.current-word-display h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

#currentTouchWord {
    font-size: 28px;
    font-weight: bold;
    color: #ff6b6b;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Game Mode Styles */
#gameMode {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-stats {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.3);
}

.timer-display {
    font-size: 36px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.score-display {
    font-size: 24px;
    font-weight: 600;
}

.word-input-container {
    margin: 20px 0;
}

.word-input-container input {
    font-size: 20px;
    padding: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 3px solid #ff6b6b;
    border-radius: 15px;
}

.word-input-container input:focus {
    outline: none;
    border-color: #ee5a24;
    box-shadow: 0 0 0 3px rgba(238, 90, 36, 0.2);
}

.found-words-panel {
    background: white;
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #ff6b6b;
}

.found-words-panel h4 {
    margin: 0 0 10px 0;
    color: #ff6b6b;
}

.found-word {
    display: inline-block;
    background: #ffe5e5;
    padding: 5px 12px;
    margin: 3px;
    border-radius: 20px;
    font-weight: 500;
    color: #c44569;
    border: 1px solid #ff6b6b;
}

.word-points {
    color: #27ae60;
    font-weight: bold;
    margin-left: 5px;
}

.game-controls {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-submit {
    background: #27ae60;
    color: white;
}

.btn-submit:hover {
    background: #229954;
}

.btn-clear-word {
    background: #f39c12;
    color: white;
}

.btn-clear-word:hover {
    background: #e67e22;
}

.btn-end {
    background: #e74c3c;
    color: white;
}

.btn-end:hover {
    background: #c0392b;
}

/* Results styling */
.light-box h3 {
    color: #ff6b6b;
}

.words.btn {
    transition: all 0.3s ease;
}

.words.btn:hover {
    transform: translateY(-2px);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .blitz-grid {
        max-width: 95vw;
        padding: 12px;
        gap: 8px;
        margin: 15px auto;
    }

    .cell-input {
        font-size: 20px;
        font-weight: 700;
    }

    /* Bigger touch targets on mobile */
    .blitz-cell {
        min-height: 60px;
    }

    .blitz-controls {
        gap: 8px;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0 10px;
        justify-content: center;
    }

    .btn-blitz {
        flex: 0 0 calc(50% - 4px);
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 700;
        min-height: 50px;
    }

    .btn-solve {
        flex: 0 0 100%;
        padding: 16px 30px !important;
        font-size: 18px !important;
        order: -1; /* Put "Find Words" button first */
    }

    /* Grid size selector more prominent */
    .grid-size-selector {
        margin: 15px 0;
        padding: 15px;
        background: #fff3f3;
        border-radius: 12px;
        border: 2px solid #ff6b6b;
    }

    .grid-size-selector label {
        display: block;
        margin-bottom: 8px;
        font-size: 16px;
    }

    .grid-size-selector select {
        width: 100%;
        padding: 12px 15px;
        font-size: 16px;
    }

    /* Results stats boxes */
    .row.text-center [class*="col-"] {
        margin-bottom: 10px;
    }

    .row.text-center h4 {
        font-size: 28px;
        margin-bottom: 5px;
    }

    .timer-display {
        font-size: 32px;
    }

    .score-display {
        font-size: 22px;
    }

    /* Advanced options button */
    .btn.rounded-input-group {
        font-size: 16px !important;
        padding: 14px !important;
    }
}

@media (max-width: 576px) {
    .blitz-grid {
        gap: 6px;
        padding: 10px;
    }

    .cell-input {
        font-size: 18px;
    }

    .blitz-cell {
        min-height: 55px;
    }

    .btn-solve {
        padding: 15px 25px !important;
        font-size: 17px !important;
    }

    /* Word length groups on mobile */
    .light-box h3 {
        font-size: 18px !important;
    }

    .light-box h3 .pull-right {
        display: block;
        float: none !important;
        margin-top: 8px;
        font-size: 14px !important;
    }

    .words.btn {
        font-size: 14px !important;
        padding: 8px 12px !important;
        margin: 4px 2px !important;
    }

    #currentTouchWord {
        font-size: 24px;
    }

    .found-words-panel {
        max-height: 150px;
    }

    /* Make game mode stats stack better */
    .game-stats .col-xs-4 {
        margin-bottom: 15px;
    }
}

@media (max-width: 400px) {
    .blitz-grid {
        gap: 5px;
        padding: 8px;
    }

    .cell-input {
        font-size: 16px;
    }

    .blitz-cell {
        min-height: 50px;
    }
}

/* Mobile Quick Guide */
.mobile-quick-guide {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    border: 2px solid #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15);
}

.mobile-quick-guide strong {
    color: #ee5a24;
}

/* Hide quick guide on desktop */
@media (min-width: 769px) {
    .mobile-quick-guide {
        display: none;
    }
}

/* Feature boxes */
.spaced li {
    margin-bottom: 10px;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #ffe5e5;
}

.table th {
    background-color: #ff6b6b;
    color: white;
}

/* Collapsible Word Groups on Mobile */
@media (max-width: 768px) {
    .word-group-header {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 40px !important;
    }

    .word-group-header::after {
        content: "▼";
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        transition: transform 0.3s ease;
    }

    .word-group-header.collapsed::after {
        transform: translateY(-50%) rotate(-90deg);
    }

    .word-group-content {
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .word-group-content.collapsed {
        max-height: 0;
    }
}