/* General Styles */
body {
    background: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
}

header img {
    width: auto;
    height: 60px;
    margin-bottom: 10px;
}

header h1 {
    margin: 0;
    color: #ffffff;
    font-size: 2em;
}

header button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #444;
    color: #e0e0e0;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
}

header button:hover {
    background: #555;
}

/* Modern Controls Styling */
#controls {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

#controls select {
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 1em;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 6em;
    cursor: pointer;
}

#controls select::-ms-expand {
    display: none; /* Hide default arrow in IE */
}

#controls::after {
    content: '▼';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #ffffff;
    font-size: 0.8em;
}

#controls button {
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 10px;
}

#controls button:hover {
    background: #2a2a2a;
}

#controls button:active {
    transform: translateY(1px);
}

/* Game Container */
#game {
    background: #1e1e1e;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    display: inline-block; /* Allows container to shrink or grow with content */
    width: auto; /* Width is now determined by its internal content */
    max-width: 90vw; /* Still responsive on smaller screens */
    height: auto; /* Height adjusts to content */
    margin-bottom: 20px;
}

/* Board Styling */
#board {
    margin-bottom: 20px;
}

/* Guess Row */
.guess-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

/* Guess Slot (Tile) */
.guess-slot {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 10px;
    border-radius: 8px; /* Slightly rounded square for a word-crack feel */
    background: #121212;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 1.2em;
    color: #e0e0e0;
}

/* Input and Button Container */
#input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

#input-container input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #2a2a2a;
    color: #e0e0e0;
    font-size: 16px;
    box-sizing: border-box;
}

#input-container input::placeholder {
    color: #888;
}

#input-container button {
    padding: 10px 20px;
    background: #444;
    color: #e0e0e0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#input-container button:hover {
    background: #555;
    transform: translateY(-2px);
}

#input-container button:active {
    transform: translateY(0);
}

#input-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#input-container button:disabled:hover {
    transform: none;
    background: #444;
}

/* Pop-up Overlay Styles */
#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#popup {
    background: #1e1e1e;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    text-align: center;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#popup p {
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #e0e0e0;
}

#popup button {
    padding: 10px 20px;
    background: #444;
    color: #e0e0e0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#popup button:hover {
    background: #555;
    transform: translateY(-2px);
}

#popup button:active {
    transform: translateY(0);
}

/* Leaderboard Table Styles */
#leaderboard {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    color: #e0e0e0;
}

#leaderboard th,
#leaderboard td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    text-align: center;
}

#leaderboard th {
    background: #2a2a2a;
    color: #ffffff;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    #game {
        width: 100%;
        max-width: 350px;
        padding: 10px;
    }
    
    header {
        margin-bottom: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .guess-slot {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    #input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    #input-container input {
        width: 100%;
    }
}