/* Word Game specific styles */
:root {
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --card-bg: #ffffff;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #e5e7eb;
    --input-bg: #ffffff;
    --hover-bg: #f3f4f6;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body.dark-mode {
    --text-color: #f9fafb;
    --text-secondary: #9ca3af;
    --card-bg: #374151;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --border-color: #4b5563;
    --input-bg: #4b5563;
    --hover-bg: #4b5563;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

body.dark-mode .letter-tiles {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.tool-content {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 3rem;
}

.ascii-title {
    margin-bottom: 1.5rem;
}

.ascii-title pre {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--accent-color);
    margin: 0;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

.smith-art {
    margin-top: 1rem;
}

.smith-art pre {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    line-height: 1.1;
    color: #8b5cf6;
    margin: 0;
    font-weight: normal;
    text-shadow: 0 0 6px rgba(139, 92, 246, 0.3);
}

.tool-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

.tool-subtitle i {
    color: var(--accent-color);
    margin: 0 0.5rem;
}

body.dark-mode .ascii-title pre {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

body.dark-mode .smith-art pre {
    color: #a78bfa;
    text-shadow: 0 0 6px rgba(167, 139, 250, 0.4);
}

.back-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent-hover);
}

.word-game-container {
    max-width: 100%;
}



.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-label i {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

.game-board {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.letters-container {
    margin-bottom: 2rem;
}

.letters-container h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.letters-container h3 i {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.letter-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    width: 240px;
    height: 240px;
    margin-left: auto;
    margin-right: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.letter-tile {
    width: 100%;
    height: 100%;
    background: var(--accent-color);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.letter-tile-blank {
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: default;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.3;
}

body.dark-mode .letter-tile-blank {
    background: var(--input-bg);
    border-color: var(--border-color);
}

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

.letter-tile:active {
    transform: translateY(0) scale(0.95);
}

.letter-tile.used {
    opacity: 0.3;
    transform: scale(0.9);
}

.letter-tile.typing {
    background: #f59e0b;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    cursor: default;
}

.letter-tile.typing:hover {
    transform: translateY(-2px) scale(1.05);
}

.letter-tile.invalid {
    background: #ef4444;
    animation: shake 0.3s ease-in-out;
    cursor: default;
}

.letter-tile.invalid:hover {
    transform: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.letter-tile .point-value {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.7rem;
    opacity: 0.8;
}

.word-input-section {
    text-align: center;
}

.input-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

#word-input {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    min-width: 200px;
    text-transform: uppercase;
}

#word-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.btn-backspace {
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ef4444;
    color: white;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-backspace:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-backspace:active {
    transform: translateY(0) scale(0.95);
}

.btn-backspace:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-backspace:disabled:hover {
    background: #9ca3af;
    transform: none;
}

.btn-end-game {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f59e0b;
    color: white;
    font-weight: 500;
}

.btn-end-game:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-end-game:active {
    transform: translateY(0) scale(0.95);
}

.btn-end-game:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-end-game:disabled:hover {
    background: #9ca3af;
    transform: none;
}

.words-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.found-words, .game-info {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.found-words h3, .game-info h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.found-words h3 i, .game-info h3 i {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 100px;
}

.word-item {
    background: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.word-score {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.word-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

.word-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

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

.game-info li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.game-info li i {
    color: var(--accent-color);
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.game-info li:last-child {
    border-bottom: none;
}

.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.ascii-game-over {
    text-align: center;
    margin-bottom: 1.5rem;
}

.ascii-game-over pre {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    line-height: 1;
    color: var(--accent-color);
    margin: 0;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

.final-stats {
    margin: 1.5rem 0;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0;
    font-size: 1.1rem;
}

.stat-label {
    color: var(--text-color);
    font-weight: 500;
}

.stat-value {
    color: var(--accent-color);
    font-weight: bold;
    text-align: right;
}

body.dark-mode .final-stats {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

body.dark-mode .ascii-game-over pre {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.missed-words-section {
    margin: 1.5rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.missed-words-section h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.missed-words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.missed-word-item {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.missed-word-score {
    background: rgba(244, 67, 54, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: bold;
}

.missed-word-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

.missed-word-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

.message.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.message.error {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.message.info {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .word-game-container {
        padding: 1rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-label {
        display: inline;
        margin-bottom: 0;
    }
    
    .words-section {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        flex-direction: column;
        align-items: center;
    }
    
    #word-input {
        width: 100%;
        max-width: 300px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 200px;
    }
    
    .btn-backspace {
        min-width: 45px;
        padding: 0.6rem;
    }
    
    .btn-end-game {
        width: 100%;
        max-width: 200px;
    }
    
    .letter-tiles {
        width: 200px;
        height: 200px;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .letter-tile {
        font-size: 1.4rem;
        border-radius: 8px;
    }
}

/* Tablet styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .letter-tiles {
        width: 220px;
        height: 220px;
    }
}

/* Large mobile styles */
@media (max-width: 600px) {
    .letter-tiles {
        width: 180px;
        height: 180px;
        gap: 0.4rem;
    }
    
    .letter-tile {
        font-size: 1.3rem;
    }
    
    .ascii-game-over pre {
        font-size: 0.5rem;
    }
    
    .ascii-title pre {
        font-size: 0.5rem;
    }
    
    .smith-art pre {
        font-size: 0.5rem;
        line-height: 1;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 2rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .letter-tiles {
        width: 160px;
        height: 160px;
        gap: 0.3rem;
        padding: 0.6rem;
    }
    
    .letter-tile {
        font-size: 1.2rem;
    }
    
    .ascii-game-over pre {
        font-size: 0.4rem;
    }
    
    .ascii-title pre {
        font-size: 0.35rem;
    }
    
    .smith-art pre {
        font-size: 0.4rem;
        line-height: 1;
    }
    
    .stat-row {
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .stat-value {
        text-align: left;
    }
}