:root {
    /* Palette de couleurs demandée - Orange / Hacker */
    --color-primary: #F26513;
    --color-secondary: #F25116;
    --color-accent: #F2421B;
    --color-danger: #F22727;
    
    --bg-dark: #0a0a0a;
    --bg-lighter: #1a1a1a;
    --text-main: #e0e0e0;
    --text-muted: #888;
    
    --glow-effect: 0 0 10px rgba(242, 101, 19, 0.5), 0 0 20px rgba(242, 101, 19, 0.3);
    --glow-effect-strong: 0 0 15px rgba(242, 81, 22, 0.8), 0 0 30px rgba(242, 81, 22, 0.5);
    
    --font-main: 'Share Tech Mono', 'Courier New', monospace;
    --font-heading: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .brand {
    font-family: var(--font-heading);
    color: var(--color-primary);
    text-shadow: var(--glow-effect);
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--color-secondary);
    text-shadow: var(--glow-effect);
}

/* --- Navbar --- */
header {
    background-color: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(5px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--color-accent);
    box-shadow: 0 2px 10px rgba(242, 66, 27, 0.2);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.brand {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--color-primary);
    display: flex;
    align-items: center;
}

.brand img {
    height: 40px;
    width: auto;
    margin-right: 12px;
}

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

.nav-links a {
    color: var(--text-main);
    font-size: 1rem;
    position: relative;
    padding: 5px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
    box-shadow: var(--glow-effect);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}
.nav-links a.active {
    color: var(--color-primary);
    text-shadow: var(--glow-effect);
}

/* --- Layout --- */
main {
    padding-top: 80px; /* Space for fixed navbar */
    min-height: calc(100vh - 80px); /* Full height minus footer approximately */
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 4rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    text-transform: uppercase;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 5px rgba(242, 101, 19, 0.2);
    border-radius: 4px;
}

.btn:hover, .btn.active {
    background-color: var(--color-primary);
    color: var(--bg-dark);
    box-shadow: var(--glow-effect-strong);
}

.btn-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
    box-shadow: inset 0 0 5px rgba(242, 39, 39, 0.2);
}
.btn-danger:hover {
    background-color: var(--color-danger);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(242, 39, 39, 0.8);
}

.btn-easy {
    color: #0f0;
    border-color: #0f0;
    box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.2);
}
.btn-easy:hover, .btn-easy.active {
    background-color: #0f0;
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
}

/* --- Hero Section --- */
.hero {
    min-height: 40vh;
    padding: 4rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* Simulate a code/binary background or dark gradient */
    background: radial-gradient(circle at center, var(--bg-lighter) 0%, var(--bg-dark) 100%);
    border-bottom: 1px dashed var(--color-primary);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulseGlow 2s infinite alternate;
    white-space: nowrap;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin: 0 auto 2rem auto;
    max-width: 600px;
}

/* --- Grid & Cards --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg-lighter);
    border: 1px solid #333;
    padding: 1.5rem;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards ease-out;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--color-secondary);
    box-shadow: var(--glow-effect);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.difficulty {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    border: 1px solid;
}

.diff-easy { color: #0f0; border-color: #0f0; box-shadow: 0 0 5px rgba(0, 255, 0, 0.3); }
.diff-medium { color: var(--color-primary); border-color: var(--color-primary); box-shadow: 0 0 5px rgba(242, 101, 19, 0.3); }
.diff-hard { color: var(--color-danger); border-color: var(--color-danger); box-shadow: 0 0 5px rgba(242, 39, 39, 0.3); }

/* --- Table (Leaderboard) --- */
.table-container {
    overflow-x: auto;
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-lighter);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    color: var(--color-primary);
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

tr:hover td {
    background-color: rgba(242, 101, 19, 0.05);
}

tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Rank styling */
.rank {
    font-weight: bold;
    color: var(--color-accent);
}

/* --- Forms --- */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-lighter);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
    font-family: var(--font-heading);
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    background: var(--bg-dark);
    border: 1px solid #444;
    color: var(--text-main);
    font-family: var(--font-main);
    border-radius: 4px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(242, 101, 19, 0.4);
}

.error-message {
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

/* --- Footer --- */
footer {
    background-color: var(--bg-lighter);
    border-top: 1px solid #333;
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.socials {
    display: flex;
    gap: 1rem;
}

.socials a {
    color: var(--text-muted);
}
.socials a:hover {
    color: var(--color-primary);
}

/* --- Animations --- */
@keyframes pulseGlow {
    0% { text-shadow: var(--glow-effect); }
    100% { text-shadow: var(--glow-effect-strong); }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Add stagger delay to cards */
.grid .card:nth-child(1) { animation-delay: 0.1s; }
.grid .card:nth-child(2) { animation-delay: 0.2s; }
.grid .card:nth-child(3) { animation-delay: 0.3s; }
.grid .card:nth-child(4) { animation-delay: 0.4s; }

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.8rem 5%;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    header {
        position: relative; /* Removes the hard sticky break on mobile */
    }

    main {
        padding-top: 10px; /* Adapts to non-fixed header */
    }

    .hero h1 {
        white-space: normal;
        font-size: clamp(1.2rem, 6vw, 2.2rem);
        word-break: break-word;
        overflow-wrap: break-word;
    }

    h2, h3, .btn {
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    .btn {
        max-width: 100%;
    }

    .socials {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .socials a {
        font-size: 0.8rem;
    }
}
