:root {
    --primary: #00f2ff;
    --secondary: #7000ff;
    --bg-dark: #05050a;
    --bg-panel: rgba(15, 15, 25, 0.8);
    --text-main: #e0e0ff;
    --text-dim: #a0a0c0;
    --error: #ff2a6d;
    --success: #05ffa1;
    --font-main: 'JetBrains Mono', monospace;
    --font-title: 'Orbitron', sans-serif;
    --glow: 0 0 15px rgba(0, 242, 255, 0.5);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.scanline {
    width: 100%;
    height: 100px;
    z-index: 99;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 242, 255, 0.1) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.1;
    position: absolute;
    bottom: 100%;
    animation: scanline 8s linear infinite;
    pointer-events: none;
}

@keyframes scanline {
    0% { bottom: 100%; }
    100% { bottom: -100px; }
}

.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    opacity: 0.05;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.logo {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--primary);
}

.status {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
}

.pulse {
    width: 8px;
    height: 8px;
    background-color: var(--error);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--error);
    animation: pulse 1.5s infinite;
}

.pulse.green {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

.access-box {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 242, 255, 0.3);
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 242, 255, 0.05);
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 90% 100%, 0 100%);
}

.glass-panel h1 {
    font-family: var(--font-title);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    text-shadow: var(--glow);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.input-group {
    margin-bottom: 2rem;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-bottom: 2px solid rgba(0, 242, 255, 0.2);
    padding: 1rem 0;
    color: white;
    font-family: var(--font-main);
    font-size: 1.2rem;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-bottom-color: var(--primary);
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.input-group input:focus + .input-border {
    width: 100%;
}

.btn-primary {
    width: 100%;
    background: transparent;
    border: 1px solid var(--primary);
    padding: 1.2rem;
    color: var(--primary);
    font-family: var(--font-title);
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: rgba(0, 242, 255, 0.1);
    box-shadow: inset 0 0 15px rgba(0, 242, 255, 0.2), 0 0 20px rgba(0, 242, 255, 0.1);
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.error-hidden {
    margin-top: 1.5rem;
    color: var(--error);
    font-size: 0.8rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.error-visible {
    opacity: 1;
}

.hub-page {
    overflow-y: auto;
}

.hub-container {
    flex: 1;
    padding-bottom: 4rem;
}

.page-title {
    font-family: var(--font-title);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: var(--text-dim);
    margin-bottom: 3rem;
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.challenge-card {
    position: relative;
    height: 250px;
    perspective: 1000px;
    cursor: pointer;
}

.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-panel);
    border: 1px solid rgba(112, 0, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
    clip-path: polygon(0 0, 90% 0, 100% 10%, 100% 100%, 0 100%);
}

.challenge-card:hover .card-bg {
    transform: scale(1.05) translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 255, 0.2);
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.difficulty {
    font-size: 0.6rem;
    padding: 2px 8px;
    border: 1px solid currentColor;
    letter-spacing: 1px;
}

[data-level="facile"] .difficulty { color: #00ffaa; }
[data-level="moyen"] .difficulty { color: #ffcc00; }
[data-level="difficile"] .difficulty { color: #ff6600; }
[data-level="expert"] .difficulty { color: #ff0055; }

.id {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.card-content h2 {
    font-family: var(--font-title);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.card-content p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
    flex: 1;
}

.btn-secondary {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.8rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.writeup-link {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.65rem;
    text-align: center;
    color: var(--text-dim);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.writeup-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.challenge-card:hover .btn-secondary {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
}

footer {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.divider {
    color: rgba(255, 255, 255, 0.1);
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.text-btn:hover {
    color: var(--error);
}

.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    color: #ff00c1;
    z-index: -1;
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

.glitch::after {
    color: #00fff9;
    z-index: -2;
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@media (max-width: 768px) {
    .container { padding: 1rem; }
    .page-title { font-size: 2rem; }
    .glass-panel { padding: 2rem; }
}
