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

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    background: #030306;
    color: #f4f4ff;
    font-family: Arial, Helvetica, sans-serif;
}

/* HOME */
.home-body {
    overflow: hidden;
}

.home-page {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100svh;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 50px;
    overflow: hidden;
    background-image:
        linear-gradient(rgba(0,0,0,.12), rgba(0,0,0,.35), rgba(0,0,0,.86)),
        url("../images/logo.png");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.home-page.entering {
    animation: backgroundPulse 2.8s ease-in forwards;
}

@keyframes backgroundPulse {
    0% { filter: brightness(1) contrast(1); }
    30% { filter: brightness(1.25) contrast(1.25) hue-rotate(8deg); }
    55% { filter: brightness(.75) contrast(1.8) hue-rotate(-12deg); }
    100% { filter: brightness(0) contrast(2); }
}

.lem-portal {
    position: absolute;
    right: 7%;
    top: 28%;
    width: 36%;
    height: 26%;
    border: 0;
    background: transparent;
    cursor: crosshair;
    z-index: 20;
}

.lem-portal:focus-visible {
    outline: 1px solid rgba(255, 60, 190, .8);
    outline-offset: 6px;
}

.contact {
    position: relative;
    z-index: 10;
    padding: 16px 34px;
    border-radius: 50px;
    border: 1px solid rgba(255,80,200,.45);
    background: rgba(5,8,18,.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    font-size: 14px;
    letter-spacing: .05em;
    user-select: text;
    box-shadow: 0 0 40px rgba(255,0,170,.18);
    transition: .25s;
}

.contact:hover {
    border-color: rgba(0,220,255,.6);
    box-shadow: 0 0 50px rgba(0,220,255,.30);
}

.hide {
    display: none;
}

.rain-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .22;
    background-image: repeating-linear-gradient(105deg, rgba(255,255,255,.16) 0 1px, transparent 1px 9px);
    transform: translateY(-8%);
    animation: rain 1s linear infinite;
}

@keyframes rain {
    from { background-position: 0 0; }
    to { background-position: 0 120px; }
}

.scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .18;
    background: repeating-linear-gradient(to bottom, rgba(255,255,255,.08) 0 1px, transparent 1px 4px);
    mix-blend-mode: overlay;
}

.glitch-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    background-image: url("../images/logo.png");
    background-size: cover;
    background-position: center center;
    mix-blend-mode: screen;
}

.home-page.entering .glitch-layer {
    animation: glitchFrames .16s steps(2) infinite;
    opacity: .34;
}

@keyframes glitchFrames {
    0% { transform: translate(0,0); clip-path: inset(0 0 84% 0); }
    25% { transform: translate(-16px,4px); clip-path: inset(18% 0 52% 0); }
    50% { transform: translate(14px,-6px); clip-path: inset(46% 0 34% 0); }
    75% { transform: translate(-5px,10px); clip-path: inset(74% 0 8% 0); }
    100% { transform: translate(0,0); clip-path: inset(0 0 84% 0); }
}

.blackout {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: #000;
    opacity: 0;
    pointer-events: none;
}

.home-page.entering .blackout {
    animation: blackout 3s ease-in forwards;
}

@keyframes blackout {
    0%, 60% { opacity: 0; }
    100% { opacity: 1; }
}

/* VOID */
.void-body,
.memory-body,
.terminal-body {
    min-height: 100vh;
    background: #000;
    color: #d8e7ff;
    font-family: "Courier New", Courier, monospace;
}

.void-page,
.memory-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.void-box {
    text-align: left;
    line-height: 2.1;
    letter-spacing: .08em;
    text-shadow: 0 0 20px rgba(150, 210, 255, .25);
}

.bars {
    color: #6d7b93;
    margin: 12px 0;
}

.continue {
    display: inline-block;
    color: #ff4fba;
    text-decoration: none;
    margin-top: 18px;
}

.continue:hover {
    color: #7ee9ff;
}

/* MEMORY */
.memory-page {
    cursor: pointer;
    text-align: center;
}

.memory-line {
    font-size: clamp(18px, 3vw, 30px);
    letter-spacing: .04em;
    text-shadow: 0 0 18px rgba(255,255,255,.18);
}

.delayed {
    opacity: 0;
    margin-top: 28px;
    animation: appear 2s ease forwards;
    animation-delay: 8s;
}

.memory-hint {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    color: rgba(255,255,255,.28);
    font-size: 12px;
    letter-spacing: .2em;
    text-transform: uppercase;
}

@keyframes appear {
    to { opacity: 1; }
}

/* TERMINAL */
.terminal {
    min-height: 100vh;
    padding: clamp(18px, 4vw, 48px);
    font-size: clamp(14px, 2vw, 18px);
    line-height: 1.7;
    text-shadow: 0 0 14px rgba(90, 210, 255, .25);
}

#output {
    white-space: pre-wrap;
}

#terminalForm {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.prompt {
    color: #ff4fba;
}

#terminalInput {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #d8e7ff;
    font: inherit;
    caret-color: #ff4fba;
}

.terminal-line-muted {
    color: #6f7c91;
}

/* ARCHIVE / CITY */
.archive-page {
    min-height: 100vh;
    padding: clamp(24px, 5vw, 70px);
    font-family: "Courier New", Courier, monospace;
    color: #d8e7ff;
    text-shadow: 0 0 14px rgba(90, 210, 255, .18);
}

.archive-page h1 {
    font-size: clamp(24px, 4vw, 48px);
    font-weight: 400;
    margin-bottom: 12px;
    color: #ff4fba;
}

.archive-grid {
    display: grid;
    gap: 14px;
    max-width: 760px;
    margin-top: 34px;
}

.archive-file {
    border: 1px solid rgba(126, 233, 255, .18);
    background: rgba(255,255,255,.025);
    padding: 16px 18px;
}

.archive-file summary {
    cursor: pointer;
    color: #7ee9ff;
}

.archive-file div {
    margin-top: 16px;
    color: #d8e7ff;
    line-height: 1.8;
}

.archive-footer {
    margin-top: 34px;
}

.archive-page a {
    color: #ff4fba;
    text-decoration: none;
}

.archive-page a:hover {
    color: #7ee9ff;
}

.ascii-map {
    margin-top: 28px;
    color: #94a4bc;
    line-height: 1.6;
    overflow-x: auto;
}

.rare-home-message {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: #000;
    color: #d8e7ff;
    font-family: "Courier New", Courier, monospace;
    font-size: clamp(20px, 4vw, 44px);
    letter-spacing: .08em;
}

.silhouette {
    position: absolute;
    left: 12%;
    bottom: 28%;
    width: 38px;
    height: 120px;
    background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,.92));
    border-radius: 50% 50% 12px 12px;
    filter: blur(.2px);
    opacity: .42;
    pointer-events: none;
}

.silhouette::before {
    content: "";
    position: absolute;
    top: -24px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,.88);
    border-radius: 50%;
}

@media (max-width: 768px) {
    .home-page {
        padding: 20px 20px 35px;
        background-image:
            linear-gradient(rgba(0,0,0,.10), rgba(0,0,0,.30), rgba(0,0,0,.88)),
            url("../images/logo-mobile.png");
        background-position: 58% center;
    }

    .glitch-layer {
        background-image: url("../images/logo-mobile.png");
        background-position: 58% center;
    }

    .lem-portal {
        right: 3%;
        top: 37%;
        width: 50%;
        height: 18%;
    }

    .contact {
        width: 100%;
        max-width: 420px;
        text-align: center;
        font-size: 12px;
        line-height: 1.6;
        padding: 14px 18px;
        border-radius: 18px;
    }
}
