@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

html, body {
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    font-family: 'VT323', monospace;
    font-size: 20px;
    line-height: 1.5;
    overflow-x: hidden;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.15);
}

/* ── Split layout ─────────────────────────────────────── */

#layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

#terminal-panel {
    width: 50%;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #222;
}

#right-panel {
    width: 50%;
    min-height: 100vh;
}

/* ── Terminal ─────────────────────────────────────────── */

#terminal {
    width: 80ch;
    max-width: 92%;
    min-height: 100%;
    margin: 0 auto;
    padding: 60px 20px 33vh;
}

#terminal-text {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

#prompt-line {
    display: none;
    line-height: inherit;
}

#prompt-line.active {
    display: block;
}

.blink {
    animation: blink-animation 1s step-end infinite;
}

@keyframes blink-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#hidden-input {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    width: 1px;
    height: 1px;
}

::selection {
    background: #fff;
    color: #000;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #333;
}

/* ── Home page right panel ────────────────────────────── */

body[data-page="home"] #right-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 80%;
}

#main-hero-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}

#hero-quote {
    text-align: center;
    max-width: 400px;
}

#hero-quote-text {
    color: #fff;
    font-size: 18px;
    line-height: 1.6;
    white-space: pre-wrap;
}

#hero-quote-author {
    display: block;
    color: #ccc;
    font-size: 16px;
    margin-top: 10px;
}

/* ── User Settings panel ─────────────────────────────── */

#user-settings-panel {
    flex-direction: column;
    padding: 48px 40px;
    gap: 32px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    color: #ccc;
}

.settings-header {
    font-size: 28px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
    letter-spacing: 2px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
}

.settings-section-title {
    font-size: 18px;
    color: #888;
    letter-spacing: 1px;
}

.settings-input {
    background: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    text-shadow: none;
}

.settings-input:focus {
    border-color: #666;
}

.settings-btn {
    display: inline-block;
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 6px 16px;
    cursor: pointer;
    letter-spacing: 1px;
    text-shadow: none;
    align-self: flex-start;
}

.settings-btn:hover {
    border-color: #fff;
    color: #fff;
}

.settings-status {
    font-size: 16px;
    min-height: 20px;
    text-shadow: none;
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.settings-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #1e1e1e;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #aaa;
    flex-shrink: 0;
    overflow: hidden;
    text-shadow: none;
}

.settings-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ── Chat panel (right side) ─────────────────────────── */

#chat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #333;
    font-size: 18px;
}

#chat-container {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: #0a0a0a;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #333;
}

/* Scroll anchoring: suppress browser anchoring on messages, pin to sentinel at bottom */
#chat-messages > *:not(#chat-bottom-anchor) {
    overflow-anchor: none;
}

#chat-bottom-anchor {
    overflow-anchor: auto;
    height: 1px;
    flex-shrink: 0;
}

.chat-empty {
    color: #555;
    text-align: center;
    margin-top: 40px;
}

/* ── MOTD box ─────────────────────────────────────────── */

#motd-box {
    background: #151515;
    border: 1px solid #222;
    padding: 24px 32px;
    color: #777;
    font-size: 18px;
    line-height: 1.6;
    text-align: center;
    max-width: 800px;
    text-shadow: none;
}

/* ── MOTD overlay (shown before chat for signed-in users) */

#motd-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

#motd-overlay-box {
    background: #151515;
    border: 1px solid #222;
    padding: 24px 32px;
    color: #777;
    font-size: 18px;
    line-height: 1.6;
    text-align: center;
    max-width: 800px;
    text-shadow: none;
}

/* ── Drag-and-drop indicator ─────────────────────────── */

#chat-container.drag-over,
#fs-container.drag-over {
    outline: 2px dashed #555;
    outline-offset: -4px;
    background: #0e0e0e;
}

/* ── Date separators ──────────────────────────────────── */

.chat-date-sep {
    text-align: center;
    color: #555;
    font-size: 16px;
    padding: 12px 0 6px;
}

/* ── Message rows ─────────────────────────────────────── */

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 80%;
    position: relative;
    padding: 2px 0;
}

.chat-msg-other {
    align-self: flex-start;
}

.chat-msg-self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Avatar (all users) */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e1e1e;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
    overflow: hidden;
    text-shadow: none;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Hide avatar on continuation messages */
.chat-msg-cont .chat-avatar {
    visibility: hidden;
}

.chat-msg-cont .chat-meta {
    display: none;
}

.chat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-meta {
    display: flex;
    gap: 8px;
    font-size: 15px;
    color: #666;
    text-shadow: none;
}

.chat-msg-self .chat-meta {
    justify-content: flex-end;
}

.chat-username {
    color: #999;
}

.chat-public-tag {
    color: #555;
}

.chat-time {
    color: #555;
}

/* ── Bubbles ──────────────────────────────────────────── */

.chat-bubble {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-shadow: none;
}

.chat-msg-other .chat-bubble {
    background: #000;
    border: 1px solid #fff;
    color: #ddd;
}

.chat-msg-self .chat-bubble {
    background: #000;
    border: 1px solid #555;
    color: #ddd;
}

.chat-bubble img {
    max-width: 280px;
    max-height: 200px;
    border-radius: 4px;
    display: block;
    margin-top: 6px;
    cursor: pointer;
}

.chat-file-link {
    display: block;
    margin-top: 6px;
    color: #999;
    text-decoration: none;
    padding: 6px 10px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-size: 16px;
}

.chat-file-link:hover {
    color: #ccc;
    border-color: #444;
}

/* ── Editing state (widen message) ────────────────────── */

.chat-msg.editing {
    max-width: 95%;
    width: 95%;
}

.chat-msg.editing .chat-content {
    width: 100%;
}

.chat-msg.editing .chat-bubble {
    width: 100%;
}

/* ── Edit button ─────────────────────────────────────── */

.chat-edit-btn {
    position: absolute;
    top: 4px;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s;
    text-shadow: none;
}

.chat-msg:hover .chat-edit-btn {
    opacity: 1;
}

.chat-msg-self .chat-edit-btn {
    left: -24px;
    right: auto;
}

.chat-edit-btn:hover {
    color: #ccc;
}

/* ── Inline edit form ────────────────────────────────── */

.chat-edit-textarea {
    width: 100%;
    background: #111;
    border: 1px solid #444;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 6px 10px;
    outline: none;
    resize: none;
    min-height: 36px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
}

.chat-edit-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 14px;
}

.chat-edit-save,
.chat-edit-cancel,
.chat-edit-toggle {
    cursor: pointer;
    text-shadow: none;
}

.chat-edit-save {
    color: #888;
}

.chat-edit-save:hover {
    color: #ccc;
}

.chat-edit-cancel {
    color: #666;
}

.chat-edit-cancel:hover {
    color: #999;
}

.chat-edit-toggle {
    color: #668;
    margin-left: auto;
}

.chat-edit-toggle:hover {
    color: #99c;
}

/* ── Reply indicator (above input) ──────────────────── */

#chat-reply-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: #0d0d0d;
    border-top: 1px solid #222;
    border-left: 2px solid #555;
    font-size: 15px;
    color: #888;
    text-shadow: none;
}

#chat-reply-label {
    flex: 1;
}

#chat-reply-cancel {
    cursor: pointer;
    color: #666;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}

#chat-reply-cancel:hover {
    color: #fff;
}

/* ── Reply quote inside bubble ───────────────────────── */

.chat-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 2px solid #555;
    padding: 4px 8px;
    margin-bottom: 6px;
    cursor: pointer;
    text-shadow: none;
}

.chat-reply-quote:hover {
    border-left-color: #aaa;
}

.chat-reply-quote-user {
    font-size: 14px;
    color: #888;
}

.chat-reply-quote-text {
    font-size: 15px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Reply button on posts ───────────────────────────── */

.chat-reply-btn {
    position: absolute;
    bottom: 2px;
    right: -24px;
    opacity: 0;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    transition: opacity 0.15s, color 0.15s;
    text-shadow: none;
    line-height: 1;
}

.chat-msg:hover .chat-reply-btn {
    opacity: 1;
}

/* Keep self-message reply inside the container (aligned with avatar) */
.chat-msg-self .chat-reply-btn {
    right: 4px;
}

.chat-reply-btn:hover {
    color: #fff;
}

/* ── Highlight flash on jumped-to post ───────────────── */

.chat-msg-highlight .chat-bubble {
    border-color: #aaa !important;
    transition: border-color 0.3s;
}

/* ── Edited indicator ────────────────────────────────── */

.chat-edited {
    display: block;
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

/* ── Admin delete button ──────────────────────────────── */

.chat-delete-btn {
    position: absolute;
    top: 4px;
    color: #993333;
    cursor: pointer;
    font-size: 18px;
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s;
    text-shadow: none;
}

.chat-msg:hover .chat-delete-btn {
    opacity: 1;
}

.chat-msg-other .chat-delete-btn {
    right: -24px;
}

.chat-msg-self .chat-delete-btn {
    left: -24px;
    right: auto;
}

/* Shift delete below edit on own messages */
.chat-msg-self .chat-edit-btn + .chat-delete-btn {
    top: 22px;
}

/* ── Image preview ────────────────────────────────────── */

#chat-image-preview {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #0e0e0e;
    border-top: 1px solid #1a1a1a;
}

#chat-image-preview img {
    max-height: 60px;
    border-radius: 4px;
}

.remove-preview {
    color: #993333;
    cursor: pointer;
    font-size: 20px;
    padding: 0 6px;
}

.file-preview-name {
    color: #999;
    font-size: 16px;
}

/* ── Chat input area ──────────────────────────────────── */

#chat-input-area {
    display: none;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #222;
    background: #0a0a0a;
    align-items: flex-end;
}

#chat-text-input {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 12px;
    outline: none;
    text-shadow: none;
    resize: none;
    overflow-y: hidden;
    min-height: 38px;
    max-height: 150px;
    line-height: 1.4;
    word-wrap: break-word;
}

#chat-text-input::placeholder {
    color: #444;
}

#chat-text-input:focus {
    border-color: #444;
}

#chat-send-btn,
#chat-upload-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px 14px;
    cursor: pointer;
    text-shadow: none;
}

#chat-send-btn:hover,
#chat-upload-btn:hover {
    background: #222;
    color: #ccc;
}

/* ── Public checkbox ──────────────────────────────────── */

#chat-public-label {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 5px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: none;
    user-select: none;
}

#chat-public-check {
    cursor: pointer;
    accent-color: #555;
}

/* ── Delete modal ─────────────────────────────────────── */

#delete-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#delete-modal.active {
    display: flex;
}

#delete-modal-content {
    background: #111;
    border: 1px solid #333;
    padding: 30px 40px;
    text-align: center;
    text-shadow: none;
}

#delete-modal-content p {
    margin-bottom: 20px;
    font-size: 20px;
}

#delete-modal-content button {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 24px;
    margin: 0 8px;
    border: 1px solid #333;
    cursor: pointer;
}

#delete-confirm-btn {
    background: #661a1a;
    color: #fff;
}

#delete-confirm-btn:hover {
    background: #882222;
}

#delete-cancel-btn {
    background: #222;
    color: #ccc;
}

#delete-cancel-btn:hover {
    background: #333;
}

/* ── Image lightbox modal ─────────────────────────────── */

#image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#image-modal.active {
    display: flex;
}

#image-modal-img {
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

#image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ccc;
    font-size: 36px;
    cursor: pointer;
    text-shadow: none;
    z-index: 201;
}

#image-modal-close:hover {
    color: #fff;
}

/* ── Account request review panel (admin) ─────────────── */

.request-review-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 60px 40px;
    color: #ccc;
}

.request-review-panel h2 {
    font-family: 'VT323', monospace;
    font-size: 24px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
    font-weight: normal;
}

.request-field {
    display: flex;
    gap: 12px;
    font-size: 20px;
    line-height: 1.5;
}

.request-label {
    color: #777;
    min-width: 120px;
}

.request-value {
    color: #ddd;
}

.request-count {
    margin-top: 20px;
    color: #555;
    font-size: 18px;
}

/* ── MOTD editor panel (admin) ───────────────────────── */

.motd-hint {
    color: #555;
    font-size: 16px;
    margin-top: -8px;
}

.motd-textarea {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 20px;
    line-height: 1.5;
    padding: 12px 16px;
    resize: vertical;
    outline: none;
}

.motd-textarea:focus {
    border-color: #555;
}

.motd-preview-label {
    color: #555;
    font-size: 16px;
    margin-bottom: -8px;
}

.motd-preview {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    color: #777;
    font-family: 'VT323', monospace;
    font-size: 20px;
    line-height: 1.6;
    padding: 12px 16px;
    white-space: pre-wrap;
    min-height: 60px;
}

.motd-submit-btn {
    align-self: flex-start;
    background: #000;
    border: 1px solid #555;
    color: #fff;
    font-family: 'VT323', monospace;
    font-size: 20px;
    padding: 8px 24px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: background 0.15s, border-color 0.15s;
}

.motd-submit-btn:hover {
    background: #1a1a1a;
    border-color: #aaa;
}

/* ── Quote management panel (admin) ───────────────────── */

.quote-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 60px 40px;
    color: #ccc;
    overflow-y: auto;
    height: 100vh;
}

.quote-panel h2 {
    font-family: 'VT323', monospace;
    font-size: 24px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
    font-weight: normal;
}

.quote-panel-error {
    color: #cc4444;
    font-size: 18px;
}

.quote-add-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 16px;
    cursor: pointer;
    text-shadow: none;
    text-align: left;
}

.quote-add-btn:hover {
    background: #1a1a1a;
    color: #ccc;
    border-color: #444;
}

.quote-empty {
    color: #555;
    font-size: 18px;
    text-shadow: none;
}

.quote-card {
    border: 1px solid #1a1a1a;
    padding: 16px;
    text-shadow: none;
}

.quote-card:hover {
    border-color: #333;
    background: #0a0a0a;
}

.quote-card-text {
    color: #ccc;
    font-size: 18px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.quote-card-author {
    color: #777;
    font-size: 16px;
    margin-top: 8px;
}

.quote-card-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.15s;
}

.quote-card:hover .quote-card-actions {
    opacity: 1;
}

.quote-action-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 4px 14px;
    cursor: pointer;
    text-shadow: none;
}

.quote-action-btn:hover {
    background: #222;
    color: #ccc;
}

.quote-action-delete {
    color: #993333;
    border-color: #4a1a1a;
}

.quote-action-delete:hover {
    background: #2a1111;
    color: #cc4444;
}

.quote-form {
    border: 1px solid #333;
    padding: 16px;
    background: #0e0e0e;
}

.quote-form-heading {
    font-size: 20px;
    color: #ddd;
    margin-bottom: 12px;
}

.quote-form-label {
    display: block;
    color: #777;
    font-size: 16px;
    margin-bottom: 4px;
    margin-top: 10px;
}

.quote-form-textarea {
    width: 100%;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 14px;
    outline: none;
    resize: vertical;
    text-shadow: none;
    line-height: 1.5;
}

.quote-form-textarea:focus {
    border-color: #444;
}

.quote-form-textarea::placeholder {
    color: #444;
}

.quote-form-input {
    width: 100%;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 14px;
    outline: none;
    text-shadow: none;
}

.quote-form-input:focus {
    border-color: #444;
}

.quote-form-input::placeholder {
    color: #444;
}

.quote-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

/* ── File preview modal ──────────────────────────────── */

#preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#preview-modal.active {
    display: flex;
}

#preview-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ccc;
    font-size: 36px;
    cursor: pointer;
    text-shadow: none;
    z-index: 201;
}

#preview-modal-close:hover {
    color: #fff;
}

#preview-body {
    max-width: 90vw;
    max-height: 80vh;
    overflow: auto;
    cursor: default;
}

#preview-body img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

#preview-body pre {
    background: #111;
    border: 1px solid #333;
    padding: 20px;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 16px;
    max-width: 80vw;
    max-height: 75vh;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    cursor: text;
}

#preview-download {
    margin-top: 16px;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    text-shadow: none;
}

#preview-download:hover {
    color: #ccc;
}

/* ── File System panel ────────────────────────────────── */

body[data-page="filesystem"] #right-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0a0a0a;
}

/* ── Webmail Page Layout ─────────────────────────────── */

body[data-page="webmail"] #terminal-panel {
    width: 25%;
}

body[data-page="webmail"] #right-panel {
    width: 75%;
}

#fs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#fs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #222;
}

#fs-view-toggle {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #666;
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 4px 10px;
    cursor: pointer;
    text-shadow: none;
    white-space: nowrap;
}

#fs-view-toggle:hover {
    background: #222;
    color: #999;
}

#fs-breadcrumb {
    color: #777;
    font-size: 18px;
}

#fs-breadcrumb span {
    cursor: pointer;
    color: #999;
}

#fs-breadcrumb span:hover {
    color: #fff;
}

#fs-breadcrumb .fs-sep {
    color: #555;
    cursor: default;
}

#fs-breadcrumb .fs-sep:hover {
    color: #555;
}

#fs-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

#fs-items::-webkit-scrollbar {
    width: 6px;
}

#fs-items::-webkit-scrollbar-thumb {
    background: #333;
}

.fs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #ccc;
    cursor: pointer;
    font-size: 18px;
    border-bottom: 1px solid #111;
    text-shadow: none;
}

.fs-item:hover {
    background: #151515;
}

.fs-item-icon {
    color: #666;
    font-size: 16px;
    width: 48px;
    flex-shrink: 0;
}

.fs-item-name {
    flex: 1;
    word-break: break-all;
}

.fs-item-info {
    color: #555;
    font-size: 16px;
    white-space: nowrap;
}

.fs-item-delete {
    color: #993333;
    cursor: pointer;
    font-size: 20px;
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.fs-item:hover .fs-item-delete {
    opacity: 1;
}

.fs-item-delete:hover {
    color: #cc4444;
}

.fs-empty {
    color: #555;
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
    text-shadow: none;
}

/* ── Grid / Thumbnail view ───────────────────────────── */

#fs-items.fs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    padding: 16px;
}

.fs-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    cursor: pointer;
    border: 1px solid #151515;
    border-radius: 4px;
    position: relative;
    text-shadow: none;
    color: #ccc;
}

.fs-grid-item:hover {
    background: #151515;
    border-color: #222;
}

.fs-grid-thumb {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.fs-grid-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fs-grid-thumb-placeholder {
    color: #555;
    font-size: 16px;
}

.fs-grid-name {
    margin-top: 8px;
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.fs-grid-item .fs-item-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    opacity: 0;
    font-size: 18px;
    color: #993333;
    cursor: pointer;
    padding: 0 4px;
    transition: opacity 0.15s;
}

.fs-grid-item:hover .fs-item-delete {
    opacity: 1;
}

.fs-grid-item .fs-item-delete:hover {
    color: #cc4444;
}

#fs-actions {
    padding: 16px 20px;
    border-top: 1px solid #222;
    background: #0a0a0a;
}

#fs-action-buttons {
    display: flex;
    gap: 12px;
}

#fs-new-folder-btn,
#fs-upload-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px 14px;
    cursor: pointer;
    text-shadow: none;
}

#fs-new-folder-btn:hover,
#fs-upload-btn:hover {
    background: #222;
    color: #ccc;
}

#fs-new-folder-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

#fs-folder-name-input {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 12px;
    outline: none;
    text-shadow: none;
}

#fs-folder-name-input::placeholder {
    color: #444;
}

#fs-folder-name-input:focus {
    border-color: #444;
}

#fs-folder-create-btn,
#fs-folder-cancel-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px 14px;
    cursor: pointer;
    text-shadow: none;
}

#fs-folder-create-btn:hover {
    background: #222;
    color: #ccc;
}

#fs-folder-cancel-btn:hover {
    background: #222;
    color: #999;
}

/* ── Upload panel ─────────────────────────────────────── */

#fs-upload-panel {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #222;
    background: #0a0a0a;
    max-height: 280px;
}

#fs-upload-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-bottom: 1px solid #1a1a1a;
    font-family: 'VT323', monospace;
    color: #888;
    font-size: 16px;
}

#fs-upload-clear-btn {
    background: transparent;
    border: none;
    color: #666;
    font-family: 'VT323', monospace;
    font-size: 14px;
    cursor: pointer;
    text-shadow: none;
    padding: 2px 6px;
}

#fs-upload-clear-btn:hover {
    color: #ccc;
}

#fs-upload-list {
    overflow-y: auto;
    padding: 6px 12px 10px;
}

#fs-upload-list::-webkit-scrollbar {
    width: 8px;
}

#fs-upload-list::-webkit-scrollbar-thumb {
    background: #2a2a2a;
}

.fs-upload-item {
    padding: 8px 8px 10px;
    border-bottom: 1px solid #161616;
    font-family: 'VT323', monospace;
    font-size: 15px;
    color: #aaa;
}

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

.fs-upload-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.fs-upload-name {
    flex: 1;
    color: #ccc;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.fs-upload-meta {
    color: #666;
    font-size: 13px;
    flex-shrink: 0;
}

.fs-upload-cancel {
    background: transparent;
    border: none;
    color: #555;
    font-family: 'VT323', monospace;
    font-size: 13px;
    cursor: pointer;
    text-shadow: none;
    padding: 0 4px;
}

.fs-upload-cancel:hover {
    color: #cc4444;
}

.fs-upload-bar {
    width: 100%;
    height: 6px;
    background: #161616;
    border: 1px solid #222;
    overflow: hidden;
}

.fs-upload-bar-fill {
    height: 100%;
    width: 0%;
    background: #3a6a3a;
    transition: width 0.15s ease-out;
}

.fs-upload-item.done .fs-upload-bar-fill {
    background: #4a8a4a;
}

.fs-upload-item.error .fs-upload-bar-fill,
.fs-upload-item.cancelled .fs-upload-bar-fill {
    background: #6a2a2a;
}

.fs-upload-status {
    margin-top: 4px;
    color: #777;
    font-size: 13px;
}

.fs-upload-item.error .fs-upload-status {
    color: #cc6a6a;
}

.fs-upload-item.done .fs-upload-status {
    color: #6aa46a;
}

/* ── Networking panel ─────────────────────────────────── */

body[data-page="networking"] #right-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0a0a0a;
}

#net-articles-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

#net-articles-panel::-webkit-scrollbar {
    width: 6px;
}

#net-articles-panel::-webkit-scrollbar-thumb {
    background: #333;
}

/* ── Article list ─────────────────────────────────────── */

.net-article-list {
    padding: 20px;
}

.net-create-btn {
    display: block;
    width: 100%;
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 12px 16px;
    cursor: pointer;
    text-shadow: none;
    text-align: left;
    margin-bottom: 16px;
}

.net-create-btn:hover {
    background: #1a1a1a;
    color: #ccc;
    border-color: #444;
}

.net-article-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid #1a1a1a;
    margin-bottom: 8px;
    cursor: pointer;
    text-shadow: none;
    position: relative;
}

.net-article-card:hover {
    background: #111;
    border-color: #333;
}

.net-article-num {
    color: #555;
    font-size: 16px;
    min-width: 30px;
    padding-top: 2px;
}

.net-article-info {
    flex: 1;
    min-width: 0;
}

.net-article-title {
    color: #ddd;
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 6px;
}

.net-article-summary {
    color: #888;
    font-size: 17px;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.net-article-meta {
    color: #555;
    font-size: 15px;
}

.net-article-delete {
    color: #993333;
    cursor: pointer;
    font-size: 22px;
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.net-article-card:hover .net-article-delete {
    opacity: 1;
}

.net-article-delete:hover {
    color: #cc4444;
}

.net-empty {
    color: #555;
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
    text-shadow: none;
}

/* ── Full article view ────────────────────────────────── */

.net-article-full {
    padding: 20px 30px 40px;
}

.net-article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #222;
}

.net-nav-arrows {
    display: flex;
    gap: 8px;
}

.net-nav-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 6px 14px;
    cursor: pointer;
    text-shadow: none;
}

.net-nav-btn:hover {
    background: #222;
    color: #ccc;
}

.net-full-title {
    font-family: 'VT323', monospace;
    font-size: 28px;
    color: #fff;
    font-weight: normal;
    line-height: 1.3;
    margin-bottom: 8px;
}

.net-full-meta {
    color: #555;
    font-size: 16px;
    margin-bottom: 16px;
}

.net-article-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.net-action-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 6px 14px;
    cursor: pointer;
    text-shadow: none;
}

.net-action-btn:hover {
    background: #222;
    color: #ccc;
}

.net-action-delete {
    color: #993333;
    border-color: #4a1a1a;
}

.net-action-delete:hover {
    background: #2a1111;
    color: #cc4444;
}

.net-full-body {
    color: #ccc;
    font-size: 18px;
    line-height: 1.6;
    text-shadow: none;
    padding-top: 16px;
    border-top: 1px solid #222;
}

.net-full-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 12px 0;
    display: block;
}

.net-full-body h1,
.net-full-body h2,
.net-full-body h3 {
    font-family: 'VT323', monospace;
    font-weight: normal;
    color: #ddd;
    margin: 16px 0 8px;
}

.net-full-body h1 { font-size: 26px; }
.net-full-body h2 { font-size: 23px; }
.net-full-body h3 { font-size: 20px; }

.net-full-body p {
    margin: 8px 0;
}

.net-full-body ul,
.net-full-body ol {
    padding-left: 24px;
    margin: 8px 0;
}

.net-full-body a {
    color: #889;
    text-decoration: underline;
}

.net-full-body a:hover {
    color: #aab;
}

.net-full-body blockquote {
    border-left: 2px solid #333;
    padding-left: 16px;
    color: #999;
    margin: 12px 0;
}

.net-full-body code {
    background: #151515;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 16px;
}

.net-full-body pre {
    background: #111;
    border: 1px solid #222;
    padding: 12px;
    overflow-x: auto;
    margin: 12px 0;
}

/* ── Article editor ───────────────────────────────────── */

.net-editor {
    padding: 20px 30px 40px;
}

.net-editor-heading {
    font-family: 'VT323', monospace;
    font-size: 24px;
    color: #fff;
    font-weight: normal;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.net-editor-label {
    display: block;
    color: #777;
    font-size: 16px;
    margin-bottom: 4px;
    margin-top: 16px;
}

.net-editor-input {
    width: 100%;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 20px;
    padding: 10px 14px;
    outline: none;
    text-shadow: none;
}

.net-editor-input:focus {
    border-color: #444;
}

.net-editor-input::placeholder {
    color: #444;
}

.net-editor-textarea {
    width: 100%;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 14px;
    outline: none;
    resize: vertical;
    text-shadow: none;
    line-height: 1.5;
}

.net-editor-textarea:focus {
    border-color: #444;
}

.net-editor-textarea::placeholder {
    color: #444;
}

.net-editor-summary {
    min-height: 70px;
}

.net-editor-body {
    min-height: 200px;
}

.net-editor-hint {
    color: #555;
    font-size: 14px;
    margin-top: 6px;
}

.net-editor-upload-section {
    margin-top: 16px;
}

.net-editor-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

.net-upload-status {
    color: #666;
    font-size: 15px;
}

.net-image-list {
    margin-top: 8px;
}

.net-image-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #1a1a1a;
}

.net-image-name {
    color: #888;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.net-image-insert {
    background: none;
    border: 1px solid #333;
    color: #666;
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 1px 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.net-image-insert:hover {
    color: #aaa;
    border-color: #555;
}

.net-image-delete {
    background: none;
    border: 1px solid #4a1a1a;
    color: #993333;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 0 6px;
    cursor: pointer;
    line-height: 1.2;
    flex-shrink: 0;
}

.net-image-delete:hover {
    background: #2a1111;
    color: #cc4444;
}

.net-editor-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #222;
}

.net-submit-btn {
    color: #888;
}

.net-submit-btn:hover {
    color: #ccc;
}

.net-discard-btn {
    color: #993333;
    border-color: #4a1a1a;
}

.net-discard-btn:hover {
    background: #2a1111;
    color: #cc4444;
}

.net-editor-error {
    color: #cc4444;
    font-size: 16px;
    margin-top: 12px;
    text-shadow: none;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 900px) {
    #layout {
        flex-direction: column;
    }

    #terminal-panel {
        width: 100%;
        height: auto;
        overflow-y: visible;
        border-right: none;
    }

    #right-panel {
        display: none;
    }

    /* On postings page, show the right panel stacked below */
    body[data-page="postings"] #right-panel {
        display: block;
        width: 100%;
        height: 60vh;
    }

    /* On networking page, show the right panel stacked below */
    body[data-page="networking"] #right-panel {
        display: flex;
        width: 100%;
        height: 60vh;
    }

    body[data-page="networking"] #terminal-panel {
        height: auto;
    }

    body[data-page="networking"] #terminal {
        min-height: auto;
    }

    /* On filesystem page, show the right panel stacked below */
    body[data-page="filesystem"] #right-panel {
        display: flex;
        width: 100%;
        height: 60vh;
    }

    body[data-page="filesystem"] #terminal-panel {
        height: auto;
    }

    body[data-page="filesystem"] #terminal {
        min-height: auto;
    }

    body[data-page="postings"] #terminal-panel {
        height: auto;
    }

    body[data-page="postings"] #terminal {
        min-height: auto;
    }

    body[data-page="postings"] #chat-container {
        height: 60vh;
    }

    body[data-page="webmail"] #terminal-panel {
        width: 100%;
        height: auto;
    }

    body[data-page="webmail"] #right-panel {
        width: 100%;
        height: 80vh;
    }

    body[data-page="webmail"] #terminal {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    html, body {
        font-size: 16px;
    }

    #terminal {
        padding: 30px 12px 15vh;
    }
}
