/* ═══════════════════════════════════════════════
   HIRAETH // SIGNAL — Design System v3.0
   Complete Rebuild
   ═══════════════════════════════════════════════ */

:root {
    --bg: #030303;
    --bg-deep: #010101;
    --fg: #e8e8e8;
    --dim: #8a8a8a;
    --dim-dark: #3a3a3a;
    --accent: #c0392b;
    --accent-glow: rgba(192, 57, 43, 0.4);
    --accent-dim: rgba(192, 57, 43, 0.15);
    --gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.3);
    --cyan: #00b4d8;
    --cyan-glow: rgba(0, 180, 216, 0.3);
    --violet: #9b59b6;
    --violet-glow: rgba(155, 89, 182, 0.3);
    --terminal-bg: rgba(3, 3, 3, 0.92);
    --glass: rgba(255, 255, 255, 0.03);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(192, 57, 43, 0.3);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: var(--fg);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'JetBrains Mono', 'Share Tech Mono', monospace;
    overflow: hidden;
    cursor: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (hover: hover) {
    body.loaded {
        cursor: none;
    }
}

/* ═══ LAYERS ═══ */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#canvas-bg {
    z-index: 1;
}

#canvas-fx {
    z-index: 2;
}

#grain-layer {
    z-index: 5;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.4s steps(6) infinite;
}

@keyframes grain {
    0% {
        transform: translate(0, 0);
    }

    16% {
        transform: translate(-5%, 5%);
    }

    33% {
        transform: translate(5%, -5%);
    }

    50% {
        transform: translate(-5%, -5%);
    }

    66% {
        transform: translate(5%, 5%);
    }

    83% {
        transform: translate(-2%, 3%);
    }

    100% {
        transform: translate(0, 0);
    }
}

#scanlines {
    z-index: 6;
    background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 0, 0, 0.15) 1px, rgba(0, 0, 0, 0.15) 2px);
    opacity: 0.35;
    animation: scanPulse 8s ease-in-out infinite;
}

@keyframes scanPulse {

    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.25;
    }
}

#vignette {
    z-index: 7;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.5) 70%, rgba(0, 0, 0, 0.95) 100%);
    transition: all 1s ease;
}

#vignette.pulse {
    background: radial-gradient(ellipse at center, transparent 15%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.98) 100%);
}

/* ═══ BOOT SEQUENCE ═══ */
#boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-deep);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}

#boot-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#boot-overlay.hidden {
    display: none;
}

#boot-content {
    width: 90%;
    max-width: 700px;
    font-family: 'Share Tech Mono', 'JetBrains Mono', monospace;
}

#boot-ascii {
    font-size: clamp(0.35rem, 1.2vw, 0.7rem);
    color: var(--accent);
    line-height: 1.2;
    text-align: center;
    opacity: 0;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px var(--accent-glow);
    animation: fadeFlicker 0.5s forwards 0.3s;
    white-space: pre;
    overflow: hidden;
}

#boot-log {
    font-size: 0.65rem;
    color: var(--dim);
    line-height: 1.8;
    max-height: 180px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 100%);
}

#boot-log .log-line {
    opacity: 0;
    animation: logIn 0.15s forwards;
}

#boot-log .log-line.ok {
    color: var(--gold);
}

#boot-log .log-line.err {
    color: var(--accent);
}

#boot-log .log-line.sys {
    color: var(--cyan);
}

@keyframes logIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#boot-progress-bar {
    width: 100%;
    height: 2px;
    background: var(--dim-dark);
    margin-bottom: 0.5rem;
    overflow: hidden;
    border-radius: 1px;
}

#boot-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transition: width 0.15s linear;
    box-shadow: 0 0 8px var(--accent-glow);
}

#boot-status {
    font-size: 0.6rem;
    letter-spacing: 0.3em;
    color: var(--dim);
    text-align: center;
}

@keyframes fadeFlicker {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.3;
    }

    70% {
        opacity: 0.9;
    }

    100% {
        opacity: 1;
    }
}

/* ═══ SCREENS ═══ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 11;
}

.screen-inner.center-content {
    justify-content: center;
}

.screen-inner.scrollable {
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    padding: 80px 20px 120px;
    scrollbar-width: thin;
    scrollbar-color: var(--dim-dark) transparent;
}

.screen-inner.scrollable::-webkit-scrollbar {
    width: 3px;
}

.screen-inner.scrollable::-webkit-scrollbar-thumb {
    background: var(--dim-dark);
    border-radius: 2px;
}

/* ═══ TRANSITION OVERLAY ═══ */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ═══ TITLE (Main Screen) ═══ */
#title-group {
    position: relative;
    text-align: center;
}

.title-decoration {
    font-size: 0.7rem;
    color: var(--dim-dark);
    letter-spacing: 0.5em;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 1s ease 0.8s;
}

.title-decoration.bottom {
    margin-top: 1rem;
    margin-bottom: 0;
}

.title-decoration.visible {
    opacity: 0.4;
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 10vw, 7rem);
    font-weight: 700;
    letter-spacing: 0.6em;
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
    margin-right: -0.6em;
    color: var(--fg);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1), 0 0 60px rgba(192, 57, 43, 0.05);
    position: relative;
    transition: all 1.5s ease;
    opacity: 0;
}

h1.revealed {
    opacity: 0.95;
}

h1.blur-out {
    opacity: 0.05;
    filter: blur(8px);
    transform: scale(0.9);
    letter-spacing: 1.2em;
}

h1::before,
h1::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

h1.glitch-active::before {
    color: var(--accent);
    animation: glitchClip 0.3s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    transform: translate(-3px, -1px);
    opacity: 0.7;
}

h1.glitch-active::after {
    color: var(--cyan);
    animation: glitchClip2 0.3s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    transform: translate(3px, 1px);
    opacity: 0.7;
}

@keyframes glitchClip {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 25%, 0 25%);
        transform: translate(-2px, 0);
    }

    25% {
        clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
        transform: translate(2px, -1px);
    }

    50% {
        clip-path: polygon(0 10%, 100% 10%, 100% 40%, 0 40%);
        transform: translate(-1px, 1px);
    }

    75% {
        clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
        transform: translate(3px, 0);
    }

    100% {
        clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
        transform: translate(-2px, -1px);
    }
}

@keyframes glitchClip2 {
    0% {
        clip-path: polygon(0 65%, 100% 65%, 100% 90%, 0 90%);
        transform: translate(2px, 1px);
    }

    25% {
        clip-path: polygon(0 50%, 100% 50%, 100% 70%, 0 70%);
        transform: translate(-3px, 0);
    }

    50% {
        clip-path: polygon(0 70%, 100% 70%, 100% 95%, 0 95%);
        transform: translate(1px, -1px);
    }

    75% {
        clip-path: polygon(0 55%, 100% 55%, 100% 75%, 0 75%);
        transform: translate(-2px, 1px);
    }

    100% {
        clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
        transform: translate(3px, 1px);
    }
}

.subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.55rem, 1.5vw, 0.8rem);
    font-weight: 300;
    letter-spacing: 0.5em;
    color: var(--dim);
    opacity: 0;
    transition: opacity 1s ease 0.5s;
    margin-right: -0.5em;
}

.subtitle.visible {
    opacity: 0.6;
}

.status-text {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    margin-right: -0.3em;
    color: var(--dim);
    height: 20px;
    text-transform: uppercase;
    margin-top: 3rem;
    transition: all 0.3s;
}

.status-text.glitch {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
    animation: statusGlitch 0.15s infinite;
}

@keyframes statusGlitch {
    0% {
        transform: translate(0);
        filter: none;
    }

    20% {
        transform: translate(-2px, 1px);
    }

    40% {
        transform: translate(2px, -1px);
        filter: blur(0.5px);
    }

    60% {
        transform: translate(-1px, -1px);
    }

    80% {
        transform: translate(1px, 2px);
        filter: blur(0.3px);
    }

    100% {
        transform: translate(0);
        filter: none;
    }
}

#sync-ring {
    position: fixed;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: 15;
    transform: translate(-50%, -50%) scale(0);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 20px var(--accent-glow);
}

#sync-ring.active {
    opacity: 0.6;
}

/* ═══ PAGE HEADERS ═══ */
.page-header {
    width: 100%;
    max-width: 900px;
    margin-bottom: 2rem;
    text-align: center;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: inherit;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1.5rem;
    display: inline-block;
    border-radius: 2px;
}

.back-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-dim);
}

.page-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.2rem, 4vw, 2rem);
    letter-spacing: 0.3em;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 0 20px rgba(192, 57, 43, 0.1);
}

.page-subtitle {
    font-size: 0.65rem;
    color: var(--dim);
    letter-spacing: 0.2em;
}

.page-line {
    width: 60%;
    max-width: 300px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--dim-dark), transparent);
    margin: 1.5rem auto 0;
}

.overlay-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 20px;
    background: linear-gradient(to bottom, var(--bg) 60%, transparent);
}

/* ═══ NEXUS ═══ */
.nexus-header {
    text-align: center;
    padding: 40px 20px 20px;
    flex-shrink: 0;
}

.nexus-logo {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    letter-spacing: 0.4em;
    color: var(--fg);
    margin-bottom: 0.5rem;
}

.nexus-status {
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    color: var(--gold);
    opacity: 0.7;
    animation: statusPulse 4s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.4;
    }
}

.nexus-signal-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 10px;
}

.signal-segment {
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    opacity: 0.3;
    transition: height 0.3s, opacity 0.3s;
}

.signal-segment.active {
    opacity: 1;
}

/* Nav Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 30px;
    max-width: 900px;
    width: 100%;
    flex-shrink: 0;
}

.nav-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    padding: 24px 20px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: var(--fg);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transition: width 0.4s ease;
}

.nav-card:hover::before,
.nav-card:active::before {
    width: 100%;
}

.nav-card:hover,
.nav-card:active {
    border-color: var(--border-accent);
    background: rgba(192, 57, 43, 0.03);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px var(--accent-dim);
}

.nav-card-icon {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--accent);
    opacity: 0.8;
}

.nav-card-title {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    margin-bottom: 6px;
}

.nav-card-desc {
    font-size: 0.65rem;
    color: var(--dim);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.nav-card-count {
    font-size: 0.6rem;
    color: var(--dim-dark);
    letter-spacing: 0.15em;
}

.nav-card.locked {
    opacity: 0.4;
    border-color: rgba(255, 255, 255, 0.03);
}

.nav-card.locked:hover {
    opacity: 0.6;
    border-color: var(--violet-glow);
    box-shadow: 0 0 20px var(--violet-glow);
}

/* ═══ FRAGMENTS ═══ */
.fragment-container {
    z-index: 20;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.fragment {
    position: absolute;
    transform: translate(-50%, -50%);
    background: transparent;
    border: 1px solid transparent;
    color: var(--dim);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0;
    padding: 20px 30px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
    will-change: transform;
}

.fragment.visible {
    opacity: 1;
    animation: fragmentDrift 10s ease-in-out infinite alternate;
}

.fragment::before {
    content: '[ ';
    opacity: 0;
    transition: opacity 0.3s;
    color: var(--accent);
}

.fragment::after {
    content: ' ]';
    opacity: 0;
    transition: opacity 0.3s;
    color: var(--accent);
}

.fragment:hover,
.fragment:active {
    color: var(--fg);
    letter-spacing: 0.5em;
    text-shadow: 0 0 15px var(--accent-glow), 0 0 30px var(--accent-glow);
    border-color: var(--accent-dim);
    background: rgba(192, 57, 43, 0.03);
    transform: translate(-50%, -50%) scale(1.05);
    z-index: 25;
}

.fragment:hover::before,
.fragment:hover::after,
.fragment:active::before,
.fragment:active::after {
    opacity: 1;
}

@keyframes fragmentDrift {
    0% {
        transform: translate(-50%, -50%) translateY(0) rotate(0deg);
    }

    33% {
        transform: translate(-50%, -50%) translateY(-8px) rotate(0.3deg);
    }

    66% {
        transform: translate(-50%, -50%) translateY(-4px) rotate(-0.2deg);
    }

    100% {
        transform: translate(-50%, -50%) translateY(-12px) rotate(0.1deg);
    }
}

/* ═══ TERMINAL ═══ */
.terminal-wrapper {
    position: absolute;
    bottom: 30px;
    left: 30px;
    z-index: 30;
    font-size: 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
    max-width: 520px;
    width: calc(100% - 60px);
    background: var(--terminal-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.terminal-wrapper.visible {
    opacity: 1;
    pointer-events: auto;
    border-color: var(--dim-dark);
}

.terminal-wrapper.active-input {
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-dim), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
}

.terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.6;
}

.terminal-dot.red {
    background: #e74c3c;
}

.terminal-dot.yellow {
    background: #f39c12;
}

.terminal-dot.green {
    background: #2ecc71;
}

.terminal-title {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--dim-dark);
    margin-left: auto;
}

.terminal-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.05) 2px, rgba(0, 0, 0, 0.05) 4px);
    pointer-events: none;
    z-index: 1;
}

.shortcut-bar {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
}

.shortcut-bar::-webkit-scrollbar {
    height: 0;
}

.shortcut-btn {
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    padding: 3px 8px;
    cursor: pointer;
    text-transform: uppercase;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
    letter-spacing: 0.1em;
    border-radius: 2px;
}

.shortcut-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 8px var(--accent-dim);
}

.shortcut-btn.mobile-only {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .shortcut-btn.mobile-only {
        display: block;
    }
}

.term-history {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 170px;
    overflow-y: auto;
    overflow-x: hidden;
    mask-image: linear-gradient(to top, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, black 85%, transparent 100%);
    padding: 10px 12px 4px 12px;
    position: relative;
    z-index: 2;
}

.term-history::-webkit-scrollbar {
    width: 2px;
}

.term-history::-webkit-scrollbar-thumb {
    background: var(--dim-dark);
}

.term-line {
    opacity: 1;
    word-break: break-word;
    line-height: 1.5;
    font-size: 0.7rem;
}

.term-line.sys {
    color: var(--gold);
}

.term-line.err {
    color: var(--accent);
}

.term-line.user {
    color: var(--fg);
    opacity: 0.5;
}

.term-line.info {
    color: var(--cyan);
}

.term-line.poem {
    color: var(--dim);
    font-style: italic;
}

.term-line.void {
    color: var(--violet);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg);
    min-height: 20px;
    position: relative;
    padding: 6px 12px 10px;
    z-index: 2;
}

.prompt-char {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.caret {
    width: 7px;
    height: 14px;
    background: var(--fg);
    animation: caretBlink 1s step-end infinite;
    flex-shrink: 0;
}

@keyframes caretBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

#hidden-input {
    position: absolute;
    opacity: 0;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    cursor: text;
}

.placeholder {
    color: var(--dim-dark);
    position: absolute;
    left: 32px;
    pointer-events: none;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    animation: placeholderPulse 3s ease-in-out infinite;
}

@keyframes placeholderPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.2;
    }
}

/* ═══ ARCHIVE ═══ */
.archive-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 2rem;
    max-width: 700px;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: inherit;
    font-size: 0.6rem;
    padding: 5px 14px;
    cursor: pointer;
    letter-spacing: 0.15em;
    transition: all 0.3s;
    text-transform: uppercase;
    border-radius: 2px;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px var(--accent-dim);
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 700px;
}

.archive-entry {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.archive-entry::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.archive-entry:hover::before,
.archive-entry:active::before {
    opacity: 1;
}

.archive-entry:hover,
.archive-entry:active {
    border-color: var(--border-accent);
    background: rgba(192, 57, 43, 0.02);
    transform: translateX(4px);
}

.archive-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.archive-entry-id {
    font-size: 0.55rem;
    color: var(--accent);
    letter-spacing: 0.15em;
}

.archive-entry-date {
    font-size: 0.55rem;
    color: var(--dim-dark);
    letter-spacing: 0.1em;
}

.archive-entry-title {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
}

.archive-entry-preview {
    font-size: 0.65rem;
    color: var(--dim);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-entry-tag {
    display: inline-block;
    font-size: 0.5rem;
    padding: 2px 8px;
    margin-top: 8px;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    letter-spacing: 0.15em;
    border-radius: 2px;
    text-transform: uppercase;
}

.archive-entry-tag.origin {
    border-color: var(--gold);
    color: var(--gold);
}

.archive-entry-tag.discovery {
    border-color: var(--cyan);
    color: var(--cyan);
}

.archive-entry-tag.warning {
    border-color: var(--accent);
    color: var(--accent);
}

.archive-entry-tag.corrupted {
    border-color: var(--violet);
    color: var(--violet);
}

/* ═══ DOSSIER ═══ */
.dossier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 800px;
}

.dossier-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.dossier-card:hover,
.dossier-card:active {
    border-color: var(--border-accent);
    background: rgba(192, 57, 43, 0.02);
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.dossier-card-photo {
    width: 60px;
    height: 60px;
    border: 1px solid var(--dim-dark);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--dim-dark);
}

.dossier-card-photo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.1) 2px, rgba(0, 0, 0, 0.1) 4px);
}

.dossier-card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.dossier-card-role {
    font-size: 0.6rem;
    color: var(--accent);
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.dossier-card-status {
    font-size: 0.55rem;
    color: var(--dim);
    letter-spacing: 0.1em;
}

.dossier-card-status .active-status {
    color: var(--gold);
}

.dossier-card-status .missing-status {
    color: var(--accent);
}

.dossier-card-status .unknown-status {
    color: var(--violet);
}

.redacted {
    background: var(--fg);
    color: var(--fg);
    padding: 0 4px;
    cursor: help;
    transition: all 0.5s;
    position: relative;
}

.redacted:hover {
    background: transparent;
    color: var(--accent);
}

/* ═══ SIGNAL MAP ═══ */
.signal-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.node-info {
    position: fixed;
    z-index: 25;
    background: rgba(3, 3, 3, 0.95);
    border: 1px solid var(--dim-dark);
    padding: 20px;
    max-width: 300px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 2px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    transition: opacity 0.3s, transform 0.3s;
}

.node-info.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.node-info-title {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.node-info-type {
    font-size: 0.55rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.node-info-body {
    font-size: 0.7rem;
    color: var(--dim);
    line-height: 1.6;
}

.node-info-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--dim);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.node-info-close:hover {
    color: var(--accent);
}

.signal-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.6rem;
    color: var(--dim);
    letter-spacing: 0.1em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.active-dot {
    background: var(--gold);
    color: var(--gold);
}

.dormant-dot {
    background: var(--dim-dark);
    color: var(--dim-dark);
}

.corrupted-dot {
    background: var(--accent);
    color: var(--accent);
}

/* ═══ VOID ═══ */
.void-content {
    position: relative;
    overflow: hidden;
}

.void-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.2s steps(10) infinite;
}

.void-text-block {
    text-align: center;
    z-index: 5;
    margin-bottom: 40px;
}

.void-line {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    letter-spacing: 0.2em;
    color: var(--fg);
    margin: 10px 0;
    opacity: 0.8;
}

.v-glitch {
    animation: voidGlitch 3s ease-in-out infinite;
}

.v-glitch[data-speed="fast"] {
    animation-duration: 1.5s;
}

@keyframes voidGlitch {

    0%,
    90%,
    100% {
        transform: none;
        opacity: 0.8;
    }

    92% {
        transform: translate(-3px, 0) skewX(-2deg);
        opacity: 0.4;
    }

    94% {
        transform: translate(3px, 0) skewX(2deg);
        opacity: 0.9;
    }

    96% {
        transform: translate(-1px, -1px);
        opacity: 0.3;
    }

    98% {
        transform: translate(2px, 1px);
        opacity: 0.7;
    }
}

.void-transmissions {
    max-height: 200px;
    overflow: hidden;
    text-align: center;
    z-index: 5;
    font-size: 0.65rem;
    color: var(--violet);
    line-height: 2;
    letter-spacing: 0.1em;
}

.void-exit {
    z-index: 10;
    margin-top: 30px;
}

.void-exit-btn {
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: inherit;
    font-size: 0.7rem;
    padding: 10px 24px;
    cursor: pointer;
    letter-spacing: 0.2em;
    transition: all 0.3s;
    border-radius: 2px;
}

.void-exit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 20px var(--accent-dim);
}

.void-counter {
    font-size: 0.6rem;
    color: var(--dim-dark);
    letter-spacing: 0.15em;
    margin-top: 20px;
    z-index: 5;
}

/* ═══ CHRONICLE (TIMELINE) ═══ */
.chronicle-timeline {
    position: relative;
    width: 100%;
    max-width: 600px;
    padding-left: 30px;
}

.chronicle-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--dim-dark) 10%, var(--dim-dark) 90%, transparent);
}

.chronicle-entry {
    position: relative;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.6s ease;
}

.chronicle-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

.chronicle-entry::before {
    content: '◈';
    position: absolute;
    left: -26px;
    top: 16px;
    color: var(--accent);
    font-size: 0.6rem;
}

.chronicle-date {
    font-size: 0.55rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    margin-bottom: 6px;
}

.chronicle-title {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}

.chronicle-body {
    font-size: 0.65rem;
    color: var(--dim);
    line-height: 1.7;
}

/* ═══ CIPHER ═══ */
.cipher-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cipher-input-area {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 16px;
}

.cipher-input-area label {
    display: block;
    font-size: 0.6rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.cipher-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--fg);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    line-height: 1.6;
}

.cipher-textarea::placeholder {
    color: var(--dim-dark);
}

.cipher-methods {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cipher-method-btn {
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: inherit;
    font-size: 0.6rem;
    padding: 6px 14px;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.3s;
    border-radius: 2px;
}

.cipher-method-btn:hover,
.cipher-method-btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(0, 180, 216, 0.1);
}

.cipher-output {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 16px;
    font-size: 0.75rem;
    color: var(--gold);
    line-height: 1.6;
    min-height: 80px;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

.cipher-run-btn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: inherit;
    font-size: 0.7rem;
    padding: 10px 24px;
    cursor: pointer;
    letter-spacing: 0.2em;
    transition: all 0.3s;
    align-self: flex-start;
    border-radius: 2px;
}

.cipher-run-btn:hover {
    background: var(--accent);
    color: var(--fg);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ═══ MODAL ═══ */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 3, 3, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(5, 5, 5, 0.98);
    border: 1px solid var(--dim-dark);
    padding: 2.5rem;
    max-width: 620px;
    width: 90%;
    color: var(--fg);
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 60px rgba(192, 57, 43, 0.05);
    max-height: 80vh;
    overflow-y: auto;
}

#modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-glitch-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent));
    transition: width 0.6s ease;
}

#modal-overlay.active .modal-glitch-line {
    width: 100%;
}

.modal-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--accent);
    border-style: solid;
    transition: all 0.4s ease;
}

.tl {
    top: -1px;
    left: -1px;
    border-width: 1px 0 0 1px;
}

.tr {
    top: -1px;
    right: -1px;
    border-width: 1px 1px 0 0;
}

.bl {
    bottom: -1px;
    left: -1px;
    border-width: 0 0 1px 1px;
}

.br {
    bottom: -1px;
    right: -1px;
    border-width: 0 1px 1px 0;
}

#modal-overlay.active .modal-corner {
    width: 20px;
    height: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--dim-dark);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-label {
    font-size: 0.55rem;
    color: var(--accent);
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.modal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    letter-spacing: 0.15em;
}

.modal-id-wrap {
    font-size: 0.65rem;
    color: var(--dim-dark);
    letter-spacing: 0.1em;
}

.modal-body {
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--dim);
    border-left: 2px solid var(--accent);
    padding-left: 1.2rem;
    min-height: 60px;
}

.modal-btn {
    margin-top: 2rem;
    background: transparent;
    border: 1px solid var(--dim-dark);
    color: var(--dim);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0.6rem 1.2rem;
    float: right;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.modal-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 15px var(--accent-dim);
}

/* ═══ CURSOR ═══ */
#cursor-container {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100;
    mix-blend-mode: exclusion;
    opacity: 0;
    transition: opacity 0.8s;
}

body.loaded #cursor-container {
    opacity: 1;
}

@media (hover: none) and (pointer: coarse) {
    #cursor-container {
        display: none !important;
    }

    body,
    html {
        cursor: auto !important;
    }
}

.cursor-dot {
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.cursor-ring {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.23, 1, 0.32, 1),
        height 0.3s cubic-bezier(0.23, 1, 0.32, 1),
        border-color 0.3s, background 0.3s, border-radius 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-ring.held {
    width: 20px;
    height: 20px;
    background: var(--accent-glow);
    border-color: var(--accent);
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.bracket {
    position: absolute;
    width: 6px;
    height: 100%;
    border: 1px solid var(--fg);
    border-width: 1px 0;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.bracket.left {
    left: -6px;
    border-left: 1px solid var(--fg);
}

.bracket.right {
    right: -6px;
    border-right: 1px solid var(--fg);
}

.cursor-ring.hovering .bracket {
    opacity: 1;
    height: 75%;
}

.cursor-ring.hovering {
    width: 50px;
    height: 50px;
    border-color: var(--accent);
}

.trail-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    transition: opacity 0.4s;
}

/* ═══ SCREEN EFFECTS ═══ */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    animation: flash 0.6s ease-out forwards;
}

@keyframes flash {
    0% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
    }
}

body.shake-light {
    animation: shakeLight 0.1s infinite;
}

body.shake-heavy {
    animation: shakeHeavy 0.08s infinite;
}

@keyframes shakeLight {
    0% {
        transform: translate(0);
    }

    25% {
        transform: translate(-1px, 1px);
    }

    50% {
        transform: translate(1px, -1px);
    }

    75% {
        transform: translate(-1px, -1px);
    }

    100% {
        transform: translate(1px, 1px);
    }
}

@keyframes shakeHeavy {
    0% {
        transform: translate(0);
    }

    25% {
        transform: translate(-3px, 2px);
    }

    50% {
        transform: translate(3px, -2px);
    }

    75% {
        transform: translate(-2px, -3px);
    }

    100% {
        transform: translate(2px, 3px);
    }
}

/* ═══ RESPONSIVE ═══ */
@media screen and (max-width: 768px) {
    h1 {
        letter-spacing: 0.3em;
        margin-right: -0.3em;
    }

    .subtitle {
        font-size: 0.5rem;
    }

    .terminal-wrapper {
        left: 10px;
        bottom: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }

    .fragment {
        font-size: 0.7rem;
        padding: 15px 20px;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .modal-header {
        flex-direction: column;
        gap: 5px;
    }

    #boot-ascii {
        font-size: 0.3rem;
    }

    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 10px;
        padding: 15px;
    }

    .nav-card {
        padding: 18px 16px;
    }

    .dossier-grid {
        grid-template-columns: 1fr;
    }

    .overlay-header {
        padding: 15px;
    }

    .page-title {
        font-size: 1rem;
    }
}

@media screen and (max-width: 480px) {
    h1 {
        font-size: 2rem;
        letter-spacing: 0.2em;
        margin-right: -0.2em;
    }

    .status-text {
        font-size: 0.6rem;
    }

    .nav-grid {
        grid-template-columns: 1fr 1fr;
    }

    .archive-filters {
        gap: 4px;
    }

    .filter-btn {
        padding: 4px 10px;
        font-size: 0.55rem;
    }
}