:root {
    /* TEMA OSCURO (Default) */
    --bg-body: #0f1012;
    --bg-post: #17191c;
    --bg-reply: #1a1a1e;
    --border-color: #2d2d32;
    --text-main: #d1d1d1;
    --accent-red: #cc0000;
    --accent-green: #c9c9c9;
    --text-muted: #666;
    --input-bg: #000;
    --hover-gradient: linear-gradient( #16161a, #121214);
    --user-link: #d1d1d1;
    --ban-text: #FFA500;
    --hilo: #333;
}

[data-theme="light"] {
    /* TEMA CLARO (Soft) */
    --bg-body: #eef2ff;
    --bg-post: #D6DAF0;
    --bg-reply: #c3c7da;
    --border-color: #B7C5D9;
    --text-main: #2c2c2c;
    --accent-red: #cc0000;
    --accent-green: #444;
    --text-muted: #777; 
    --input-bg: #fff;
    --hover-gradient: linear-gradient( #D1D5EE, #EEF2FF);
    --user-link: #34345c;
    --ban-text: #ff4b05;
    --hilo: #999;
}

body { 
    background-color: var(--bg-body);   
    color: var(--text-main); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 20px; 
    line-height: 1.5;
    padding-bottom: 220px; 
    transition: background 0.3s, color 0.3s;
    padding-top: 70px;
}

#auth { 
    background: var(--bg-post); 
    border-bottom: 2px solid var(--accent-red); 
    color: var(--text-main); 
    padding: 10px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    top: 0;
    left: 0;
    right: 0;
    position: fixed;
    z-index: 2000;
}
        
#userPhoto {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 0;
}

#form-container { background: var(--bg-post); border-top: 2px solid var(--accent-red); padding: 15px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; box-shadow: 0 -5px 20px rgba(0,0,0,0.8); }
        
.form-inner { max-width: 600px; margin: 0 auto; }
        
textarea { 
    background: var(--input-bg); 
    color: var(--text-main); 
    border: 1px solid var(--border-color); 
    width: 100%; 
    padding: 10px; 
    border-radius: 4px; 
    font-family: monospace;
}



        button { 
            background: var(--input-bg); color: var(--text-main); border: 1px solid var(--border-color); 
            cursor: pointer; padding: 8px 16px; border-radius: 4px; font-weight: bold;
            
        }
        button:hover { background: var(--accent-red); }

        .form-controls {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            margin-top: 5px;
        }
        .badge-veteran {
    background: linear-gradient(45deg, #ffd700, #fff, #ffd700);
    background-size: 200% auto;
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 10px;
    animation: shine 2s linear infinite;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes shine {
    to { background-position: 200% center; }
}

        #posts { display: flex; flex-direction: column; gap: 10px; }
.post { 
    background-color: var(--bg-post); 
    border: 1px solid var(--border-color); 
    border-style: dashed;
    padding: 5px 10px;
    width: fit-content; /* Se ajusta al ancho del texto */
    max-width: 600px;   /* LIMITE CRÍTICO: No dejar que pase de aquí para que no se vea gigante */
    margin-bottom: 4px;
    display: block;
    transition: border-color 0.2s ease;
    contain: layout style; /* Aísla el post para que el navegador lo dibuje más rápido */
    content-visibility: auto; /* Solo dibuja el contenido cuando está cerca de verse */
    contain-intrinsic-size: 100px; /* Tamaño estimado para el scroll */
}

.is-reply { 
    margin-left: 20px; 
    border: 1px solid var(--border-color);
    border-left: 2px solid var(--accent-red); /* Indicador de respuesta */
}

        
.pfp-mini { 
    width: 24px; 
    height: 24px; 
    border-radius: 0; /* Estilo retro */
    object-fit: cover; 
    vertical-align: middle;
}

.user-link { color: var(--accent-red) !important; font-weight: bold; text-decoration: none; }

        .post-id { 
    color: var(--text-muted); 
    font-family: 'Courier New', monospace; 
    font-size: 11px; 
    letter-spacing: -0.5px;
}

.post-content { 
    color: var(--text-main); 
    font-size: 13px; 
    font-family: "Verdana", sans-serif;
    line-height: 1.3;
    margin-top: 5px;
    word-wrap: break-word; 
    overflow-wrap: break-word;
    max-width: 100%; /* Se mantiene dentro del .post */
}

.post-img { 
    max-width: 150px; 
    max-height: 150px;
    border: 1px solid var(--border-color);
    margin: 5px 0;
    cursor: zoom-in;
    aspect-ratio: auto; 
    height: auto;
}

.post-img.expanded { 
    max-width: 100%; 
    max-height: none; 
    cursor: zoom-out; 
}

        #imagePreviewContainer { 
            margin-bottom: 10px; 
            display: flex; 
            align-items: center; 
            gap: 10px; }
        #imgPrev { 
            max-width: 80px; 
            border: 1px solid var(--accent-red);}

        .verified-icon, .staff-badge { 
            width: 16px !important; height: 16px !important; 
            min-width: 16px; flex-shrink: 0; vertical-align: middle; 
            box-shadow: #000;
        }
        .badge-blue { fill: #027ac9; }
        .badge-red { fill: #ff0000; }
        .badge-yellow { fill: #ffcc00; }
        .badge-gold { fill: #ffd700; }

        [data-theme="light"] .badge-veteran, 
        [data-theme="light"] .badge-gold,
        [data-theme="light"] .badge-red,
        [data-theme="light"] .verified-icon[style*="fill:#ffd700"],
        [data-theme="light"] .verified-icon[style*="fill:red"] {
        filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5));
        }
        [data-theme="light"] .verified-icon[style*="fill:gold"] {
        filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5));
        }


        .reply-tag { color: #ff0000; font-size: 0.8em; cursor: pointer; margin-bottom: 4px; text-decoration: underline;}
        .reply-btn { font-size: 0.75em; color: red; cursor: pointer; margin-left: auto; text-transform: uppercase; text-decoration: underline;}
        .delete-btn { font-size: 0.75em; color: #555; cursor: pointer; margin-left: 10px; }
        .highlight-post { border: 1px solid gold !important; }
        
        .replies-container { margin-left: 20px; border-left: 2px solid var(--hilo); padding-left: 10px; }
        .hidden { display: none; }
        .toggle-btn { cursor: pointer; color: #f00; font-size: 12px; margin-left: 10px; }


       #searchInput {
    flex-grow: 1; 
    padding: 8px 12px; 
    background: var(--input-bg); 
    color: var(--text-main); 
    border: 1px solid var(--border-color); 
    border-radius: 2px; /* Menos redondeado para estilo retro */
    outline: none; 
    font-size: 13px;
    min-width: 150px;
}
        #searchInput:focus {
           border-color: var(--accent-red);
           box-shadow: 0 0 5px var(--accent-red);
        }
        .highlight-text {
        background-color: #ff000066 !important; /* Rojo transparente */
        color: white !important;
        font-weight: bold;
        padding: 0 2px;
        } 


.text-spoiler{
background:#000;
color:#000;
cursor:pointer;
padding:0 3px;
}

.text-spoiler.revealed{
color:#fff;
background:#000;
}

.post:hover {
    border-color: red !important; /* Color naranja clásico de alerta */
    background-color: var(--bg-reply);
    transform: none; /* Quitamos el desplazamiento para ser más minimalistas */
}

.board-nav a {
    padding: 5px 10px;
    background: #111;
    border: 1px solid #333;
    margin: 0 2px;
    text-decoration: none;
}
.board-nav a:hover {
    background: var(--accent-red);
    color: white !important;
}
/* Estilo del Header del Post inspirado en Imageboards */
.post-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; }

.user-link {
    font-weight: bold;
    color: var(--accent-red) !important; /* Verde clásico de 4chan para nombres */
    text-decoration: none;
}

.user-link:hover {
    text-decoration: underline;
}

.user-info-container {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Ajusta según prefieras */
}

/* Contenedor para los badges y botones de admin para que no estorben al nombre */
.status-badges {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-actions-feed {
    background: var(--border-color);
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: auto; /* Empuja los botones de borrado al final a la derecha */
}

.backlink-container {
    display: block;
    font-size: 10px;
    margin-top: 5px;
    color: var(--text-muted);
}

.backlink {
    color: var(--accent-red) !important;
    text-decoration: none;
    margin-right: 5px;
    cursor: pointer;
}

.backlink:hover {
    text-decoration: underline;
}
/* Animación de parpadeo para resaltar el post */
@keyframes highlight-fade {
    0% { outline: 3px solid var(--accent-red); background-color: rgba(204, 0, 0, 0.2); }
    100% { outline: 0px solid transparent; }
}

.highlight-post {
    animation: highlight-fade 2s ease-out;
}

#board-nav-container a {
    color: var(--accent-red);
    text-decoration: none;
    padding: 0 5px;
}
#board-nav-container strong {
    color: var(--text-main);
    border-bottom: 1px solid var(--accent-red);
}

.post { 
    background-color: var(--bg-post); 
    border: 1.5px solid var(--border-color); 
    padding: 5px 10px;
    border-style: none solid solid none;
    width: fit-content; 
    max-width: 600px;
    margin-bottom: 4px;
    border-radius: 0;
    display: table; 
    transition: border-color 0.2s ease;
    margin-left: 0; /* Alineado a la izquierda como en los boards */
    border-width: medium 1.5px 1.5px medium;
}

/* 2. DISEÑO ESPECÍFICO PARA MÓVIL */
@media (max-width: 600px) {
    body { padding: 10px; padding-top: 80px; padding-bottom: 220px; }
    
    .post { 
        width: 92% !important; /* Casi todo el ancho */
        max-width: none;
        display: block; /* Para que ocupe el ancho disponible */
        margin: 5px auto !important; /* Centrados en el celular */
    }
    
    .is-reply {
        margin-left: 5% !important; /* Un pequeño margen para que se note que es respuesta */
        width: 85% !important;
    }

    #auth { 
        padding: 5px; 
        font-size: 12px;
    }
}
.search-highlight {
    background-color: rgba(255, 0, 0, 0.548);
    color: #fff;
    font-weight: bold;
    border-radius: 2px;
    padding: 0 2px;
}
.omitted-posts:hover {
    background: var(--bg-reply);
    border-style: solid;
    color: gold;
}

/* --- CONFIGURACIÓN DE SPOILER KAGURAZU --- */
.img-container.img-spoiler {
    background-image: url('../images/page/SPOILER.jpg');
    background-size: cover;
    background-position: center;
    /* Esto mantiene la proporción de tu imagen original de spoiler */
    aspect-ratio: 1 / 1; 
    width: 200px; 
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Ocultar imagen original dentro del spoiler */
.img-container.img-spoiler img {
    opacity: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Al revelar (clic), mostramos la imagen */
.img-container.img-spoiler.spoiler-off {
    background-image: none !important;
    aspect-ratio: auto; /* Permite que tome la forma de la imagen real */
    width: auto;
}

.img-container.img-spoiler.spoiler-off img {
    opacity: 1;
}

/* Efecto de expansión al hacer clic en imágenes normales o reveladas */
.post-img.expanded {
    max-width: 80vw !important;
    max-height: 80vh !important;
    object-fit: contain !important;
    cursor: zoom-out;
    position: relative;
    z-index: 100;
}

.spoiler-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px black;
}

/* Mejora visual de las citas rojas */
.quote-link {
    color: #ff4f4f !important;
    background: rgba(255, 79, 79, 0.1);
    padding: 0 4px;
    border-radius: 3px;
    transition: 0.2s;
}
.quote-link:hover {
    background: rgba(255, 79, 79, 0.3);
}
#preview-popup {
    position: absolute;
    z-index: 5000;
    border: 1px solid var(--accent-red);
    background-color: var(--bg-post);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5);
    padding: 10px;
    max-width: 400px;
    pointer-events: none; /* Evita que el mouse interfiera con el popup */
}
.post.is-banned-visual::after {
    content: url('../images/page/ban.jpg'); /* Sube tu imagen a ImgBB y pon el link aquí */
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0.8;
    pointer-events: none;
}
.highlight-post {
    outline: 2px solid var(--accent-red) !important;
    box-shadow: 0 0 15px var(--accent-red) !important;
    transition: all 0.5s ease;
}

.quote-link {
    color: #ff0000;
    cursor: pointer;
}
.reply-reference {
    color: #ff0000;   
    margin-bottom: 4px;
    cursor: pointer;
    text-decoration: underline;
}

/* Si ves un gris no deseado en OP, esto lo oculta */
.post:not(.is-reply) .reply-reference {
    display: none !important;
}
.is-reply { 
    margin-left: 20px; 
    border: 1px solid var(--border-color);
    border-left: 2px solid var(--accent-red); /* Indicador de respuesta */
}
.cita-tag { color: #6fff43; font-size: 0.8em; cursor: pointer; margin-bottom: 4px; text-decoration: underline;}
       
.quote-preview {
    position: absolute;
    z-index: 9999;
    background: var(--bg-post);
    border: 1px solid var(--accent-red);
    padding: 8px;
    max-width: 400px;
    font-size: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6);
    pointer-events: none;
    animation: fadeInPreview 0.15s ease-out;
}

@keyframes fadeInPreview {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.preview-img{
max-width:120px;
margin-top:6px;
border-radius:3px;
}
.img-banned{
position:relative;
}

.ban-overlay{
position:absolute;
background:url("../images/page/ban.jpg");
background-color:#000;
pointer-events:none;
}
.spoiler-preview{
background:url("../images/page/SPOILER.jpg") center/contain no-repeat;
position:absolute;
}

.spoiler-preview::after{
background:url("../images/page/SPOILER.jpg") center/contain no-repeat;
position:absolute;
pointer-events:none;
}


.post-img{
pointer-events:none;
user-select:none;
-webkit-user-drag:none;
}

.img-container{
cursor:pointer;
}



