* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #000;
    color: #ddd;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    overflow-x: hidden;
}

/* =========================
   TŁO — ROZPAD MATERII
========================= */

#particles {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #777;
    opacity: 0;
    animation: drift linear infinite;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); opacity: 0; }
    15% { opacity: .45; }
    70% { opacity: .18; }
    100% { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}

/* =========================
   GŁÓWNY INTERFEJS
========================= */

.wrapper {
    position: relative;
    z-index: 2;
    width: min(1100px, 94%);
    margin: auto;
}

/* =========================
   HEADER
========================= */

header {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid #181818;
    position: relative;
}

.logo {
    font-size: clamp(42px, 8vw, 82px);
    font-weight: 900;
    letter-spacing: -5px;
    color: #f2f2f2;
    text-transform: lowercase;
    position: relative;
    display: inline-block;
    width: max-content;
    cursor: pointer;
}

.logo::after {
    content: "netivly";
    position: absolute;
    left: 4px;
    top: 3px;
    color: #333;
    z-index: -1;
    animation: glitch 4s infinite;
}

@keyframes glitch {
    0%, 88%, 100% { transform: translate(0); opacity: .3; }
    90% { transform: translate(8px, -2px); opacity: .7; }
    92% { transform: translate(-6px, 2px); opacity: .1; }
}

.subtitle {
    color: #555;
    margin-top: 8px;
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* =========================
   PRZYCISKI I FILTRY SEKCJI
========================= */

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 0 15px 0;
    gap: 15px;
    flex-wrap: wrap;
}

.categories-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.cat-btn {
    background: #050505;
    color: #888;
    border: 1px solid #1a1a1a;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: .2s;
}

.cat-btn:hover, .cat-btn.active {
    background: #151515;
    color: #fff;
    border-color: #444;
}

button {
    background: #090909;
    color: #ddd;
    border: 1px solid #252525;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: bold;
    transition: .2s;
}

button:hover {
    background: #151515;
    border-color: #555;
    color: white;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status {
    color: #444;
    font-size: 12px;
}

/* =========================
   NOWY WĄTEK
========================= */

#createBox {
    display: none;
    background: #050505;
    border: 1px solid #202020;
    padding: 20px;
    margin-bottom: 25px;
}

#createBox input,
#createBox select,
#createBox textarea {
    width: 100%;
    background: #000;
    color: #ddd;
    border: 1px solid #222;
    padding: 12px;
    margin-bottom: 10px;
    outline: none;
}

#createBox input:focus,
#createBox select:focus,
#createBox textarea:focus {
    border-color: #555;
}

#createBox textarea {
    min-height: 100px;
    resize: vertical;
}

.char-counter {
    font-size: 11px;
    color: #555;
    text-align: right;
    margin-top: -5px;
    margin-bottom: 10px;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #aaa;
    cursor: pointer;
}

.option-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* =========================
   WĄTKI
========================= */

#threads {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thread {
    position: relative;
    background: rgba(7, 7, 7, .88);
    border: 1px solid #151515;
    padding: 20px;
    cursor: pointer;
    overflow: hidden;
    transition: border .3s, transform .3s, background .3s;
}

.thread.pinned-thread {
    border-color: #443810;
    background: #0e0c05;
}

.thread:hover {
    border-color: #383838;
    background: #0b0b0b;
    transform: translateX(4px);
}

.thread-title {
    font-size: 19px;
    color: #eee;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.thread-meta {
    color: #555;
    font-size: 12px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.badge {
    text-transform: uppercase;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    background: #111;
    border: 1px solid #333;
}

.badge-pinned { border-color: #aa8800; color: #ffd700; font-weight: bold; }
.badge-nsfw { border-color: #a33; color: #f66; font-weight: bold; }
.badge-netivly { border-color: #38a; color: #8cf; }
.badge-private { border-color: #833; color: #f88; }
.badge-trash { border-color: #555; color: #888; }
.badge-main { border-color: #383; color: #8f8; }

.empty {
    padding: 80px 20px;
    text-align: center;
    color: #333;
    border: 1px dashed #151515;
}

/* =========================
   WĄTEK & POSTY
========================= */

#board {
    display: none;
}

.back {
    margin-bottom: 20px;
}

.post {
    position: relative;
    background: #070707;
    border-left: 2px solid #202020;
    padding: 18px;
    margin-bottom: 10px;
    overflow: visible;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.post.highlight {
    background: #141410;
    border-left-color: #ffd700;
}

.post:hover {
    border-left-color: #555;
}

.post-head {
    color: #555;
    font-size: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-id-btn {
    color: #888;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
}

.post-id-btn:hover {
    color: #fff;
    text-decoration: underline;
}

.post-content {
    white-space: pre-wrap;
    color: #ccc;
    line-height: 1.6;
    word-break: break-word;
}

.post-content a.post-link {
    color: #6495ed;
    text-decoration: underline;
}

.post-content a.post-link:hover {
    color: #a0c4ff;
}

.post-content a.post-quote-ref {
    color: #8fbc8f;
    font-weight: bold;
    text-decoration: none;
}

.post-content a.post-quote-ref:hover {
    text-decoration: underline;
}

.post-content .post-greentext {
    color: #789922;
}

/* QoL: Spoiler */
.spoiler {
    background: #222;
    color: #222;
    padding: 0 4px;
    border-radius: 2px;
    cursor: pointer;
    user-select: none;
    filter: blur(4px);
    transition: background 0.2s, color 0.2s, filter 0.2s;
}

.spoiler:hover, .spoiler.revealed {
    background: #333;
    color: #eee;
    filter: none;
}

.youtube-embed {
    margin-top: 12px;
    max-width: 560px;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid #222;
    border-radius: 4px;
}

.youtube-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* =========================
   MULTIMEDIA & OBNIŻENIE / POWIĘKSZANIE
========================= */

.post-image-container {
    margin-top: 12px;
    position: relative;
    display: inline-block;
}

.post-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: 4px;
    border: 1px solid #222;
    display: block;
    object-fit: cover;
    cursor: zoom-in;
    transition: max-width 0.3s ease, max-height 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
}

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

/* NSFW Blur Filter */
.post-image.nsfw-blurred {
    filter: blur(22px);
    opacity: 0.6;
}

.post-image.nsfw-blurred:hover {
    opacity: 0.85;
}

.nsfw-overlay-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(180, 20, 20, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    pointer-events: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0,0,0,0.6);
    white-space: nowrap;
}

/* =========================
   BLUR DLA WĄTKÓW PRYWATNYCH
========================= */

.post-image.private-blurred {
    filter: blur(25px);
    opacity: 0.5;
}

.post-image.private-blurred:hover {
    opacity: 0.75;
}

.private-overlay-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(40, 10, 10, 0.9);
    color: #f88;
    border: 1px solid #833;
    font-size: 11px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    pointer-events: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0,0,0,0.8);
    white-space: nowrap;
}

/* Hover Preview dla cytatów */
#quote-preview-popup {
    position: absolute;
    z-index: 9999;
    background: #0d0d0d;
    border: 1px solid #444;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    max-width: 450px;
    pointer-events: none;
    display: none;
    border-radius: 4px;
}

.reply {
    margin-top: 25px;
    background: #050505;
    border: 1px solid #171717;
    padding: 20px;
}

.reply textarea {
    width: 100%;
    min-height: 130px;
    resize: vertical;
    background: #000;
    border: 1px solid #222;
    color: #ddd;
    padding: 13px;
    outline: none;
    margin-bottom: 5px;
}

.file-input-wrapper {
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
    font-size: 12px;
    color: #888;
}

footer {
    color: #292929;
    text-align: center;
    padding: 60px 0 30px;
    font-size: 11px;
    letter-spacing: 2px;
}

@media (max-width: 600px) {
    header { min-height: 140px; }
    .logo { letter-spacing: -3px; }
    .controls { align-items: flex-start; flex-direction: column; }
    .thread { padding: 16px; }
    .post-image { max-width: 100%; }
}

/* =========================
   STYLOWANIE SELEKTORA MOTYWÓW
========================= */

.theme-switcher select {
    background: #090909;
    color: #ddd;
    border: 1px solid #252525;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: .2s;
}

.theme-switcher select:hover {
    background: #151515;
    border-color: #555;
    color: white;
}

.theme-switcher select option {
    background: #090909;
    color: #ddd;
}
