/* sfondo */
body {
    margin: 0;
    padding: 0;
    background: #000;
    color: #e5e5e5;
    font-family: "IBM Plex Mono", monospace;
    min-height: 100vh;
    cursor: none; /* usiamo il nostro cursore custom */
}

.page-bg {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* cornice principale */
.site-frame {
    width: 92%;
    max-width: 620px;
    background: #050505;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    padding: 18px 20px 14px 20px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 18px rgba(255,255,255,0.08),
        0 0 60px rgba(255,255,255,0.05);
}

/* scanlines lievi */
.site-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.05),
        rgba(255,255,255,0.05) 1px,
        rgba(255,255,255,0) 2px
    );
    opacity: .2;
    pointer-events: none;
}

/* header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
    padding-bottom: 8px;
}

.site-title {
    font-size: 15px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
}

/* sottotitolo sempre sulla stessa riga, ma può stringersi */
.site-subtitle {
    font-size: 10px;
    color: rgba(255,255,255,0.38);
    margin-left: 8px;
    white-space: nowrap;
    max-width: 55%;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

/* leggero tuning su schermi piccoli */
@media (max-width: 600px) {
    .site-title {
        font-size: 13px;
    }

    .site-subtitle {
        font-size: 9px;
        max-width: 60%;
    }
}

/* layout verticale dei moduli */
.site-layout-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

/* card modulo */
.module {
    position: relative;
    background: #0a0a0a;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.22);
    padding: 10px 12px;
    box-sizing: border-box;
    min-height: 80px;
    opacity: 0;
    transform: translateY(6px) scale(.97);
    transition:
        opacity .45s ease-out,
        transform .45s ease-out,
        border-color .25s ease-out,
        background-color .25s ease-out;
}


.module.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.module.active:hover {
    border-color: rgba(255,255,255,0.40);
    background-color: #101010;
}

/* contenuto modulo */
.module-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-bottom: 4px;
}

.module-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.30);
    margin-bottom: 6px;
}

.module-status {
    font-size: 10px;
}

/* micro-varianti di layout, da applicare in modo imprevedibile */
.module-drift-a {
    padding-left: 10px;  /* +/− 2px rispetto al default */
    padding-right: 14px;
}

.module-drift-b {
    padding-left: 14px;
    padding-right: 10px;
}

.module-drift-c {
    padding-top: 12px;
    padding-bottom: 8px;
}

/* stati monocromo */
.status-boot    { color: rgba(255,255,255,0.45); }
.status-loading { color: rgba(255,255,255,0.70); }
.status-ok      { color: rgba(255,255,255,0.9);  }
.status-error   {
    color: rgba(255,255,255,0.9);
    text-decoration: underline dotted rgba(255,255,255,0.4);
}
.status-retry   { color: rgba(255,255,255,0.6); }
.status-ghost   { color: rgba(255,255,255,0.25); }

/* shimmer + barra di caricamento in alto */
.module.loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.06),
        transparent 40%,
        transparent 60%,
        rgba(255,255,255,0.04)
    );
    opacity: .4;
    animation: shimmer 1.4s linear infinite;
    pointer-events: none;
}

.module.loading::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 2px;
    background: rgba(255,255,255,0.85);
    animation: loadbar 1.2s ease-out infinite;
    transform-origin: left center;
}

@keyframes shimmer {
    0%   { transform: translateX(-40%); }
    100% { transform: translateX(40%); }
}

@keyframes loadbar {
    0%   { width: 0%;   opacity: 0.2; }
    40%  { width: 100%; opacity: 0.9; }
    100% { width: 0%;   opacity: 0.0; }
}

/* footer */
.site-footer-status {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    border-top: 1px solid rgba(255,255,255,0.18);
    padding-top: 8px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

#build-log {
    font-size: 9px;
    color: rgba(255,255,255,0.40);
}

/* hint sequenza tasti */
#key-sequence {
    font-size: 9px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.35em;
}

/* popup di uscita */
#exit-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.exit-box {
    background: #000;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 18px 24px;
    border-radius: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-family: monospace;
    text-align: center;
    opacity: 0;
    transform: scale(.92);
    transition: opacity .4s ease-out, transform .4s ease-out;
}

#exit-popup.visible .exit-box {
    opacity: 1;
    transform: scale(1);
}

.exit-line {
    display: block;
    margin-bottom: 6px;
}

.exit-contact {
    font-size: 11px;
    opacity: .6;
    letter-spacing: .1em;
}

/* backdoor overlay */
#backdoor-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2500;
}

.backdoor-inner {
    max-width: 460px;
    padding: 24px 26px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.45);
    color: #f5f5f5;
    font-size: 14px;
    line-height: 1.5;
}

.backdoor-inner p {
    margin: 0 0 8px;
}

.backdoor-contact {
    letter-spacing: 0.12em;
    font-size: 12px;
    opacity: 0.9;
}

.backdoor-hint {
    font-size: 11px;
    opacity: 0.5;
}

/* cursore personalizzato */
/* nasconde il cursore di default */
body {
    cursor: none !important;
}

/* cerchio esterno */
#cursor-dot {
    position: fixed;
    top: 0;          /* IMPORTANTISSIMO */
    left: 0;         /* IMPORTANTISSIMO */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.8);
    background: transparent;
    pointer-events: none;
    z-index: 9999999;
    transform: translate(-50%, -50%);
    transition:
        width .2s ease,
        height .2s ease,
        border-color .2s ease,
        opacity .2s ease;
    opacity: 1;
}

/* puntino interno */
#cursor-core {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,1);
    border-radius: 50%;
    inset: 0;
    margin: auto;
}

/* hover */
.cursor-hover {
    width: 24px !important;
    height: 24px !important;
    border-color: #fff;
}

/* click */
.cursor-click {
    opacity: 0.6;
}


/* mobile */
@media (max-width: 600px) {
    .site-frame {
        padding: 14px 14px 10px 14px;
    }

    .site-footer-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* overlay terminale finale */
#terminal-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: none;            /* verrà attivato via JS */
    z-index: 3000;
    padding: 18px 20px;
    box-sizing: border-box;
    font-family: "IBM Plex Mono", monospace;
    color: #e5e5e5;
}

.terminal-inner {
    max-width: 720px;
    margin: 0 auto;
}

.terminal-line {
    font-size: 13px;
    white-space: pre-wrap;
    outline: none;
}

/* cursore testo che lampeggia tipo terminale */
.terminal-cursor {
    display: inline-block;
    width: 7px;
    height: 1em;
    background: #e5e5e5;
    margin-left: 2px;
    animation: terminal-blink 1s steps(2, start) infinite;
}

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

/* console centrale come overlay minimale */
#module-console {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 460px;
    width: 80%;
    display: none;            /* nascosta all'inizio */
    z-index: 1500;
    pointer-events: auto;
}

#module-console .terminal {
    font-size: 12px;
    line-height: 1.4;
    font-family: "IBM Plex Mono", monospace;
    color: rgba(255,255,255,0.85);
}

#module-console .terminal-line {
    outline: none;
    white-space: pre-wrap;
}

#module-console .terminal-cursor {
    display: inline-block;
    width: 6px;
    height: 1.05em;
    background: rgba(255,255,255,0.9);
    margin-left: 3px;
    animation: console-blink 1.1s steps(2, start) infinite;
}

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

/* --- erosione: quando la console è aperta, spariscono header + moduli --- */
.site-frame.console-open .site-header {
    opacity: 0;
    pointer-events: none;
}

.site-frame.console-open .site-layout-grid {
    display: none;
}

/* footer quasi fantasma */
.site-frame.console-open .site-footer-status {
    opacity: 0.15;
}

#build-meta {
    font-size: 9px;
    color: rgba(255,255,255,0.35);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 10px;
    opacity: 0.9;
}

/* niente cursore custom su dispositivi touch */
@media (hover: none) and (pointer: coarse) {
    #cursor-dot {
        display: none;
    }

    body {
        cursor: auto;
    }
}

.site-frame.eroding {
    opacity: 0;
    transform: scale(0.98);
    filter: blur(1.4px);
    transition:
        opacity 1.2s ease-out,
        transform 1.2s ease-out,
        filter 1.2s ease-out;
    pointer-events: none;
}

.vs-link{
  text-decoration:none;
  border-bottom:1px dotted rgba(255,255,255,0.4);
}
.vs-link:hover{
  border-bottom-color:rgba(255,255,255,0.9);
}