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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --light-bg: #ecf0f1;
    --dark-text: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============= HEADER ============= */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    font-style: italic;
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-link.active {
    background-color: var(--accent-color);
    color: white;
}

/* ============= FOOTER ============= */
.footer {
    background-color: var(--primary-color);
    color: white;
    margin-top: auto;
    padding: 3rem 0 1rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 0 2rem 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--secondary-color);
    padding-left: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    padding-top: 1.5rem;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* ============= CONTAINER ============= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* ============= PAGES GÉNÉRALES ============= */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 4rem 2rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    text-align: center;
}

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

.lead {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* ============= HISTOIRE PAGE ============= */
.history-page {
    padding: 2rem;
}

.content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.article-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--light-bg);
}

.article-section:last-child {
    border-bottom: none;
}

.article-section h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.article-section p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.bio-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
}

.highlight-box {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
}

.highlight-box h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.highlight-box ul {
    list-style: none;
    padding: 0;
}

.highlight-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.highlight-box li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

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

.timeline-item {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.timeline-date {
    min-width: 80px;
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.timeline-content h4 {
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

.rules-box {
    background-color: #f0f8ff;
    border: 2px solid var(--secondary-color);
    padding: 2rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.rules-box h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.rules-box ul {
    list-style: none;
    padding: 0;
}

.rules-box li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
}

.rules-box li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

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

.rule-card {
    background-color: white;
    border: 2px solid var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.rule-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.rule-card h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

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

.impact-item {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(46, 204, 113, 0.1) 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.impact-item h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.importance-list {
    list-style: none;
    padding: 0;
}

.importance-list li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.importance-list li:before {
    content: "✦";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* ============= JEU PAGE ============= */
.game-page {
    padding: 2rem;
}

.game-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.game-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.controls-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

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

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-text);
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 0.25rem;
}

.control-group select,
.control-group input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--light-bg);
    color: var(--dark-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--border-color);
}

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

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.info-box {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.info-item .label {
    font-weight: 600;
}

.info-item .value {
    color: var(--secondary-color);
    font-weight: bold;
}

.control-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.control-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--secondary-color);
}

.instructions-list {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
}

.instructions-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.instructions-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

.game-area {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    border: 2px solid var(--secondary-color);
    background-color: white;
    max-width: 100%;
    height: auto;
}

.game-info {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.game-info h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

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

.info-card {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.info-card h4 {
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.tips-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tips-section h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.tips-list li:before {
    content: "💡";
    position: absolute;
    left: 0;
}

/* ============= MODULES PAGE ============= */
.modules-page {
    padding: 2rem;
}

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

.module-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.module-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.module-header {
    padding: 1.5rem;
    color: white;
    font-weight: 600;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #16a085 100%);
}

.module-header h2 {
    font-size: 1.4rem;
    margin: 0;
}

.module-header.still-life {
    background: linear-gradient(135deg, #3498db 0%, #9b59b6 100%);
}

.module-header.oscillator {
    background: linear-gradient(135deg, #e74c3c 0%, #e67e22 100%);
}

.module-header.spaceship {
    background: linear-gradient(135deg, #27ae60 0%, #16a085 100%);
}

.module-header.methuselah {
    background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
}

.module-header.gun {
    background: linear-gradient(135deg, #c0392b 0%, #8b0000 100%);
}

.module-header.computer {
    background: linear-gradient(135deg, #2980b9 0%, #34495e 100%);
}

.module-header.breeder {
    background: linear-gradient(135deg, #16a085 0%, #27ae60 100%);
}

.module-header.sawtooth {
    background: linear-gradient(135deg, #8e44ad 0%, #3498db 100%);
}

.module-content {
    padding: 1.5rem;
}

.module-content p {
    margin-bottom: 1rem;
}

.pattern-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 4px;
}

.pattern-section h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.pattern-section p {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.pattern-visual {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.grid-small {
    display: grid;
    grid-template-columns: repeat(4, 20px);
    gap: 1px;
    background-color: #ccc;
    padding: 2px;
}

.grid-small div {
    width: 20px;
    height: 20px;
    background-color: white;
}

.grid-small .alive {
    background-color: #333;
}

.advantages {
    margin: 1rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.advantages h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.advantages ul {
    list-style: none;
    padding: 0;
}

.advantages li {
    padding: 0.3rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
}

.advantages li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

.classification-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.classification-section h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.classification-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background-color: var(--secondary-color);
    color: white;
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--light-bg);
}

table tbody tr:hover {
    background-color: var(--light-bg);
}

.fascinating-facts {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.fascinating-facts h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

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

.fact-card {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(46, 204, 113, 0.1) 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.fact-card h4 {
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.exploration-guide {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.exploration-guide h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.guide-list {
    list-style: none;
    padding: 0;
    counter-reset: step-counter;
}

.guide-list li {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--light-bg);
    border-radius: 4px;
    counter-increment: step-counter;
    padding-left: 3rem;
    position: relative;
}

.guide-list li:before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 0.75rem;
    font-weight: bold;
    color: white;
    background-color: var(--secondary-color);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar ul {
        gap: 1rem;
        justify-content: center;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .logo {
        text-align: center;
    }

    .bio-container {
        grid-template-columns: 1fr;
    }

    .game-container {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        position: static;
    }

    .rules-grid,
    .modules-grid,
    .facts-grid,
    .impact-container,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
    }

    .article-section h2,
    .game-info h2,
    .modules-page h2 {
        font-size: 1.5rem;
    }

    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.6rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        padding: 0 1rem 1rem;
    }
}

@media (max-width: 480px) {
    .nav-link {
        padding: 0.3rem 0.5rem;
        font-size: 0.9rem;
    }

    .navbar ul {
        gap: 0.5rem;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .hero h1 {
        font-size: 1.4rem;
    }

    .timeline-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    #gameCanvas {
        max-width: 100vw;
    }

    .button-group {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* ============= ANIMATIONS ============= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-card {
    animation: fadeIn 0.5s ease-out;
}

/* ============= UTILITIES ============= */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
