/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@font-face {
    font-family: 'Segoe UI';
    font-display: swap;
}

:root {
    --primary-color: #00ff88;
    --secondary-color: #fbbf24;
    --accent-color: #00ff88;
    --success-color: #00ff88;
    --bg-dark: #1e1e1e;
    --bg-darker: #0a0a0a;
    --bg-card: #252525;
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --border-color: #333333;
    --hover-color: #00cc6f;
}

/* Prevent layout shifts */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal scroll */
.main-content,
.hero-section,
.game-section,
.game-section-first,
.content-section {
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    overflow: visible;
    width: 100%;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
}

/* Hero Section */
.hero-section {
    padding: 40px 0;
    background: radial-gradient(circle at center, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

.main-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.section-title {
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

/* ================================================
   Game Section First
   FIX 1 : max-width réduit de 1400px → 1100px
   ================================================ */
.game-section-first {
    padding: 60px 0;
    background: var(--bg-dark);
}

.game-container-main {
    max-width: 1100px; /* était 1400px — trop large sur desktop */
    margin: 0 auto;
    contain: layout style;
    min-height: 600px;
    padding: 0 20px;
    box-sizing: border-box;
}

.game-wrapper-with-table {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 30px;
    margin-bottom: 30px;
    contain: layout;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .game-wrapper-with-table {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ================================================
   Wrapper iframe (ratio 16/9)
   ================================================ */
.game-iframe-main-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-darker);
    border: 2px solid var(--border-color);
    min-height: 400px;
    contain: layout style paint;
}

.iframe-game {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ================================================
   FIX 2 — Placeholder : image plein cadre
   Cause : style="position:relative" inline sur
   #game-placeholder écrase le CSS, l'image sort
   du flux et ne remplit pas le wrapper.
   Solution : !important pour forcer position:absolute.
   ================================================ */
#game-placeholder,
.game-placeholder {
    position: absolute !important; /* override inline style="position:relative" */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    /* display absent intentionnellement — le JS gère show/hide via style.display='none' */
    cursor: pointer;
    z-index: 10;
}

/* Image couvre tout le placeholder */
#game-placeholder > img,
.game-placeholder > img {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    filter: brightness(0.4);
}

/* Contenu (titre + boutons) centré par-dessus */
#game-placeholder .placeholder-content,
.game-placeholder .placeholder-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90%;
    text-align: center !important;
    z-index: 2;
    padding: 0;
}

/* Titre adaptatif — évite le débordement sur mobile */
#game-placeholder h2,
.game-placeholder .section-title {
    font-size: clamp(1rem, 4vw, 2rem);
    white-space: nowrap;
}

/* Ancien style placeholder (gardé pour compatibilité) */
.placeholder-content {
    text-align: center;
    padding: 40px;
    color: var(--text-primary);
}

.placeholder-content h3 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

.placeholder-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* ================================================
   Boutons
   ================================================ */
.game-buttons-main {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 60px;
    contain: layout;
    margin: 30px 0;
}

.btn-play-main {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6f 100%);
    color: var(--bg-darker);
    padding: 15px 40px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: #00ff88 0px 3.89045px 23.3427px 0px;
    animation: pulse-green 2s infinite;
    transition: all 0.3s ease;
    min-width: 150px;
    justify-content: center;
    will-change: transform;
}

.btn-play-main:hover {
    transform: translateY(-3px);
    box-shadow: #00ff88 0px 5px 30px 0px;
}

.btn-demo-main {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #f59e0b 100%);
    color: var(--bg-darker);
    padding: 15px 40px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
    min-width: 150px;
    justify-content: center;
    will-change: transform;
}

.btn-demo-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6);
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: #00ff88 0px 3.89045px 23.3427px 0px;
    }
    50% {
        box-shadow: #00ff88 0px 5px 35px 0px;
    }
}

/* ================================================
   Specs Table
   ================================================ */
.game-specs-table {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    height: fit-content;
    min-height: 400px;
    contain: layout style;
}

.game-specs-table h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table tr {
    border-bottom: 1px solid var(--border-color);
}

.specs-table td {
    padding: 12px 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.specs-table td:first-child {
    color: var(--text-primary);
    font-weight: bold;
    width: 50%;
}

/* ================================================
   Update Info
   ================================================ */
.update-info {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    margin: 30px 0;
    border-left: 4px solid var(--primary-color);
}

.update-date {
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 10px;
}

.modifications-list {
    margin-left: 20px;
    margin-top: 10px;
}

.modifications-list li {
    margin: 8px 0;
    color: var(--text-secondary);
}

.modifications-title {
    margin: 15px 0 10px 0;
    font-weight: bold;
    color: var(--text-primary);
}

/* ================================================
   Content Section
   ================================================ */
.content-section {
    padding: 60px 0;
    background: var(--bg-dark);
}

.table-of-contents {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 40px;
    border: 2px solid var(--border-color);
}

.table-of-contents h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin: 10px 0;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-list a::before {
    content: "→";
    color: var(--primary-color);
}

.toc-list a:hover {
    color: var(--primary-color);
}

.content-article {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
    contain: layout style;
    animation: fadeIn 0.6s ease-out;
}

.content-article h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.content-article h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin: 25px 0 15px 0;
}

.content-article p {
    margin-bottom: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.intro-image-wrapper {
    margin: 25px 0 30px 0;
    text-align: center;
}

.intro-image {
    max-width: 100%;
    width: 800px;
    height: auto;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block;
    margin: 0 auto;
    object-fit: cover;
}

@media (max-width: 900px) {
    .intro-image {
        width: 100%;
        max-width: 800px;
    }
}

.content-article strong {
    color: var(--primary-color);
    font-weight: bold;
}

/* ================================================
   Tables
   ================================================ */
.bonus-table {
    overflow-x: auto;
    margin: 25px 0;
}

.bonus-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-darker);
    border-radius: 8px;
    overflow: hidden;
}

.bonus-table th {
    background: var(--primary-color);
    color: var(--text-primary);
    padding: 15px;
    text-align: left;
    font-weight: bold;
}

.bonus-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.bonus-table tr:hover {
    background: rgba(0, 255, 136, 0.1);
}

/* ================================================
   Lists
   ================================================ */
.steps-list,
.tips-list {
    margin: 20px 0;
    padding-left: 30px;
}

.steps-list li,
.tips-list li {
    margin: 15px 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ================================================
   FAQ
   ================================================ */
.faq-item {
    background: var(--bg-darker);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.faq-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.faq-item p {
    color: var(--text-secondary);
}

/* ================================================
   Author Block
   ================================================ */
.author-block {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 10px;
    margin-top: 40px;
    border: 2px solid var(--border-color);
}

.author-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.author-avatar {
    flex-shrink: 0;
}

.author-info h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.author-name {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.author-bio {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.author-social {
    display: flex;
    gap: 15px;
}

.social-link {
    color: var(--primary-color);
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-link:hover {
    color: var(--hover-color);
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 768px) {
    .main-title {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .game-container-main {
        padding: 0 15px;
        min-height: auto;
    }

    /* Fix : abandon du ratio padding-bottom sur mobile
       On passe à hauteur fixe pour que tout le jeu soit visible */
    .game-iframe-main-wrapper {
        padding-bottom: 0 !important;
        height: 75vh;
        min-height: 480px;
        max-height: 650px;
    }

    .game-buttons-main {
        flex-direction: column;
        align-items: center;
    }

    .btn-play-main,
    .btn-demo-main {
        width: 100%;
        justify-content: center;
    }

    .author-content {
        flex-direction: column;
        text-align: center;
    }

    .content-article {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.5rem;
    }

    .content-article {
        padding: 20px;
    }

    /* Légèrement plus petit sur très petits écrans */
    .game-iframe-main-wrapper {
        height: 70vh;
        min-height: 420px;
        max-height: 580px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.5rem;
    }

    .content-article {
        padding: 20px;
    }
}

/* ================================================
   Animations
   ================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}