:root {
    /* Gothic Monochrome Palette */
    --primary-color: #1C2526; /* Near-black charcoal */
    --accent-color: #D3D3D3; /* Light grey */
    --error-color: #B22222; /* Warning red */
    --error-hover-color: #800000; /* Darker red */
    --text-color: #F5F5F5; /* Off-white */
    --muted-color: #808080; /* Mid-grey */
    --primary-hover-color: #3C3F41; /* Dark grey */
    --table-accent-bg: rgba(211, 211, 211, 0.1); /* Subtle light grey */
    --form-bg: rgba(28, 37, 38, 0.8); /* Semi-transparent charcoal */
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Cinzel', serif;
    background: #808080; /* Mid Grey */
    color: var(--text-color);
    overflow-x: hidden;
    margin: 0;
    padding-top: calc(env(safe-area-inset-top) + 0px);
    padding-bottom: env(safe-area-inset-bottom);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: twinkle 5s infinite;
}

@keyframes twinkle {
    0%, 100% { background-image: radial-gradient(white 1px, transparent 1px), radial-gradient(white 1px, transparent 1px); }
    50% { background-image: radial-gradient(rgba(255,255,255,0.8) 1px, transparent 1px), radial-gradient(rgba(255,255,255,0.8) 1px, transparent 1px); }
}

.wand-sparkle {
    position: relative;
    animation: wand-sparkle 4s infinite ease-in-out;
}

.nav-sparkle:hover {
    animation: wand-sparkle 0.5s;
}

@keyframes wand-sparkle {
    0%, 100% { text-shadow: 0 0 2px var(--accent-color); }
    50% { text-shadow: 0 0 4px rgba(211, 211, 211, 0.5); }
}

.spell-glow {
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color), 0 0 10px rgba(211, 211, 211, 0.5);
    padding: 1rem;
    background: var(--form-bg);
}

.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.05) 50%, transparent 50%);
    background-size: 100% 4px;
    animation: starfield 20s linear infinite;
    pointer-events: none;
}

@keyframes starfield {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: linear-gradient(to bottom, #A9A9A9, #D3D3D3);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-logo {
    width: 260px;
    max-width: 90%;
}

.header-nav {
    width: 100%;
}

.header-nav .nav-menu {
    display: flex;
    gap: 1rem;
    justify-content: center;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.7);
    width: 100%;
}

.header-nav .nav-item a {
    color: #fff;
    text-decoration: none;
}

.nav-toggle,
.nav-close {
    display: none;
}
@media (max-width: 640px) {
    .header-logo {
        width: 80px;
        height: 80px;
    }
    .header {
        height: 90px;
    }
    body {
        padding-top: calc(env(safe-area-inset-top) + 0px);
    }
}

.header-nav {
    display: flex;
    align-items: center;
}

.nav-toggle {
    display: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--accent-color);
    font-size: 1.5rem;
}

@media (max-width: 640px) {
    .nav-toggle {
        display: block;
    }
}

.nav-menu {
    display: flex;
    flex-direction: row;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 640px) {
    .nav-menu {
        position: fixed;
        top: 0px;
        left: -100%;
        flex-direction: column;
        width: 250px;
        height: calc(100vh - 0px);
        background: var(--form-bg);
        padding: .5rem;
        transition: left 0.3s ease-in-out;
        z-index: 90;
    }
    .nav-menu.active {
        left: 0;
    }
}

.nav-item {
    display: block;
}

.nav-item a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease-in-out;
    display: block;
    background: rgba(245, 245, 245, 0.1);
    border-radius: 4px;
}

.nav-item a:hover, .nav-item a:focus {
    color: var(--text-color);
    background: rgba(211, 211, 211, 0.2);
    outline: none;
}

.current-page {
    border-bottom: 2px solid var(--accent-color);
}

@media (max-width: 640px) {
    .nav-item a {
        font-size: 1.25rem;
        padding: 1rem;
    }
    .current-page {
        border-bottom: none;
        background: rgba(211, 211, 211, 0.3);
    }
}

.nav-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    color: var(--accent-color);
    font-size: 1.5rem;
}

@media (max-width: 640px) {
    .nav-close {
        display: block;
    }
}

.featured-image {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color);
    margin: 0 auto;
    display: block;
}

.youtube-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color);
    margin-top: 1rem;
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    background: rgba(245, 245, 245, 0.05);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--accent-color);
}

th {
    background: var(--table-accent-bg);
}

.text-primary { color: var(--primary-color); }
.button-primary {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 120px;
    text-align: center;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
}

.button-primary:hover {
    background-color: var(--primary-hover-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.button-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.text-error { color: var(--error-color); }
.button-error {
    background-color: var(--error-color);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 70px;
    text-align: center;
    border-radius: 4px;
}

.button-error:hover {
    background-color: var(--error-hover-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.button-error:disabled { opacity: 0.6; cursor: not-allowed; }
.button-edit, .button-reset {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-width: 70px;
    text-align: center;
    border-radius: 4px;
}

.button-edit:hover, .button-reset:hover {
    background-color: var(--primary-hover-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.button-edit:disabled, .button-reset:disabled { opacity: 0.6; cursor: not-allowed; }
.password-reset-form, .post-edit-form, .comment-edit-form {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--form-bg);
    border: 1px solid var(--accent-color);
}

.password-reset-form.active, .post-edit-form.active, .comment-edit-form.active { display: flex; }
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--form-bg);
    border: 1px solid var(--accent-color);
}

.comment-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-item {
    background: var(--form-bg);
    border: 1px solid var(--accent-color);
    padding: 0.75rem;
    border-radius: 0.25rem;
}

.text-text { color: var(--text-color); }
.text-muted { color: var(--muted-color); }
.text-accent { color: var(--accent-color); }
.hover-text-primary:hover { color: var(--primary-color); }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-md { font-size: 1.125rem; }
.text-lg { font-size: 1.25rem; }
.text-xl { font-size: 1.5rem; }
.text-2xl { font-size: 2rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-6xl { font-size: 3.75rem; }

@media (max-width: 640px) {
    .text-4xl { font-size: 1.75rem; }
    .text-5xl { font-size: 2.25rem; }
    .text-6xl { font-size: 2.75rem; }
}

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-6 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.space-x-6 > * + * { margin-left: 1.5rem; }
.space-x-8 > * + * { margin-left: 2rem; }
.transition { transition: all 0.2s ease-in-out; }

.focus-ring-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
}

.input-field {
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    min-height: 44px;
    font-family: 'Cinzel', serif;
}

.input-field:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
}

.bg-transparent { background: transparent; }
.inline-block { display: inline-block; }
.inline { display: inline; }

.user-search-container, .post-search-container, .comment-search-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.user-management-container {
    background: var(--form-bg);
    padding: 1.5rem;
    border-radius: 0.25rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.content-container {
    width: 100%;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 4rem;
    padding-bottom: 6rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (min-width: 640px) {
    .content-container {
        padding-top: 5rem;
        padding-bottom: 6rem;
    }
    .user-search-container, .post-search-container, .comment-search-container {
        flex-direction: row;
        gap: 1.5rem;
    }
}

.form-container {
    width: 100%;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-links {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

.footer-text {
    margin-top: 1rem;
    margin-bottom: calc(3rem + env(safe-area-inset-bottom));
}