:root {
    --bg: #f4f4f4;
    --surface: #fff;
    --border: #222;
    --text: #111;
    --text-muted: #666;
    --accent: #4a5aba;
    --accent-light: #6b7de0;
    --radius: 3px;
}

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

body {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Icons */
.icon { display: inline-block; vertical-align: middle; fill: currentColor; flex-shrink: 0; }
.icon-muted { color: var(--text-muted); }

header { border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 1.5rem; }
.site-nav { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.4rem; font-weight: bold; color: var(--text); letter-spacing: -0.5px; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-user { color: var(--text-muted); }
.inline-form { display: inline; }
.inline-form button { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; }

main { min-height: 60vh; }

footer { border-top: 2px solid var(--border); margin-top: 2rem; padding-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }

/* Board list */
.board-list { list-style: none; }
.board-item { border: 1px solid var(--border); padding: 0.75rem 1rem; margin-bottom: 0.5rem; background: var(--surface); border-radius: var(--radius); }
.board-item h2 { font-size: 1rem; margin-bottom: 0.25rem; }
.board-item p { color: var(--text-muted); font-size: 0.85rem; }
.board-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Thread list */
.thread-list { list-style: none; }
.thread-item { border: 1px solid var(--border); padding: 0.5rem 0.75rem; margin-bottom: 0.25rem; background: var(--surface); border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; }
.thread-item.pinned { border-left: 3px solid var(--accent); }
.thread-title { font-weight: bold; word-wrap: break-word; overflow-wrap: break-word; }
.thread-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Posts */
.post { border: 1px solid var(--border); margin-bottom: 0.75rem; background: var(--surface); border-radius: var(--radius); }
.post-header { background: linear-gradient(135deg, #e8eaf6, #f5f5f5); padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; display: flex; justify-content: space-between; }
.post-body { padding: 0.75rem; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: bold; margin-bottom: 0.25rem; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: var(--surface); }
.form-group textarea { min-height: 120px; resize: vertical; }
.btn { display: inline-block; padding: 0.4rem 1rem; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font: inherit; margin-bottom: 1rem; }
.btn:hover { background: var(--accent-light); text-decoration: none; }
.validation-error { color: #c00; font-size: 0.85rem; }
.success-msg { color: #080; font-size: 0.85rem; }

h1 { font-size: 1.3rem; margin-bottom: 1rem; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); }

/* Tags */
.tag { font-size: 0.7rem; background: var(--border); color: #fff; padding: 0.1rem 0.4rem; border-radius: var(--radius); vertical-align: middle; margin-left: 0.3rem; }

/* Admin nav */
.nav-admin { font-weight: bold; color: var(--accent); }

/* Admin actions inline */
.admin-actions { margin-bottom: 1rem; display: flex; gap: 0.5rem; }
.admin-actions button { background: none; border: 1px solid var(--border); padding: 0.2rem 0.5rem; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: 0.8rem; }
.admin-actions button:hover { background: var(--border); color: #fff; }

/* Deleted posts */
.post-deleted { opacity: 0.6; }
.post-body-deleted { font-style: italic; color: var(--text-muted); }

/* Admin panel */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.admin-card { display: block; border: 1px solid var(--border); padding: 0.75rem; border-radius: var(--radius); background: var(--surface); }
.admin-card:hover { background: #eee; text-decoration: none; }
.admin-card strong { display: block; margin-bottom: 0.25rem; color: var(--text); }
.admin-card span { font-size: 0.8rem; color: var(--text-muted); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: auto; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; word-wrap: break-word; overflow-wrap: break-word; }
.admin-table th { background: var(--border); color: #fff; }
.admin-table code { word-break: break-all; }

.pagination { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; font-size: 0.85rem; }
.pagination a { color: var(--accent); }
.pagination span { color: var(--text-muted); }

/* Markdown content */
.md-content { white-space: normal; }
.md-content p { margin-bottom: 0.5rem; }
.md-content p:last-child { margin-bottom: 0; }
.md-content strong { font-weight: bold; }
.md-content em { font-style: italic; }
.md-content del { text-decoration: line-through; color: var(--text-muted); }
.md-content a { color: var(--accent); text-decoration: underline; }
.md-content code { background: #e8e8e8; padding: 0.1rem 0.3rem; border-radius: 2px; font-size: 0.9em; }
.md-content pre { border-radius: var(--radius); overflow-x: auto; margin: 0.5rem 0; }
.md-content pre:not([class*="language-"]) { background: #1a1a1a; color: #e0e0e0; padding: 0.75rem; }
.md-content pre code { background: none; padding: 0; }
.md-content blockquote { border-left: 3px solid var(--accent); padding-left: 0.75rem; margin: 0.5rem 0; color: var(--text-muted); }
.md-content ul, .md-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.md-content li { margin-bottom: 0.2rem; }
.md-content h1, .md-content h2, .md-content h3 { font-size: 1rem; font-weight: bold; margin: 0.75rem 0 0.25rem; }

/* Invite tree */
.invite-tree { font-size: 0.85rem; margin-top: 0.5rem; }
.tree-node { padding-left: 1.2rem; border-left: 1px solid var(--border); margin-bottom: 0.3rem; padding-top: 0.2rem; }
.tree-user { font-weight: bold; }
.tree-meta { color: var(--text-muted); font-size: 0.75rem; margin-left: 0.5rem; }
.tree-children { margin-top: 0.2rem; }
.row-revoked { opacity: 0.5; }

/* Checkbox settings layout */
.checkbox-group label { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: normal; }
.checkbox-group input[type="checkbox"] { width: auto; margin: 0; }

/* Banned user styling */
/* Role styling is now handled by the <username> tag helper */

/* Banners */
.banner { padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 0.75rem; word-wrap: break-word; overflow-wrap: break-word; }
.banner a { color: inherit; text-decoration: underline; font-weight: bold; }
.banner-info { background: #e3f2fd; border: 1px solid #42a5f5; color: #1565c0; }
.banner-warning { background: #fff3e0; border: 1px solid #ffa726; color: #e65100; }
.banner-danger { background: #fce4ec; border: 1px solid #ef5350; color: #c62828; }
.banner-invite { background: #f3e5f5; border: 1px solid #ab47bc; color: #6a1b9a; }

/* Banned notice */
.banned-notice { background: #fee; border: 1px solid #c00; padding: 0.5rem 0.75rem; border-radius: var(--radius); color: #900; font-size: 0.85rem; margin: 1rem 0; }
