/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
}

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

/* Screen management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Typography */
h1 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 20px;
}

.subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #a0a0a0;
    margin-bottom: 40px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Start Screen - Puzzle Selection */
.puzzle-select {
    max-width: 600px;
    margin: 0 auto;
}

.puzzle-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.puzzle-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.puzzle-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.puzzle-card.in-progress {
    border-color: rgba(254, 202, 87, 0.5);
    background: rgba(254, 202, 87, 0.1);
}

.puzzle-card.in-progress .difficulty {
    color: #feca57;
}

.puzzle-card.completed {
    border-color: rgba(38, 222, 129, 0.5);
    background: rgba(38, 222, 129, 0.1);
}

.puzzle-card.completed .difficulty {
    color: #26de81;
}

.puzzle-card h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.puzzle-card .difficulty {
    font-size: 0.9rem;
    color: #a0a0a0;
    margin-bottom: 8px;
}

.puzzle-card .preview {
    font-size: 2rem;
    text-align: center;
    margin: 15px 0;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-header h2 {
    margin: 0;
}

.progress {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 30px;
    align-items: start;
}

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

/* Word Grid */
.grid-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.word-grid {
    display: grid;
    gap: 2px;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
}

.grid-cell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.2);
}

.grid-cell.selecting {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.grid-cell.colored {
    color: #000;
    font-weight: 700;
}

/* Color classes for cells */
.grid-cell.color-red { background: #ff6b6b; }
.grid-cell.color-orange { background: #ffa502; }
.grid-cell.color-yellow { background: #feca57; }
.grid-cell.color-green { background: #26de81; }
.grid-cell.color-blue { background: #48dbfb; }
.grid-cell.color-purple { background: #a55eea; }
.grid-cell.color-pink { background: #ff9ff3; }
.grid-cell.color-brown { background: #cd6133; }
.grid-cell.color-black { background: #2d3436; color: #fff; }
.grid-cell.color-white { background: #f5f6fa; }
.grid-cell.color-gray { background: #636e72; }
.grid-cell.color-cyan { background: #00cec9; }
.grid-cell.color-lime { background: #00b894; }
.grid-cell.color-gold { background: #fdcb6e; }
.grid-cell.color-navy { background: #0a3d62; color: #fff; }
.grid-cell.color-teal { background: #38ada9; }
.grid-cell.color-coral { background: #ff7675; }
.grid-cell.color-skyblue { background: #74b9ff; }
.grid-cell.color-tan { background: #e8bc95; }
.grid-cell.color-darkgreen { background: #27ae60; }

.hint {
    text-align: center;
    color: #a0a0a0;
    font-size: 0.9rem;
    margin-top: 15px;
}

/* Word List */
.word-list-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.word-list-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.word-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.word-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.word-item.found {
    opacity: 0.6;
}

.word-item.found .word-text {
    text-decoration: line-through;
}

.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.word-text {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.checkmark {
    margin-left: auto;
    color: #26de81;
    font-weight: bold;
}

/* Victory Screen */
#victory-screen h1 {
    margin-top: 20px;
}

#victory-message {
    text-align: center;
    font-size: 1.2rem;
    color: #a0a0a0;
    margin-bottom: 30px;
}

.completed-grid-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.victory-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Selection line overlay */
.selection-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
}

/* Animations */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.grid-cell.just-colored {
    animation: pop 0.3s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.celebrating {
    animation: celebrate 0.5s ease infinite;
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .grid-cell {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .container {
        padding: 10px;
    }
}
