@font-face {
    font-family: 'Retro Gaming';
    src: url('Retro Gaming 2.ttf') format('truetype');
}

/* ========== VARIABLES ========== */
:root {
    --green:        #00FF00;
    --green-dim:    #00CC00;
    --green-dark:   #003300;
    --green-glow:   rgba(0, 255, 0, 0.6);
    --green-faint:  rgba(0, 255, 0, 0.08);
    --red:          #FF2222;
    --red-glow:     rgba(255, 34, 34, 0.6);
    --gold:         #FFD700;
    --gold-glow:    rgba(255, 215, 0, 0.6);
    --bg:           #000000;
    --font:         'Retro Gaming', monospace;
}

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ========== BODY + EFFET CRT GLOBAL ========== */
body {
    background-color: var(--bg);
    color: var(--green);
    font-family: var(--font);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    touch-action: none;
}

/* Overlay CRT : scanlines + vignette */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.18) 3px,
            rgba(0, 0, 0, 0.18) 4px
        );
}

/* Vignette CRT */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 55%,
        rgba(0, 0, 0, 0.65) 100%
    );
}

/* ========== CONTENEUR ========== */
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== ÉCRANS ========== */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
    animation: screenFadeIn 0.35s ease-out;
}

@keyframes screenFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

/* ========== ÉCRAN D'ACCUEIL ========== */
.title {
    font-size: clamp(36px, 11vw, 72px);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 4px;
    color: var(--green);
    text-shadow:
        0 0 6px  var(--green),
        0 0 14px var(--green),
        0 0 30px var(--green-glow);
}

.subtitle {
    font-size: clamp(11px, 3.2vw, 16px);
    margin-bottom: 56px;
    text-align: center;
    letter-spacing: 4px;
    color: var(--green-dim);
    opacity: 0.85;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

/* Bouton principal */
.menu-btn {
    background-color: transparent;
    color: var(--green);
    border: 1px solid var(--green-dim);
    padding: 16px 44px;
    font-family: var(--font);
    font-size: clamp(14px, 3.8vw, 22px);
    cursor: pointer;
    letter-spacing: 2px;
    min-width: 220px;
    position: relative;
    transition: color 0.15s, box-shadow 0.15s, border-color 0.15s;
    /* coin supérieur gauche coupé */
    clip-path: polygon(10px 0%, 100% 0%, 100% 100%, 0% 100%, 0% 10px);
}

.menu-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--green-faint);
    opacity: 0;
    transition: opacity 0.15s;
    clip-path: inherit;
}

.menu-btn:hover,
.menu-btn:active {
    color: var(--bg);
    border-color: var(--green);
    box-shadow:
        0 0 12px var(--green-glow),
        inset 0 0 20px var(--green-glow);
}

.menu-btn:hover::before,
.menu-btn:active::before {
    opacity: 1;
    background: var(--green);
}

@media (hover: none) and (pointer: coarse) {
    .menu-btn:active {
        color: var(--bg) !important;
        border-color: var(--green) !important;
        box-shadow: 0 0 12px var(--green-glow) !important;
    }
    .menu-btn:active::before {
        opacity: 1 !important;
        background: var(--green) !important;
    }
}

/* ========== ÉCRAN DE DIALOGUE ========== */
.dialog-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
}

/* Cadre terminal avec coins coupés */
.dialog-box {
    background-color: var(--green-faint);
    border: 1px solid var(--green-dim);
    padding: 22px 24px;
    margin-bottom: 28px;
    min-height: 180px;
    max-height: 58vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    /* Coin inférieur droit coupé */
    clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0% 100%);
    box-shadow:
        0 0 8px rgba(0, 255, 0, 0.12),
        inset 0 0 30px rgba(0, 255, 0, 0.04);
}

/* Barre de titre du terminal */
.dialog-box::before {
    content: '■ ■ ■';
    display: block;
    font-size: 8px;
    letter-spacing: 4px;
    color: var(--green-dim);
    margin-bottom: 14px;
    opacity: 0.5;
}

.dialog-text {
    font-size: clamp(13px, 3.3vw, 17px);
    line-height: 1.9;
    margin-bottom: 14px;
    text-align: left;
    color: var(--green);
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
}

.dialog-text:last-child {
    margin-bottom: 0;
}

/* Scrollbar custom */
.dialog-box::-webkit-scrollbar {
    width: 3px;
}
.dialog-box::-webkit-scrollbar-track {
    background: transparent;
}
.dialog-box::-webkit-scrollbar-thumb {
    background: var(--green-dim);
}

/* Boutons de choix */
.choices-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
}

.choice-btn {
    background-color: transparent;
    color: var(--green-dim);
    border: 1px solid rgba(0, 204, 0, 0.4);
    padding: 14px 18px;
    font-family: var(--font);
    font-size: clamp(11px, 2.8vw, 15px);
    cursor: pointer;
    letter-spacing: 1px;
    text-align: left;
    width: 100%;
    position: relative;
    transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, padding-left 0.15s;
    clip-path: polygon(8px 0%, 100% 0%, 100% 100%, 0% 100%, 0% 8px);
}

.choice-btn::before {
    content: '> ';
    color: var(--green);
    transition: color 0.15s;
}

.choice-btn:hover,
.choice-btn:active {
    color: var(--green);
    border-color: var(--green);
    padding-left: 24px;
    box-shadow:
        0 0 10px rgba(0, 255, 0, 0.25),
        inset 0 0 12px rgba(0, 255, 0, 0.06);
    background: rgba(0, 255, 0, 0.05);
}

@media (hover: none) and (pointer: coarse) {
    .choice-btn:active {
        color: var(--green) !important;
        border-color: var(--green) !important;
        padding-left: 24px !important;
        background: rgba(0, 255, 0, 0.05) !important;
    }
}

/* ========== ÉCRAN DE COMPÉTENCES ========== */
.skills-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: 100vh;
}

.skills-title {
    font-size: clamp(14px, 3.8vw, 22px);
    margin-bottom: 36px;
    text-align: center;
    letter-spacing: 2px;
    text-shadow:
        0 0 6px var(--green),
        0 0 16px var(--green-glow);
}

.skills-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.skill-item {
    width: 100%;
}

.skill-name {
    font-size: clamp(11px, 2.8vw, 15px);
    margin-bottom: 7px;
    text-align: left;
    color: var(--green-dim);
    letter-spacing: 1px;
}

.skill-bar-container {
    width: 100%;
    height: 16px;
    border: 1px solid var(--green-dim);
    background-color: var(--green-faint);
    position: relative;
    overflow: hidden;
    clip-path: polygon(6px 0%, 100% 0%, 100% 100%, 0% 100%, 0% 6px);
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-dark) 0%, var(--green) 100%);
    box-shadow: 0 0 12px var(--green-glow), 0 0 4px var(--green);
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    width: 0;
    position: relative;
}

/* Reflet sur la barre */
.skill-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: rgba(255, 255, 255, 0.08);
}

/* ========== ÉCRAN DE JEU ========== */
#game-screen {
    padding: 0;
}

.game-header {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    width: 90%;
}

.game-title {
    font-size: clamp(13px, 3.2vw, 18px);
    margin-bottom: 6px;
    letter-spacing: 2px;
    text-shadow:
        0 0 6px var(--green),
        0 0 14px var(--green-glow);
}

.game-objective {
    font-size: clamp(11px, 2.8vw, 15px);
    letter-spacing: 1px;
    color: var(--green-dim);
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.3);
}

#score-display {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(22px, 5.5vw, 44px);
    z-index: 10;
    letter-spacing: 3px;
    text-shadow:
        0 0 8px var(--green),
        0 0 20px var(--green-glow);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.touch-zone {
    display: none;
}

/* ========== ÉCRAN GAME OVER ========== */
.score-container {
    margin: 36px 0;
    text-align: center;
}

.label {
    font-size: clamp(12px, 3.2vw, 18px);
    letter-spacing: 3px;
    color: var(--green-dim);
    margin-bottom: 10px;
}

.final-score {
    font-size: clamp(52px, 13vw, 100px);
    letter-spacing: 4px;
    text-shadow:
        0 0 10px var(--green),
        0 0 30px var(--green-glow),
        0 0 60px rgba(0, 255, 0, 0.3);
    animation: scorePulse 2s ease-in-out infinite;
}

@keyframes scorePulse {
    0%, 100% { text-shadow: 0 0 10px var(--green), 0 0 30px var(--green-glow); }
    50%       { text-shadow: 0 0 18px var(--green), 0 0 50px var(--green-glow), 0 0 80px rgba(0,255,0,0.25); }
}

/* ========== ANIMATIONS GLOBALES ========== */
@keyframes pulse {
    0%, 100% { text-shadow: 0 0 10px var(--green), 0 0 24px var(--green-glow); }
    50%       { text-shadow: 0 0 20px var(--green), 0 0 44px var(--green-glow), 0 0 70px rgba(0,255,0,0.3); }
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 8px var(--green), 0 0 20px var(--green-glow);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 16px var(--green), 0 0 36px var(--green-glow), 0 0 60px rgba(0,255,0,0.25);
        transform: scale(1.015);
    }
}

/* ========== ÉCRAN D'ACCUEIL MOBILE ========== */
#welcome-screen .title {
    animation: glow 3.5s ease-in-out infinite;
}

#welcome-screen .subtitle {
    text-transform: uppercase;
    letter-spacing: 4px;
}

#start-interview-btn {
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* ========== ORIENTATION PAYSAGE ========== */
@media (orientation: landscape) {
    .title {
        margin-bottom: 24px;
    }
    .menu-options {
        flex-direction: row;
        gap: 30px;
    }
}

@media (max-height: 600px) {
    .title {
        font-size: clamp(22px, 8vw, 44px);
        margin-bottom: 16px;
    }
    .subtitle {
        font-size: clamp(10px, 3vw, 14px);
        margin-bottom: 16px;
    }
    .menu-btn {
        padding: 10px 28px;
    }
}

/* ========== BOOT SCREEN MOBILE ========== */
#boot-screen {
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
}

#boot-bg-canvas,
#welcome-bg-canvas,
#desktop-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.boot-content {
    position: relative;
    z-index: 1;
    padding: 48px 28px 28px;
    width: 100%;
}

.boot-logo {
    font-size: clamp(28px, 8vw, 48px);
    letter-spacing: 6px;
    color: var(--green);
    text-shadow:
        0 0 8px var(--green),
        0 0 24px var(--green-glow);
    margin-bottom: 32px;
    animation: glow 3s ease-in-out infinite;
}

.boot-cursor {
    animation: blink 0.9s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.boot-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.boot-line {
    font-size: clamp(12px, 3.2vw, 16px);
    color: var(--green-dim);
    letter-spacing: 1px;
    line-height: 1.5;
}

.boot-line--highlight {
    color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
    font-size: clamp(14px, 3.8vw, 20px);
    letter-spacing: 2px;
    margin-top: 8px;
}

/* ========== ÉCRAN D'ACCUEIL MOBILE ENRICHI ========== */
#welcome-screen {
    padding: 0;
}

.welcome-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 28px;
}

.welcome-tag {
    font-size: clamp(10px, 2.6vw, 13px);
    letter-spacing: 2px;
    color: var(--green-dim);
    margin-bottom: 20px;
    opacity: 0.75;
    text-align: center;
    transition: opacity 0.6s;
}

.welcome-meta {
    font-size: clamp(10px, 2.5vw, 13px);
    letter-spacing: 2px;
    color: var(--green-dim);
    opacity: 0.5;
    margin-top: 20px;
    text-align: center;
}

/* ========== LANDING PAGE DESKTOP ========== */
#desktop-landing {
    display: none;
    padding: 0;
}

/* Canvas de fond en position absolue */
#desktop-bg-canvas {
    opacity: 0.6;
}

/* Layout 2 colonnes */
.desktop-layout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(40px, 6vw, 100px);
    width: 100%;
    max-width: 1100px;
    padding: 40px 48px;
}

/* Zone gauche : pitch */
.desktop-pitch {
    flex: 1;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.desktop-tag {
    font-size: clamp(10px, 1.4vw, 13px);
    letter-spacing: 3px;
    color: var(--green-dim);
    opacity: 0.65;
    margin-bottom: 20px;
}

.desktop-title {
    font-size: clamp(56px, 9vw, 110px);
    line-height: 0.9;
    letter-spacing: 6px;
    margin-bottom: 18px;
    text-shadow:
        0 0 10px var(--green),
        0 0 28px var(--green-glow),
        0 0 60px rgba(0,255,0,0.2);
    animation: pulse 2.5s ease-in-out infinite;
}

.desktop-tagline {
    font-size: clamp(12px, 1.8vw, 18px);
    letter-spacing: 5px;
    color: var(--green-dim);
    margin-bottom: 36px;
    opacity: 0.85;
}

.desktop-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
    border-left: 1px solid rgba(0,255,0,0.2);
    padding-left: 16px;
}

.desktop-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(11px, 1.5vw, 14px);
    letter-spacing: 2px;
    color: var(--green-dim);
}

.feat-arrow {
    color: var(--green);
    text-shadow: 0 0 6px var(--green-glow);
    flex-shrink: 0;
}

.desktop-description {
    font-size: clamp(12px, 1.6vw, 15px);
    line-height: 2;
    color: var(--green-dim);
    opacity: 0.8;
    margin-bottom: 28px;
    border-top: 1px solid rgba(0,255,0,0.12);
    padding-top: 24px;
}

.desktop-direct-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(11px, 1.4vw, 13px);
    letter-spacing: 1px;
    color: var(--green-dim);
    opacity: 0.7;
    flex-wrap: wrap;
}

.desktop-url {
    color: var(--green);
    text-decoration: none;
    text-shadow: 0 0 6px var(--green-glow);
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(0,255,0,0.3);
    transition: text-shadow 0.2s, border-color 0.2s;
}

.desktop-url:hover {
    text-shadow: 0 0 12px var(--green), 0 0 24px var(--green-glow);
    border-color: var(--green);
}

/* Zone droite : QR code */
.desktop-qr-zone {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-container {
    background: var(--green-faint);
    border: 1px solid var(--green-dim);
    padding: 32px;
    clip-path: polygon(16px 0%, 100% 0%, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0% 100%, 0% 16px);
    box-shadow:
        0 0 24px rgba(0,255,0,0.12),
        inset 0 0 40px rgba(0,255,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.qr-label {
    font-size: clamp(10px, 1.3vw, 12px);
    letter-spacing: 3px;
    color: var(--green-dim);
    opacity: 0.7;
}

#qr-code {
    width: 220px;
    height: 220px;
    background: white;
    padding: 8px;
    display: block;
}

.qr-instruction {
    font-size: clamp(12px, 1.6vw, 15px);
    color: var(--green);
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.7;
}

.qr-subtext {
    font-size: clamp(10px, 1.3vw, 12px);
    color: var(--green-dim);
    opacity: 0.55;
    text-align: center;
    letter-spacing: 1px;
}

.desktop-footer {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-size: clamp(10px, 1.2vw, 12px);
    color: var(--green-dim);
    opacity: 0.35;
    letter-spacing: 1px;
    z-index: 1;
}

/* ========== MEDIA QUERIES RESPONSIVE ========== */
@media (min-width: 768px) {
    #desktop-landing {
        display: flex !important;
    }
    #boot-screen,
    #welcome-screen,
    #dialog-screen,
    #game-screen,
    #skills-screen,
    #gameover-screen {
        display: none !important;
    }
}

@media (max-width: 767px) {
    #desktop-landing {
        display: none !important;
    }
}

/* Tablette : layout desktop en colonne si écran trop étroit */
@media (min-width: 768px) and (max-width: 1024px) {
    .desktop-layout {
        flex-direction: column;
        gap: 40px;
        padding: 32px 24px;
    }
    .desktop-pitch {
        max-width: 100%;
        align-items: center;
        text-align: center;
    }
    .desktop-features {
        border-left: none;
        padding-left: 0;
        align-items: center;
    }
    .desktop-description {
        text-align: center;
    }
    .desktop-direct-link {
        justify-content: center;
    }
}
