/* ==============================
   ENDERON — Hoja de estilos
   ============================== */

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

:root {
    --bg:           #04020c;
    --purple:       #8b5cf6;
    --purple-light: #c4b5fd;
    --purple-glow:  #7c3af7;
    --cyan:         #22d3ee;
    --green-end:    #4ade80;
    --text:         #ede9fe;
    --text-muted:   #6d5e8a;
}

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

body {
    background-color: var(--bg);
    background-image: url('end.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Press Start 2P', monospace;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Oscurecer un poco la imagen de fondo */
.bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 0, 8, 0.62);
    z-index: 0;
    pointer-events: none;
}

/* ── Canvas (motes flotantes) ── */
#canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ── Vignette ── */
.vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 28%, rgba(0,0,0,0.82) 100%);
    pointer-events: none;
    z-index: 2;
}

/* ── Scanlines ── */
.scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.05) 3px,
        rgba(0,0,0,0.05) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* ── Layout ── */
.container {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    max-width: 780px;
    width: 100%;
}

/* ════════════════════════════
   TITLE
   ════════════════════════════ */

.title {
    font-size: clamp(1.7rem, 6.5vw, 3.5rem);
    letter-spacing: 0.06em;
    line-height: 1.2;
    color: var(--text);
    text-shadow:
        4px 4px 0px rgba(0,0,0,0.9),
        0 0 16px var(--purple),
        0 0 36px var(--purple-glow),
        0 0 70px rgba(124,58,247,0.35);
    position: relative;
    margin-bottom: 1rem;
    cursor: default;
}

/* Capas glitch */
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    font-size: inherit;
    letter-spacing: inherit;
}

.glitch::before {
    color: var(--cyan);
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    animation: glitchTop 6s infinite;
}

.glitch::after {
    color: #f0abfc;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    animation: glitchBot 6s infinite;
}

@keyframes glitchTop {
    0%,  88%, 100% { transform: translate(0); opacity: 0; }
    89% { transform: translate(-5px, 1px);  opacity: 0.9; }
    91% { transform: translate( 5px,-1px);  opacity: 0.9; }
    93% { transform: translate(-3px, 2px);  opacity: 0.9; }
    95% { transform: translate(0);          opacity: 0;   }
}

@keyframes glitchBot {
    0%,  83%, 100% { transform: translate(0); opacity: 0; }
    84% { transform: translate( 5px,-2px); opacity: 0.85; }
    86% { transform: translate(-5px, 2px); opacity: 0.85; }
    88% { transform: translate( 3px, 1px); opacity: 0.85; }
    90% { transform: translate(0);         opacity: 0;    }
}

/* ── Divider ── */
.title-divider {
    width: 220px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--purple), transparent);
    margin: 0 auto 1.2rem;
}

/* ── Server tag ── */
.server-tag {
    font-size: clamp(0.35rem, 1.3vw, 0.48rem);
    letter-spacing: 0.3em;
    color: var(--text-muted);
    text-transform: uppercase;
    line-height: 1.8;
}

.server-tag--sub {
    color: rgba(139,92,246,0.55);
    margin-bottom: 2.6rem;
}

/* ── Message box ── */
.message-box {
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2.6rem;
    flex-wrap: wrap;
}

.message-prefix {
    color: var(--purple);
    font-size: clamp(0.45rem, 1.5vw, 0.6rem);
    opacity: 0.7;
    flex-shrink: 0;
}

#message-text {
    font-size: clamp(0.45rem, 1.5vw, 0.6rem);
    color: var(--purple-light);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(196,181,253,0.5);
    line-height: 1.8;
}

.cursor {
    display: inline-block;
    color: var(--purple);
    font-size: clamp(0.45rem, 1.5vw, 0.6rem);
    animation: blink 0.75s step-end infinite;
    margin-left: 2px;
}

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

/* ── Badge ── */
.badge {
    font-size: clamp(0.42rem, 1.4vw, 0.58rem);
    letter-spacing: 0.25em;
    color: var(--text);
    animation: badgePulse 2.5s ease-in-out infinite alternate;
    margin-bottom: 2.6rem;
}

.badge-bracket {
    color: var(--purple);
}

@keyframes badgePulse {
    from { opacity: 0.45; }
    to   { opacity: 1;    }
}

/* ── Footer ── */
.footer {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.28rem, 1vw, 0.38rem);
    letter-spacing: 0.18em;
    color: var(--text-muted);
    line-height: 2;
}

.footer-coord {
    cursor: default;
    transition: color 0.35s ease;
}

.footer-coord:hover {
    color: var(--purple-light);
}

.footer-sep {
    color: rgba(139,92,246,0.3);
}

.footer-dim {
    color: rgba(74,222,128,0.45);
}

/* ════════════════════════════
   EASTER EGGS — OVERLAY
   ════════════════════════════ */

.ee-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4,0,10,0.93);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.ee-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.ee-overlay.red {
    background: rgba(35,0,5,0.94);
}

.ee-msg {
    font-size: clamp(0.5rem, 2vw, 0.8rem);
    color: var(--purple-light);
    text-align: center;
    padding: 2rem 1.5rem;
    line-height: 2.5;
    text-shadow: 0 0 20px var(--purple-glow);
    max-width: 520px;
    white-space: pre-line;
}

.ee-overlay.red .ee-msg {
    color: #fca5a5;
    text-shadow: 0 0 20px rgba(239,68,68,0.9);
}

/* ── Susurro de inactividad ── */
.whisper {
    position: fixed;
    bottom: 18%;
    right: 5%;
    font-size: clamp(0.3rem, 1vw, 0.42rem);
    letter-spacing: 0.12em;
    color: transparent;
    transition: color 0.9s ease;
    pointer-events: none;
    z-index: 50;
    user-select: none;
}

.whisper.visible {
    color: rgba(196,181,253,0.32);
}

/* ── Elemento invisible ── */
.hidden-watcher {
    position: fixed;
    bottom: 5%;
    right: 2%;
    font-size: 1rem;
    color: rgba(139,92,246,0.015);
    z-index: 5;
    cursor: default;
    user-select: none;
}

/* ════════════════════════════
   EASTER EGGS — SCREEN GHOSTS
   ════════════════════════════ */

/* Textos fantasma que aparecen en pantalla */
.screen-ghost {
    position: fixed;
    font-family: 'Press Start 2P', monospace;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.6s ease;
    white-space: nowrap;
    user-select: none;
    line-height: 1;
}

/* Ojos de enderman que aparecen en la oscuridad */
.screen-enderman {
    position: fixed;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.25s ease;
    display: flex;
    gap: 10px;
    align-items: center;
}

.screen-enderman::before,
.screen-enderman::after {
    content: '';
    display: block;
    width: 18px;
    height: 9px;
    background: #a855f7;
    box-shadow: 0 0 10px #a855f7, 0 0 22px #7c3af7, 0 0 40px rgba(124,58,247,0.6);
}

/* Coordenada flash */
.screen-coords {
    position: fixed;
    font-family: 'Press Start 2P', monospace;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.5s ease;
    user-select: none;
    white-space: nowrap;
}

/* Dragon glitch (easter egg: escribir "dragon") */
.dragon-glitch {
    animation: dragonShake 0.1s steps(1) infinite;
}

@keyframes dragonShake {
    0%   { transform: translate(-6px, 2px) skewX(-3deg); filter: hue-rotate(0deg); }
    25%  { transform: translate( 6px,-2px) skewX( 3deg); filter: hue-rotate(120deg); }
    50%  { transform: translate(-4px, 4px) skewX(-1deg); filter: hue-rotate(240deg); }
    75%  { transform: translate( 4px,-3px) skewX( 2deg); filter: hue-rotate(300deg); }
    100% { transform: translate(-2px, 1px) skewX(-2deg); filter: hue-rotate(360deg); }
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .container { padding: 2rem 1rem; }
    .title-divider { width: 160px; }
    .server-tag--sub { margin-bottom: 2rem; }
    .message-box { margin-bottom: 2rem; }
    .badge       { margin-bottom: 2rem; }
    .screen-enderman::before,
    .screen-enderman::after { width: 14px; height: 7px; }
}
