:root {
    --bg-color: #121213;
    --text-color: #ffffff;
    --tile-bg: transparent;
    --tile-border: #3a3a3c;
    --correct-bg: #538d4e;
    --present-bg: #b59f3b;
    --absent-bg: #3a3a3c;
    --key-bg: #818384;
    --header-height: 50px;
    --modal-bg: #121213;
}

/* Light Theme */
body.light-theme {
    --bg-color: #ffffff;
    --text-color: #1a1a1b;
    --tile-border: #d3d6da;
    --absent-bg: #787c7e;
    --key-bg: #d3d6da;
    --modal-bg: #ffffff;
}

body.light-theme .key {
    color: #1a1a1b;
}

body.light-theme #modal-content {
    background-color: var(--modal-bg);
    color: var(--text-color);
}

/* High Contrast Mode */
body.high-contrast {
    --correct-bg: #f5793a;
    --present-bg: #85c0f9;
}

body.high-contrast .key.correct {
    background-color: #f5793a;
}

body.high-contrast .key.present {
    background-color: #85c0f9;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

#container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    height: var(--header-height);
    border-bottom: 1px solid #3a3a3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    margin-left: 8px;
}

#game-board {
    flex-grow: 1;
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-gap: 5px;
    padding: 10px;
    margin-top: 20px;
    width: 350px;
    height: 420px;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 5px;
}

.tile {
    width: 100%;
    height: 100%;
    border: 2px solid var(--tile-border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.1s linear, background-color 0.5s ease;
}

.tile.filled {
    border-color: #565758;
    animation: pop 0.1s linear;
}

.tile.correct {
    background-color: var(--correct-bg);
    border-color: var(--correct-bg);
}

.tile.present {
    background-color: var(--present-bg);
    border-color: var(--present-bg);
}

.tile.absent {
    background-color: var(--absent-bg);
    border-color: var(--absent-bg);
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% {
        transform: translateX(1px);
    }

    10% {
        transform: translateX(-2px);
    }

    20% {
        transform: translateX(2px);
    }

    30% {
        transform: translateX(0);
    }

    40% {
        transform: translateX(2px);
    }

    50% {
        transform: translateX(-2px);
    }

    60% {
        transform: translateX(2px);
    }

    70% {
        transform: translateX(-2px);
    }

    80% {
        transform: translateX(2px);
    }

    90% {
        transform: translateX(-2px);
    }

    100% {
        transform: translateX(0);
    }
}

#keyboard {
    width: 100%;
    padding: 10px;
    margin-top: 20px;
}

.key-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    touch-action: manipulation;
}

.key {
    background-color: var(--key-bg);
    color: white;
    border: none;
    border-radius: 4px;
    margin: 0 3px;
    padding: 20px 12px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
    max-width: 43px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.key.wide {
    max-width: 65px;
    font-size: 12px;
}

.key.correct {
    background-color: var(--correct-bg);
}

.key.present {
    background-color: var(--present-bg);
}

.key.absent {
    background-color: var(--absent-bg);
}

/* FAQ Section Styling */
#faq-section {
    width: 100%;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin: 40px 0;
    line-height: 1.6;
}

hr {
    border: none;
    border-top: 1px solid #3a3a3c;
    margin-bottom: 20px;
}

#faq-section h2 {
    margin-bottom: 20px;
    text-align: center;
}

.faq-container details {
    margin-bottom: 12px;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 10px;
}

.faq-container summary {
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

.faq-container p {
    margin-top: 10px;
    color: #b1b1b1;
}

.color-explanation .tile {
    display: inline-flex;
    width: 30px;
    height: 30px;
    font-size: 16px;
    margin-right: 8px;
    border-radius: 4px;
}

#how-to-play-extra {
    margin-top: 30px;
}

#how-to-play-extra h3 {
    margin-bottom: 10px;
}

#how-to-play-extra ul {
    list-style: disc;
    padding-left: 20px;
    color: #b1b1b1;
}

footer {
    padding: 20px;
    font-size: 12px;
    color: #565758;
    text-align: center;
}

/* Modal and Styles */
.hidden {
    display: none !important;
}

#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#modal-content {
    background-color: var(--bg-color);
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 40px;
    position: relative;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 23px 0 rgba(0, 0, 0, 0.2);
}

#close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 24px;
}

/* Message Toast */
.message-toast {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    color: #000;
    padding: 15px 20px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Statistics Styles */
.stats-row {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px;
}

.stat-number {
    font-size: 30px;
    font-weight: bold;
}

.stat-label {
    font-size: 12px;
    text-align: center;
}

h2,
h3 {
    text-align: center;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.dist-chart {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3a3c;
    margin-bottom: 20px;
}

.dist-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}

.dist-num {
    width: 20px;
    font-size: 14px;
}

.dist-bar {
    background-color: #3a3a3c;
    color: #fff;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: bold;
    min-width: 20px;
    text-align: right;
}

.dist-bar.highlight {
    background-color: var(--correct-bg);
}

.action-btn {
    background-color: var(--correct-bg);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
}

/* Settings Modal Styles */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #3a3a3c;
}

body.light-theme .setting-item {
    border-bottom-color: #d3d6da;
}

.setting-info {
    display: flex;
    flex-direction: column;
}

.setting-title {
    font-size: 18px;
    font-weight: 500;
}

.setting-desc {
    font-size: 13px;
    color: #a6a6a6;
    margin-top: 4px;
}

body.light-theme .setting-desc {
    color: #787c7e;
}

.copyright {
    color: #a6a6a6;
    font-size: 12px;
    margin-top: 20px;
    text-align: left;
}

body.light-theme .copyright {
    color: #787c7e;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #878a8c;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--correct-bg);
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* Bot Analysis Styles */
.analysis-header {
    text-align: center;
    margin-bottom: 20px;
}


.hard-mode-badge {
    color: #f5793a;
    font-size: 12px;
    font-weight: 700;
    margin-top: -15px;
    /* Pull it up closer to the title/subtitle */
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analysis-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.analysis-info {
    flex: 1;
    padding-right: 20px;
    text-align: left;
}

.analysis-info h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #ffffff;
}

body.light-theme .analysis-info h3 {
    color: #1a1a1b;
}

.analysis-info p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #a6a6a6;
    line-height: 1.4;
}

body.light-theme .analysis-info p {
    color: #787c7e;
}

.analysis-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    flex-shrink: 0;
}

.score-circle {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.score-big {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    color: #538d4e;
}

body.light-theme .score-big {
    color: #6aaa64;
}

body.high-contrast .score-big {
    color: #f5793a;
}

.score-label {
    font-size: 10px;
    color: #a6a6a6;
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
}

body.light-theme .score-label {
    color: #787c7e;
}

.analysis-divider {
    border: none;
    border-top: 1px solid #3a3a3c;
    margin: 10px 0;
}

body.light-theme .analysis-divider {
    border-top-color: #d3d6da;
}


/* Mini Stats Grid Display */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num-mini {
    font-size: 20px;
    font-weight: 700;
}

.stat-lbl-mini {
    font-size: 10px;
    text-transform: uppercase;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    #game-board {
        width: 300px;
        height: 360px;
    }

    .tile {
        font-size: 24px;
    }
}