:root {
    --bg: #030605;
    --panel: #07120f;
    --glow: #45ffb5;
    --glow2: #22c98d;
    --text: #d7ffe9;
    --muted: #7eecc0;
    --danger: #ff4d7d;
    --bezel: #1b1f1d;
    --bezel2: #101312;
    --plastic: #2a2f2d;
    --shadow: 0 0 22px rgba(69, 255, 181, .18), 0 0 120px rgba(34, 201, 141, .10);
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: radial-gradient(1200px 900px at 50% 30%, #06110e 0%, var(--bg) 55%, #000 100%);
    color: var(--text);
    font-family: var(--mono);
    overflow-x: hidden;
}


/* ====== Layout root ====== */

.crt {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    position: relative;
}


/* ====== Monitor frame ====== */

.monitor {
    width: min(980px, 96vw);
    border-radius: 28px;
    background: linear-gradient(180deg, var(--bezel), var(--bezel2));
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03), 0 0 0 2px rgba(0, 0, 0, .35);
    padding: 18px;
    position: relative;
}

.monitorTop {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 10px 14px;
}

.monitorBadge {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badgeMark {
    letter-spacing: .18em;
    font-weight: 900;
    color: rgba(215, 255, 233, .85);
    font-size: .95rem;
}

.badgeSub {
    color: rgba(215, 255, 233, .55);
    font-size: .78rem;
    letter-spacing: .08em;
}

.monitorRight {
    display: flex;
    gap: 14px;
    align-items: center;
}

.power {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .05);
}

.powerLed {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(69, 255, 181, .95);
    box-shadow: 0 0 14px rgba(69, 255, 181, .65);
}

.powerTxt {
    font-size: .75rem;
    color: rgba(215, 255, 233, .65);
    letter-spacing: .12em;
}

.knobs {
    display: flex;
    gap: 10px
}

.knob {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .18), rgba(0, 0, 0, .28) 55%, rgba(0, 0, 0, .55));
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, .55);
}

.monitorBezel {
    position: relative;
    padding: 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .25));
    border: 1px solid rgba(255, 255, 255, .06);
}


/* Tornillos */

.screw {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .25), rgba(0, 0, 0, .35) 60%, rgba(0, 0, 0, .65));
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, .55);
}

.s1 {
    top: 10px;
    left: 10px
}

.s2 {
    top: 10px;
    right: 10px
}

.s3 {
    bottom: 10px;
    left: 10px
}

.s4 {
    bottom: 10px;
    right: 10px
}

.monitorBottom {
    padding: 14px 10px 6px;
    color: rgba(215, 255, 233, .55);
    font-size: .78rem;
    letter-spacing: .08em;
    text-align: center;
}


/* ====== Screen (glass) ====== */

.screen {
    width: 100%;
    border-radius: 18px;
    position: relative;
    overflow: hidden;
    /* “Vidrio curvo” + profundidad */
    background: linear-gradient(180deg, rgba(7, 18, 15, .82), rgba(4, 8, 6, .95));
    border: 1px solid rgba(69, 255, 181, .18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 40px rgba(69, 255, 181, .10), inset 0 0 50px rgba(0, 0, 0, .55);
    /* Curvatura sutil */
    transform: perspective(900px) rotateX(.6deg);
}

.screenFx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 18px;
    /* Bloom + glare */
    background: radial-gradient(1200px 700px at 50% 18%, rgba(69, 255, 181, .08), rgba(0, 0, 0, 0) 55%), radial-gradient(900px 500px at 50% 85%, rgba(0, 0, 0, .30), rgba(0, 0, 0, 0) 55%);
    mix-blend-mode: screen;
    opacity: .7;
}


/* Conn dot (tu JS le mete .ok) */

.connDot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 77, 125, .9);
    box-shadow: 0 0 14px rgba(255, 77, 125, .6);
    opacity: .95;
    z-index: 10;
}

.connDot.ok {
    background: rgba(69, 255, 181, .95);
    box-shadow: 0 0 14px rgba(69, 255, 181, .65);
}


/* ====== Topbar (inside screen) ====== */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(12, 32, 25, .92), rgba(7, 18, 15, .70));
    border-bottom: 1px solid rgba(69, 255, 181, .14);
    box-shadow: inset 0 -20px 40px rgba(0, 0, 0, .25);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--glow);
    box-shadow: 0 0 14px rgba(69, 255, 181, .8);
    display: inline-block;
}

.brandText {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.titleRow {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.title {
    letter-spacing: .18em;
    font-weight: 900;
}

.subtitle {
    color: var(--muted);
    font-size: .82rem;
    opacity: .9;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center
}


/* ====== Core content ====== */

.log {
    margin: 14px 16px 0;
    min-height: 44vh;
    max-height: 56vh;
    overflow: auto;
    padding: 10px 10px 12px;
    border-radius: 12px;
    border: 1px dashed rgba(69, 255, 181, .18);
    background: rgba(0, 0, 0, .14);
    box-shadow: inset 0 0 28px rgba(0, 0, 0, .35);
}

.entry {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(69, 255, 181, .14);
    background: rgba(0, 0, 0, .12);
    box-shadow: 0 0 18px rgba(69, 255, 181, .06);
}

.entry .who {
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 6px;
    opacity: .95;
}

.entry.user {
    border-color: rgba(255, 77, 125, .20)
}

.entry.user .who {
    color: rgba(255, 77, 125, .92)
}

.entry.ai .who {
    color: rgba(69, 255, 181, .98)
}

.entry .text {
    white-space: pre-wrap;
    line-height: 1.35;
}


/* Mensajes con vibe */

.entry.ai {
    background: linear-gradient(180deg, rgba(69, 255, 181, .06), rgba(0, 0, 0, .12));
}

.entry.user {
    background: linear-gradient(180deg, rgba(255, 77, 125, .06), rgba(0, 0, 0, .12));
}

.sources {
    margin-top: 8px;
    font-size: .82rem;
    color: rgba(215, 255, 233, .8);
    opacity: .9;
}

.sources a {
    color: var(--glow);
    text-decoration: none
}

.sources a:hover {
    text-decoration: underline
}


/* Input row */

.inputRow {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 14px 16px 0;
    padding-bottom: 2px;
    position: relative;
}

.prompt {
    color: var(--glow);
    font-weight: 900;
}

.input {
    flex: 1;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid rgba(69, 255, 181, .25);
    background: rgba(0, 0, 0, .25);
    color: var(--text);
    outline: none;
    box-shadow: inset 0 0 18px rgba(69, 255, 181, .06);
}

.input:focus {
    border-color: rgba(69, 255, 181, .5);
    box-shadow: 0 0 0 3px rgba(69, 255, 181, .14), inset 0 0 18px rgba(69, 255, 181, .06);
}


/* Fake terminal cursor next to prompt */

.inputRow::after {
    content: "";
    position: absolute;
    left: 34px;
    top: 50%;
    width: 10px;
    height: 18px;
    transform: translateY(-50%);
    background: rgba(69, 255, 181, .65);
    box-shadow: 0 0 16px rgba(69, 255, 181, .35);
    opacity: 0;
    pointer-events: none;
}

.inputRow:focus-within::after {
    opacity: 1;
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}


/* Buttons */

.btn {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(69, 255, 181, .25);
    background: rgba(0, 0, 0, .25);
    color: var(--text);
    cursor: pointer;
    transition: transform .08s ease, border-color .2s ease, box-shadow .2s ease;
    user-select: none;
    box-shadow: inset 0 0 18px rgba(69, 255, 181, .05), 0 0 22px rgba(0, 0, 0, .25);
}

.btn:hover {
    border-color: rgba(69, 255, 181, .45);
    box-shadow: 0 0 18px rgba(69, 255, 181, .10), inset 0 0 18px rgba(69, 255, 181, .06);
}

.btn:active {
    transform: translateY(1px)
}

.btn.primary {
    background: linear-gradient(180deg, rgba(69, 255, 181, .25), rgba(0, 0, 0, .2));
    border-color: rgba(69, 255, 181, .5);
    box-shadow: 0 0 26px rgba(69, 255, 181, .12), inset 0 0 18px rgba(69, 255, 181, .08);
}


/* Meta + footer */

.meta {
    margin: 10px 16px 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    color: rgba(215, 255, 233, .8);
    font-size: .85rem;
}

.status {
    letter-spacing: .12em
}

.hint {
    opacity: .75
}

.footer {
    margin: 12px 16px 16px;
    padding: 10px 12px;
    color: rgba(215, 255, 233, .75);
    font-size: .82rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(69, 255, 181, .10);
    background: rgba(0, 0, 0, .10);
}

.sep {
    opacity: .35
}


/* Error panel */

.errorBox {
    margin: 12px 16px 0;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 77, 125, .35);
    background: rgba(255, 77, 125, .10);
    box-shadow: 0 0 22px rgba(255, 77, 125, .12);
}

.errorTitle {
    font-weight: 900;
    letter-spacing: .06em;
    color: rgba(255, 77, 125, .95);
    margin-bottom: 8px;
}

.errorText {
    margin: 0;
    white-space: pre-wrap;
    color: rgba(215, 255, 233, .9);
    opacity: .95;
    font-size: .9rem;
    line-height: 1.35;
}

.hidden {
    display: none
}


/* ====== CRT global FX ====== */

.scanlines {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient( to bottom, rgba(255, 255, 255, .018), rgba(255, 255, 255, .018) 1px, rgba(0, 0, 0, .028) 2px, rgba(0, 0, 0, .028) 4px);
    mix-blend-mode: overlay;
    opacity: .45;
}

.vignette {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: radial-gradient(1200px 900px at 50% 30%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .25) 55%, rgba(0, 0, 0, .62) 100%);
}

.filmgrain {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
    opacity: .10;
    mix-blend-mode: overlay;
}


/* Flicker realista */

@keyframes flicker {
    0%,
    100% {
        opacity: 1
    }
    50% {
        opacity: .96
    }
    60% {
        opacity: .985
    }
    70% {
        opacity: .94
    }
}

.crt {
    animation: flicker 6.2s infinite
}


/* Glitch momentáneo: tu JS puede añadir .glitch a .screen */

@keyframes glitchShift {
    0% {
        transform: perspective(900px) rotateX(.6deg) translate(0, 0)
    }
    15% {
        transform: perspective(900px) rotateX(.6deg) translate(1px, -1px)
    }
    30% {
        transform: perspective(900px) rotateX(.6deg) translate(-1px, 1px)
    }
    45% {
        transform: perspective(900px) rotateX(.6deg) translate(2px, 0)
    }
    60% {
        transform: perspective(900px) rotateX(.6deg) translate(-2px, 0)
    }
    75% {
        transform: perspective(900px) rotateX(.6deg) translate(1px, 1px)
    }
    100% {
        transform: perspective(900px) rotateX(.6deg) translate(0, 0)
    }
}

.screen.glitch {
    animation: glitchShift .22s linear 1;
}


/* Scrollbar retro */

.log::-webkit-scrollbar {
    width: 10px
}

.log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, .20);
    border-radius: 12px;
}

.log::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(69, 255, 181, .25), rgba(0, 0, 0, .25));
    border: 1px solid rgba(69, 255, 181, .25);
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(69, 255, 181, .12);
}

.log::-webkit-scrollbar-thumb:hover {
    border-color: rgba(69, 255, 181, .45)
}


/* Fosforo/text glow */

.crt,
.screen,
.log,
.entry,
.title,
.subtitle,
.prompt,
.input,
.btn {
    text-shadow: 0 0 6px rgba(69, 255, 181, .18), 0 0 18px rgba(69, 255, 181, .10);
}


/* Reduce motion */

@media (prefers-reduced-motion: reduce) {
    .crt {
        animation: none
    }
    .inputRow:focus-within::after {
        animation: none
    }
    .screen.glitch {
        animation: none
    }
}


/* Responsive */

@media (max-width: 680px) {
    .monitor {
        padding: 14px
    }
    .monitorBezel {
        padding: 12px
    }
    .topbar {
        flex-direction: column;
        align-items: stretch
    }
    .controls {
        justify-content: flex-end;
        flex-wrap: wrap
    }
    .log {
        min-height: 42vh;
        max-height: 54vh
    }
}


/* =========================================================
   RETROFUTURE 80s + MATRIX UI PACK (ADD-ON, NO BREAKING)
   ========================================================= */

:root {
    --neon: rgba(69, 255, 181, .75);
    --neonSoft: rgba(69, 255, 181, .18);
    --hud: rgba(215, 255, 233, .55);
    --grid: rgba(69, 255, 181, .10);
}


/* Grid tipo Tron/Matrix dentro del vidrio */

.matrixGrid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .55;
    mix-blend-mode: screen;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, .10)), repeating-linear-gradient(90deg, var(--grid), var(--grid) 1px, transparent 1px, transparent 36px), repeating-linear-gradient(0deg, var(--grid), var(--grid) 1px, transparent 1px, transparent 36px), radial-gradient(900px 420px at 50% 12%, rgba(69, 255, 181, .12), transparent 60%);
    filter: blur(.2px);
    z-index: 0;
}


/* HUD corners estilo “interface” */

.hudCorners {
    position: absolute;
    inset: 10px;
    pointer-events: none;
    z-index: 1;
    opacity: .75;
}

.hudCorners .c {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(69, 255, 181, .25);
    box-shadow: 0 0 18px rgba(69, 255, 181, .08);
}

.hudCorners .tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-radius: 10px 0 0 0;
}

.hudCorners .tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
    border-radius: 0 10px 0 0;
}

.hudCorners .bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 10px;
}

.hudCorners .br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-radius: 0 0 10px 0;
}


/* Línea superior HUD */

.hudTopline {
    position: absolute;
    left: 0;
    right: 0;
    top: 58px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(69, 255, 181, .22), transparent);
    opacity: .7;
    pointer-events: none;
    z-index: 1;
}


/* Pulso suave de neón (más natural) */

@keyframes neonPulse {
    0%,
    100% {
        opacity: .30;
    }
    50% {
        opacity: .55;
    }
}

.hudGlowPulse {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(900px 560px at 50% 22%, rgba(69, 255, 181, .08), transparent 60%);
    opacity: .35;
    animation: neonPulse 5.6s ease-in-out infinite;
    mix-blend-mode: screen;
    z-index: 0;
}


/* Asegura que contenido quede por encima del overlay */

.topbar,
#errorBox,
.log,
.inputRow,
.meta,
.footer,
.screenFx,
.connDot {
    position: relative;
    z-index: 2;
}


/* Texto más “natural” (menos brillo exagerado) */

.subtitle {
    letter-spacing: .06em;
    opacity: .78;
}

.title {
    text-shadow: 0 0 10px rgba(69, 255, 181, .16), 0 0 26px rgba(69, 255, 181, .08);
}


/* Botones un poquito más “HUD” */

.btn {
    border-color: rgba(69, 255, 181, .22);
}

.btn:hover {
    border-color: rgba(69, 255, 181, .45);
}


/* Si quieres aún más “Matrix”: baja saturación de rojos */

.entry.user {
    border-color: rgba(255, 77, 125, .16);
}