/* Global styles */
:root {
    --background-light: #1a1a1a;
    --background-dark: #2a2a2a;
    --background-darker: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-light: #999999;
    --accent-blue: #4080ff;
    --accent-light-blue: #1a2332;
    --success-green: #4ade80;
    --error-red: #f87171;
    --button-hover: #3366dd;
    --card-background: #2a2a2a;
    --border-light: #404040;
    --highlight-color: rgba(64, 128, 255, 0.1);
    --nav-height: 70px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    letter-spacing: -0.015em;
    font-weight: 400;
}

.text-section ul {
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 2rem;
    font-size: 1rem;
    line-height: 1.7;
    text-align: left;
    padding-left: 20px;
    list-style-type: disc;
}

.text-section ul li {
    margin-bottom: 12px;
}

/* Header and navigation */
.site-header {
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.site-header.scrolled {
    background-color: rgba(26, 26, 26, 0.95);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    height: 40px;
    margin-right: 1rem;
}

.site-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.scrolled .site-title {
    color: var(--text-primary);
}

.site-nav {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding: 0.5rem 0;
    position: relative;
}

.scrolled .nav-link {
    color: var(--text-secondary);
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: white;
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.scrolled .nav-link:after {
    background-color: var(--accent-blue);
}

.nav-link:hover {
    color: white;
}

.scrolled .nav-link:hover {
    color: var(--text-primary);
}

.nav-link:hover:after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.nav-link.active {
    color: white;
}

.scrolled .nav-link.active {
    color: var(--accent-blue);
}

.nav-link.active:after {
    transform: scaleX(1);
}

/* Main content */
.main-content {
    min-height: calc(100vh - var(--nav-height));
}

/* Mobile menu */
.mobile-menu-toggle {
    display: none;
}

.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    transition: color 0.3s ease;
    padding: 0.5rem;
    line-height: 1;
    user-select: none;
}

.scrolled .mobile-menu-button {
    color: var(--text-secondary);
}

/* Hero section with background */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 5rem;
}

.hero-text {
    max-width: 600px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-text h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.hero-text p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-button {
    display: inline-block;
    background-color: var(--accent-blue);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hero-button:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Heading styles */
h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

p {
    color: var(--text-secondary);
    max-width: 800px;
    text-align: left;
    margin: 0 0 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
}

/* Button styles */
.button {
    display: inline-block;
    background-color: var(--accent-blue);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.button:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

/* Game container */
.game-container {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: fit-content;
    max-width: 400px;
    margin: calc(var(--nav-height) + 2rem) auto 2rem auto;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Cue button styles */
.cue-button {
    background-color: var(--background-light);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    width: 140px;
    height: 140px;
    margin: 0;
    font-size: 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    min-height: 140px;
}

.cue-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-blue);
}

.cue-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Grid layout for cues */
#cues {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
}

/* For 3 queues */
#cues.queues-3 {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* For 4 queues */
#cues.queues-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 300px;
    margin: 2rem auto;
    justify-items: center;
}

/* Result styles */
.result-correct {
    color: var(--success-green);
    font-weight: 600;
}

.result-incorrect {
    color: var(--error-red);
    font-weight: 600;
}

/* Stats and leaderboard styles */
.content-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 2rem) 1rem 2rem 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stats-card {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 1rem 0;
    color: var(--accent-blue);
}

.leaderboard-container {
    margin: 2rem 0;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.leaderboard-table th {
    background-color: var(--background-dark);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.leaderboard-table tr:hover {
    background-color: var(--accent-light-blue);
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

/* Top 3 ranks highlight */
.leaderboard-table tr:nth-child(1) td:first-child {
    color: #d4af37; /* gold */
}

.leaderboard-table tr:nth-child(2) td:first-child {
    color: #C0C0C0; /* silver */
}

.leaderboard-table tr:nth-child(3) td:first-child {
    color: #cd7f32; /* bronze */
}

/* About page styles */
.affiliations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.affiliation-card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.affiliation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.affiliation-card h3 {
    color: var(--accent-blue);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.result-container, .stats-card, .affiliation-card {
    animation: fadeIn 0.4s ease-out;
}

/* Responsive design */
@media (max-width: 768px) {
    .site-header {
        padding: 0 1rem;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: rgba(26, 26, 26, 0.98);
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        z-index: 999;
        border-top: 1px solid var(--border-light);
        backdrop-filter: blur(10px);
    }
    
    .nav-links.active {
        display: flex !important;
    }
    
    .nav-links li {
        margin: 0.5rem 0;
    }
    
    .nav-links .nav-link {
        padding: 0.8rem 0;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--border-light);
        color: var(--text-primary);
    }
    
    .nav-links .nav-link:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-button {
        display: block !important;
        z-index: 1001;
        position: relative;
    }
    
    /* Checkbox hack for reliable mobile menu */
    .mobile-menu-toggle:checked ~ .nav-links {
        display: flex !important;
    }
    
    .mobile-menu-toggle:checked ~ .mobile-menu-button {
        color: var(--accent-blue);
    }

    .hero-content {
        padding: 0 2rem;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-text p {
        font-size: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .game-container, .stats-card, .affiliation-card {
        padding: -2rem;
        margin: calc(var(--nav-height) + 1rem) 1rem 1rem 1rem;
    }
    
    .content-section {
        padding: calc(var(--nav-height) + 1rem) 1rem 1rem 1rem;
    }
    
    .leaderboard-table {
        font-size: 0.9rem;
    }
    
    .leaderboard-table th, 
    .leaderboard-table td {
        padding: 0.8rem;
    }
    
    /* Mobile-specific cue button adjustments */
    .cue-button {
        width: 180px;
        height: 180px;
        margin: 0.3rem;
        font-size: 1.4rem;
        min-width: 180px;
        min-height: 180px;
    }
    
    /* Ensure proper spacing for mobile game layout */
    #cues.queues-4 {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        max-width: 100%;
    }
    
    /* Mobile play page adjustments */
    div[style*="min-height: 60vh"] {
        min-height: calc(100vh - var(--nav-height)) !important;
        padding-top: calc(var(--nav-height) + 0.5rem);
    }
    
    /* Raise the game container significantly on mobile */
    .game-container {
        margin: calc(var(--nav-height) - 1rem) 1rem 1rem 1rem;
        padding: -1rem;
    }
    
    /* Adjust the main container for mobile rounds */
    div[style*="padding-top: calc(var(--nav-height) + 2rem)"] {
        padding-top: calc(var(--nav-height) + 0.5rem) !important;
    }
}

/* Additional mobile optimization for very small screens */
@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .game-container {
        margin: calc(var(--nav-height) + 0.5rem) 0.5rem 0.5rem 0.5rem;
        padding: 1rem;
    }
    
    .content-section {
        padding: calc(var(--nav-height) + 0.5rem) 0.5rem 0.5rem 0.5rem;
    }
    
    .cue-button {
        width: 140px;
        height: 140px;
        font-size: 1.1rem;
        min-width: 140px;
        min-height: 140px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
    }
}
