* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blood-red: #8b0000;
    --dark-bg: #0a0a0a;
    --ghost-white: #f5f5f5;
    --shadow-gray: #1a1a1a;
    --bruise-purple: #2d1b4e;
}

body {
    font-family: 'Courier New', monospace;
    background-color: var(--dark-bg);
    color: var(--ghost-white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Static noise overlay */
.static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="1" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: 1000;
    opacity: 0.3;
}

/* Vignette effect */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
    z-index: 999;
}

/* Glitch effect */
.glitch {
    position: relative;
    font-size: 4rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff0000;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #0000ff;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
    animation-delay: -1s;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-anim {
    0% { clip: rect(42px, 9999px, 44px, 0); }
    5% { clip: rect(12px, 9999px, 59px, 0); }
    10% { clip: rect(48px, 9999px, 29px, 0); }
    15% { clip: rect(42px, 9999px, 73px, 0); }
    20% { clip: rect(63px, 9999px, 27px, 0); }
    25% { clip: rect(34px, 9999px, 55px, 0); }
    30% { clip: rect(86px, 9999px, 73px, 0); }
    35% { clip: rect(20px, 9999px, 20px, 0); }
    40% { clip: rect(26px, 9999px, 60px, 0); }
    45% { clip: rect(25px, 9999px, 66px, 0); }
    50% { clip: rect(57px, 9999px, 98px, 0); }
    55% { clip: rect(5px, 9999px, 46px, 0); }
    60% { clip: rect(82px, 9999px, 31px, 0); }
    65% { clip: rect(54px, 9999px, 27px, 0); }
    70% { clip: rect(28px, 9999px, 99px, 0); }
    75% { clip: rect(45px, 9999px, 69px, 0); }
    80% { clip: rect(23px, 9999px, 85px, 0); }
    85% { clip: rect(54px, 9999px, 84px, 0); }
    90% { clip: rect(45px, 9999px, 47px, 0); }
    95% { clip: rect(37px, 9999px, 20px, 0); }
    100% { clip: rect(4px, 9999px, 91px, 0); }
}

/* Header */
.horror-header {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(180deg, rgba(45, 27, 78, 0.3) 0%, transparent 100%);
    border-bottom: 1px solid var(--blood-red);
    position: relative;
}

.horror-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blood-red), transparent);
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.tagline {
    font-size: 1rem;
    color: #666;
    margin-top: 1rem;
    font-style: italic;
    letter-spacing: 0.2em;
}

/* Navigation */
.horror-nav {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem;
    background: var(--shadow-gray);
    border-bottom: 1px solid #333;
}

.nav-link {
    color: var(--ghost-white);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    position: relative;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--blood-red);
    text-shadow: 0 0 10px var(--blood-red);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--blood-red);
}

/* Blog container */
.blog-container {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
}

/* Horror posts */
.horror-post {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #333;
    margin-bottom: 3rem;
    padding: 2.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.horror-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--blood-red);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.horror-post:hover::before {
    transform: scaleY(1);
}

.horror-post:hover {
    border-color: var(--blood-red);
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.2);
}

.post-date {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.post-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--ghost-white);
    position: relative;
    display: inline-block;
}

.glitch-hover {
    position: relative;
    transition: all 0.3s ease;
}

.glitch-hover:hover {
    animation: text-glitch 0.3s ease;
}

@keyframes text-glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
    100% { transform: translate(0); }
}

.post-content p {
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #ccc;
}

.post-text {
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #ccc;
    white-space: pre-wrap;
    transition: all 0.3s ease;
}

.post-text.collapsed {
    max-height: 3.6em;
    overflow: hidden;
    position: relative;
}

.post-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2em;
    background: linear-gradient(transparent, rgba(10, 10, 10, 0.9));
}

.glitch-text {
    color: var(--blood-red);
    text-shadow: 0 0 5px rgba(139, 0, 0, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.glitch-text:hover {
    text-shadow: 0 0 10px rgba(139, 0, 0, 1);
}

.highlight-text {
    font-style: italic;
    color: var(--blood-red) !important;
    text-shadow: 0 0 5px rgba(139, 0, 0, 0.5);
    border-left: 2px solid var(--blood-red);
    padding-left: 1rem;
    margin: 2rem 0 !important;
}

.read-more {
    color: var(--ghost-white);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    position: relative;
    display: inline-block;
    transition: all 0.3s ease;
}

.read-more::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--blood-red);
    transition: width 0.3s ease;
}

.read-more:hover {
    color: var(--blood-red);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

.read-more:hover::after {
    width: 100%;
}

/* Sidebar */
.horror-sidebar {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    display: none;
}

@media (min-width: 1200px) {
    .horror-sidebar {
        display: block;
    }
}

.sidebar-widget {
    background: var(--shadow-gray);
    border: 1px solid #333;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-widget h3 {
    font-size: 0.9rem;
    color: var(--blood-red);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.recent-posts {
    list-style: none;
}

.recent-posts li {
    margin-bottom: 0.8rem;
}

.recent-posts a {
    color: #888;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.recent-posts a:hover {
    color: var(--ghost-white);
    padding-left: 5px;
}

.fear-meter {
    height: 20px;
    background: #111;
    border: 1px solid #333;
    margin-bottom: 0.5rem;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blood-red), #ff0000);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    animation: meter-pulse 2s infinite;
}

@keyframes meter-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.meter-text {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}

/* Footer */
.horror-footer {
    text-align: center;
    padding: 3rem;
    border-top: 1px solid #333;
    margin-top: 3rem;
    background: var(--shadow-gray);
}

.horror-footer p {
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 0.1em;
}

.footer-decoration {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: #444;
    letter-spacing: 0.3em;
}

/* Flickering effect for the whole page */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

body {
    animation: flicker 5s infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--blood-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a00000;
}

/* Selection styling */
::selection {
    background: var(--blood-red);
    color: var(--ghost-white);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--shadow-gray);
    border: 1px solid var(--blood-red);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: modalAppear 0.3s ease;
}

.modal-large {
    max-width: 600px;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--blood-red);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--ghost-white);
    font-size: 1.2rem;
    letter-spacing: 0.1em;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #888;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: #111;
    border: 1px solid #333;
    color: var(--ghost-white);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blood-red);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.submit-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--blood-red);
    border: none;
    color: var(--ghost-white);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #a00000;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.5);
}

.cancel-btn {
    width: 100%;
    padding: 0.8rem;
    background: transparent;
    border: 1px solid #333;
    color: #888;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    border-color: #666;
    color: var(--ghost-white);
}

.button-group {
    display: flex;
    gap: 1rem;
}

.button-group .submit-btn,
.button-group .cancel-btn {
    flex: 1;
}

.error-message {
    margin-top: 1rem;
    padding: 0.8rem;
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid var(--blood-red);
    color: var(--blood-red);
    font-size: 0.85rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* Admin panel */
.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
    z-index: 1500;
    overflow-y: auto;
    padding: 2rem;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333;
}

.admin-header h2 {
    flex: 1;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
}

.admin-header .submit-btn {
    width: auto;
    padding: 0.6rem 1.2rem;
}

.logout-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid #333;
    color: #888;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    border-color: var(--blood-red);
    color: var(--blood-red);
}

.admin-section {
    max-width: 800px;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #333;
}

.section-title {
    font-size: 1rem;
    color: var(--blood-red);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.admin-posts {
    max-width: 800px;
}

.admin-post-item {
    background: var(--shadow-gray);
    border: 1px solid #333;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

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

.admin-post-info {
    flex: 1;
}

.admin-post-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--ghost-white);
}

.admin-post-date {
    font-size: 0.75rem;
    color: #666;
}

.admin-post-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-post-actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn {
    background: transparent;
    border: 1px solid #333;
    color: #888;
}

.edit-btn:hover {
    border-color: var(--ghost-white);
    color: var(--ghost-white);
}

.delete-btn {
    background: transparent;
    border: 1px solid var(--blood-red);
    color: var(--blood-red);
}

.delete-btn:hover {
    background: var(--blood-red);
    color: var(--ghost-white);
}

/* Admin link highlight */
.admin-link {
    opacity: 0.5;
}

.admin-link:hover {
    opacity: 1;
}

/* Logged in state */
.logged-in .admin-link {
    opacity: 1;
    color: var(--blood-red);
}
