/* === RED PROTOCOL — Shared Styles === */

body {
    background-color: #050505;
    color: #e0e0e0;
}

/* Panel System */
.panel {
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid #2a2a2a;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #111111;
    border-bottom: 1px solid #2a2a2a;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #888888;
    text-transform: uppercase;
}

/* Drone Reticle */
.reticle-container {
    position: absolute;
    inset: 10%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.reticle-container::before,
.reticle-container::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #cc2222;
}

.reticle-container::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.reticle-container::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.center-cross {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.center-cross::before,
.center-cross::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
}

.center-cross::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
}

.center-cross::after {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
}

/* Tactical Buttons */
.btn-tactical {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #e0e0e0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.btn-tactical:hover:not(:disabled) {
    border-color: #cc2222;
    background: rgba(204, 34, 34, 0.15);
    color: #fff;
}

.btn-tactical::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #cc2222;
    transform: scaleY(0);
    transition: transform 0.2s ease;
    transform-origin: bottom;
}

.btn-tactical:hover::before {
    transform: scaleY(1);
}

/* Animations */
@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse-slow {
    animation: pulse-slow 3s infinite;
}

/* Scanline Effect */
.scanlines {
    position: relative;
    overflow: hidden;
}

.scanlines::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 15;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Panel Entrance Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }

/* Boot Sequence Overlay */
#boot-sequence {
    position: fixed;
    inset: 0;
    background: #020402;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    color: #4caf50;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    overflow: hidden;
}

/* CRT curvature */
#boot-sequence::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.12) 2px,
        rgba(0, 0, 0, 0.12) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* CRT vignette */
#boot-sequence::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 2;
}

/* Phosphor glow on text */
#boot-text {
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.5), 0 0 20px rgba(76, 175, 80, 0.15);
    z-index: 1;
}

/* CRT flicker */
@keyframes boot-flicker {
    0%, 100% { opacity: 1; }
    4% { opacity: 0.95; }
    8% { opacity: 1; }
    42% { opacity: 0.97; }
    44% { opacity: 1; }
    78% { opacity: 0.96; }
    80% { opacity: 1; }
}

#boot-sequence.boot-active {
    animation: boot-flicker 4s infinite;
}

/* Screen shake for WARNING lines */
@keyframes boot-shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, 1px); }
    30% { transform: translate(2px, -1px); }
    50% { transform: translate(-1px, -2px); }
    70% { transform: translate(1px, 2px); }
    90% { transform: translate(-2px, -1px); }
}

.boot-shake {
    animation: boot-shake 0.3s ease-out;
}

/* Block cursor */
.boot-cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    background: #4caf50;
    vertical-align: text-bottom;
    animation: boot-cursor-blink 0.8s step-end infinite;
}

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

/* Static noise canvas */
#boot-static {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
}

.boot-hidden {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* HUD Tracking Box */
.hud-tracking-box {
    transition: top 2.5s ease-in-out, left 2.5s ease-in-out;
}

.hud-tracking-box::before {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid rgba(204, 34, 34, 0.4);
    animation: hud-sweep 3s linear infinite;
}

@keyframes hud-sweep {
    0% { clip-path: inset(0 100% 0 0); }
    25% { clip-path: inset(0 0 0 0); }
    50% { clip-path: inset(0 0 0 100%); }
    75% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 100% 0 0); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a;
}

::-webkit-scrollbar-thumb:hover {
    background: #cc2222;
}

/* === LEADERBOARD === */

/* Difficulty Tabs */
.lb-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-align: center;
    color: #666666;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.lb-tab:hover {
    color: #aaaaaa;
}

.lb-tab--active {
    color: #cc2222;
    border-bottom-color: #cc2222;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.lb-th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #888888;
    text-transform: uppercase;
    border-bottom: 1px solid #2a2a2a;
    white-space: nowrap;
}

.lb-th--rank,
.lb-td--rank {
    text-align: center;
    width: 3.5rem;
}

.lb-th--score,
.lb-td--score {
    text-align: right;
    font-weight: 700;
}

.lb-th--stat,
.lb-td--stat {
    text-align: center;
}

.lb-td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(42, 42, 42, 0.4);
    color: #e0e0e0;
    white-space: nowrap;
}

.lb-td--name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-row {
    transition: background 0.15s ease;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Podium */
.lb-rank-1 .lb-td--rank { color: #ffd700; font-weight: 700; }
.lb-rank-1 .lb-td--name { color: #ffd700; }
.lb-rank-1 { background: rgba(255, 215, 0, 0.04); }

.lb-rank-2 .lb-td--rank { color: #c0c0c0; font-weight: 700; }
.lb-rank-2 .lb-td--name { color: #c0c0c0; }
.lb-rank-2 { background: rgba(192, 192, 192, 0.03); }

.lb-rank-3 .lb-td--rank { color: #cd7f32; font-weight: 700; }
.lb-rank-3 .lb-td--name { color: #cd7f32; }
.lb-rank-3 { background: rgba(205, 127, 50, 0.03); }

/* Status */
.lb-status {
    text-align: center;
    padding: 1.5rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: #888888;
    text-transform: uppercase;
}

.lb-status--error {
    color: #cc2222;
}

.lb-empty {
    text-align: center;
    padding: 2rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.lb-retry {
    margin-top: 0.75rem;
    padding: 0.5rem 1.5rem;
    font-size: 10px;
}

/* Skeleton loader */
.lb-skeleton td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(42, 42, 42, 0.4);
}

.lb-skeleton-bar {
    height: 14px;
    background: linear-gradient(90deg, #1a1a1a 25%, #222222 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: lb-shimmer 1.5s infinite;
    border-radius: 2px;
}

@keyframes lb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
