:root {
    --bg-main: #1a1a1a;
    --bg-card: #222222;
    --bg-hover: #333333;
    --text-main: #e0e0e0;
    --text-muted: #999999;
    --accent-orange: #ff9900;
    --border-color: #3a3a3a;
    --link-color: #ff9900;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- HEADER --- */
.header {
    background-color: #111;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    gap: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--accent-orange);
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-menu a {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
}

.header-middle {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    max-width: 600px;
}

.search-box {
    display: flex;
    background-color: #000;
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.7rem;
    width: 100%;
}

.search-box input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    outline: none;
    font-size: 0.85rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    justify-content: flex-end;
}

.user-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* --- MAIN LAYOUT --- */
.container {
    max-width: 1200px;
    margin: 1rem auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    padding: 0 1rem;
}

/* --- CONTENT AREA (70%) --- */
.content-main {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.article-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.article-title-group h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.last-modified {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.action-buttons {
    display: flex;
    background-color: #2a2a2a;
    border: 1px solid var(--border-color);
}

.action-buttons button, .action-buttons a {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.action-buttons a:last-child {
    border-right: none;
}

.action-buttons button:hover, .action-buttons a:hover {
    background-color: var(--bg-hover);
    text-decoration: none;
}

/* --- INFOBOX --- */
.infobox {
    float: right;
    width: 280px;
    border: 1px solid var(--border-color);
    background-color: #1a1a1a;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.infobox-title {
    background-color: #ff9900;
    color: #000;
    text-align: center;
    padding: 0.4rem;
    font-weight: 800;
    font-size: 0.9rem;
}

.infobox-img {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.infobox-img img {
    max-width: 100%;
    filter: grayscale(1);
}

.infobox-data {
    padding: 0.5rem;
}

.data-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    padding: 0.3rem 0;
    border-bottom: 1px solid #333;
}

.data-row:last-child {
    border-bottom: none;
}

.label {
    color: var(--text-muted);
    font-weight: 600;
}

/* --- TOC --- */
.toc-box {
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    display: inline-block;
    margin-bottom: 2rem;
    padding: 0.8rem 1.5rem 0.8rem 0.8rem;
    min-width: 250px;
}

.toc-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.toc-toggle {
    font-size: 0.8rem;
    font-weight: normal;
    color: var(--accent-orange);
    text-decoration: underline;
}

.toc-list {
    list-style: none;
    padding-left: 0.5rem;
}

.toc-list li {
    margin: 0.2rem 0;
}

.toc-num {
    color: var(--accent-orange);
    font-weight: 600;
    margin-right: 0.4rem;
}

.toc-sub {
    padding-left: 1.5rem;
}

/* --- ARTICLE CONTENT --- */
.section-header {
    border-bottom: 1px solid var(--border-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.5rem;
}

/* --- FOOTNOTES --- */
.footnote-ref {
    font-size: 0.8rem;
    vertical-align: super;
    margin-left: 2px;
    font-weight: 600;
}

.footnotes-section {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footnotes-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.footnote-list {
    list-style: none;
    padding-left: 0.5rem;
    font-size: 0.85rem;
}

.footnote-list li {
    margin-bottom: 0.4rem;
    display: flex;
    gap: 0.5rem;
}

.footnote-id {
    color: var(--accent-orange);
    font-weight: 600;
    min-width: 20px;
}

.footnote-text {
    color: var(--text-muted);
}

.back-link {
    color: var(--accent-orange);
    font-size: 0.7rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.edit-link {
    font-size: 0.8rem;
    color: var(--accent-orange);
    font-weight: normal;
}

.article-body p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* --- SIDEBAR (30%) --- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.sidebar-title {
    background-color: #2a2a2a;
    padding: 0.5rem 0.8rem;
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
    padding: 0.8rem;
}

.sidebar-list {
    list-style: none;
}

.sidebar-list li {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.sidebar-list li span {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.ads {
    background-color: #000;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.category-box {
    margin-top: 2rem;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
}

.category-label {
    background-color: var(--accent-orange);
    color: #000;
    font-weight: 800;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
}

/* --- TOOLTIP --- */
.wiki-tooltip {
    position: absolute;
    z-index: 2000;
    background: rgba(20, 20, 20, 0.95);
    color: #e0e0e0;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    max-width: 300px;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: none;
}

/* --- REDACTED TEXT --- */
.redacted {
    background-color: #000;
    color: #000;
    cursor: pointer;
    transition: color 0.3s ease;
    user-select: all;
    padding: 0 2px;
}

.redacted:active, .redacted::selection {
    background-color: #000;
    color: #8b0000 !important;
}

/* --- GLITCH EFFECT --- */
.hazard-text {
    position: relative;
    display: inline-block;
    transition: 0.2s;
}

.hazard-text:hover {
    animation: glitch-shake 0.3s infinite linear alternate-reverse;
    color: #fff;
    text-shadow: 1px 0 #ff0000, -1px 0 #00ffff;
}

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

/* --- EDITOR STYLES --- */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.editor-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.editor-field label {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.editor-field input, .editor-field textarea {
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem;
    font-family: inherit;
    outline: none;
}

.editor-field textarea {
    min-height: 400px;
    resize: vertical;
}

.save-btn {
    background-color: var(--accent-orange);
    color: #000;
    border: none;
    padding: 0.8rem 1.5rem;
    font-weight: 800;
    cursor: pointer;
    font-size: 1rem;
    width: fit-content;
}

.save-btn:hover {
    background-color: #ffaa33;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1a1a1a;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 400px;
    box-shadow: 0 0 20px rgba(255,153,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--accent-orange);
    letter-spacing: 2px;
}

.close-modal {
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.auth-tab.active {
    color: var(--accent-orange);
    border-bottom: 2px solid var(--accent-orange);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    background: #000;
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    color: #fff;
    outline: none;
}

.auth-submit {
    background: var(--accent-orange);
    color: #000;
    border: none;
    padding: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
}

/* --- HISTORY SECTION --- */
.history-section {
    margin-top: 2rem;
    padding: 1rem;
    background: #111;
    border: 1px solid var(--border-color);
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px dotted #333;
    font-size: 0.85rem;
}

.history-item:last-child { border-bottom: none; }

.history-info { color: var(--text-muted); }
.history-user { color: var(--accent-orange); font-weight: 600; }

/* --- INLINE EDITOR --- */
.inline-editor {
    width: 100%;
    min-height: 400px;
    background: #0a0a0a;
    color: #e0e0e0;
    border: 1px solid var(--accent-orange);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    outline: none;
    margin-bottom: 1rem;
}

.save-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* --- FOOTER --- */
.footer {
    margin-top: 3rem;
    padding: 2rem;
    background-color: #111;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* --- PORTAL / HOME VIEW --- */
.scp-warning {
    border: 2px solid #ff4444;
    background: rgba(255, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.scp-warning h1 {
    color: #ff4444;
    font-size: 1.5rem;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.portal-section {
    background: #111;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.portal-section h3 {
    color: var(--accent-orange);
    border-bottom: 1px solid var(--accent-orange);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1rem;
}

.portal-links {
    list-style: none;
}

.portal-links li {
    margin-bottom: 8px;
}

.portal-links a {
    font-size: 0.9rem;
}

.news-ticker {
    background: #000;
    border: 1px solid #333;
    padding: 10px;
    font-size: 0.8rem;
    color: #999;
}

/* --- MISC --- */
.loading-text {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-orange);
    animation: pulse 1.5s infinite;
}

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