@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

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

:root {
    --bg-dark: #0d0d12;
    --bg-panel: #13131a;
    --neon-pink: #ff2a6d;
    --neon-cyan: #05d9e8;
    --neon-purple: #d300c5;
    --neon-yellow: #f9f002;
    --neon-green: #39ff14;
    --text-dim: #4a4a5a;
    --text-light: #a0a0b0;
    --border-dark: #2a2a3a;
    --samurai-red: #c41e3a;
    --samurai-gold: #d4af37;
}

body {
    font-family: 'VT323', monospace;
    background: var(--bg-dark);
    min-height: 100vh;
    color: var(--neon-cyan);
    position: relative;
    overflow-x: hidden;
}

/* Scanlines overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}


.construction-ribbon {
    position: fixed;
    top: 20px;
    left: -20px;
    background: #ff0;
    color: #000;
    padding: 5px 30px;
    font-family: monospace;
    font-size: 10px;
    font-weight: bold;
    transform: rotate(-45deg);
    z-index: 9999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Background pattern - Japanese wave */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(ellipse at 20% 80%, rgba(255, 42, 109, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(5, 217, 232, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(211, 0, 197, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.logo-link {
    display: inline-block;
    margin-bottom: 1rem;
    transition: transform 0.3s, filter 0.3s;
}
.logo-link:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px #ff2d95);
}
.header-logo {
    border: 2px solid #ff2d95;
    box-shadow: 0 0 10px rgba(255, 45, 149, 0.5);
}

/* User Bar - Top */
.user-bar {
    background: linear-gradient(180deg, var(--bg-panel) 0%, rgba(19, 19, 26, 0.95) 100%);
    border-bottom: 2px solid var(--neon-pink);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 0 20px rgba(255, 42, 109, 0.3);
}

.user-bar-content { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
#loginPrompt { display: flex; align-items: center; gap: 15px; }
#loginPrompt p { color: var(--text-dim); font-size: 1em; margin: 0; letter-spacing: 1px; }

.user-compact { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; justify-content: center; }
.user-avatar-small {
    width: 36px;
    height: 36px;
    border: 2px solid var(--neon-cyan);
    border-radius: 0;
    image-rendering: pixelated;
    box-shadow: 0 0 10px rgba(5, 217, 232, 0.5);
}

.user-stat { color: var(--text-dim); font-size: 1em; }
.user-stat span { color: var(--neon-cyan); text-shadow: 0 0 5px var(--neon-cyan); }

.toggle-user-btn { background: none; border: none; color: var(--neon-pink); cursor: pointer; font-size: 1em; }
.logout-btn-small {
    background: transparent;
    color: var(--samurai-red);
    border: 2px solid var(--samurai-red);
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.9em;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6em;
    text-decoration: none;
    transition: all 0.3s;
}
.logout-btn-small:hover {
    background: var(--samurai-red);
    color: #fff;
    box-shadow: 0 0 15px rgba(196, 30, 58, 0.5);
}

.user-details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-dark); }

.discord-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6em;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid #7289da;
    transition: all 0.3s;
}
.discord-btn:hover {
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.6);
    transform: translateY(-2px);
}

/* Main Layout */
.main-wrapper { max-width: 1200px; margin: 0 auto; padding: 20px; }

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    position: relative;
}

/* Katana divider */
header::after {
    display: block;
    font-size: 2em;
    color: var(--samurai-gold);
    margin-top: 15px;
    text-shadow: 0 0 10px var(--samurai-gold);
}

h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.8em;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    92% { transform: translate(-2px, 1px); }
    94% { transform: translate(2px, -1px); }
    96% { transform: translate(-1px, 2px); }
    98% { transform: translate(1px, -2px); }
}

.subtitle {
    color: var(--text-light);
    font-size: 1.2em;
    letter-spacing: 3px;
}

.layout { display: flex; flex-direction: column; gap: 20px; }
.content { flex: 1; min-width: 0; }

/* Leaderboard */
.leaderboard {
    background: var(--bg-panel);
    border: 2px solid var(--neon-purple);
    position: relative;
}

.leaderboard::before {

    position: absolute;
    top: -15px;
    right: 15px;
    font-size: 1.5em;
    color: var(--samurai-gold);
    text-shadow: 0 0 10px var(--samurai-gold);
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(90deg, rgba(211, 0, 197, 0.2), transparent);
    border-bottom: 1px solid var(--neon-purple);
    cursor: pointer;
}

.leaderboard-header span {
    color: var(--neon-purple);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6em;
    letter-spacing: 2px;
}

.toggle-btn { background: none; border: none; color: var(--neon-purple); cursor: pointer; font-size: 1em; transition: transform 0.3s; }
.leaderboard.collapsed .toggle-btn { transform: rotate(-90deg); }
.leaderboard-content { padding: 15px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 300px; overflow-y: auto; }
.leaderboard.collapsed .leaderboard-content { display: none; }

.leader-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.3);
    font-size: 1em;
    transition: all 0.3s;
}
.leader-row:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(5, 217, 232, 0.3);
}

.leader-rank { color: var(--samurai-gold); width: 35px; font-family: 'Press Start 2P', monospace; font-size: 0.6em; }
.leader-name { flex: 1; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-points { color: var(--neon-green); text-shadow: 0 0 5px var(--neon-green); }

/* Categories */
.category {
    margin-bottom: 25px;
    border: 2px solid var(--border-dark);
    background: var(--bg-panel);
    position: relative;
}

.category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan));
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: linear-gradient(90deg, rgba(255, 42, 109, 0.1), transparent);
    cursor: pointer;
    border-bottom: 1px solid var(--border-dark);
}
.category-header:hover { background: linear-gradient(90deg, rgba(255, 42, 109, 0.2), transparent); }

.category-title {
    color: var(--neon-pink);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
    letter-spacing: 2px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-count { color: var(--text-dim); font-size: 0.9em; font-family: 'VT323', monospace; }
.category-toggle { background: none; border: none; color: var(--neon-pink); cursor: pointer; font-size: 1em; transition: transform 0.3s; }
.category.collapsed .category-toggle { transform: rotate(-90deg); }
.category-challenges { padding: 15px; display: flex; flex-direction: column; gap: 15px; }
.category.collapsed .category-challenges { display: none; }

/* Challenges */
.challenge {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border-dark);
    padding: 18px;
    transition: all 0.3s;
    position: relative;
}

.challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-purple));
}

.challenge:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(5, 217, 232, 0.2);
}

.challenge.completed { border-color: var(--neon-green); }
.challenge.completed::before { background: var(--neon-green); box-shadow: 0 0 10px var(--neon-green); }

.challenge.locked { opacity: 0.4; filter: grayscale(50%); }
.challenge.locked::before { background: var(--samurai-red); }

.challenge-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }

.challenge-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65em;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--neon-cyan);
}

.challenge-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
    padding: 4px 10px;
    font-size: 0.9em;
    font-family: 'VT323', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid;
    background: rgba(0, 0, 0, 0.5);
}

.badge-points { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.badge-easy { border-color: var(--neon-green); color: var(--neon-green); }
.badge-medium { border-color: var(--neon-yellow); color: var(--neon-yellow); }
.badge-hard { border-color: var(--samurai-red); color: var(--samurai-red); }
.badge-completed { border-color: var(--neon-green); color: var(--neon-green); background: rgba(57, 255, 20, 0.1); }
.badge-locked { border-color: var(--samurai-red); color: var(--samurai-red); }
.badge-terminal { border-color: var(--neon-purple); color: var(--neon-purple); }
.badge-active { border-color: var(--neon-green); color: var(--neon-green); }
.badge-inactive { border-color: var(--text-dim); color: var(--text-dim); }

.challenge-desc { color: var(--text-light); margin-bottom: 12px; font-size: 1.1em; line-height: 1.5; }

.cipher-text {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--samurai-gold);
    border-left: 4px solid var(--samurai-gold);
    padding: 12px;
    color: var(--samurai-gold);
    margin-bottom: 12px;
    word-break: break-all;
    font-size: 1em;
    font-family: 'VT323', monospace;
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1);
}

.hint { color: var(--text-dim); font-size: 0.95em; margin-bottom: 12px; font-style: italic; }
.hint::before { content: '// '; color: var(--neon-purple); }

.input-group { display: flex; gap: 8px; }

.flag-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 10px 12px;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
}
.flag-input:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(5, 217, 232, 0.4);
}
.flag-input:disabled { opacity: 0.3; border-color: var(--border-dark); }
.flag-input::placeholder { color: var(--text-dim); }

.submit-btn {
    background: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-purple) 100%);
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}
.submit-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(255, 42, 109, 0.5);
    transform: translateY(-2px);
}
.submit-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.result { margin-top: 10px; padding: 10px; display: none; font-size: 1em; }
.result.success {
    display: block;
    background: rgba(57, 255, 20, 0.1);
    border-left: 4px solid var(--neon-green);
    color: var(--neon-green);
}
.result.error {
    display: block;
    background: rgba(196, 30, 58, 0.1);
    border-left: 4px solid var(--samurai-red);
    color: var(--samurai-red);
}

/* Terminal */
.terminal-btn {
    background: transparent;
    border: 2px solid var(--neon-purple);
    color: var(--neon-purple);
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    width: 100%;
    transition: all 0.3s;
}
.terminal-btn:hover {
    background: var(--neon-purple);
    color: #fff;
    box-shadow: 0 0 20px rgba(211, 0, 197, 0.5);
}

.terminal-container { margin: 10px 0; border: 2px solid var(--neon-purple); }
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(211, 0, 197, 0.2), transparent);
    border-bottom: 1px solid var(--neon-purple);
}
.terminal-header span { color: var(--neon-purple); font-size: 1em; text-transform: uppercase; letter-spacing: 1px; }
.terminal-timer { color: var(--neon-green); font-family: 'Press Start 2P', monospace; font-size: 0.6em; }
.terminal-close {
    background: transparent;
    border: 2px solid var(--samurai-red);
    color: var(--samurai-red);
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}
.terminal-close:hover { background: var(--samurai-red); color: #fff; }
.terminal-iframe { width: 100%; height: 400px; border: none; background: #0a0a0a; }

/* Progress bar */
.progress-bar {
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    height: 20px;
    position: relative;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan));
    transition: width 0.5s;
    box-shadow: 0 0 10px var(--neon-pink);
}
.progress-label { color: var(--text-dim); font-size: 0.95em; text-align: center; margin-top: 8px; }

/* Footer */
footer {
    margin-top: 50px;
    padding: 25px 0;
    border-top: 2px solid var(--border-dark);
    text-align: center;
    position: relative;
}

footer::before {
    content: '刀';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    color: var(--samurai-red);
    background: var(--bg-dark);
    padding: 0 15px;
}

.footer-content { color: var(--text-dim); font-size: 1em; }
.footer-links { margin: 15px 0; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.footer-links a {
    color: var(--neon-cyan);
    text-decoration: none;
    transition: all 0.3s;
}
.footer-links a:hover {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}
.footer-links span { color: var(--border-dark); }
.footer-legal { color: var(--text-dim); font-size: 0.9em; margin-top: 15px; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 18, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
    background: var(--bg-panel);
    border: 2px solid var(--neon-pink);
    padding: 30px;
    width: 550px;
    max-width: 90%;
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple), var(--neon-cyan));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-dark);
}
.modal-header h3 {
    color: var(--neon-pink);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8em;
    letter-spacing: 2px;
}
.modal-close { background: none; border: none; color: var(--samurai-red); font-size: 1.8em; cursor: pointer; }
.modal-body { color: var(--text-light); font-size: 1.1em; line-height: 1.8; }
.modal-body ul { list-style: none; }
.modal-body li { padding: 10px 0; border-bottom: 1px solid var(--border-dark); }
.modal-body li:before { content: '► '; color: var(--neon-cyan); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--neon-purple); }
::-webkit-scrollbar-thumb:hover { background: var(--neon-pink); }

/* Responsive */
@media (max-width: 900px) {
    .leaderboard-content { grid-template-columns: 1fr; }
    h1 { font-size: 1.2em; }
    .challenge-title { font-size: 0.55em; }
}

@media (max-width: 600px) {
    .user-compact { gap: 10px; }
    .footer-links { flex-direction: column; gap: 10px; }
    .footer-links span { display: none; }
}

/* ========== PIXEL SAMURAI ========== */

header {
    position: relative;
}

.samurai-container {
    position: absolute;
    top: -10px;
    left: 0;
    z-index: 50;
    animation: samurai-patrol 20s linear infinite;
    pointer-events: none;
}

@keyframes samurai-patrol {
    0% { left: -20px; transform: scaleX(1); }
    45% { left: calc(100% - 40px); transform: scaleX(1); }
    50% { left: calc(100% - 40px); transform: scaleX(-1); }
    95% { left: -20px; transform: scaleX(-1); }
    100% { left: -20px; transform: scaleX(1); }
}

.samurai {
    width: 48px;
    height: 48px;
    position: relative;
    animation: samurai-bounce 0.4s steps(2) infinite;
    image-rendering: pixelated;
}

@keyframes samurai-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Pixel art samurai using box-shadow technique */
.samurai-pixel {
    width: 4px;
    height: 4px;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow:
        /* Chapeau blanc (whitehat) */
        16px 0 0 #fff,
        20px 0 0 #fff,
        24px 0 0 #fff,
        12px 4px 0 #fff,
        16px 4px 0 #eee,
        20px 4px 0 #eee,
        24px 4px 0 #eee,
        28px 4px 0 #fff,
        8px 8px 0 #fff,
        12px 8px 0 #ddd,
        16px 8px 0 #ccc,
        20px 8px 0 #ccc,
        24px 8px 0 #ccc,
        28px 8px 0 #ddd,
        32px 8px 0 #fff,

        /* Visage */
        16px 12px 0 #FFD5B5,
        20px 12px 0 #FFD5B5,
        24px 12px 0 #FFD5B5,
        12px 16px 0 #FFD5B5,
        16px 16px 0 #222,
        20px 16px 0 #FFD5B5,
        24px 16px 0 #222,
        28px 16px 0 #FFD5B5,
        16px 20px 0 #FFD5B5,
        20px 20px 0 #FFD5B5,
        24px 20px 0 #FFD5B5,

        /* Corps (kimono) */
        12px 24px 0 var(--neon-purple),
        16px 24px 0 var(--neon-purple),
        20px 24px 0 #1a1a2e,
        24px 24px 0 var(--neon-purple),
        28px 24px 0 var(--neon-purple),
        8px 28px 0 var(--neon-purple),
        12px 28px 0 var(--neon-purple),
        16px 28px 0 var(--neon-purple),
        20px 28px 0 #1a1a2e,
        24px 28px 0 var(--neon-purple),
        28px 28px 0 var(--neon-purple),
        32px 28px 0 var(--neon-purple),
        8px 32px 0 var(--neon-purple),
        12px 32px 0 var(--neon-purple),
        16px 32px 0 var(--samurai-red),
        20px 32px 0 var(--samurai-red),
        24px 32px 0 var(--samurai-red),
        28px 32px 0 var(--neon-purple),
        32px 32px 0 var(--neon-purple),

        /* Katana */
        36px 20px 0 #888,
        40px 16px 0 #aaa,
        44px 12px 0 #ccc,
        48px 8px 0 #fff,
        52px 4px 0 #fff,
        36px 24px 0 var(--samurai-gold),
        36px 28px 0 var(--samurai-red),

        /* Jambes */
        12px 36px 0 #1a1a2e,
        16px 36px 0 #1a1a2e,
        24px 36px 0 #1a1a2e,
        28px 36px 0 #1a1a2e,
        12px 40px 0 #1a1a2e,
        16px 40px 0 #1a1a2e,
        24px 40px 0 #1a1a2e,
        28px 40px 0 #1a1a2e,

        /* Pieds (geta) */
        8px 44px 0 #4a3728,
        12px 44px 0 #4a3728,
        16px 44px 0 #4a3728,
        24px 44px 0 #4a3728,
        28px 44px 0 #4a3728,
        32px 44px 0 #4a3728;

    filter: drop-shadow(0 0 8px rgba(211, 0, 197, 0.5));
}

/* Effet de brillance du katana */
.samurai::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    top: 4px;
    right: -8px;
    box-shadow: 0 0 6px 2px #fff;
    animation: katana-glint 2s ease-in-out infinite;
}

@keyframes katana-glint {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* ========== BLACKHAT ENEMIES ========== */
.blackhat {
    position: absolute;
    top: -5px;
    width: 32px;
    height: 32px;
    z-index: 40;
    pointer-events: none;
}

.blackhat-1 { left: 15%; animation: blackhat-die 20s linear infinite; animation-delay: 0s; }
.blackhat-2 { left: 40%; animation: blackhat-die 20s linear infinite; animation-delay: -5s; }
.blackhat-3 { left: 65%; animation: blackhat-die 20s linear infinite; animation-delay: -10s; }
.blackhat-4 { left: 85%; animation: blackhat-die 20s linear infinite; animation-delay: -15s; }

/* Animation de mort synchro avec le samurai (20s patrol) */
@keyframes blackhat-die {
    /* Aller (0-45%): meurt quand samurai passe */
    0% { opacity: 1; transform: scale(1) rotate(0deg); }
    10% { opacity: 1; transform: scale(1) rotate(0deg); }
    12% { opacity: 0; transform: scale(0.5) rotate(180deg) translateY(-20px); }
    45% { opacity: 0; }
    /* Respawn avant le retour */
    46% { opacity: 1; transform: scale(1) rotate(0deg); }
    /* Retour (50-95%): meurt quand samurai repasse */
    55% { opacity: 1; transform: scale(1) rotate(0deg); }
    57% { opacity: 0; transform: scale(0.5) rotate(-180deg) translateY(-20px); }
    95% { opacity: 0; }
    96% { opacity: 1; transform: scale(1) rotate(0deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Pixel art blackhat hacker */
.blackhat-pixel {
    width: 3px;
    height: 3px;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow:
        /* Chapeau noir (fedora style) */
        9px 0 0 #111,
        12px 0 0 #111,
        15px 0 0 #111,
        6px 3px 0 #111,
        9px 3px 0 #222,
        12px 3px 0 #222,
        15px 3px 0 #222,
        18px 3px 0 #111,
        3px 6px 0 #111,
        6px 6px 0 #222,
        9px 6px 0 #333,
        12px 6px 0 #333,
        15px 6px 0 #333,
        18px 6px 0 #222,
        21px 6px 0 #111,

        /* Visage (pale/sinistre) */
        9px 9px 0 #b8a088,
        12px 9px 0 #b8a088,
        15px 9px 0 #b8a088,
        6px 12px 0 #b8a088,
        9px 12px 0 #0f0,
        12px 12px 0 #b8a088,
        15px 12px 0 #0f0,
        18px 12px 0 #b8a088,
        9px 15px 0 #b8a088,
        12px 15px 0 #666,
        15px 15px 0 #b8a088,

        /* Hoodie noir */
        6px 18px 0 #111,
        9px 18px 0 #111,
        12px 18px 0 #1a1a1a,
        15px 18px 0 #111,
        18px 18px 0 #111,
        3px 21px 0 #111,
        6px 21px 0 #1a1a1a,
        9px 21px 0 #1a1a1a,
        12px 21px 0 #0f0,
        15px 21px 0 #1a1a1a,
        18px 21px 0 #1a1a1a,
        21px 21px 0 #111,
        6px 24px 0 #111,
        9px 24px 0 #1a1a1a,
        12px 24px 0 #0f0,
        15px 24px 0 #1a1a1a,
        18px 24px 0 #111,

        /* Jambes */
        9px 27px 0 #0a0a0a,
        15px 27px 0 #0a0a0a;

    filter: drop-shadow(0 0 4px rgba(0, 255, 0, 0.3));
}

/* Effet de slash quand le samurai tue */
.blackhat::after {
    content: '×';
    position: absolute;
    font-size: 24px;
    color: var(--samurai-red);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: slash-effect 20s linear infinite;
    text-shadow: 0 0 10px var(--samurai-red);
}

.blackhat-1::after { animation-delay: 0s; }
.blackhat-2::after { animation-delay: -5s; }
.blackhat-3::after { animation-delay: -10s; }
.blackhat-4::after { animation-delay: -15s; }

@keyframes slash-effect {
    0%, 10% { opacity: 0; }
    11% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
    14% { opacity: 0; transform: translate(-50%, -50%) scale(2); }
    55%, 56% { opacity: 0; }
    57% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
    60% { opacity: 0; transform: translate(-50%, -50%) scale(2); }
    100% { opacity: 0; }
}

/* Masquer sur mobile */
@media (max-width: 768px) {
    .samurai-container { display: none; }
    .blackhat { display: none; }
}

/* Timer challenge */
.web-challenge-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}
.challenge-timer {
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    color: #00f7ff;
    text-shadow: 0 0 10px rgba(0, 247, 255, 0.5);
}
.web-url-display {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(0, 247, 255, 0.1);
    border: 1px solid #00f7ff;
}
.web-url-display code {
    color: #00f7ff;
    font-size: 1.1rem;
}

/* Compensation bannière construction */
body {
    padding-top: 40px;
}


/* Ruban En Construction - coin gauche */
.construction-ribbon {
    position: fixed;
    top: 20px;
    left: -35px;
    background: #ff0;
    color: #000;
    padding: 5px 40px;
    font-family: monospace;
    font-size: 10px;
    font-weight: bold;
    transform: rotate(-45deg);
    z-index: 9999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Bouton Cours */
.course-btn {
    display: inline-block;
    margin: 10px 0;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid #ff6600;
    color: #ff6600;
    text-decoration: none;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}
.course-btn:hover {
    background: #ff6600;
    color: #000;
    box-shadow: 0 0 20px #ff6600;
}

/* ===== FILTRES CHALLENGES ===== */
.filters-bar {
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    border: 2px solid #333;
    padding: 20px;
    margin-bottom: 20px;
}

.filters-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    background: #0a0a0f;
    border: 2px solid #333;
    color: #00f7ff;
    padding: 12px 15px 12px 40px;
    font-family: 'VT323', monospace;
    font-size: 1.2em;
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.search-box input:focus {
    outline: none;
    border-color: #00f7ff;
    box-shadow: 0 0 10px rgba(0,247,255,0.3);
}

.filter-select {
    background: #0a0a0f;
    border: 2px solid #333;
    color: #00f7ff;
    padding: 12px 30px 12px 15px;
    font-family: 'VT323', monospace;
    font-size: 1.2em;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300f7ff'%3E%3Cpath d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus {
    outline: none;
    border-color: #00f7ff;
}

.tags-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-tag {
    background: transparent;
    border: 1px solid #666;
    color: #888;
    padding: 6px 12px;
    font-family: 'VT323', monospace;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    border-color: #00f7ff;
    color: #00f7ff;
}

.filter-tag.active { background: #00f7ff; color: #0a0a0f; border-color: #00f7ff; }
.filter-tag.active-crypto { background: #ff6b6b; border-color: #ff6b6b; color: #000; }
.filter-tag.active-web { background: #4ecdc4; border-color: #4ecdc4; color: #000; }
.filter-tag.active-linux { background: #ffe66d; border-color: #ffe66d; color: #000; }
.filter-tag.active-forensics { background: #a855f7; border-color: #a855f7; color: #000; }
.filter-tag.active-reverse { background: #f97316; border-color: #f97316; color: #000; }
.filter-tag.active-misc { background: #22c55e; border-color: #22c55e; color: #000; }

.clear-filters-btn {
    background: none;
    border: 1px solid #ff4757;
    color: #ff4757;
    padding: 6px 12px;
    font-family: 'VT323', monospace;
    cursor: pointer;
}

.clear-filters-btn:hover {
    background: #ff4757;
    color: #fff;
}

.sort-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.sort-options {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #888;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-btn {
    background: #0a0a0f;
    border: 2px solid #333;
    color: #888;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2em;
}

.view-btn.active {
    border-color: #00f7ff;
    color: #00f7ff;
}

.results-count {
    color: #666;
    font-size: 1.1em;
    margin: 15px 0;
}

/* ===== FOOTER UNIFIÉ ===== */
.footer {
    background: linear-gradient(180deg, transparent 0%, rgba(18,18,26,0.95) 20%);
    border-top: 1px solid #333;
    padding: 40px 20px 20px;
    margin-top: auto;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}
.footer-section h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7em;
    color: var(--neon-pink);
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--neon-pink);
}
.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: 10px; }
.footer-section a {
    color: #888;
    text-decoration: none;
    font-size: 1.1em;
    transition: all 0.3s;
}
.footer-section a:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
}
.footer-section p {
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
}
.newsletter-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}
.newsletter-form input {
    flex: 1;
    min-width: 150px;
    background: #0a0a0f;
    border: 2px solid #333;
    color: var(--neon-cyan);
    padding: 12px 15px;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
}
.newsletter-form input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0,247,255,0.3);
}
.newsletter-form button {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    padding: 12px 20px;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
}
.newsletter-form button:hover {
    background: var(--neon-pink);
    color: #0a0a0f;
    box-shadow: 0 0 20px var(--neon-pink);
}
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}
.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid #444;
    color: #888;
    font-size: 1.2em;
    transition: all 0.3s;
}
.social-links a:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    box-shadow: 0 0 15px var(--neon-purple);
}
.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: #444;
    font-size: 1em;
}
.footer-bottom a {
    color: var(--neon-purple);
    text-decoration: none;
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
