body, html {
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
    background-color: #15202b;
    color: #fff;
}

* {
    box-sizing: border-box;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    width: 100%;
    padding: 15px 15px 100px;
    background-color: #15202b;
    color: #fff;
    position: relative;
}

h1 {
    color: #fff;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

p {
    color: #e8eaed;
    font-size: 1.1em;
    margin-bottom: 25px;
    line-height: 1.5;
}

.attempts-counter {
    font-size: 1.1em;
    color: #e8eaed;
    margin-bottom: 15px;
}

.input-area {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
}

input {
    padding: 12px;
    font-size: 1em;
    border: 2px solid #68687B;
    border-radius: 10px;
    outline: none;
    background-color: #1e2732;
    color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

input:focus {
    border-color: #ff8c00;
    box-shadow: 0 0 8px rgba(255, 140, 0, 0.3);
}

button {
    padding: 12px 25px;
    font-size: 1.2em;
    background-color: #ff8c00;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #e07b00;
    transform: scale(1.05);
}

#result {
    margin-top: 20px;
    font-size: 1.2em;
    color: #fff;
    font-weight: 700;
    width: 100%;
    max-width: 500px;
}

.result-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    width: 100%;
    height: 38px;
    border-radius: 7px;
    font-size: 18px;
    font-weight: 700;
    background-color: #1e2732;
    margin-bottom: 5px;
}

.result-bar {
    width: 150px;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-right: 10px;
    overflow: hidden;
}

.result-bar div {
    height: 100%;
    transition: width 0.5s ease;
}

.result-bar.red div {
    background-color: #ff4d94;
}

.result-bar.yellow div {
    background-color: #ff8c00;
}

.result-bar.green div {
    background-color: #28a745;
}

.result-word {
    flex: 1;
    text-transform: uppercase;
}

.result-rank {
    width: 50px;
    text-align: right;
}

#history {
    margin-top: 20px;
    color: #fff;
    font-size: 1em;
    width: 100%;
    max-width: 500px;
}

.history-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    width: 100%;
    height: 38px;
    border-radius: 7px;
    font-size: 18px;
    font-weight: 700;
    background-color: #1e2732;
    margin-bottom: 5px;
}

.history-item.latest {
    background-color: #2a3542;
}

.history-item .proximity-bar {
    width: 150px;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-right: 10px;
    overflow: hidden;
}

.history-item .proximity-bar div {
    height: 100%;
    transition: width 0.5s ease;
}

.history-item .proximity-bar.red div {
    background-color: #ff4d94;
}

.history-item .proximity-bar.yellow div {
    background-color: #ff8c00;
}

.history-item .proximity-bar.green div {
    background-color: #28a745;
}

.history-word {
    flex: 1;
}

.history-rank {
    width: 50px;
    text-align: right;
}

#stats {
    margin-top: 20px;
    color: #fff;
    font-size: 1em;
    width: 100%;
    max-width: 500px;
}

#stats h2 {
    color: #fff;
    font-size: 1.5em;
    margin-bottom: 10px;
    text-align: center;
}

#stats p {
    margin-bottom: 10px;
}

#stats-list div {
    background-color: #1e2732;
    padding: 5px 10px;
    border-radius: 7px;
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: 700;
}

.rules-toggle {
    margin: 20px 0;
}

.rules-toggle button {
    padding: 10px 20px;
    font-size: 1em;
    background-color: #ff8c00;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.rules-toggle button:hover {
    background-color: #e07b00;
    transform: scale(1.05);
}

.rules {
    background-color: #1e2732;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    color: #fff;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    width: 100%;
    max-width: 500px;
}

.rules.show {
    display: block;
    opacity: 1;
}

.rules h2 {
    color: #fff;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

.rules p {
    margin: 10px 0;
}

.rules ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 10px 0;
}

.rules ul li {
    margin-bottom: 8px;
    color: #e8eaed;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 2em;
    }

    .rules {
        padding: 15px;
    }

    .rules h2 {
        font-size: 1.3em;
    }

    input, button {
        font-size: 0.9em;
    }

    .result-bar, .history-item .proximity-bar {
        width: 100px;
    }

    .result-rank, .history-rank {
        width: 40px;
    }

    .result-item, .history-item {
        font-size: 16px;
        height: 34px;
    }
}