:root {
    --primary-color: #1e7d39;
    --primary-hover: #145a28;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-sub: #555555;
    --nav-bg: #1e7d39; /* Changed to Green as requested for better contrast vs Dark Grey */
    --nav-text: #ffffff;
    --nav-hover: #145a28;
    --header-bg: #ffffff;
    --font-primary: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
}

/* --- Base Styles --- */
body {
    font-family: var(--font-primary);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-sub);
    /* Removed padding-top: 120px because header is now sticky */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Non-selectable elements */
h1,
h2,
.nav-btn,
.btn,
.back-btn,
.hub-title,
.section-header {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* --- Fixed Header & Navigation --- */
.header-container {
    background-color: var(--header-bg);
    position: sticky; /* Changed from fixed to sticky */
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.top-bar {
    background-color: var(--primary-color);
    padding: 10px 0;
    text-align: center;
    /* Optional: Can be removed if we move to a greener nav, 
       but keeping it for structure. */
}

/* Container for Logo, Search, and External Link */
.header-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px; /* Reduced top/bottom padding */
    gap: 20px;
}

.logo {
    height: 50px; /* Slightly smaller to reduce header height */
    width: auto;
    vertical-align: middle;
    background: white;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}

/* Search Bar Styles */
.search-container {
    flex-grow: 1;
    max-width: 600px;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    outline: none;
}

.search-btn {
    background-color: #333; /* Keeping dark for contrast on button */
    color: white;
    border: 2px solid #333;
    border-radius: 0 6px 6px 0;
    padding: 0 20px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase; /* Keep uppercase for small UI elements? User said Title Case for Title specifically. */
    letter-spacing: 0.4px;
    transition: background 0.3s;
}
.search-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* External Website Button */
.website-link-btn {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.3s;
}
.website-link-btn:hover {
    background-color: var(--primary-hover);
}
.website-link-btn::after {
    content: '\f08e'; /* fa-external-link-alt */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 8px;
}

/* Help button */
.help-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.help-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Navigation Menu --- */
.nav-menu {
    display: flex;
    justify-content: center;
    background-color: var(--nav-bg); /* Green background */
    padding: 0;
}

.nav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85); /* Slightly transparent white */
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none; /* Changed from uppercase to none (Title Case handled in HTML) */
    border-bottom: 4px solid transparent;
}

.nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.1); /* Subtle dark overlay on hover */
    color: #fff;
}

.nav-btn.active {
    color: #fff;
    border-bottom: 4px solid #fff; /* White underline for active state */
}

/* --- Main Content Container --- */
.content {
    max-width: 1800px; /* Increased from 1400px to allow fuller width */
    width: 95%; /* Ensure it takes up most of the screen on smaller devices */
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 60vh;
    flex: 1; /* Pushes footer down */
}

/* Page Title */
.hub-title {
    text-align: center;
    color: var(--text-main);
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: none; /* Removed uppercase */
}

/* Section Visibility Control */
.section-tab {
    display: none;
    /* Removed animation */
}

.section-tab.active-section {
    display: block;
    /* Removed explicit animation to prevent flashing */
}

/* Sub-section Visibility */
.sub-view {
    display: none;
    /* Removed explicit animation to prevent flashing */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2.section-header {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 1.8rem;
}

.section-desc {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Grid & Card Styles --- */
.links-grid {
    display: grid;
    /* Changed back to auto-fit to ensure items fill the width or center */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px; /* Increased gap slightly */
    align-items: stretch;
    justify-content: center;
}

.link-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Removed transform transition */
    transition: box-shadow 0.3s ease;
    height: 100%;
}

.link-card:hover {
    /* Removed transform translateY */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12); /* Subtle shadow increase only */
}

/* Utility to make cards clickable */
.nav-card {
    cursor: pointer;
}

/* Re-added card-image-container styles */
.card-image-container {
    height: 240px; /* Increased from 160px for bigger images */
    width: 100%;
    overflow: hidden;
    background-color: #fff; /* White bg for clean look with contain */
    display: flex; /* Center if image is smaller */
    align-items: center;
    justify-content: center;
    padding: 10px; /* Padding for 'contain' mode */
    box-sizing: border-box;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure full product is visible, not cropped */
    /* Removed transform transition */
}
/* Removed :hover zoom effect on images */

.card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.card-content p {
    margin-bottom: 25px;
    color: var(--text-sub);
    flex-grow: 1;
    line-height: 1.6;
}

.btn {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 0;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn:hover {
    background-color: var(--primary-hover);
}

/* --- Back Button --- */
.back-btn {
    display: inline-block;
    margin-bottom: 25px; /* More margin */
    margin-top: 20px;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    background-color: #e0e0e0; /* Button style */
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    font-family: inherit;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: #d0d0d0;
}

.main-menu-btn {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--text-main);
    font-weight: 700;
    text-decoration: none;
    background-color: #e0e0e0;
    padding: 10px 20px;
    border-radius: 4px;
    transition: background 0.3s;
}
.main-menu-btn:hover {
    background-color: #ccc;
}

/* --- Game Styling --- */
.game-frame {
    width: 100%;
    height: 700px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    background-color: white;
}

/* --- Footer --- */
.footer {
    background-color: #f3f4f6;
    color: var(--text-main);
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
    border-top: 1px solid #ddd;
}
.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Mobile Nav Adjustments */
@media (max-width: 900px) {
    .header-main-row {
        flex-direction: column;
    }
    .nav-menu {
        flex-wrap: wrap;
    }
    .nav-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    /* Removed padding-top here as well since header is sticky */
    .search-container {
        width: 100%;
        margin-top: 10px;
    }

    .header-actions {
        width: 100%;
        flex-direction: row; /* Changed back to row for side-by-side */
        margin-top: 10px;
        align-items: center;
        gap: 10px;
    }

    .website-link-btn,
    .help-btn {
        flex: 1; /* Share space equality */
        width: auto; /* Let flex handle width */
        text-align: center;
        margin-top: 0;
        padding: 10px 5px; /* Reduce side padding slightly to ensure fit */
        font-size: 0.85rem; /* Slightly smaller text for mobile split */
        white-space: normal; /* Allow text wrapping if needed on very small screens */
        display: flex;
        justify-content: center;
        align-items: center;
        height: auto;
    }
}

#copyMessage {
    display: none;
    color: var(--primary-color);
    font-weight: bold;
    margin-top: 10px;
    text-align: center;
}

/* External Link Indicator */
a[target='_blank']:not(.website-link-btn)::after {
    content: '\f08e'; /* fa-external-link-alt */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    display: inline-block;
    margin-left: 6px;
    font-size: 0.85em;
    text-decoration: none; /* Ensure underline doesn't affect icon if valid */
}
/* Exclude specific buttons if needed, generally useful */
