:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --accent-color: #f7e018;
    /* Banana Yellow */
    --gray-dark: #202020;
    --gray-mid: #3a3a3c;
    --gray-light: #818384;
    --correct-color: #2eb872;
    /* Vibrant Green */
    --present-color: #f7e018;
    /* Banana Yellow */
    --absent-color: #312a2c;
    /* Darker gray/brown */
    --key-bg: #4a3f41;
    /* Base key color */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1a1a1a, #0a0a0a);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    /* Fix layout, no scroll on body */
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Fixed viewport height */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
}

.header-left,
.header-right {
    flex: 1;
}

.header-center {
    flex: 2;
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stats-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gray-light);
    line-height: 1.2;
}

#attempts-display {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent-color);
}

.nano-text {
    font-weight: 900;
    color: var(--accent-color);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

#board-container {
    display: flex;
    justify-content: center;
}

#game-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    gap: 8px;
}

.tile,
.tile-input {
    width: 60px;
    height: 60px;
    border: 2px solid var(--gray-mid);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.1s ease;
    background-color: transparent;
    color: var(--text-color);
    text-align: center;
}

.tile-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(247, 224, 24, 0.3);
}

.tile.filled,
.tile-input:not(:placeholder-shown) {
    border-color: var(--gray-light);
}

.tile.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
}

.tile.present {
    background-color: var(--present-color);
    border-color: var(--present-color);
}

.tile.absent {
    background-color: var(--absent-color);
    border-color: var(--absent-color);
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Equal split side by side */
    gap: 40px;
    flex: 1;
    min-height: 0;
    margin-top: 20px;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

#left-column {
    justify-content: center;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

#right-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.history-section {
    flex: 1;
    /* History on top */
}

.keyboard-section {
    flex: 1.5;
    /* Keyboard on bottom with more space */
}

.section-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--gray-light);
    text-transform: uppercase;
}

#virtual-keyboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    align-items: center;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.keyboard-row:nth-child(2) {
    width: 90%;
    /* Slight indent for ASDF row */
}

.key {
    background-color: var(--key-bg);
    color: white;
    border: none;
    border-radius: 8px;
    height: 58px;
    min-width: 44px;
    padding: 0 12px;
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}

.key.correct {
    background-color: var(--correct-color) !important;
    color: white;
}

.key.present {
    background-color: var(--present-color) !important;
    color: black;
    /* Better contrast for yellow */
}

.key.absent {
    background-color: var(--absent-color) !important;
    opacity: 0.4;
}

.key:active {
    opacity: 0.7;
    transform: scale(0.95);
}

.key:disabled {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed;
    pointer-events: none;
}

.key.wide {
    min-width: 70px;
}

#key-ENTER {
    min-width: 140px;
    /* Wider ENTER as seen in image */
}

.key:hover {
    background-color: var(--gray-light);
}

#history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.history-word {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    letter-spacing: 2px;
}

.history-tiles {
    display: flex;
    gap: 4px;
}

.history-tile {
    width: 20px;
    height: 20px;
    border-radius: 2px;
}

/* Modals */
.hidden {
    display: none !important;
}

#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #121213;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
}

.glass {
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.btn-primary {
    background: var(--accent-color);
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 20px;
    cursor: pointer;
}

/* Animations */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.flip {
    animation: flip 0.6s ease;
}

@keyframes flip {
    0% {
        transform: rotateX(0);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0);
    }
}

@media (max-width: 768px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    .tile {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}