:root {
    --bg: #050805; /* near-black */
    --green: #2aff6b; /* phosphor */
    --green-dim: #16c957; /* prompt */
    --green-ghost: rgba(42, 255, 107, .18);
    --scan: #0b140d;
    --bezel: #0b120b;
    --static: rgba(42, 255, 107, .05);
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    line-height: 1.5;
    /* Fullscreen terminal */
    overflow: hidden;
}

/* Fullscreen bezel / CRT curvature */
.crt {
    position: fixed;
    inset: 0;
    padding: 2.6vh 2.6vw;
    background: radial-gradient(1200px 800px at 50% 0%, #071107 0%, var(--bg) 62%);
}

.terminal {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 18px;
    padding: 2.4rem 2rem;
    overflow: hidden; /* hidden so scanlines overlay */
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .75));
    box-shadow: inset 0 0 55px rgba(0, 0, 0, .85), inset 0 0 1px #0a150a;
}

/* The scrollable content area inside */
.view {
    position: absolute;
    inset: 0;
    padding: 2.4rem 2rem;
    overflow: auto;
    color: var(--green);
    text-shadow: 0 0 2px rgba(42, 255, 107, .35);
    font-size: clamp(10px, 1.7vw, 16px);
}

.view {
    scrollbar-width: thin;                     /* Firefox */
    scrollbar-color: var(--green-dim) var(--bg);
}

.view::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.view::-webkit-scrollbar-thumb {
    background: var(--green-dim);
    border-radius: 4px;
}

.view::-webkit-scrollbar-track {
    background: var(--bg);
}

@media (max-width: 600px) {
    .view {
        font-size: clamp(6px, 1vw, 18px);
    }
}

.line {
    white-space: pre-wrap;
    min-height: 1.5em
}

.prompt {
    color: var(--green-dim)
}

/* Cursor */
.cursor {
    display: inline-block;
    width: 0.6ch;
    animation: blink 1s steps(1, end) infinite
}

@keyframes blink {
    50% {
        opacity: 0
    }
}

/* Faux screen lines + subtle roll + glare */
.terminal::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: /* scanlines */ repeating-linear-gradient(to bottom, rgba(255, 255, 255, .035) 0px, rgba(255, 255, 255, .035) 1px, transparent 3px, transparent 5px),
        /* fine pixel grid */ repeating-linear-gradient(to right, var(--static) 0px, transparent 1px, transparent 2px),
        /* glare */ radial-gradient(120% 85% at 50% -10%, rgba(255, 255, 255, .06), transparent 55%);
    mix-blend-mode: overlay;
    opacity: .35;
    animation: roll 9s linear infinite;
    border-radius: 18px;
}

@keyframes roll {
    0% {
        transform: translateY(0)
    }
    100% {
        transform: translateY(4px)
    }
}

/* Slight barrel distortion vignette */
.terminal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 18px;
    background: radial-gradient(100% 170% at 50% -10%, transparent 60%, rgba(0, 0, 0, .55));
}

/* HUD badge */
.badge {
    position: fixed;
    right: 1.2rem;
    bottom: 0.9rem;
    font-size: .75rem;
    letter-spacing: .08em;
    opacity: .5;
    user-select: none;
}

/* Controls */
.controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: .6rem;
    z-index: 2
}

.btn {
    appearance: none;
    border: 1px solid #0f1e0f;
    background: #081208;
    color: var(--green);
    box-shadow: inset 0 0 0 1px #0b160b;
    padding: .5rem .7rem;
    border-radius: 8px;
    font: 600 12px/1 ui-monospace, monospace;
    letter-spacing: .04em;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .2s ease;
    text-shadow: 0 0 2px rgba(42, 255, 107, .35);
}

.btn:hover {
    box-shadow: inset 0 0 0 1px #123412, 0 0 0 3px rgba(42, 255, 107, .15)
}

.btn:active {
    transform: translateY(1px)
}

::selection {
    background: rgba(42, 255, 107, .25)
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none
    }

    .terminal::after {
        animation: none
    }
}
