/* =========================================================
   ARTIST REJECTOR — Cybercore / Serial Experiments Lain
   · tipografía Inter (heredada de One More Sim)
   · fondos azules intensos
   · efecto TV vieja (scanlines + corrimiento RGB + ruido)
   · barras de UI biseladas metálico-azul (estilo One More Sim)
   ========================================================= */

:root {
    /* electric blue / cyan accent */
    --accent-a: #2f6bff;
    --accent-b: #19e6ff;
    --grad: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
    --cyan: #5fe9ff;

    /* deep saturated blue field */
    --bg: #03061c;
    --bg-2: #050b35;

    /* glass panels */
    --panel: rgba(40, 80, 200, 0.06);
    --panel-strong: rgba(60, 110, 255, 0.12);
    --line: rgba(120, 170, 255, 0.16);

    /* chrome UI bar (One More Sim) */
    --bar-grad: linear-gradient(180deg, #3a5db3 0%, #21408f 46%, #142a64 54%, #2a4795 100%);
    --bar-hi: rgba(180, 205, 255, 0.55);
    --bar-lo: rgba(0, 4, 30, 0.7);

    --text: #dfe9ff;
    --muted: rgba(200, 220, 255, 0.55);
    --muted-2: rgba(180, 205, 255, 0.32);
    --display: 'Averia Libre', 'Inter', system-ui, cursive;
    /* misma tipografía en todo el proyecto: 'mono' ahora también es Averia */
    --mono: var(--display);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--display);
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* intense blue field + glows */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% -5%, rgba(45, 95, 255, 0.45), transparent 55%),
        radial-gradient(circle at 12% 100%, rgba(0, 120, 255, 0.30), transparent 55%),
        radial-gradient(circle at 90% 80%, rgba(110, 0, 255, 0.18), transparent 55%),
        linear-gradient(180deg, #061045 0%, #03061c 60%, #01020c 100%);
}

.hidden {
    display: none !important;
}

/* ---------- HUD / monospace technical text ---------- */
.hud {
    font-family: var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.dim {
    opacity: 0.5;
}

/* ===========================================================
   CHROME UI BAR (estilo One More Sim) — biselada metálico-azul
   =========================================================== */
.bar {
    background: var(--bar-grad);
    border-top: 1px solid var(--bar-hi);
    border-bottom: 1px solid var(--bar-lo);
    box-shadow:
        inset 0 1px 0 rgba(200, 220, 255, 0.45),
        inset 0 -1px 0 rgba(0, 0, 0, 0.55),
        0 2px 10px rgba(0, 0, 20, 0.5);
    position: relative;
}

/* thin engraved glint running across every bar */
.bar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(180, 210, 255, 0.25), transparent);
    pointer-events: none;
}

/* ======================= LANDING / BOOT ======================= */
#landing {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 40%, rgba(40, 90, 255, 0.30), transparent 60%),
        linear-gradient(180deg, #061045 0%, #02030f 100%);
    transition: opacity 0.8s ease;
}

.boot-frame {
    text-align: center;
    padding: 24px;
    max-width: 680px;
}

#boot-log {
    text-align: left;
    margin: 0 auto 34px;
    max-width: 520px;
    min-height: 132px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(95, 233, 255, 0.5);
    white-space: pre-wrap;
}

#boot-log::after {
    content: "_";
    animation: blink 1s steps(1) infinite;
}

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

#landing-title {
    margin: 0;
    font-family: var(--display);
    font-size: max(7vw, 60px);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #eaf2ff;
    text-shadow:
        0 0 6px rgba(180, 215, 255, 0.95),
        0 0 18px rgba(80, 150, 255, 0.85),
        0 0 42px rgba(50, 110, 255, 0.7),
        0 0 80px rgba(40, 95, 255, 0.55),
        0 0 130px rgba(40, 90, 255, 0.4);
    animation: titleGlow 3.6s infinite alternate ease-in-out;
}

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 6px rgba(180, 215, 255, 0.8),
            0 0 16px rgba(80, 150, 255, 0.7),
            0 0 36px rgba(50, 110, 255, 0.55),
            0 0 70px rgba(40, 95, 255, 0.4);
    }
    100% {
        text-shadow:
            0 0 10px rgba(200, 225, 255, 1),
            0 0 26px rgba(95, 165, 255, 0.95),
            0 0 60px rgba(55, 120, 255, 0.8),
            0 0 110px rgba(45, 100, 255, 0.65),
            0 0 170px rgba(40, 90, 255, 0.5);
    }
}

#landing-subtitle {
    margin: 30px auto 0;
    max-width: 540px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--muted);
}

#enter-button {
    margin-top: 50px;
    background: var(--bar-grad);
    color: #eaf2ff;
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 400;
    padding: 16px 50px;
    border: 1px solid var(--bar-hi);
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 4px;
    box-shadow:
        inset 0 1px 0 rgba(200, 220, 255, 0.5),
        inset 0 -2px 0 rgba(0, 0, 0, 0.5),
        0 0 30px rgba(45, 110, 255, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s;
    animation: btnGlow 2.4s infinite alternate ease-in-out;
}

#enter-button:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(220, 235, 255, 0.6),
        inset 0 -2px 0 rgba(0, 0, 0, 0.5),
        0 0 46px rgba(70, 150, 255, 0.85);
}

#enter-button:active {
    transform: translateY(1px);
}

#landing-foot {
    margin-top: 40px;
    font-size: 11px;
    letter-spacing: 5px;
    color: var(--muted-2);
}

@keyframes btnGlow {
    0% { box-shadow: inset 0 1px 0 rgba(200, 220, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(45, 110, 255, 0.4); }
    100% { box-shadow: inset 0 1px 0 rgba(200, 220, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.5), 0 0 44px rgba(45, 110, 255, 0.8); }
}

/* ===========================================================
   GLITCH / chromatic aberration text (TV vieja, corrimiento RGB)
   =========================================================== */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    white-space: pre;
    pointer-events: none;
}

.glitch::before {
    color: #ff2b6d;
    z-index: -1;
    transform: translate(-1.5px, 0);
    mix-blend-mode: screen;
    animation: ab-r 2.6s infinite steps(1);
}

.glitch::after {
    color: #19e6ff;
    z-index: -1;
    transform: translate(1.5px, 0);
    mix-blend-mode: screen;
    animation: ab-b 3.1s infinite steps(1);
}

@keyframes ab-r {
    0%, 92%, 100% { transform: translate(-1.5px, 0); }
    94% { transform: translate(-4px, 1px); }
    96% { transform: translate(2px, -1px); }
}

@keyframes ab-b {
    0%, 90%, 100% { transform: translate(1.5px, 0); }
    93% { transform: translate(4px, -1px); }
    97% { transform: translate(-2px, 1px); }
}

/* ======================= APP SHELL ======================= */
#app {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 1s ease;
    filter: saturate(1.15) contrast(1.04);
}

#app.show {
    opacity: 1;
}

/* Topbar */
#topbar {
    flex: 0 0 auto;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 4;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--grad);
    box-shadow: 0 0 14px var(--cyan);
    animation: pulseDot 1.6s infinite alternate;
}

@keyframes pulseDot {
    0% { box-shadow: 0 0 6px var(--cyan); }
    100% { box-shadow: 0 0 18px var(--cyan); }
}

.brand-name {
    font-family: var(--mono);
    font-weight: 400;
    letter-spacing: 3px;
    font-size: 15px;
    color: #fff;
    text-shadow:
        0 0 10px rgba(95, 233, 255, 0.7),
        0 0 22px rgba(60, 130, 255, 0.5);
}

.brand-tag {
    font-size: 11px;
    color: var(--muted-2);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

#rejection-counter {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 14px;
    border: 1px solid var(--bar-hi);
    border-radius: 3px;
    background: rgba(0, 8, 40, 0.5);
    box-shadow: inset 0 1px 0 rgba(200, 220, 255, 0.25);
}

.rejection-label {
    font-size: 10px;
    color: var(--cyan);
}

#rejection-count {
    font-family: var(--mono);
    font-size: 19px;
    font-weight: 400;
    color: #fff;
    text-shadow: 0 0 14px rgba(95, 233, 255, 0.8);
}

#rejection-counter.bump #rejection-count {
    animation: countBump 0.5s ease;
}

@keyframes countBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); color: var(--cyan); }
    100% { transform: scale(1); }
}

#sound-toggle {
    background: rgba(0, 8, 40, 0.5);
    border: 1px solid var(--bar-hi);
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#sound-toggle:hover {
    background: var(--panel-strong);
}

#sound-toggle.muted {
    opacity: 0.4;
}

/* Three columns */
#client {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 230px 340px 1fr;
    min-height: 0;
    z-index: 2;
}

/* ======================= SIDEBAR ======================= */
#sidebar {
    border-right: 1px solid var(--line);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(4, 10, 45, 0.45);
    backdrop-filter: blur(3px);
}

.compose {
    width: 100%;
    padding: 11px;
    border-radius: 22px;
    border: 1px dashed var(--line);
    background: transparent;
    color: var(--muted-2);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 2px;
    cursor: not-allowed;
}

.folders {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.folder {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border-radius: 22px;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: background 0.16s, color 0.16s;
}

.folder:hover {
    background: var(--panel);
    color: var(--text);
}

.folder.active {
    background: linear-gradient(180deg, rgba(60, 110, 255, 0.22), rgba(20, 50, 150, 0.12));
    color: #fff;
    border: 1px solid var(--line);
    box-shadow: inset 2px 0 0 var(--cyan), inset 0 1px 0 rgba(200, 220, 255, 0.2);
}

.f-icon {
    width: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--cyan);
}

.f-name {
    flex: 1;
}

.f-badge {
    min-width: 22px;
    text-align: center;
    font-family: var(--mono);
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 2px;
    background: var(--grad);
    color: #021;
    box-shadow: 0 0 12px rgba(25, 230, 255, 0.6);
}

.f-badge:empty,
.f-badge.zero {
    display: none;
}

.sidebar-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.node-readout {
    font-size: 11px;
    line-height: 1.7;
    color: var(--muted-2);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: rgba(0, 8, 40, 0.4);
}

.quota-bar {
    height: 5px;
    border-radius: 2px;
    background: rgba(0, 10, 50, 0.7);
    overflow: hidden;
    border: 1px solid var(--line);
}

.quota-bar span {
    display: block;
    height: 100%;
    width: 3%;
    background: var(--grad);
    box-shadow: 0 0 10px var(--cyan);
    transition: width 0.6s ease;
}

.quota small {
    display: block;
    margin-top: 8px;
    font-size: 10px;
    color: var(--muted-2);
}

/* ======================= LIST PANE ======================= */
#list-pane {
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(2, 6, 26, 0.35);
}

.list-head {
    flex: 0 0 auto;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#list-title {
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 17px;
    color: #fff;
    text-shadow:
        0 0 8px rgba(95, 233, 255, 0.6),
        0 0 18px rgba(60, 130, 255, 0.45),
        0 0 34px rgba(50, 110, 255, 0.3);
}

#list-sub {
    font-size: 11px;
    color: var(--cyan);
}

#email-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}

.email-item {
    margin: 9px 12px;
    padding: 14px 20px;
    border: 1px solid var(--line);
    background: rgba(10, 20, 60, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: background 0.16s, transform 0.16s, border-color 0.16s;
    animation: slideIn 0.4s ease;
    /* cuadrado con puntas redondeadas */
    border-radius: 14px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.email-item:hover {
    background: var(--panel-strong);
    transform: scale(1.015);
}

.email-item.active {
    background: var(--panel-strong);
    border-color: var(--cyan);
    box-shadow: 0 0 18px rgba(25, 230, 255, 0.22);
}

.avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 3px;
    object-fit: cover;
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--bar-hi);
    box-shadow: 0 0 12px rgba(25, 230, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.email-meta {
    flex: 1;
    min-width: 0;
}

.email-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.email-sender {
    font-size: 13.5px;
    color: #bcd8ff;
    -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.55);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.55), 0 0 12px rgba(150, 200, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-time {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted-2);
}

.email-subject {
    margin-top: 3px;
    font-size: 13.5px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-preview {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item.unread .email-subject {
    color: #fff;
    font-weight: 700;
}

.email-item.unread .email-sender {
    color: #dceaff;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7), 0 0 16px rgba(150, 200, 255, 0.5);
}

.email-item.unread::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

.list-empty {
    padding: 50px 24px;
    text-align: center;
    color: var(--muted-2);
    font-size: 14px;
    line-height: 1.8;
}

/* ======================= READ PANE ======================= */
#read-pane {
    position: relative;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(1, 3, 16, 0.3);
}

/* back button: solo visible en móvil */
#reader-back {
    display: none;
    position: sticky;
    top: 0;
    z-index: 3;
    width: 100%;
    padding: 13px 16px;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--bar-lo);
    background: var(--bar-grad);
    box-shadow: inset 0 1px 0 rgba(200, 220, 255, 0.4), 0 2px 10px rgba(0, 0, 20, 0.5);
    color: #eaf2ff;
    font-size: 13px;
    letter-spacing: 2px;
    cursor: pointer;
}

#empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted-2);
}

.empty-mark {
    font-size: 54px;
    opacity: 0.35;
    color: var(--cyan);
    text-shadow: 0 0 24px rgba(95, 233, 255, 0.4);
}

#reader {
    padding: 38px 46px 70px;
    max-width: 760px;
    animation: fadeUp 0.4s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.reader-subject {
    font-family: var(--display);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 22px;
    color: #fff;
    text-shadow:
        0 0 6px rgba(170, 210, 255, 0.7),
        0 0 20px rgba(70, 140, 255, 0.55),
        0 0 44px rgba(50, 110, 255, 0.4);
}

.reader-from {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.reader-from .avatar {
    width: 46px;
    height: 46px;
    font-size: 18px;
}

.reader-from-meta {
    flex: 1;
    min-width: 0;
}

.reader-from-name {
    font-weight: 600;
    font-size: 15px;
    color: #eaf2ff;
}

.reader-from-email {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--cyan);
}

.reader-to {
    font-size: 12px;
    color: var(--muted-2);
    margin-top: 2px;
}

.reader-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-2);
    white-space: nowrap;
}

.reader-body {
    margin-top: 24px;
    font-size: 15px;
    line-height: 1.78;
    color: rgba(223, 233, 255, 0.9);
}

.reader-body p {
    margin: 0 0 18px;
}

.reader-sign {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.reader-actions {
    margin-top: 38px;
    display: flex;
    gap: 12px;
}

.reader-actions button {
    padding: 10px 22px;
    border-radius: 3px;
    border: 1px solid var(--line);
    background: rgba(0, 8, 40, 0.5);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 1px;
    cursor: not-allowed;
}

/* ======================= STATUS BAR (Lain HUD) ======================= */
#statusbar {
    flex: 0 0 auto;
    height: 30px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 18px;
    font-size: 11px;
    color: var(--muted);
    z-index: 4;
}

#statusbar .st-link {
    color: #4dff9b;
    text-shadow: 0 0 8px rgba(77, 255, 155, 0.6);
    animation: blink 2.4s steps(1) infinite;
}

#statusbar .st-spacer {
    flex: 1;
}

#st-clock {
    color: var(--cyan);
}

.st-present {
    color: var(--muted-2);
}

#st-feed {
    color: var(--muted-2);
}

/* ======================= TOAST ======================= */
#toast {
    position: fixed;
    bottom: 46px;
    right: 24px;
    z-index: 8000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: 4px;
    background: rgba(6, 14, 50, 0.92);
    border: 1px solid var(--bar-hi);
    box-shadow: 0 12px 40px rgba(0, 0, 20, 0.7), 0 0 26px rgba(45, 110, 255, 0.4);
    backdrop-filter: blur(8px);
    max-width: 320px;
    transform: translateY(160%);
    transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}

#toast.show {
    transform: translateY(0);
}

#toast .toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 3px;
    background: var(--grad);
    color: #021;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: 0 0 14px rgba(25, 230, 255, 0.6);
}

#toast .toast-text strong {
    display: block;
    font-size: 12px;
    font-family: var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
}

#toast .toast-text span {
    font-size: 12px;
    color: var(--muted);
}

/* =========================================================
   CRT / TV VIEJA — overlays a pantalla completa
   ========================================================= */
.fx {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
}

/* horizontal scanlines */
.fx-scanlines {
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 10, 40, 0.28) 3px,
        rgba(0, 10, 40, 0.28) 3px
    );
    background-size: 100% 3px;
    mix-blend-mode: multiply;
    opacity: 0.7;
}

/* rolling vertical-sync bar */
.fx-rollbar {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(120, 180, 255, 0.05) 45%,
        rgba(150, 200, 255, 0.08) 50%,
        rgba(120, 180, 255, 0.05) 55%,
        transparent 100%
    );
    height: 40%;
    animation: roll 7s linear infinite;
}

@keyframes roll {
    0% { transform: translateY(-60%); }
    100% { transform: translateY(260%); }
}

/* animated analog grain (svg noise) */
.fx-grain {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
    opacity: 0.05;
    mix-blend-mode: screen;
    animation: grain 0.6s steps(3) infinite;
}

@keyframes grain {
    0% { transform: translate(0, 0); }
    33% { transform: translate(-4%, 3%); }
    66% { transform: translate(3%, -4%); }
    100% { transform: translate(0, 0); }
}

/* CRT glass curvature + vignette */
.fx-vignette {
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 2, 15, 0.55) 100%);
    box-shadow: inset 0 0 160px rgba(0, 2, 20, 0.85);
}

/* subtle brightness flicker */
.fx-flicker {
    background: rgba(80, 140, 255, 0.025);
    mix-blend-mode: screen;
    animation: flicker 5s steps(1) infinite;
}

@keyframes flicker {
    0%, 96%, 100% { opacity: 0.15; }
    97% { opacity: 0.45; }
    98% { opacity: 0; }
    99% { opacity: 0.35; }
}

/* scrollbars */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(60, 110, 255, 0.25);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(60, 110, 255, 0.4);
}

/* ======================= RESPONSIVE — TABLET ======================= */
@media (max-width: 1000px) and (min-width: 761px) {
    #client {
        grid-template-columns: 300px 1fr;
    }

    #sidebar {
        display: none;
    }
}

/* ======================= RESPONSIVE — PHONE ======================= */
@media (max-width: 760px) {

    /* alto real del viewport (evita salto por barra del navegador) */
    #app {
        height: 100vh;
        height: 100dvh;
        filter: none;
        /* el filtro de página es caro en móvil */
    }

    #landing {
        height: 100vh;
        height: 100dvh;
    }

    body {
        -webkit-tap-highlight-color: transparent;
    }

    /* ---- topbar compacta ---- */
    #topbar {
        height: 50px;
        padding: 0 12px;
    }

    .brand-tag {
        display: none;
    }

    .brand-name {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .topbar-right {
        gap: 10px;
    }

    #rejection-counter {
        padding: 4px 9px;
        gap: 6px;
    }

    .rejection-label {
        display: none;
    }

    #rejection-count {
        font-size: 16px;
    }

    /* ---- una sola columna ---- */
    #client {
        display: flex;
        flex-direction: column;
    }

    /* sidebar -> barra horizontal de folders */
    #sidebar {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
        border-right: none;
        border-bottom: 1px solid var(--line);
        overflow-x: auto;
    }

    .compose,
    .sidebar-foot {
        display: none;
    }

    .folders {
        flex-direction: row;
        gap: 6px;
    }

    .folder {
        padding: 7px 14px;
        white-space: nowrap;
    }

    .folder .f-icon {
        display: none;
    }

    #list-pane {
        flex: 1;
        border-right: none;
        min-height: 0;
    }

    .list-head {
        padding: 12px 16px;
    }

    .email-item {
        padding: 15px 16px;
        gap: 13px;
    }

    .avatar {
        width: 44px;
        height: 44px;
    }

    .email-item.unread::before {
        top: 50%;
    }

    /* ---- lector como overlay deslizante ---- */
    #read-pane {
        position: fixed;
        left: 0;
        right: 0;
        top: 50px;
        bottom: 28px;
        z-index: 60;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        background: linear-gradient(180deg, #050b2c 0%, #02030f 100%);
    }

    #client.reading #read-pane {
        transform: translateX(0);
    }

    #reader-back {
        display: block;
    }

    #empty-state {
        display: none;
    }

    #reader {
        padding: 20px 18px 70px;
    }

    .reader-subject {
        font-size: 22px;
    }

    .reader-from {
        gap: 11px;
    }

    .reader-body {
        font-size: 15px;
    }

    /* ---- status bar compacta ---- */
    #statusbar {
        height: 28px;
        gap: 12px;
        padding: 0 12px;
        font-size: 10px;
    }

    #st-feed,
    .st-present {
        display: none;
    }

    /* ---- landing compacto ---- */
    .boot-frame {
        padding: 18px;
    }

    #boot-log {
        font-size: 12px;
        min-height: 118px;
        margin-bottom: 26px;
    }

    #landing-title {
        font-size: 46px;
        letter-spacing: 2px;
    }

    #landing-subtitle {
        font-size: 14px;
        margin-top: 22px;
    }

    #enter-button {
        margin-top: 38px;
        padding: 15px 36px;
        font-size: 14px;
        letter-spacing: 2px;
    }

    /* ---- toast a lo ancho ---- */
    #toast {
        left: 12px;
        right: 12px;
        bottom: 36px;
        max-width: none;
    }

    /* ---- aligerar efectos CRT para rendimiento ---- */
    .fx-grain,
    .fx-rollbar,
    .fx-flicker {
        display: none;
    }

    .fx-scanlines {
        opacity: 0.5;
    }

    #sidebar,
    #list-pane,
    #toast,
    #topbar {
        backdrop-filter: none;
    }

    /* ---- topbar robusta en pantallas angostas ---- */
    .brand {
        min-width: 0;
        overflow: hidden;
    }

    .brand-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-right {
        flex: 0 0 auto;
    }

    /* ---- folders: área táctil más grande + barra activa abajo ---- */
    .folder {
        padding: 10px 16px;
    }

    .folder.active {
        box-shadow: inset 0 -2px 0 var(--cyan), inset 0 1px 0 rgba(200, 220, 255, 0.2);
    }

    /* ---- lector con más aire ---- */
    #reader {
        padding: 18px 16px 80px;
    }

    /* ---- buscaminas: cabe y se toca bien ---- */
    .ms-grid {
        max-width: 280px;
    }

    .ms-cell {
        font-size: 13px;
    }

    .reply-opt {
        padding: 13px 18px;
    }
}

/* pantallas muy chicas (<= 360px) */
@media (max-width: 360px) {
    .brand-name {
        font-size: 11px;
        letter-spacing: 1px;
    }

    #lang-toggle {
        font-size: 13px;
        padding: 8px 12px;
    }

    .topbar-right {
        gap: 8px;
    }
}

/* accesibilidad: menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .fx-rollbar,
    .fx-grain,
    .fx-flicker,
    .glitch::before,
    .glitch::after,
    #enter-button,
    .brand-dot {
        animation: none !important;
    }
}

/* =========================================================
   HILO DE RESPUESTAS + SLOP + BUSCAMINAS
   ========================================================= */
.reader-thread {
    margin-top: 4px;
}

.msg {
    padding: 18px 0;
    border-bottom: 1px solid rgba(120, 170, 255, 0.08);
}

.msg-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.msg-head .avatar {
    width: 40px;
    height: 40px;
}

.msg-meta {
    flex: 1;
    min-width: 0;
}

.msg-name {
    font-weight: 600;
    font-size: 14px;
    color: #eaf2ff;
}

.msg-email {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--cyan);
}

.msg-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted-2);
    white-space: nowrap;
}

.msg-body {
    font-size: 15px;
    line-height: 1.72;
    color: rgba(223, 233, 255, 0.9);
}

.msg-body p {
    margin: 0 0 14px;
}

.msg-body p:last-child {
    margin-bottom: 0;
}

/* tus mensajes */
.msg.me .msg-name {
    color: var(--cyan);
}

.msg.me .msg-body {
    background: linear-gradient(180deg, rgba(60, 110, 255, 0.14), rgba(30, 60, 160, 0.06));
    border-left: 2px solid var(--cyan);
    padding: 12px 14px;
    border-radius: 0 6px 6px 0;
}

/* indicador "escribiendo…" */
.typing .msg-body {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
}

.typing .dots > span {
    animation: blink 1.2s infinite;
}

.typing .dots > span:nth-child(2) { animation-delay: 0.2s; }
.typing .dots > span:nth-child(3) { animation-delay: 0.4s; }

/* caja de respuesta */
.reply-box {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.reply-prompt {
    font-size: 11px;
    color: var(--cyan);
    margin-bottom: 10px;
}

.reply-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reply-opt {
    text-align: left;
    padding: 12px 18px;
    border: 1px solid var(--line);
    background: rgba(0, 8, 40, 0.4);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.reply-opt:hover {
    background: var(--panel-strong);
    border-color: var(--cyan);
}

.reply-opt:active {
    transform: scale(0.99);
}

/* ---- SLOP: mensajes degradados ---- */
.msg.slop {
    background: repeating-linear-gradient(45deg,
        rgba(25, 230, 255, 0.06) 0, rgba(25, 230, 255, 0.06) 12px,
        rgba(255, 184, 0, 0.06) 12px, rgba(255, 184, 0, 0.06) 24px);
    border: 1px solid rgba(25, 230, 255, 0.4);
    border-radius: 6px;
    padding: 14px;
    margin: 8px 0;
    transform: rotate(-0.5deg);
}

.msg.slop .msg-name {
    color: #ffb800;
}

.msg.slop .msg-body {
    font-family: 'Comic Sans MS', 'Averia Libre', cursive;
    color: #ffe14d;
    text-shadow: 0 0 10px rgba(95, 233, 255, 0.4);
}

/* ---- ANUNCIOS falsos (fondo = imagen adjunta, estirada) ---- */
.slop-ad {
    position: relative;
    margin: 14px 0;
    display: flex;
    align-items: flex-end;
    min-height: 130px;
    padding: 14px 16px;
    border-radius: 6px;
    background: #000 url('Image/studyingMyPain.png') center / 100% 100% no-repeat;
    color: #fff;
    box-shadow: 0 0 26px rgba(25, 230, 255, 0.35);
    animation: adPulse 1.4s infinite alternate;
    cursor: pointer;
    overflow: hidden;
}

/* velo para que el texto se lea sobre la imagen */
.slop-ad::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.05));
    pointer-events: none;
}

.ad-txt {
    position: relative;
    z-index: 1;
}

.ad-txt strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.15;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.ad-txt span {
    font-size: 12px;
    color: #dfe9ff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.ad-x {
    position: absolute;
    top: 6px;
    right: 10px;
    z-index: 2;
    font-family: var(--mono);
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 6px #000;
    transition: transform 0.2s;
}

.slop-ad:hover .ad-x {
    transform: translate(16px, -12px);
    /* el botón de cerrar se escapa (dark pattern) */
}

@keyframes adPulse {
    from { box-shadow: 0 0 16px rgba(25, 230, 255, 0.25); }
    to { box-shadow: 0 0 32px rgba(25, 230, 255, 0.55); }
}

/* ---- BUSCAMINAS ---- */
.minesweeper {
    margin: 14px 0 4px;
    padding: 14px;
    border: 2px dashed #ffb800;
    border-radius: 6px;
    background: rgba(0, 0, 20, 0.5);
}

.ms-status {
    font-family: var(--mono);
    font-size: 12px;
    margin-bottom: 12px;
    color: #ffd23b;
    text-align: center;
}

.ms-grid {
    display: grid;
    gap: 3px;
    max-width: 300px;
    margin: 0 auto;
}

.ms-cell {
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #21408f, #142a64);
    box-shadow: inset 0 1px 0 rgba(200, 220, 255, 0.25);
    color: #fff;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    padding: 0;
    border-radius: 2px;
    cursor: pointer;
    line-height: 1;
}

.ms-cell.rev {
    background: rgba(0, 8, 30, 0.55);
    box-shadow: none;
    cursor: default;
}

.ms-cell.mine {
    background: #a45cff;
}

.ms-cell.flag {
    background: #3a5db3;
}

.ms-cell.n1 { color: #5fe9ff; }
.ms-cell.n2 { color: #4dff9b; }
.ms-cell.n3 { color: #ffd23b; }
.ms-cell.n4 { color: #ff8e3b; }
.ms-cell.n5,
.ms-cell.n6,
.ms-cell.n7,
.ms-cell.n8 { color: #c77dff; }

.ms-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.ms-controls button {
    font-family: var(--mono);
    font-size: 11px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    background: rgba(0, 8, 40, 0.5);
    color: var(--text);
    border-radius: 20px;
    cursor: pointer;
}

.ms-controls button:hover {
    background: var(--panel-strong);
}

/* =========================================================
   BOTÓN DE IDIOMA + VIDEO EN SIDEBAR
   ========================================================= */
#lang-toggle {
    background: rgba(0, 8, 40, 0.5);
    border: 1px solid var(--bar-hi);
    color: var(--cyan);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 9px 18px;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#lang-toggle:hover {
    background: var(--panel-strong);
    color: #fff;
}

#video-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    box-shadow: inset 0 0 24px rgba(0, 0, 20, 0.8);
}

#bg-gif {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* mensajes de spam: un dejo verde de "phishing" */
.msg.spammy .msg-name {
    color: #6cff9e;
}

