:root {
    --bg-arcade: #07070b;
    --cabinet-body: #12131a;
    --cabinet-bezel: #1b1d28;
    --crt-void: #040507;
    --pixel-gold: #ffbb00;
    --pixel-green: #00f566;
    --pixel-red: #ff2244;
    --pixel-cyan: #00e5ff;
    --border-dark: #090a0f;
    --border-mid: #2a2e3f;
    --border-light: #444b66;
    --text-main: #e2e8f0;
    --text-muted: #8b95ad;
}

* {
    box-sizing: border-box;
    border-radius: 0 !important;
}

html {
    scroll-behavior: smooth;
}

body.arcade-bg {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-arcade);
    color: var(--text-main);
    font-family: 'Vazirmatn', sans-serif;
    background-image:
        linear-gradient(45deg, #0b0c12 25%, transparent 25%),
        linear-gradient(-45deg, #0b0c12 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #0b0c12 75%),
        linear-gradient(-45deg, transparent 75%, #0b0c12 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    overflow-x: hidden;
}

.font-pixel-en { font-family: 'Silkscreen', monospace; }
.font-crt-osd { font-family: 'VT323', monospace; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--pixel-gold); }
.text-green { color: var(--pixel-green); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.mt-4 { margin-top: 4px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.flex-row { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }

/* Desktop Full-Screen Pixel-Art / CRT Background */
.desktop-bg-canvas,
.desktop-bg-dim {
    display: none;
}

@media (min-width: 500px) {
    .desktop-bg-canvas {
        display: block;
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        z-index: 0;
        pointer-events: none;
        image-rendering: pixelated;
        image-rendering: crisp-edges;
    }
    .desktop-bg-dim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        background-color: rgba(4, 5, 10, 0.42);
        background-image: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.28) 50%);
        background-size: 100% 4px;
    }
    body.mode-16bit .desktop-bg-dim,
    body.mode-8bit .desktop-bg-dim {
        background-image: none;
        background-color: rgba(4, 5, 10, 0.36);
    }
}

/* Dynamic Mouse Spotlight (Desktop) */
.cursor-glow {
    position: fixed;
    width: 340px;
    height: 340px;
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(0, 245, 102, 0.14) 0%, rgba(0, 229, 255, 0.05) 45%, transparent 72%);
    opacity: 0;
    transition: opacity 0.25s steps(4);
}
@media (hover: hover) and (pointer: fine) {
    .cursor-glow.active { opacity: 1; }
}

/* Mobile-Ratio Shell (Centered 440px on Desktop, Full on Mobile) */
.mobile-shell {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 10px 8px 36px;
}

@media (max-width: 499px) {
    .mobile-shell {
        padding: 0;
    }
}

/* Stepped Pixel Frame */
.pixel-box-frame {
    position: relative;
    background-color: var(--cabinet-body);
    border: 4px solid var(--border-mid);
    box-shadow:
        0 -4px 0 0 var(--border-dark),
        0 4px 0 0 var(--border-dark),
        -4px 0 0 0 var(--border-dark),
        4px 0 0 0 var(--border-dark),
        0 0 0 4px #000000,
        inset 0 0 0 4px #0b0c11,
        0 18px 0 0 rgba(0, 0, 0, 0.8);
    transition: border-color 0.12s steps(2);
}
.pixel-box-frame:hover {
    border-color: #3d445e;
}

.pixel-screw {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #2b3042;
    border: 2px solid #090a0e;
    box-shadow: inset 2px 2px 0 #4a526e;
    position: relative;
}
.pixel-screw::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 1px;
    width: 4px;
    height: 2px;
    background: #090a0e;
}

.cabinet-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0d0e14;
    border-bottom: 2px solid #232736;
}
.footer-bar {
    border-bottom: none;
    border-top: 2px solid #232736;
}

.pixel-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 1px solid #000;
}
.pixel-dot.green { background: var(--pixel-green); }
@keyframes stepBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.2; }
}
.blink { animation: stepBlink 1.2s infinite; }

.osd-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    padding: 1px 6px;
    background: #07140c;
    border: 1px solid #144726;
}

/* Sticky Instagram Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #12131a;
    border-bottom: 3px solid #25293a;
    box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.55);
}

.header-actions-right,
.header-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-circle-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #191c26;
    color: #cbd5e1;
    border: 2px solid #383f56;
    cursor: pointer;
    box-shadow: 0 3px 0 0 #07080c, inset 0 2px 0 0 #2c3246;
    transition: transform 0.08s steps(2), border-color 0.08s steps(2), color 0.08s steps(2);
}
.icon-circle-btn:hover {
    color: #fff;
    border-color: var(--pixel-gold);
    transform: translateY(-2px);
}
.icon-circle-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 0 #07080c;
}
.icon-circle-btn.is-logged {
    border-color: var(--pixel-green);
    color: var(--pixel-green);
}

.brand-logo {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}
.brand-title {
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}
.brand-sub {
    font-size: 10px;
    color: var(--pixel-green);
    margin-top: 2px;
}

/* Drawers */
.search-drawer,
.menu-drawer,
.tv-mode-drawer {
    display: none;
    padding: 10px 12px;
    background: #0c0e14;
    border-bottom: 2px solid #25293a;
}
.search-drawer[data-open="1"],
.search-drawer.open,
.menu-drawer.open,
.tv-mode-drawer.open {
    display: block;
}

.tv-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.tv-mode-btn {
    font-family: 'Silkscreen', monospace !important;
    font-size: 11px !important;
}

.search-form {
    display: flex;
    gap: 6px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.menu-user-bar {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px dashed #232838;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Tactile Arcade Buttons */
.arcade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #191c26;
    color: #e2e8f0;
    border: 2px solid #383f56;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 0 0 #08090d, inset 0 2px 0 0 #2c3246;
    transition: transform 0.08s steps(2), border-color 0.08s steps(2), background-color 0.08s steps(2);
}
.arcade-btn:hover {
    transform: translateY(-2px);
    background: #222736;
    border-color: var(--pixel-gold);
    color: #fff;
}
.arcade-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 0 #08090d;
}
.arcade-btn.active,
.arcade-btn-gold {
    background: #2b2108;
    border-color: var(--pixel-gold);
    color: var(--pixel-gold);
}
.arcade-btn-green {
    background: #082414;
    border-color: var(--pixel-green);
    color: var(--pixel-green);
}
.arcade-btn-red {
    background: #2b0910;
    border-color: var(--pixel-red);
    color: #ff6b81;
}
.arcade-btn-cyan {
    background: #082229;
    border-color: var(--pixel-cyan);
    color: var(--pixel-cyan);
}

/* Feed & Post Cards */
.feed-container {
    display: flex;
    flex-direction: column;
}

.post-card {
    padding: 14px 12px 16px;
    border-bottom: 4px solid #090a0f;
    background: var(--cabinet-body);
    transition: background-color 0.12s steps(2);
}
.post-card:hover {
    background: #151721;
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pixel-avatar {
    width: 34px;
    height: 34px;
    background: #0a2915;
    border: 2px solid var(--pixel-green);
    color: var(--pixel-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 2px 2px 0 #000;
}

.author-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.author-name {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}
.post-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: #1b1408;
    border: 1px solid #614409;
    color: var(--pixel-gold);
}

.post-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Normal Image Well (No CRT/Pixel effect) */
.normal-media-well {
    border: 2px solid #232736;
    background: #08090d;
    margin-bottom: 10px;
    overflow: hidden;
}
.normal-media-well .normal-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

/* CRT Bezel & Pixelized Canvas Screen */
.crt-bezel-well {
    background: #08090d;
    border: 4px solid #050608;
    box-shadow: inset 0 0 0 3px #1e2230, 0 2px 0 0 #2b3042;
    padding: 5px;
    margin-bottom: 10px;
}

.crt-screen-tube {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--crt-void);
    overflow: hidden;
    border: 2px solid #000;
    cursor: crosshair;
}

.pixel-source-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.crt-screen-tube.pixel-ready .pixel-source-img {
    display: none;
}

.crt-pixel-canvas {
    width: 100%;
    height: 100%;
    display: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.crt-screen-tube.pixel-ready .crt-pixel-canvas {
    display: block;
}

@keyframes crtGlitch {
    0% { transform: translate(0, 0) scale(1); filter: hue-rotate(0deg); }
    25% { transform: translate(-3px, 1px) scale(1.02); filter: hue-rotate(90deg) saturate(1.8); }
    50% { transform: translate(3px, -1px) scale(0.99); filter: hue-rotate(-90deg) contrast(1.3); }
    75% { transform: translate(-2px, 0) scale(1.01); filter: hue-rotate(30deg); }
    100% { transform: translate(0, 0) scale(1); filter: hue-rotate(0deg); }
}
.crt-screen-tube.glitching .crt-pixel-canvas {
    animation: crtGlitch 0.35s steps(4);
}

.crt-scanlines,
.crt-phosphor-grille,
.crt-roll-line,
.crt-tube-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

body.mode-16bit .crt-scanlines,
body.mode-16bit .crt-phosphor-grille,
body.mode-16bit .crt-roll-line,
body.mode-8bit .crt-scanlines,
body.mode-8bit .crt-phosphor-grille,
body.mode-8bit .crt-roll-line {
    display: none;
}

.crt-scanlines {
    z-index: 3;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.36) 50%);
    background-size: 100% 4px;
}

.crt-phosphor-grille {
    z-index: 4;
    background-image: repeating-linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.04) 0px,
        rgba(0, 255, 0, 0.04) 1px,
        rgba(0, 120, 255, 0.04) 2px,
        rgba(0, 0, 0, 0.1) 3px
    );
    background-size: 3px 100%;
}

@keyframes crtRoll {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(300px); }
}
.crt-roll-line {
    z-index: 5;
    height: 22px;
    bottom: auto;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.05), transparent);
    animation: crtRoll 5.5s linear infinite;
}

.crt-tube-vignette {
    z-index: 6;
    box-shadow: inset 0 0 16px 3px rgba(0, 0, 0, 0.72);
}

.crt-osd-corner {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 7;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #1d3b27;
    color: var(--pixel-green);
    font-size: 13px;
    padding: 1px 6px;
    pointer-events: none;
}

/* Instagram Actions Row */
.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.actions-right,
.actions-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-icon-btn {
    background: transparent;
    border: none;
    color: #e2e8f0;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s steps(2), color 0.08s steps(2);
}
.action-icon-btn:hover {
    color: var(--pixel-gold);
    transform: translateY(-2px) scale(1.1);
}
.action-icon-btn:active {
    transform: scale(0.92);
}
.action-icon-btn.liked { color: var(--pixel-red); }
.action-icon-btn.bookmarked { color: var(--pixel-gold); }
.action-icon-btn.bookmarked svg { fill: currentColor; }

.likes-counter {
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}

.post-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.55;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

.post-body-wrap {
    font-size: 13.5px;
    line-height: 1.75;
    color: #cbd5e1;
}
.post-body-wrap p,
.post-body-full { margin: 0; }

.read-more-btn {
    background: transparent;
    border: none;
    color: var(--pixel-cyan);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 0;
    margin-top: 2px;
    cursor: pointer;
}
.read-more-btn:hover {
    color: var(--pixel-gold);
    text-decoration: underline;
}

/* Comments Footer */
.post-comment-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 2px dashed #212534;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.view-comments-link {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 12px;
    padding: 0;
    text-align: right;
    cursor: pointer;
}
.view-comments-link:hover { color: #fff; }

.guest-comment-prompt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.login-trigger-link {
    background: transparent;
    border: none;
    color: var(--pixel-cyan);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 12px;
    font-weight: 800;
    padding: 0;
    cursor: pointer;
}

.inline-comment-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.inline-comment-input {
    flex: 1;
    background: #0b0d13;
    border: 2px solid #282d3e;
    color: #fff;
    padding: 7px 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 12px;
    outline: none;
}
.inline-comment-input:focus { border-color: var(--pixel-green); }
.inline-comment-send {
    background: #082414;
    border: 2px solid var(--pixel-green);
    color: var(--pixel-green);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 12px;
    cursor: pointer;
}

/* Tutorials List & Detail Pages */
.tutorial-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tutorial-list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: #0d0f16;
    border: 2px solid #2a2e3f;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 4px 0 0 #06070a;
    transition: transform 0.08s steps(2), border-color 0.08s steps(2);
}
.tutorial-list-card:hover {
    transform: translateY(-2px);
    border-color: var(--pixel-gold);
    background: #151824;
}
.tutorial-card-title {
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.5;
}
.tutorial-card-date {
    font-size: 10px;
    color: var(--pixel-cyan);
    white-space: nowrap;
    flex-shrink: 0;
}

.tutorial-article {
    background: #0d0f16;
    border: 2px solid #25293a;
    padding: 14px;
}
.tutorial-article-head {
    border-bottom: 2px dashed #25293a;
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.tutorial-article-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 900;
    color: var(--pixel-gold);
    line-height: 1.6;
}
.tutorial-date-badge {
    font-size: 11px;
    color: var(--pixel-cyan);
}
.tutorial-article-body {
    font-size: 13.5px;
    line-height: 1.85;
    color: #e2e8f0;
}
.tutorial-article-body h3 {
    font-size: 15px;
    color: var(--pixel-green);
    margin: 14px 0 8px;
}
.tutorial-article-body img {
    max-width: 100%;
    height: auto;
    border: 2px solid #2a2e3f;
    margin: 8px 0;
    display: block;
}
.tutorial-article-body a {
    color: var(--pixel-cyan);
}

/* WYSIWYG Tutorial Editor in Admin */
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: #0d0e14;
    border: 2px solid #2d3348;
    border-bottom: none;
}
.wysiwyg-editor {
    min-height: 180px;
    max-height: 360px;
    overflow-y: auto;
    background: #0b0d13;
    border: 2px solid #2d3348;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    line-height: 1.75;
    outline: none;
}
.wysiwyg-editor:focus {
    border-color: var(--pixel-gold);
}
.wysiwyg-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

/* Scroll Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 40;
    width: 40px;
    height: 40px;
    background: #1b1d28;
    border: 2px solid var(--pixel-gold);
    color: var(--pixel-gold);
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 0 0 #000;
    display: none;
    align-items: center;
    justify-content: center;
}
.scroll-top-btn.visible { display: flex; }
.scroll-top-btn:hover {
    transform: translateY(-2px);
    background: #2b2108;
}

/* Modals */
.pixel-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(4, 5, 8, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.pixel-modal-backdrop[hidden] { display: none !important; }

.pixel-modal {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #0d0e14;
    border-bottom: 2px solid #25293a;
}

.comments-list {
    padding: 12px 14px;
    overflow-y: auto;
    max-height: 52vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    background: #0d0f16;
    border: 2px solid #222636;
    padding: 8px 10px;
}
.comment-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.comment-author {
    font-size: 12px;
    font-weight: 800;
    color: var(--pixel-gold);
}
.comment-date {
    font-size: 10px;
    color: var(--text-muted);
}
.comment-body {
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
}

.modal-footer {
    padding: 10px 14px;
    background: #0d0e14;
    border-top: 2px solid #25293a;
}

/* Forms & Admin */
.pixel-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pixel-form[hidden] {
    display: none !important;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.pixel-input {
    width: 100%;
    background: #0b0d13;
    border: 2px solid #2d3348;
    color: #fff;
    padding: 8px 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    outline: none;
}
.pixel-input:focus { border-color: var(--pixel-gold); }

.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.admin-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.admin-tabs .arcade-btn { flex: 1; }

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #0c0e14;
    border: 2px solid #232736;
    padding: 10px;
}
.admin-item-info {
    flex: 1;
    min-width: 0;
}

.section-pixel-title {
    font-size: 13px;
    font-weight: 900;
    color: var(--pixel-gold);
    border-bottom: 2px dashed #232838;
    padding-bottom: 6px;
}

.pixel-alert {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid;
}
.pixel-alert.success {
    background: #082414;
    border-color: var(--pixel-green);
    color: var(--pixel-green);
}
.pixel-alert.error {
    background: #2b0910;
    border-color: var(--pixel-red);
    color: #ff6b81;
}
.pixel-alert[hidden] { display: none !important; }

.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.pixel-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: #12131a;
    border: 2px solid var(--pixel-green);
    color: var(--pixel-green);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 4px 0 #000;
}
.pixel-toast[hidden] { display: none !important; }

/* v3 Updates: Faster CRT, Heart Pop, Shared Post Scroll Highlight, Instagram 2-Level Replies */
.crt-roll-line {
    animation-duration: 3.1s !important;
}

.post-card {
    scroll-margin-top: 68px;
}

@keyframes sharedPostFlash {
    0%, 100% { box-shadow: none; }
    25%, 75% { box-shadow: inset 0 0 0 3px var(--pixel-gold); }
}
.post-card.shared-highlight {
    animation: sharedPostFlash 1.4s steps(4);
}

@keyframes heartPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.38); }
    75% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.action-icon-btn.heart-pop svg {
    animation: heartPop 0.28s steps(4);
}

.comment-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}
.comment-reply-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}
.comment-reply-btn:hover {
    color: var(--pixel-cyan);
}

.view-replies-btn {
    background: transparent;
    border: none;
    color: var(--pixel-cyan);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 0 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.view-replies-btn::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: #38405a;
}

.comment-replies-wrap {
    margin-top: 8px;
    margin-right: 16px;
    padding-right: 10px;
    border-right: 2px solid #282e42;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comment-replies-wrap[hidden] {
    display: none !important;
}

.reply-indicator-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    margin-bottom: 6px;
    background: #082229;
    border: 1px solid var(--pixel-cyan);
}
.reply-indicator-bar[hidden] {
    display: none !important;
}
.reply-cancel-btn {
    background: transparent;
    border: none;
    color: #ff6b81;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.text-cyan { color: var(--pixel-cyan); }

/* v4 Updates: Pixel font for Author Name */
.author-name {
    font-family: 'Silkscreen', monospace !important;
    font-size: 12px !important;
    letter-spacing: 0.3px;
}

/* v5 Updates: Bolder 2x CRT Roll Bar + Faster Sweep + Convex CRT Tube Bulge */
@keyframes crtRollV5 {
    0% { transform: translateY(-52px); }
    82% { transform: translateY(290px); }
    100% { transform: translateY(290px); }
}

.crt-roll-line {
    height: 44px !important;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 245, 102, 0.03) 25%,
        rgba(255, 255, 255, 0.095) 50%,
        rgba(0, 245, 102, 0.03) 75%,
        transparent 100%
    ) !important;
    animation: crtRollV5 2.1s linear infinite !important;
}

body.mode-crt .crt-screen-tube {
    border-radius: 14px / 10px !important;
}

body.mode-crt .crt-tube-vignette {
    border-radius: 14px / 10px !important;
    background:
        radial-gradient(ellipse at 30% 22%, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.025) 32%, transparent 62%),
        radial-gradient(ellipse at 50% 50%, transparent 56%, rgba(0, 0, 0, 0.55) 100%);
    box-shadow:
        inset 0 0 24px 8px rgba(0, 0, 0, 0.88),
        inset 0 2px 4px rgba(255, 255, 255, 0.12) !important;
}

/* v6 Updates: 4-Mode TV Grid (with LED), Multi-Image Carousel & Center Dots, Compact Action Counts */
.tv-mode-grid-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

body.mode-led .crt-scanlines,
body.mode-led .crt-phosphor-grille,
body.mode-led .crt-roll-line {
    display: none;
}

.carousel-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--crt-void);
    touch-action: pan-y;
}
.normal-carousel {
    border: 2px solid #232736;
}
.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
}
.carousel-slide .normal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 8;
    width: 28px;
    height: 36px;
    background: rgba(10, 12, 18, 0.78);
    border: 2px solid #383f56;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.72;
    transition: opacity 0.15s, border-color 0.15s;
}
.carousel-arrow:hover {
    opacity: 1;
    border-color: var(--pixel-gold);
    color: var(--pixel-gold);
}
.carousel-arrow.prev { left: 6px; }
.carousel-arrow.next { right: 6px; }

/* Action Row with Counts Under Like & Comment + Center Carousel Dots */
.post-actions {
    align-items: flex-start !important;
    margin-bottom: 8px !important;
}
.action-stat-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.action-count-label {
    font-size: 11px;
    font-weight: 800;
    color: #cbd5e1;
    line-height: 1.2;
}

.carousel-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding-top: 10px;
    flex: 1;
}
.carousel-dot {
    width: 5px;
    height: 5px;
    padding: 0;
    border: none;
    background: #444b66;
    cursor: pointer;
    transition: width 0.22s ease, height 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}
.carousel-dot.active {
    width: 8px;
    height: 8px;
    background: var(--pixel-gold);
    box-shadow: 0 0 6px rgba(255, 187, 0, 0.55);
}

/* v7 Updates: Single-line CRT TV button, Grab cursor, Single-line body preview + inline بخوانید */
.tv-mode-btn {
    white-space: nowrap !important;
    padding: 8px 4px !important;
    font-size: 10px !important;
}

.carousel-viewport {
    cursor: grab;
    user-select: none;
    transition: aspect-ratio 0.24s ease;
}
.carousel-viewport:active {
    cursor: grabbing;
}
.carousel-viewport img,
.carousel-viewport canvas {
    pointer-events: none;
    user-select: none;
}

.post-body-inline-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    width: 100%;
}
.post-body-inline-row[hidden] {
    display: none !important;
}
.post-body-inline-row .post-body-preview {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.post-body-inline-row .read-more-btn {
    flex-shrink: 0;
    white-space: nowrap;
    margin-top: 0;
    padding: 0;
}
.read-less-btn {
    display: inline-block;
    background: transparent;
    border: none;
    color: var(--pixel-cyan);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 0 0;
    cursor: pointer;
}

/* v8 Update: Always show single-line ... right before بخوانید even on short first lines */
.post-body-inline-row .post-body-preview {
    flex: 0 1 auto !important;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip !important;
}
.preview-dots {
    flex-shrink: 0;
    color: #94a3b8;
    font-weight: 700;
}

/* v9 Updates: OLED Mode (Sharp Original Photo + Subtle Light Sheen Vignette) */
body.mode-oled .crt-scanlines,
body.mode-oled .crt-phosphor-grille,
body.mode-oled .crt-roll-line {
    display: none !important;
}
body.mode-oled .crt-screen-tube.pixel-ready .pixel-source-img {
    display: block !important;
    object-fit: cover;
}
body.mode-oled .crt-screen-tube.pixel-ready .crt-pixel-canvas {
    display: none !important;
}
body.mode-oled .crt-tube-vignette {
    background:
        radial-gradient(ellipse at 30% 22%, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.025) 34%, transparent 65%),
        radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.38) 100%);
    box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.10);
}
body.mode-oled .desktop-bg-dim {
    background-image: none;
    background-color: rgba(4, 5, 10, 0.36);
}

/* v10 Updates: Centered LIVE_FEED, Animated Notification Bell, Gray-Green Reply Tint, Smooth Modals */
.cabinet-bar-3col {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}
.cabinet-bar-3col > :last-child {
    justify-content: flex-end;
}
.cabinet-center {
    display: flex;
    justify-content: center;
}

.notif-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: #141722;
    border: 1px solid #2e3448;
    color: #94a3b8;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 800;
    transition: border-color 0.15s, color 0.15s;
}
.notif-btn:hover {
    border-color: var(--pixel-gold);
    color: #fff;
}
.notif-badge {
    font-size: 11px;
    color: #94a3b8;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(16deg); }
    30% { transform: rotate(-16deg); }
    45% { transform: rotate(12deg); }
    60% { transform: rotate(-10deg); }
    75% { transform: rotate(5deg); }
}
@keyframes notifBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.35; }
}

.notif-btn.has-unread {
    border-color: var(--pixel-gold);
    color: var(--pixel-gold);
    background: #241b06;
}
.notif-btn.has-unread .notif-bell-icon {
    animation: bellShake 1.1s ease-in-out infinite;
    transform-origin: top center;
}
.notif-btn.has-unread .notif-badge {
    color: var(--pixel-green);
    animation: notifBlink 0.9s infinite;
}

/* Muted Gray-Green Tint on Reply Buttons */
.comment-reply-btn,
.notif-reply-btn {
    background: transparent;
    border: none;
    color: #7ea38e;
    text-shadow: 0 0 6px rgba(0, 245, 102, 0.16);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}
.comment-reply-btn:hover,
.notif-reply-btn:hover {
    color: #9fcbb2;
    text-shadow: 0 0 8px rgba(0, 245, 102, 0.28);
}

/* Smooth Modal Transition */
@keyframes modalPopIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.pixel-modal-backdrop:not([hidden]) .pixel-modal {
    animation: modalPopIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.notif-item {
    background: #0d0f16;
    border: 2px solid #222636;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.notif-item.unread {
    border-color: #3d4b34;
    background: #101613;
}
.notif-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

/* v11 Update: Bold 8-bit Pixel Bevel & Tactile Shadow on Notification Bell */
.notif-btn {
    border: 2px solid #383f56 !important;
    padding: 4px 8px !important;
    background: #191c26 !important;
    box-shadow: 0 3px 0 0 #07080c, inset 0 2px 0 0 #2c3246 !important;
    transition: transform 0.08s steps(2), border-color 0.08s steps(2), color 0.08s steps(2) !important;
}
.notif-btn:hover {
    transform: translateY(-2px);
    border-color: var(--pixel-gold) !important;
    color: #fff !important;
}
.notif-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 0 #07080c !important;
}
.notif-btn.has-unread {
    border-color: var(--pixel-gold) !important;
    background: #2b2108 !important;
    box-shadow: 0 3px 0 0 #07080c, inset 0 2px 0 0 #594410 !important;
}

/* v12 Update: Matching top & bottom cabinet-bar height + auto-expanding notif button width */
.cabinet-bar {
    min-height: 44px;
}
.notif-btn {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
.notif-badge {
    white-space: nowrap;
}

/* v13 Update: 70% opacity & smooth auto-fade for Scroll-to-Top button */
.scroll-top-btn {
    display: flex !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.12s steps(2), background-color 0.12s steps(2);
}
.scroll-top-btn.visible {
    opacity: 0.7;
    pointer-events: auto;
}
.scroll-top-btn.visible:hover {
    opacity: 0.95;
}

/* v14 Updates: Red Auth Button (Logged Out), Comment Likes, Admin Delete Comment, Admin Stats, Forum Styles */
#authModalBtn:not(.is-logged) {
    border-color: var(--pixel-red) !important;
    color: #ff5c77 !important;
}

.comment-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between !important;
    margin-top: 6px;
}
.comment-actions-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comment-delete-btn {
    background: transparent;
    border: none;
    color: #b85666;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}
.comment-delete-btn:hover {
    color: #ff4d6a;
}

.comment-like-btn {
    background: transparent;
    border: none;
    color: #8b95ad;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 11px;
    font-weight: 800;
    transition: color 0.12s, transform 0.12s;
}
.comment-like-btn:hover {
    color: #ff6b81;
}
.comment-like-btn.liked {
    color: var(--pixel-red);
}
.comment-like-btn.heart-pop svg {
    animation: heartPop 0.25s steps(4);
}

/* Admin Stats Bar */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.stat-mini-box {
    background: #0d0f16;
    border: 2px solid #232736;
    padding: 8px 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-val { font-size: 15px; font-weight: 900; }
.stat-lbl { font-size: 10px; color: var(--text-muted); }

/* Forum UI */
.forum-cats-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.forum-cats-scroll .arcade-btn {
    white-space: nowrap;
    flex-shrink: 0;
}
.forum-sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sort-pill {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid #2a2e3f;
    background: #0d0f16;
}
.sort-pill.active {
    color: var(--pixel-gold);
    border-color: var(--pixel-gold);
    background: #241b06;
}

.forum-topics-list,
.forum-replies-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forum-topic-card {
    display: block;
    text-decoration: none;
    color: #fff;
    background: #0d0f16;
    border: 2px solid #252a3a;
    padding: 12px;
    box-shadow: 0 4px 0 #06070a;
    transition: transform 0.08s steps(2), border-color 0.08s steps(2);
}
.forum-topic-card:hover {
    transform: translateY(-2px);
    border-color: var(--pixel-cyan);
    background: #131622;
}
.forum-topic-card.is-pinned {
    border-color: var(--pixel-gold);
    background: #16140c;
}
.forum-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.forum-cat-pill {
    font-size: 10px;
    padding: 2px 6px;
    background: #181c28;
    border: 1px solid #383f56;
    color: var(--pixel-cyan);
}
.forum-badge {
    font-size: 10px;
    padding: 2px 6px;
    font-weight: 700;
}
.forum-badge.pin { background: #2b2108; border: 1px solid var(--pixel-gold); color: var(--pixel-gold); }
.forum-badge.lock { background: #2b0910; border: 1px solid var(--pixel-red); color: #ff6b81; }

.forum-topic-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.55;
    margin-bottom: 6px;
}
.forum-topic-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}
.forum-stats-right {
    margin-right: auto;
    color: #94a3b8;
    font-weight: 700;
}

.forum-topic-detail {
    background: #0d0f16;
    border: 2px solid #2a2e3f;
    padding: 14px;
}
.forum-detail-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    line-height: 1.6;
}
.forum-author-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 2px dashed #232838;
    font-size: 12px;
}
.forum-detail-body {
    font-size: 13.5px;
    line-height: 1.8;
    color: #e2e8f0;
}
.forum-detail-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #232736;
    display: flex;
    justify-content: flex-end;
}
.forum-new-topic-form {
    background: #0d0f16;
    border: 2px solid var(--pixel-green);
    padding: 12px;
}

/* v15 Updates: Gray-Green Comment Like Button + Custom Dark Pixel Scrollbar for Forum Categories */
.comment-like-btn {
    color: #7ea38e !important;
    text-shadow: 0 0 6px rgba(0, 245, 102, 0.16);
}
.comment-like-btn:hover {
    color: #9fcbb2 !important;
}
.comment-like-btn.liked {
    color: var(--pixel-red) !important;
    text-shadow: none;
}

.forum-cats-scroll {
    padding-bottom: 8px !important;
    scrollbar-width: thin;
    scrollbar-color: #383f56 #0b0d13;
}
.forum-cats-scroll::-webkit-scrollbar {
    height: 6px;
}
.forum-cats-scroll::-webkit-scrollbar-track {
    background: #0b0d13;
    border: 1px solid #1e2230;
}
.forum-cats-scroll::-webkit-scrollbar-thumb {
    background: #383f56;
    border: 1px solid #000;
}
.forum-cats-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--pixel-gold);
}
