@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --primary: #0f0;
    /* Green */
    --primary-dim: #004d00;
    --secondary: #000;
    /* Black */
    --accent: #2ecc71;
    --danger: #ff003c;
    --text: #0f0;
    --scan-line-color: rgba(0, 255, 0, 0.1);
}

* {
    box-sizing: border-box;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    cursor: crosshair;
}

body {
    background-color: var(--secondary);
    color: var(--text);
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Desktop keeps hidden overflow */
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Scroll Fix */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        display: block;
    }
}

/* Background Effects */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(transparent 0%,
            rgba(0, 255, 0, 0.05) 50%,
            transparent 100%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
    animation: scanAnimation 10s linear infinite;
}

@keyframes scanAnimation {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.2;
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><text x="10" y="30" fill="%230f0" font-family="monospace" font-size="20">10101</text><text x="50" y="70" fill="%230f0" font-family="monospace" font-size="20">01010</text></svg>');
    animation: rain 2s linear infinite;
}

@keyframes rain {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100px;
    }
}

/* Layout */
.cyber-container {
    width: 95vw;
    height: 90vh;
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px var(--primary-dim), inset 0 0 50px var(--primary-dim);
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: rgba(0, 20, 0, 0.9);
    position: relative;
    z-index: 20;
    border-radius: 4px;
    /* Slightly rounded corners */
}

@media (max-width: 768px) {
    .cyber-container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        border: none;
        box-shadow: none;
        display: flex;
        flex-direction: column;
    }
}

/* Header */
.cyber-header {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 2px solid var(--primary);
    background: rgba(0, 50, 0, 0.3);
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
    gap: 10px;
}

@media (max-width: 768px) {
    .cyber-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .connection-status {
        font-size: 0.8rem;
        margin-top: 5px;
    }
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary);
    text-shadow: 2px 2px var(--danger);
    letter-spacing: 2px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.2;
    }
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Mobile Main Grid */
@media (max-width: 768px) {
    .main-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
        gap: 15px;
        padding: 10px;
    }
}

.left-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-col {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .right-col {
        height: 400px;
        /* Fixed height for feed simulation on mobile */
    }
}

.cyber-card {
    border: 1px solid var(--primary);
    padding: 15px;
    background: rgba(0, 10, 0, 0.6);
    position: relative;
}

.card-title {
    background: var(--primary);
    color: #000;
    padding: 5px 10px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Target Area */
.target-display {
    text-align: center;
    border: 1px dashed var(--primary);
}

.alien-avatar-frame {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary);
    background: #000;
}

.alien-svg {
    width: 80%;
    height: 80%;
    color: var(--primary);
    filter: drop-shadow(0 0 5px var(--primary));
}

.hacker-green {
    color: var(--primary);
    font-size: 1.4rem;
    margin: 10px 0;
    text-shadow: 0 0 5px var(--primary);
}

.status-blink {
    animation: blink 0.5s infinite;
    color: var(--danger);
}

/* Controls */
.controls {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#startScanBtn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 15px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

#startScanBtn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 30px var(--primary);
}

#startScanBtn:active {
    transform: scale(0.95);
}

.terminal-output {
    flex-grow: 1;
    background: #000;
    border: 1px solid var(--primary-dim);
    padding: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    overflow-y: auto;
    max-height: 200px;
    color: #aaa;
}

.terminal-output p {
    margin: 2px 0;
}

/* Feed */
.results-feed {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.feed-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 10px;
    border-bottom: 1px solid var(--primary);
    font-weight: bold;
    background: rgba(0, 255, 0, 0.1);
}

.feed-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.feed-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 8px;
    border-bottom: 1px solid var(--primary-dim);
    color: #ccc;
    font-size: 0.9rem;
    align-items: center;
}

/* Mobile Feed Fix */
@media (max-width: 768px) {

    .feed-header,
    .feed-row {
        grid-template-columns: 1fr 1fr;
        /* Reduce columns */
        font-size: 0.8rem;
        gap: 5px;
    }

    /* Hide Status and Time on very small screens if needed, or stack them */
    .feed-header span:nth-child(3),
    .feed-header span:nth-child(4),
    .feed-row span:nth-child(3),
    .feed-row span:nth-child(4) {
        display: none;
    }

    /* Show limited info */
    .feed-row span:nth-child(2) {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.feed-row:hover {
    background: rgba(0, 255, 0, 0.1);
    color: var(--primary);
}

.feed-row.critical {
    color: var(--danger);
    border-left: 3px solid var(--danger);
    animation: flash 0.5s;
}

@keyframes flash {
    0% {
        background-color: var(--danger);
        color: #fff;
    }

    100% {
        background-color: transparent;
    }
}

/* Footer */
.cyber-footer {
    border-top: 1px solid var(--primary);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    background: #000;
}

@media (max-width: 768px) {
    .cyber-footer {
        flex-direction: row;
        /* Keep horizontal but smaller */
        padding: 10px;
        gap: 5px;
        font-size: 0.8rem;
    }

    .stat-box {
        min-width: auto;
        flex: 1;
        text-align: center;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--primary-dim);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-value.danger {
    color: var(--danger);
    text-shadow: 0 0 10px var(--danger);
}

/* Glitch Effect used on large text */
.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    text-shadow: 1px 0 red;
    top: 0;
    color: rgb(250, 0, 0);
    background: black;
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
    animation: noise-anim-2 3s infinite linear alternate-reverse;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dim);
    border: 1px solid var(--primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}