* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #4facfe;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    gap: 20px;
}

.stat-box {
    background: #f8f9fa;
    padding: 15px 25px;
    border-radius: 10px;
    text-align: center;
    flex: 1;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #4facfe;
}

.scramble-box {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.instruction {
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.letters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.letter-tile {
    width: 60px;
    height: 60px;
    background: white;
    border: 3px solid #4facfe;
    border-radius: 10px;
    color: #4facfe;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-family: inherit;
}

.letter-tile:hover {
    background: #4facfe;
    color: white;
    transform: translateY(-2px);
}

.letter-tile.used {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

#inputBox {
    width: 100%;
    padding: 15px;
    font-size: 1.4em;
    border: 3px solid #4facfe;
    border-radius: 10px;
    outline: none;
    margin-bottom: 20px;
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
}

#inputBox:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    font-family: inherit;
}

#clearBtn {
    background: #ffc107;
    color: white;
}

#shuffleBtn {
    background: #17a2b8;
    color: white;
}

#submitBtn {
    background: #28a745;
    color: white;
}

#restartBtn {
    background: #4facfe;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.found-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.found-label {
    color: #666;
    font-weight: bold;
    margin-bottom: 10px;
}

.found-words {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

.word-chip {
    background: #4facfe;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.message {
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
    min-height: 24px;
    font-size: 1.1em;
}

.message-success {
    color: #28a745;
}

.message-error {
    color: #dc3545;
}

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

.result-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

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

.result-content h2 {
    color: #4facfe;
    margin-bottom: 20px;
}

.result-stats {
    margin: 20px 0;
}

.result-stat {
    margin: 15px 0;
    font-size: 1.2em;
}

.result-stat span {
    font-weight: bold;
    color: #4facfe;
    font-size: 1.5em;
}

#closeResult {
    background: #28a745;
    color: white;
    margin-top: 20px;
    padding: 12px 30px;
}

@media (max-width: 600px) {
    body {
        padding: 8px;
        align-items: flex-start;
    }

    .container {
        min-width: 0;
        padding: 20px 12px;
    }

    .stats {
        gap: 8px;
    }

    .stat-box {
        min-width: 0;
        padding: 12px 4px;
    }

    .stat-label {
        font-size: 0.75em;
        overflow-wrap: anywhere;
    }

    .stat-value {
        font-size: 1.45em;
    }

    .scramble-box {
        padding: 18px 10px;
    }

    .letter-tile {
        width: 50px;
        height: 50px;
        font-size: 1.4em;
    }

    h1 {
        font-size: 2em;
    }

    button {
        min-height: 44px;
    }

    .result-content {
        width: calc(100% - 24px);
        padding: 24px 16px;
    }
}
