/* Basic Reset & Body Styling */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.container {
    max-width: 650px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styling */
.main-header {
    background-color: #333;
    color: #fff;
    padding: 10px 0;
    width: 100%; /* Ensure background extends full width */
    height: 100px; /* Fixed height for consistency */
}

.main-header .container {
    max-width: 650px; /* Set total length of top menu to 650px */
    margin: 0 auto;
}

/* Adjust main-nav to take full width if needed for centering its content */
.main-nav {
    flex-grow: 0; /* Do not allow nav to take available space */
    text-align: center; /* Fallback for older browsers or non-flex items */
}

/* Navigation Styling */
.main-nav .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px; /* Space between menu items */
    justify-content: center; /* Center the navigation items */
    align-items: center; /* Vertically center items in the flex container */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.main-nav .nav-item a {
    color: #fff;
    text-decoration: none;
    padding: 8px 15px; /* Button-like padding */
    display: block;
    background-color: #555; /* Button background */
    border-radius: 5px; /* Rounded corners for buttons */
    transition: background-color 0.3s ease;
    line-height: 20px; /* Explicit line height for consistency, adjusted for border */
    height: 38px; /* Explicit height to match select, considering padding */
    box-sizing: border-box; /* Ensure padding is included in height */
    border: 1px solid #fff; /* White border for other buttons */
}

.main-nav .nav-item a:hover {
    background-color: #777; /* Darker background on hover */
    text-decoration: none; /* Remove underline on hover for buttons */
}

.main-nav .nav-item.selected a {
    background-color: #999; /* Lighter gray for selected item */
}

/* Special style for the skill-based game button */
.main-nav .nav-item-skill a {
    border: 1px solid #87CEEB; /* SkyBlue border */
    line-height: 20px; /* Adjust line-height for border */
}

/* Language Selector Styling */
.language-selector-wrapper select {
    padding: 8px 15px; /* Match button padding */
    border-radius: 5px;
    border: 1px solid #ccc; /* Keep a subtle border */
    background-color: #555; /* Match button background */
    color: #fff; /* Match button text color */
    cursor: pointer;
    appearance: none; /* Remove default select arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-5.4H18.6c-5%200-9.3%201.8-13.2%205.4A17.6%2017.6%200%200%200%200%2082.6c0%204.8%201.8%209.3%205.4%2013.2l128%20128c3.9%203.9%208.4%205.4%2013.2%205.4s9.3-1.8%2013.2-5.4l128-128c3.9-3.9%205.4-8.4%205.4-13.2%200-4.8-1.8-9.3-5.4-13.2z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 100px; /* Ensure it's wide enough */
    line-height: 1.2; /* Explicit line height for consistency */
    height: 38px; /* Explicit height to match buttons, considering padding */
    box-sizing: border-box; /* Ensure padding is included in height */
    text-align: left; /* Left-align text within the select box */
    text-align-last: left; /* For IE/Edge */
}

.language-selector-wrapper select:hover {
    background-color: #777; /* Darker background on hover */
}

.language-selector-wrapper select:hover {
    background-color: #777; /* Darker background on hover */
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1000;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    position: absolute;
    left: 0;
    transition: all 0.3s ease-in-out;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* Main Content Wrapper Styling */
.main-content-wrapper {
    width: 750px; /* Set to 750px as requested */
    margin: 50px auto 20px auto; /* 50px top margin, auto horizontal, 20px bottom */
    /* padding: 0 20px; Removed to prevent width issues */
}


/* Mobile Navigation - Hidden by default */
@media (max-width: 650px) {
    .menu-toggle {
        display: none; /* Hide on mobile as well */
    }

    .main-nav {
        display: flex; /* Always show navigation on mobile */
        flex-direction: row; /* Keep it horizontal like desktop */
        position: static; /* Remove absolute positioning */
        width: auto; /* Let content determine width */
        background-color: transparent; /* Remove background */
        padding: 0; /* Remove padding */
        box-shadow: none; /* Remove shadow */
    }

    .main-nav .nav-list {
        flex-direction: row; /* Keep items horizontal */
        flex-wrap: wrap; /* Allow wrapping if needed */
    }

    .main-nav .nav-item {
        margin: 0 5px; /* Adjust margin for spacing */
    }

    .main-header .container {
        justify-content: center; /* Center all items in the header container */
    }
}

/* Hamburger animation when active */
.menu-toggle.active .hamburger {
    background-color: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Footer Styling */
.main-footer {
    text-align: center;
    padding: 20px 0;
    background-color: white; /* Revert to original background color */
    color: #333; /* Example text color, adjust as needed */
    width: 100%;
    margin: 0 auto;
}

.main-footer img {
    max-width: 100px; /* Adjust image size as needed */
    height: auto;
    margin-bottom: 10px;
}

.main-content-wrapper h1 {
    text-align: center;
    margin-bottom: 20px; /* Consistent 50px gap below h1 */
    line-height: 1.2;
    height: auto;
    min-height: 40px;
    box-sizing: border-box;
}

.main-content-wrapper h1 + div {
    margin-top: 0;
}

.header-left {
    flex-grow: 1; /* Allow header-left to take available space */
    display: flex;
    justify-content: center; /* Center the logo */
    align-items: center;
    margin-bottom: 10px; /* Add 10px space below the logo */
    height: 50px; /* Fixed height for consistency */
}

.header-left .logo {
    color: #fff;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
}

.header-right .nickname {
    display: none;
    color: #fff;
    font-size: 18px;
    margin-left: 10px;
}

/* Adjust main-nav to be centered */
.main-nav {
    flex-grow: 1; /* Allow nav to take available space */
    text-align: center;
}

.main-nav .nav-list {
    justify-content: center; /* Center the navigation items */
}

.nickname-input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.nickname-input {
    padding: 8px 15px; /* Match button padding */
    border: 1px solid #ccc;
    border-radius: 5px; /* Match button border-radius */
    margin-right: 5px;
    width: 190px;
    height: 38px; /* Match button height */
    box-sizing: border-box; /* Ensure padding is included in height */
    text-align: center;
}

.save-nickname-btn {
    padding: 8px 15px;
    background-color: #555; /* Match game button background */
    color: #fff; /* Match game button text color */
    border: none;
    border-radius: 5px; /* Match game button border-radius */
    cursor: pointer;
    transition: background-color 0.3s ease; /* Match game button transition */
    height: 38px; /* Match game button height */
    box-sizing: border-box; /* Ensure padding is included in height */
    vertical-align: middle;
}

.language-selector-wrapper select {
    padding: 8px 15px; /* Match button padding */
    border-radius: 5px;
    border: 0px solid #ccc; /* Keep a subtle border */
    background-color: #555; /* Match button background */
    color: #fff; /* Match button text color */
    cursor: pointer;
    appearance: none; /* Remove default select arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-5.4H18.6c-5%200-9.3%201.8-13.2%205.4A17.6%2017.6%200%200%200%200%2082.6c0%204.8%201.8%209.3%205.4%2013.2l128%20128c3.9%203.9%208.4%205.4%2013.2%205.4s9.3-1.8%2013.2-5.4l128-128c3.9-3.9%205.4-8.4%205.4-13.2%200-4.8-1.8-9.3-5.4-13.2z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 100px; /* Ensure it's wide enough */
    line-height: 1.2; /* Explicit line height for consistency */
    height: 38px; /* Explicit height to match buttons, considering padding */
    box-sizing: border-box; /* Ensure padding is included in height */
    text-align: left; /* Left-align text within the select box */
    text-align-last: left; /* For IE/Edge */
    vertical-align: middle;
}

.language-selector-wrapper {
    display: inline-block;
    margin-left: 10px;
}

.save-nickname-btn:hover {
    background-color: #777; /* Match game button hover background */
}