/* --- VARIABLES --- */
:root {
    --primary: #8B0000;       /* Dark Red */
    --primary-bright: #ff1a1a;/* Neon Red */
    --bg-dark: #050505;       /* Black */
    --bg-card: #0f0f0f;
    --text-main: #e0e0e0;
    --text-muted: #888;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --- RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-mono);
    line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- SCANLINE & GLOW --- */
.scanline {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px;
    pointer-events: none; z-index: 999; opacity: 0.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- NAVBAR --- */
.navbar {
    padding: 20px 0;
    background: rgba(5, 5, 5, 0.95);
    border-bottom: 1px solid #222;
    position: sticky; top: 0; z-index: 100;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; color: white; letter-spacing: -1px; }
.blink { animation: blink 1s infinite; color: var(--primary-bright); }
.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a:hover { color: var(--primary-bright); text-shadow: 0 0 8px var(--primary); }
.btn-nav { border: 1px solid var(--primary); padding: 8px 20px; color: var(--primary-bright) !important; }
.btn-nav:hover { background: var(--primary); color: white !important; box-shadow: 0 0 15px var(--primary); }

/* --- HERO --- */
.hero {
    height: 70vh;
    display: flex; align-items: center; justify-content: center; text-align: center;
    background: radial-gradient(circle at center, #1a0000 0%, #050505 70%);
}
.hero-subtitle { color: var(--primary-bright); font-size: 0.8rem; letter-spacing: 2px; margin-bottom: 10px; }
.hero-title {
    font-size: 3.5rem; margin-bottom: 20px; color: white; position: relative; letter-spacing: -2px;
}
/* Glitch Effect CSS */
.hero-title::before, .hero-title::after {
    content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-dark);
}
.hero-title::before { left: 2px; text-shadow: -1px 0 red; clip: rect(24px, 550px, 90px, 0); animation: glitch 3s infinite alternate-reverse; }
.hero-title::after { left: -2px; text-shadow: -1px 0 blue; clip: rect(85px, 550px, 140px, 0); animation: glitch 2s infinite alternate-reverse; }

.hero-desc { max-width: 600px; margin: 0 auto 40px; color: var(--text-muted); }

/* BUTTONS */
.hero-btns { display: flex; gap: 20px; justify-content: center; }
.btn { padding: 12px 30px; font-family: var(--font-mono); font-weight: bold; cursor: pointer; text-transform: uppercase; font-size: 0.9rem; transition: 0.3s; }
.btn-primary { border: 1px solid var(--primary); color: var(--primary-bright); background: transparent; }
.btn-primary:hover { background: var(--primary); color: white; box-shadow: 0 0 20px var(--primary); }
.btn-secondary { border: 1px solid #333; color: #888; }
.btn-secondary:hover { border-color: #eee; color: #eee; }

/* --- STATUS BAR --- */
.status-bar { border-top: 1px solid #222; border-bottom: 1px solid #222; background: #080808; padding: 20px 0; }
.status-grid { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; }
.status-item { display: flex; flex-direction: column; align-items: center; }
.status-item .label { color: #555; font-size: 0.7rem; margin-bottom: 5px; }
.status-item .value { color: white; font-weight: bold; font-size: 1.2rem; }
.status-item .value.online { color: #00ff41; text-shadow: 0 0 5px #00ff41; }

/* --- CONTENT SECTION --- */
.challenges { padding: 60px 0; }
.section-header { display: flex; align-items: center; gap: 20px; margin-bottom: 40px; }
.section-header h2 { font-size: 1.5rem; color: white; }
.line-deco { flex: 1; height: 1px; background: #222; }

/* --- TERMINAL TABLE (LEADERBOARD) --- */
.terminal-table-wrapper {
    background: #0a0a0a;
    border: 1px solid #222;
    padding: 2px; /* Double border effect */
    position: relative;
}
.terminal-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
}
.terminal-table th {
    text-align: left;
    padding: 15px 20px;
    background: #111;
    color: #666;
    font-size: 0.8rem;
    border-bottom: 1px solid #222;
}
.terminal-table td {
    padding: 20px;
    border-bottom: 1px solid #1a1a1a;
    font-size: 1rem;
}
.terminal-table tr:hover td {
    background: rgba(139, 0, 0, 0.05); /* Slight red hover */
    color: white;
}
.team-name .prefix { color: var(--primary); margin-right: 5px; opacity: 0.7; }
.points { color: #00ff41; font-family: var(--font-mono); }

.empty-state { padding: 40px; text-align: center; color: #555; font-style: italic; }
.btn-icon { color: var(--text-muted); font-size: 0.85rem; }
.btn-icon:hover { color: var(--primary-bright); }

/* --- FOOTER --- */
footer { padding: 40px 0; border-top: 1px solid #222; text-align: center; color: #444; font-size: 0.8rem; margin-top: 40px; }

/* ANIMATIONS */
@keyframes blink { 50% { opacity: 0; } }
@keyframes glitch {
    0% { clip: rect(10px, 9999px, 30px, 0); transform: translate(2px,0); }
    100% { clip: rect(40px, 9999px, 80px, 0); transform: translate(-2px,0); }
}

/* RESPONSIVE */
@media(max-width: 768px) {
    .hero-title { font-size: 2rem; }
    .nav-links { display: none; }
    .status-grid { gap: 30px; }
}

/* --- UTILS --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- SCANLINE EFFECT --- */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    opacity: 0.6;
}

/* --- NAVBAR --- */
.navbar {
    padding: 20px 0;
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #1a1a1a;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: white;
}

.blink {
    animation: blink 1s infinite;
    color: var(--primary-bright);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.nav-links a:hover {
    color: var(--primary-bright);
    text-shadow: 0 0 8px var(--primary);
}

.btn-nav {
    border: 1px solid var(--primary);
    padding: 8px 20px;
    color: var(--primary-bright) !important;
}

.btn-nav:hover {
    background: var(--primary);
    color: white !important;
    box-shadow: var(--glow-shadow);
}

/* --- HERO SECTION --- */
.hero {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at center, #110000 0%, #050505 70%);
}

.hero-subtitle {
    color: var(--primary-bright);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.hero-title {
    font-size: 4rem;
    margin-bottom: 20px;
    position: relative;
    color: white;
    letter-spacing: -2px;
}

/* Glitch Effect */
.hero-title::before, .hero-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

.hero-title::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.hero-title::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

.hero-desc {
    max-width: 600px;
    margin: 0 auto 40px;
    color: var(--text-muted);
}

/* Buttons */
.hero-btns {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    font-family: var(--font-mono);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-bright);
    box-shadow: inset 0 0 10px rgba(139,0,0,0.2);
}

.btn-primary:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px var(--primary);
}

.btn-secondary {
    border: 1px solid #333;
    color: #888;
}

.btn-secondary:hover {
    border-color: #eee;
    color: #eee;
}

/* --- STATUS BAR --- */
.status-bar {
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
    background: #080808;
    padding: 15px 0;
}

.status-grid {
    display: flex;
    justify-content: space-around;
    font-size: 0.85rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.status-item .label { color: #555; font-size: 0.7rem; }
.status-item .value { color: white; font-weight: bold; }
.status-item .value.online { color: #00ff41; text-shadow: 0 0 5px #00ff41; }

/* --- CHALLENGES SECTION --- */
.challenges {
    padding: 80px 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.section-header h2 { font-size: 1.5rem; color: white; }
.line-deco { flex: 1; height: 1px; background: #222; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* Card Design */
.card {
    background: var(--bg-card);
    border: 1px solid #222;
    padding: 25px;
    position: relative;
    transition: all 0.3s ease;
}

/* Tech corners */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    border-top: 2px solid var(--primary);
    border-right: 2px solid transparent;
    transition: width 0.3s, height 0.3s;
}
.card::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-bottom: 2px solid #333;
    border-right: 2px solid #333;
}

.card:hover {
    transform: translateY(-5px);
    border-color: #444;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card:hover::before {
    width: 30px;
    height: 30px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    background: #1a1a1a;
    border: 1px solid #333;
}

.points { color: var(--primary-bright); font-weight: bold; }

.card h3 { font-size: 1.2rem; margin-bottom: 10px; color: white; }
.card-desc { font-size: 0.85rem; color: #888; margin-bottom: 20px; min-height: 45px; }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #1a1a1a;
    padding-top: 15px;
}

.difficulty { font-size: 0.75rem; font-weight: bold; }
.easy { color: #00ff41; }
.medium { color: #ffae00; }
.hard { color: #ff1a1a; }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
}

.btn-icon:hover { color: var(--primary-bright); margin-right: -5px; }

/* Active/Solved States */
.card.active-target { border: 1px solid var(--primary); box-shadow: 0 0 15px rgba(139,0,0,0.1); }
.card.solved { opacity: 0.6; }
.card.solved h3 { text-decoration: line-through; }

/* --- FOOTER --- */
footer {
    padding: 40px 0;
    border-top: 1px solid #1a1a1a;
    text-align: center;
    color: #444;
    font-size: 0.8rem;
}

/* --- ANIMATIONS --- */
@keyframes blink { 50% { opacity: 0; } }

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 30px, 0); transform: translate(2px,0); }
    20% { clip: rect(80px, 9999px, 90px, 0); transform: translate(-2px,2px); }
    40% { clip: rect(10px, 9999px, 50px, 0); transform: translate(1px,-1px); }
    100% { clip: rect(40px, 9999px, 80px, 0); transform: translate(0,0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(60px, 9999px, 70px, 0); transform: translate(-1px,0); }
    20% { clip: rect(10px, 9999px, 30px, 0); transform: translate(2px,-2px); }
    40% { clip: rect(90px, 9999px, 100px, 0); transform: translate(-1px,2px); }
    100% { clip: rect(20px, 9999px, 40px, 0); transform: translate(0,0); }
}

/* Responsive */
@media(max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
    .nav-links { display: none; } /* Simplified for demo */
    .grid { grid-template-columns: 1fr; }
}