/* ============================================================
   w4ttz :: alive.css
   Theme: INDIGO / BLACK / PURPLE / HOLO CYAN
   ============================================================ */

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

:root {
    --bg-void: #0a0714;
    --bg-deep: #120b22;
    --bg-panel: #1a1030;
    --bg-elevated: #221741;
    --bg-input: #0d0820;

    --purple-900: #2a1a4a;
    --purple-700: #4c2a7a;
    --purple-500: #7b3fa0;
    --purple-400: #9d4edd;
    --purple-300: #c77dff;
    --purple-200: #e0aaff;

    --holo-cyan: #00e5ff;
    --holo-glow: #7df9ff;
    --holo-soft: #a8f0ff;

    --text-primary: #e0aaff;
    --text-bright: #f0d9ff;
    --text-dim: #9d7ab8;
    --text-faint: #5a4278;

    --success: #7df9ff;
    --danger: #ff4d6d;
    --warning: #ffb347;
}

body {
    font-family: 'Courier New', monospace;
    background: var(--bg-void);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* ---------- Background layers & Background-Only CRT Effect (#crt-bg) ---------- */

.crt-bg {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.crt-bg-content {
    position: absolute;
    inset: 0;
    animation: crtBrightness 6.5s infinite steps(1);
    will-change: transform, filter;
}

.crt-bg.crt-slip .crt-bg-content {
    animation:
        crtBrightness 6.5s infinite steps(1),
        crtSlip 0.28s steps(2) infinite;
    filter: drop-shadow(-1px 0 0 rgba(255, 50, 90, 0.25)) drop-shadow(1px 0 0 rgba(0, 229, 255, 0.3));
}

@keyframes crtBrightness {
    0%, 100% { filter: brightness(1)    contrast(1.03) saturate(1.04); }
    14%      { filter: brightness(0.98) contrast(1.04) saturate(1.02); }
    15%      { filter: brightness(1.02) contrast(1.02) saturate(1.05); }
    42%      { filter: brightness(0.99) contrast(1.03) saturate(1.04); }
    43%      { filter: brightness(0.96) contrast(1.05) saturate(1.02); }
    44%      { filter: brightness(1.02) contrast(1.03) saturate(1.05); }
    77%      { filter: brightness(0.98) contrast(1.04) saturate(1.03); }
    78%      { filter: brightness(1.03) contrast(1.01) saturate(1.06); }
}

@keyframes crtSlip {
    0%   { transform: translate3d(0, 0, 0) skewX(0deg); }
    25%  { transform: translate3d(-1.5px, 0.3px, 0) skewX(-0.2deg); }
    50%  { transform: translate3d(2px, -0.3px, 0) skewX(0.3deg); }
    75%  { transform: translate3d(-1px, 0, 0) skewX(-0.1deg); }
    100% { transform: translate3d(0, 0, 0) skewX(0deg); }
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(157, 78, 221, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(157, 78, 221, 0.07) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    animation: gridScroll 20s linear infinite;
    pointer-events: none;
}

@keyframes gridScroll {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.crt-roll {
    position: absolute;
    left: 0; right: 0;
    top: -28%;
    height: 24%;
    background: linear-gradient(
        180deg,
        rgba(0, 229, 255, 0)      0%,
        rgba(0, 229, 255, 0.055)  38%,
        rgba(224, 170, 255, 0.09) 52%,
        rgba(0, 0, 0, 0.24)       72%,
        rgba(0, 229, 255, 0)      100%
    );
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 3;
    animation: crtRoll 5.7s linear infinite;
}

@keyframes crtRoll {
    0%   { top: -28%; }
    100% { top: 112%; }
}

.crt-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    opacity: 0.16;
    mix-blend-mode: screen;
    background-image:
        radial-gradient(rgba(0, 229, 255, 0.55) 1px, transparent 1px),
        radial-gradient(rgba(224, 170, 255, 0.4) 1px, transparent 1px);
    background-size: 3px 3px, 5px 5px;
    background-position: 0 0, 1px 2px;
    animation: crtGrainShift 0.9s steps(3) infinite;
}

@keyframes crtGrainShift {
    0%   { background-position: 0 0,    1px 2px; }
    33%  { background-position: 1px 2px, 0   1px; }
    66%  { background-position: 2px 1px, 2px 0;   }
    100% { background-position: 0 0,    1px 2px; }
}

.scanlines {
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0)    0px,
            rgba(0, 0, 0, 0)    1px,
            rgba(0, 0, 0, 0.28) 2px,
            rgba(0, 0, 0, 0.28) 3px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 0, 80, 0.02)  0px,
            rgba(0, 255, 180, 0.02) 1px,
            rgba(0, 180, 255, 0.02) 2px,
            rgba(0, 0, 0, 0)        3px
        );
    pointer-events: none;
    z-index: 5;
    animation: crtScanShift 0.8s linear infinite;
    opacity: 0.65;
}

@keyframes crtScanShift {
    0%   { transform: translateY(0); }
    100% { transform: translateY(3px); }
}

canvas.crt-noise {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    opacity: 0.04;
    mix-blend-mode: screen;
    image-rendering: pixelated;
    transition: opacity 120ms linear;
}
canvas.crt-noise.crt-burst {
    opacity: 0.16;
}

/* Phosphor edge vignette bloom */
.crt-glass {
    position: absolute; inset: 0; z-index: 5; pointer-events: none;
    background: radial-gradient(ellipse at 50% 48%, transparent 50%, rgba(5, 2, 14, 0.35) 75%, rgba(0, 0, 4, 0.82) 100%);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.85), inset 0 0 45px rgba(0, 229, 255, 0.18), inset 0 0 80px rgba(157, 78, 221, 0.22);
}

.crt-glow {
    position: absolute; inset: 0;
    background: radial-gradient(
        ellipse 95% 85% at 50% 50%,
        rgba(0, 229, 255, 0.12) 0%,
        rgba(157, 78, 221, 0.16) 45%,
        rgba(10, 7, 20, 0.70) 80%,
        rgba(2, 0, 8, 0.95) 100%
    );
    z-index: 0;
    pointer-events: none;
    animation: pulseCrtGlow 4.5s ease-in-out infinite alternate;
}

@keyframes pulseCrtGlow {
    0% {
        opacity: 0.75;
        filter: brightness(0.95) saturate(1.1);
    }
    50% {
        opacity: 1.0;
        filter: brightness(1.22) saturate(1.35);
    }
    100% {
        opacity: 0.85;
        filter: brightness(1.05) saturate(1.15);
    }
}

.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    top: 0;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--purple-200);
    /* Matches artemis_run's mote glow so the field reads the same everywhere */
    box-shadow: 0 0 8px 1px var(--purple-300), 0 0 18px 3px rgba(157, 78, 221, 0.45);
    animation: floatParticle linear infinite;
    opacity: 0;
    will-change: transform, opacity;
}

.particle.cyan {
    background: var(--holo-glow);
    box-shadow: 0 0 10px 1px var(--holo-cyan), 0 0 22px 4px rgba(0, 229, 255, 0.5);
}

@keyframes floatParticle {
    0%   { opacity: 0; transform: translateY(112vh) scale(0.4); }
    6%   { opacity: 1; }
    94%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-9vh) scale(1.15); }
}

/* ---------- Layout ---------- */

.container {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: var(--purple-200);
    text-shadow:
        0 0 10px rgba(157, 78, 221, 0.6),
        0 0 20px rgba(157, 78, 221, 0.4),
        0 0 40px rgba(0, 229, 255, 0.15);
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 8px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.subtitle {
    text-align: center;
    color: var(--holo-cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    letter-spacing: 4px;
    margin-bottom: 30px;
    animation: subtitlePulse 2s ease-in-out infinite;
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 0.65; }
    50%      { opacity: 1; }
}

/* ---------- Card ---------- */

.code-container {
    background: rgba(18, 11, 34, 0.68);
    border-radius: 8px;
    margin-bottom: 25px;
    overflow: hidden;
    border: 1px solid rgba(157, 78, 221, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.code-container:hover {
    border-color: rgba(199, 125, 255, 0.5);
    box-shadow: 0 0 40px rgba(157, 78, 221, 0.18);
}

.code-header {
    background: linear-gradient(
        90deg,
        rgba(26, 16, 48, 0.72) 0%,
        rgba(34, 23, 65, 0.72) 100%
    );
    color: var(--purple-200);
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid rgba(157, 78, 221, 0.25);
}

.code-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.code-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Badges ---------- */

.public-badge {
    background: rgba(0, 229, 255, 0.15);
    color: var(--holo-cyan);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    border: 1px solid rgba(0, 229, 255, 0.25);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.user-badge {
    background: rgba(255, 179, 71, 0.15);
    color: var(--warning);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    border: 1px solid rgba(255, 179, 71, 0.3);
}

.public-badge.denied-badge {
    background: rgba(255, 77, 109, 0.15);
    color: var(--danger);
    border-color: rgba(255, 77, 109, 0.3);
    text-shadow: 0 0 8px rgba(255, 77, 109, 0.3);
}

/* ---------- Author / labels ---------- */

.snippet-author {
    color: var(--holo-cyan);
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.author-tooltip {
    cursor: help;
    border-bottom: 1px dashed var(--holo-cyan);
}

.language-label {
    background: rgba(157, 78, 221, 0.25);
    color: var(--purple-200);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    border: 1px solid rgba(199, 125, 255, 0.3);
}

/* ---------- Table ---------- */

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 18px;
    text-align: left;
    font-size: 13px;
    font-family: 'Fira Code', 'Courier New', monospace;
    border-bottom: 1px solid rgba(157, 78, 221, 0.12);
}

th {
    color: var(--holo-cyan);
    background: rgba(157, 78, 221, 0.06);
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
    font-weight: normal;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

td:first-child {
    color: var(--text-faint);
    letter-spacing: 1px;
    width: 35%;
}

td.ok {
    color: var(--holo-soft);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

td.bad {
    color: var(--danger);
    text-shadow: 0 0 8px rgba(255, 77, 109, 0.3);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(157, 78, 221, 0.04);
}

/* ---------- Timestamp / errors ---------- */

.timestamp {
    font-size: 0.8em;
    color: var(--text-faint);
    margin-top: 5px;
    padding: 5px 15px 10px;
    font-family: 'Courier New', monospace;
}

.error-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--danger);
    text-shadow: 0 0 12px rgba(255, 77, 109, 0.4);
    letter-spacing: 3px;
    font-size: 1rem;
}

/* ---------- Status bar ---------- */

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 20px;
    background: rgba(10, 7, 20, 0.95);
    border-top: 1px solid rgba(157, 78, 221, 0.2);
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-faint);
    z-index: 10;
    font-family: 'Courier New', monospace;
    backdrop-filter: blur(5px);
}

.status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-bar .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--holo-cyan);
    box-shadow: 0 0 8px var(--holo-cyan);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

/* ---------- Selection & scrollbar ---------- */

::selection {
    background: rgba(0, 229, 255, 0.3);
    color: var(--text-bright);
}

::-moz-selection {
    background: rgba(0, 229, 255, 0.3);
    color: var(--text-bright);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--purple-500) rgba(13, 8, 32, 0.85);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(13, 8, 32, 0.85);
    border: 1px solid rgba(157, 78, 221, 0.18);
    border-radius: 5px;
    box-shadow: inset 0 0 8px rgba(10, 7, 20, 0.9);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--purple-700) 0%, var(--purple-400) 60%, rgba(0, 229, 255, 0.75) 100%);
    border-radius: 5px;
    border: 1px solid rgba(0, 229, 255, 0.35);
    box-shadow: 0 0 8px rgba(157, 78, 221, 0.4);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--purple-500) 0%, var(--holo-cyan) 100%);
    border-color: var(--holo-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.65);
}

::-webkit-scrollbar-corner {
    background: rgba(13, 8, 32, 0.85);
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: 5px;
    }

    .code-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .code-header-right {
        width: 100%;
        flex-wrap: wrap;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 12px;
    }

    td:first-child {
        width: 45%;
    }
}
