:root {
  --bg: #0b0b0f;
  --panel: #16151d;
  --panel-2: #1e1c27;
  --border: #2c2a38;
  --text: #eceaf4;
  --text-dim: #918fa3;
  --accent: #a855f7;
  --accent-2: #7c3aed;
  --danger: #e05263;
  --ok: #3ecf8e;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

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

.site-banner {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center;
}
@media (max-width: 720px) { .site-banner { max-height: 120px; } }

.community-banner {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  object-position: center;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 720px) { .community-banner { max-height: 100px; } }

/* --- Icon buttons (create post, notifications) --- */
.icon-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#openCreatePostBtn { font-size: 20px; font-weight: 700; line-height: 1; }

.link-btn { background: none; border: none; color: inherit; cursor: pointer; font-size: inherit; padding: 0; text-decoration: none; font: inherit; }
.text-link-btn { background: none; border: none; color: var(--text); cursor: pointer; font-size: inherit; padding: 0; text-decoration: none; font: inherit; }

/* --- Notifications --- */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #1a0511;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 50;
}
.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}
.notif-dropdown-header button { background: none; border: none; color: var(--accent-2); font-size: 11px; cursor: pointer; }
.notif-item { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: flex-start; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(168,85,247,0.06); }
.notif-item a { color: var(--text); display: block; }
.notif-item .notif-meta { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.notif-item .notif-dismiss { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; flex-shrink: 0; }
.notif-item .notif-dismiss:hover { color: var(--danger); }

/* --- Create post modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.char-count { float: right; color: var(--text-dim); font-weight: 400; font-size: 11px; }

/* --- Site-wide footer --- */
.site-footer {
  position: relative;
  border-top: 1px solid var(--border);
  overflow: hidden;
  margin-top: 60px;
}
.site-footer-watermark {
  position: absolute;
  top: 10px;
  right: 260px;
  width: 200px;
  height: 200px;
  opacity: 0.05;
  object-fit: contain;
  pointer-events: none;
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 28px;
  display: flex;
  justify-content: flex-start;
  gap: 160px;
  flex-wrap: wrap;
  position: relative;
}
.site-footer-col h4 {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.site-footer-col a {
  display: block;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 10px;
}
.site-footer-col a:hover { color: var(--text); text-decoration: none; }
.site-footer-divider { border-top: 1px solid var(--border); margin: 8px 0 14px; width: 170px; }
.site-footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13px;
}

/* --- Mod mail --- */
.modmail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  color: var(--text);
}
.modmail-row a:hover { text-decoration: none; color: var(--accent); }
.modmail-subject { font-weight: 700; font-size: 14px; }

.modmail-thread { display: flex; flex-direction: column; gap: 10px; }
.modmail-msg {
  border-radius: var(--radius);
  padding: 12px 14px;
  max-width: 80%;
  border: 1px solid var(--border);
}
.modmail-msg-user { background: var(--panel); align-self: flex-start; }
.modmail-msg-staff { background: rgba(168,85,247,0.08); border-color: var(--accent); align-self: flex-end; }
.modmail-msg-meta { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; }
.modmail-msg-body { white-space: pre-wrap; font-size: 14px; }

.chat-room { display: flex; flex-direction: column; }
.chat-room-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.chat-room-header h1 { margin: 0; font-size: 20px; text-align: center; }
.chat-online-indicator {
  position: absolute;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.chat-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}
.chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.chat-date-divider span { padding: 0 10px; }
.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}
.chat-message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 60vh;
  min-height: 320px;
  overflow-y: auto;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chat-message { display: flex; gap: 10px; align-items: flex-start; }
.chat-avatar { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }
.chat-message-body { min-width: 0; flex: 1; }
.chat-message-meta { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.chat-message-meta a { color: var(--text); font-weight: 600; }
.chat-message-time { margin-left: 4px; font-size: 11px; }
.chat-message-text { font-size: 14px; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.chat-remove-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  margin-left: auto;
  padding: 0 4px;
}
.chat-remove-btn:hover { color: var(--danger); }
#chatSendForm {
  display: flex;
  align-items: center;
  gap: 10px;
  /* .panel (used for narrow auth/settings forms) caps max-width at 480px —
     override it here so the send box matches the message list's full
     width above it instead of looking like a separate, narrower widget. */
  max-width: none;
  width: 100%;
}
/* Pill-shaped single-line input, scoped to the chat form only — the
   .textarea-with-emoji class is shared with the post and comment
   composers (submit.ejs, post.ejs), which want their normal multi-line
   box, not this compact pill. Chat has no emoji-picker-btn at all (see
   chat.ejs) — just the GIF and photo buttons below. */
#chatSendForm .textarea-with-emoji { position: relative; flex: 1; display: flex; }
#chatSendForm textarea {
  flex: 1;
  height: 46px;
  min-height: 0;
  max-height: 46px;
  resize: none;
  overflow: hidden;
  border-radius: 999px;
  padding: 12px 128px 12px 18px;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
}
#chatGifBtn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 3px 6px;
}
#chatGifBtn:hover { color: var(--text); border-color: var(--accent); }
#chatPhotoLabel {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 3px 6px;
  line-height: 1.5;
}
#chatPhotoLabel:hover { color: var(--text); border-color: var(--accent); }
#chatPhotoPreview {
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
#chatPhotoPreview img { max-height: 60px; border-radius: 6px; }
#chatPhotoPreview button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}
.chat-message-media { display: block; max-width: 320px; max-height: 320px; border-radius: 8px; margin-top: 6px; }

/* Shared by the post/comment composers (submit.ejs, post.ejs) — chat has
   its own compact pill version instead (#chatSendForm rules above), since
   chat has no emoji-picker-btn at all. This was previously completely
   unstyled: .emoji-popup rendered as a plain block in normal document
   flow instead of floating, pushing the rest of the page down whenever
   it opened rather than appearing as an actual popup. */
.textarea-with-emoji { position: relative; }
.emoji-picker-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.emoji-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 20;
}
.emoji-popup-section { margin-bottom: 8px; }
.emoji-popup-section:last-child { margin-bottom: 0; }
.emoji-popup-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.emoji-popup-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-popup-item {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.emoji-popup-item:hover { background: var(--panel-2); }

.gif-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  width: 300px;
  max-height: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gif-popup-search {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
}
.gif-popup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  overflow-y: auto;
}
.gif-popup-item { background: none; border: none; padding: 0; cursor: pointer; border-radius: 6px; overflow: hidden; }
.gif-popup-item img { width: 100%; height: 70px; object-fit: cover; display: block; }
.gif-popup-loading { grid-column: 1 / -1; text-align: center; color: var(--text-dim); font-size: 12px; padding: 20px 0; }
#chatSendForm button[type='submit'] {
  border-radius: 999px;
  padding: 12px 24px;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
}
.brand { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.brand:hover { text-decoration: none; color: var(--accent); }
.site-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 6px;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.site-header nav a { color: var(--text-dim); font-weight: 600; font-size: 13px; white-space: nowrap; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }

.nav-dropdown-wrap { position: relative; white-space: nowrap; flex-shrink: 0; }
.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.nav-dropdown-btn:hover { color: var(--text); }
.nav-dropdown-caret { font-size: 10px; }
.nav-dropdown-menu {
  position: absolute;
  top: 26px;
  left: 0;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 50;
  padding: 6px;
}
.nav-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.auth-area { display: flex; align-items: center; gap: 14px; font-size: 14px; flex-shrink: 0; }
.whoami { color: var(--text-dim); }
#logoutLink { color: var(--text-dim); font-weight: 600; white-space: nowrap; }
#logoutLink:hover { color: var(--text); text-decoration: none; }
.auth-area a[href="/login"], .auth-area a[href="/register"] { color: var(--text-dim); font-weight: 600; text-decoration: none; }
.auth-area a[href="/login"]:hover, .auth-area a[href="/register"]:hover { color: var(--text); text-decoration: none; }

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}
.role-user { background: #2a2f3a; color: var(--text-dim); }
.role-mod { background: #24405c; color: #7fb8ff; }
.role-admin { background: #4a2140; color: #e58bd6; }
.role-owner { background: #4d3a12; color: #f2c14e; }

main.wrap { padding-top: 24px; padding-bottom: 60px; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 12px; }

.post-card {
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.post-card-media { margin-left: auto; }
.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 28px;
}
.vote-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
  line-height: 1;
}
.vote-btn:hover { color: var(--accent); }
.vote-btn.active-up { color: var(--accent); }
.vote-btn.active-down { color: var(--accent-2); }

.comment-votes { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.commentVoteBtn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 2px; line-height: 1; }
.commentVoteBtn:hover { color: var(--accent); }
.commentVoteBtn.active-up { color: var(--accent); }
.commentVoteBtn.active-down { color: var(--accent-2); }
.comment-score { font-weight: 700; font-size: 12px; color: var(--text-dim); }
.score { font-weight: 700; font-size: 13px; }

.post-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.post-title a { color: var(--text); }
.post-meta { color: var(--text-dim); font-size: 12px; }
.post-body { margin-top: 8px; color: var(--text); white-space: pre-wrap; }

/* Link embeds: YouTube/Twitch iframes get a fixed 16:9 box; Twitter/
   Instagram's own embed scripts size their blockquote themselves, so
   those just get a max-width and are left alone otherwise. */
.link-embed { margin-top: 10px; max-width: 550px; }
.profile-link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.profile-link-icon { font-size: 24px; }
/* A small original icon for Instagram-related fallback cards — a generic
   camera-lens motif (a plain ring, a shape used broadly across countless
   apps' UI, not unique to any one platform's logo) on a gradient
   approximating Instagram's brand colors. Colors alone aren't
   copyrightable, and this is built from plain CSS shapes rather than
   tracing Instagram's actual logo artwork — see the reasoning in
   public/app.js where this class is applied. */
.profile-link-icon.instagram-gradient {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(45deg, #4f5bd5, #962fbf, #d62976, #fa7e1e, #feda75);
  position: relative;
  flex-shrink: 0;
}
.profile-link-icon.instagram-gradient::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.profile-link-name { font-weight: 700; color: var(--text); }
.profile-link-card a { color: var(--accent-2); font-size: 13px; }
.link-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
}
.post-actions { margin-top: 10px; display: flex; gap: 14px; font-size: 12px; }
.post-actions a, .post-actions button { color: var(--text-dim); background: none; border: none; cursor: pointer; font-size: 12px; padding: 0; }
.post-actions a:hover, .post-actions button:hover { color: var(--text); text-decoration: none; }

form.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 480px;
}
label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
label:first-of-type { margin-top: 0; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

button.btn, a.btn {
  display: inline-block;
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
}
button.btn:hover, a.btn:hover { opacity: 0.9; text-decoration: none; }
button.btn-danger { background: var(--danger); color: #fff; }
button.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.btn-sm { padding: 5px 10px; font-size: 12px; margin-top: 0; }

.error-box { background: #3a1620; border: 1px solid var(--danger); color: #ff9caa; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.ok-box { background: #10352a; border: 1px solid var(--ok); color: #8fe9c6; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.empty { color: var(--text-dim); padding: 30px 0; text-align: center; }
.user-search-results { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }
.user-search-results a { margin-left: 4px; }

.comment { border-left: 2px solid var(--border); padding-left: 12px; margin-top: 14px; }
.comment-meta { font-size: 12px; color: var(--text-dim); }
.comment-body { margin-top: 4px; white-space: pre-wrap; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 30px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.admin-table th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.admin-table tr:hover { background: var(--panel-2); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-dim); }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: auto; padding: 5px 8px; font-size: 12px; }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--panel-2); color: var(--text-dim); }
.tag-banned { background: #3a1620; color: #ff9caa; }

/* --- Public profile card --- */
.profile-card { max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.profile-card-top { display: flex; align-items: center; gap: 16px; }
.profile-card-avatar { width: 64px; height: 64px; font-size: 24px; flex-shrink: 0; }
.profile-card-name { margin: 0; font-size: 20px; }
.profile-card-handle { color: var(--accent-2); font-size: 13px; margin-top: 2px; }
.profile-card-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-online { background: var(--ok); }
.status-offline { background: var(--text-dim); }
.profile-card-joined { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.revoke-badge-btn {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 13px;
  padding: 0 0 0 2px;
  line-height: 1;
}
.revoke-badge-btn:hover { opacity: 1; }

.earned-badge-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  cursor: default;
}
.lbAwardBadgeBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
}
.lbAwardBadgeBtn:hover { color: var(--text); border-color: var(--accent); }
.award-badge-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  max-width: 340px;
}
.award-badge-dialog::backdrop { background: rgba(0,0,0,0.6); }
.award-badge-dialog select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
}

.earned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.profile-card-actions { display: flex; gap: 8px; }

/* --- Community stats & recent activity (public profile sidebar) --- */
.stats-panel h3, .activity-panel h3 { margin: 0 0 12px; font-size: 14px; color: var(--accent-2); }
.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.stats-row:last-child { border-bottom: none; }
.stats-row strong { color: var(--text); }

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}
.activity-item:last-of-type { border-bottom: none; }
.activity-item:hover { text-decoration: none; }
.activity-item:hover div div:first-child { color: var(--accent); }
.activity-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

/* --- Avatar / profile link --- */
.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  flex-shrink: 0;
}
.avatar-circle:hover { text-decoration: none; background: var(--accent); color: #1a0511; }

/* --- Layout: content + sidebar --- */
.feed-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 780px) { .feed-layout { grid-template-columns: 1fr; } }

.sidebar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.sidebar-panel h3 { margin: 0 0 8px; font-size: 15px; }
.sidebar-panel p { color: var(--text-dim); font-size: 13px; margin: 0 0 14px; }
.sidebar-stats { display: flex; gap: 20px; margin-bottom: 14px; }
.sidebar-stats .stat-num { font-weight: 800; font-size: 18px; color: var(--accent); }
.sidebar-stats .stat-label { font-size: 11px; color: var(--text-dim); }
.rules-panel h3 { color: var(--accent-2); }
.rules-panel ol { margin: 0; padding-left: 18px; color: var(--text); font-size: 13px; }
.rules-panel li { margin-bottom: 8px; }

/* --- Search + filter bar --- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 14px;
}
.filter-tabs { display: flex; gap: 8px; }
.filter-tabs a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}
.filter-tabs a:hover { text-decoration: none; color: var(--text); }
.filter-tabs a.active { background: var(--accent); border-color: var(--accent); color: #1a0511; }

.sort-select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  max-width: 90px;
}

.user-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  z-index: 40;
  overflow: hidden;
}
.user-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
}
.user-search-item:hover { background: var(--panel-2); text-decoration: none; }

.create-post-btn { white-space: nowrap; margin-top: 0; }

/* --- Post type badges + NSFW spoiler tile --- */
.post-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--accent-2);
  margin-right: 6px;
}
.nsfw-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #4a1420;
  color: #ff7d95;
  margin-right: 6px;
}
.pinned-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #4a3a12;
  color: #ffc76b;
  margin-right: 6px;
}

.tombstone-label {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-style: italic;
}

/* Role/streamer checkmark badges next to a username. Rendered as a small
   filled circle with a white checkmark glyph, not a plain colored glyph —
   this site's theme is dark throughout, so a literal black checkmark on
   its own would be invisible against the background; a black circle with
   a white checkmark stays legible and still reads as its own distinct
   color from the red/blue ones. */
.checkmark-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
  color: #fff;
  margin-left: 3px;
  vertical-align: middle;
}
.checkmark-red { background: #e0304a; }
.checkmark-blue { background: #3f8cff; }
.checkmark-green { background: #2fb75d; }

.nsfw-tile {
  width: 96px;
  height: 72px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  text-align: center;
}
/* The "18+"/"18+ NSFW" label specifically (first span, see index.ejs and
   post.ejs) gets its own bold, larger, high-contrast treatment — original
   CSS text styling, not an image asset — so it reads as a clear content
   warning at a glance rather than blending into the smaller "tap to
   reveal" hint below it. */
.nsfw-tile span:first-child {
  font-size: 22px;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: 0.02em;
}
.nsfw-tile:hover { border-color: var(--accent); color: var(--accent); }
.nsfw-tile.revealed { background: var(--bg); color: var(--text-dim); cursor: default; }
.media-thumb { width: 96px; height: 72px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--panel-2); }
.link-thumb { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-dim); }
.media-type-icon { width: 32px; height: 32px; color: var(--text-dim); }
.media-type-icon-thumb { display: flex; align-items: center; justify-content: center; }
.media-type-icon-thumb .media-type-icon { width: 28px; height: 28px; }

/* --- Account settings shell --- */
.account-body { margin: 0; }
.avatar-circle img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.account-shell { display: flex; min-height: 100vh; }
.account-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
}
.account-back {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 20px;
  padding: 0 10px;
}
.account-nav { display: flex; flex-direction: column; gap: 4px; }
.account-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}
.account-nav-item:hover { text-decoration: none; background: var(--panel-2); color: var(--text); }
.account-nav-item.active { background: rgba(168,85,247,0.12); color: var(--accent); border-left: 3px solid var(--accent); padding-left: 9px; }
.account-nav-icon { font-size: 15px; width: 18px; text-align: center; }

.account-sidebar-bottom { border-top: 1px solid var(--border); padding-top: 14px; }
.account-user-card { display: flex; align-items: center; gap: 10px; padding: 6px 10px 12px; }
.account-user-name { font-size: 13px; font-weight: 700; }
.account-user-role { font-size: 10px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.account-signout {
  display: block;
  text-align: center;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}
.account-signout:hover { text-decoration: none; background: rgba(224,82,99,0.1); }

.account-content { flex: 1; padding: 30px 40px; }

.account-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 900px;
  margin-bottom: 20px;
}
.account-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: 0.04em;
  margin: 0 0 24px;
}
.account-panel-title .bar { width: 4px; height: 16px; background: var(--accent); border-radius: 2px; display: inline-block; }
.account-panel-footer { margin-top: 24px; text-align: right; }

.account-profile-row { display: flex; gap: 40px; }
.account-avatar-block { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 140px; flex-shrink: 0; }
.generated-avatar-picker { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.generated-avatar-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  background: none;
}
.generated-avatar-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.generated-avatar-option:hover { border-color: var(--accent); }

.avatar-upload-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  font-size: 32px;
  font-weight: 700;
  overflow: hidden;
  background: var(--panel-2);
}
.avatar-upload-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-change-label {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 0;
}
.account-hint { color: var(--text-dim); font-size: 12px; text-align: center; }

.account-fields { flex: 1; }
.account-fields label { font-size: 11px; letter-spacing: 0.04em; color: var(--text-dim); margin: 16px 0 6px; }
.account-fields label:first-of-type { margin-top: 0; }
.account-field-row { display: flex; gap: 10px; }
.account-field-row input { flex: 1; }
.account-field-row .btn { margin-top: 0; white-space: nowrap; }

.modlog-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.modlog-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}
.modlog-toolbar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}
/* .btn's default margin-top: 16px is meant for a button sitting below a
   form field — here it's inline next to a checkbox, so that top margin
   was pushing it down out of line with everything else next to it. */
.modlog-toolbar .btn { margin-top: 0; }

@media (max-width: 720px) {
  .account-shell { flex-direction: column; }
  .account-sidebar { width: 100%; flex-direction: row; align-items: center; }
  .account-profile-row { flex-direction: column; }
  /* Fixed at right:260px regardless of screen width — on a narrow screen
     the footer columns wrap right underneath it, so just remove it here
     rather than have it sit behind/through wrapped text. */
  .site-footer-watermark { display: none; }
}

/* API docs — API.md rendered to static HTML at build time (see
   partials/apiDocsBody.ejs), styled to match GitHub's own dark-mode
   README rendering as closely as reasonable (their actual color values,
   heading underlines, striped tables, code block treatment) rather than
   this site's own purple accent theme — that's the point of this page. */
.gh-readme-box {
  max-width: 900px;
  border: 1px solid #30363d;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 40px;
}
.gh-readme-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 12px 16px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 600;
}
.gh-file-icon { flex-shrink: 0; }

.api-docs {
  background: #0d1117;
  padding: 32px 32px 40px;
  color: #c9d1d9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
.api-docs h1, .api-docs h2, .api-docs h3, .api-docs h4 { color: #e6edf3; font-weight: 600; }
.api-docs h1 {
  font-size: 2em;
  margin: 0 0 16px;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #21262d;
}
.api-docs h2 {
  font-size: 1.5em;
  margin: 24px 0 16px;
  padding-bottom: 0.3em;
  border-top: none;
  border-bottom: 1px solid #21262d;
}
.api-docs h2:first-of-type { margin-top: 0; }
.api-docs h3 { font-size: 1.25em; margin: 24px 0 16px; color: #e6edf3; }
.api-docs p, .api-docs ul, .api-docs ol, .api-docs table, .api-docs pre, .api-docs blockquote { margin: 0 0 16px; }
.api-docs li { margin-top: 4px; }
.api-docs ul, .api-docs ol { padding-left: 2em; }
.api-docs a { color: #58a6ff; }
.api-docs a:hover { text-decoration: underline; }
.api-docs hr { height: 1px; background: #21262d; border: 0; margin: 24px 0; }
.api-docs strong { color: #e6edf3; }
.api-docs code {
  background: rgba(110, 118, 129, 0.4);
  padding: 0.2em 0.4em;
  border-radius: 6px;
  font-size: 85%;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color: #c9d1d9;
}
.api-docs pre {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  line-height: 1.45;
}
.api-docs pre code { background: none; padding: 0; font-size: 100%; border-radius: 0; }
.api-docs .table-wrap { overflow-x: auto; margin-bottom: 16px; }
.api-docs .table-wrap table { margin-bottom: 0; }
.api-docs table {
  width: 100%;
  border-collapse: collapse;
}
.api-docs th, .api-docs td {
  border: 1px solid #30363d;
  padding: 6px 13px;
}
.api-docs th { font-weight: 600; }
.api-docs tr { background: #0d1117; border-top: 1px solid #21262d; }
.api-docs tr:nth-child(2n) { background: #161b22; }
.api-docs blockquote {
  color: #8b949e;
  border-left: 0.25em solid #3b434b;
  padding: 0 1em;
  margin-left: 0;
}

/* --- Utility classes (auto-generated from former inline style
   attributes) — see the conversion note on style-src in server.js.
   Each maps to exactly one property:value pair that used to be
   written inline; names are mechanically generated, not curated. --- */
.u-margin-bottom-16px { margin-bottom: 16px; }
.u-display-inline { display: inline; }
.u-min-height-70px { min-height: 70px; }
.u-max-width-720px { max-width: 720px; }
.u-flex-1 { flex: 1; }
.u-display-flex { display: flex; }
.u-gap-10px { gap: 10px; }
.u-position-relative { position: relative; }
.u-display-none { display: none; }
.u-min-width-0 { min-width: 0; }
.u-align-items-center { align-items: center; }
.u-gap-8px { gap: 8px; }
.u-width-24px { width: 24px; }
.u-height-24px { height: 24px; }
.u-border-radius-50 { border-radius: 50%; }
.u-display-block { display: block; }
.u-width-100 { width: 100%; }
.u-text-align-center { text-align: center; }
.u-max-width-480px { max-width: 480px; }
.u-margin-top-0 { margin-top: 0; }
.u-margin-top-8px { margin-top: 8px; }
.u-margin-bottom-12px { margin-bottom: 12px; }
.u-display-inline-flex { display: inline-flex; }
.u-margin-left-6px { margin-left: 6px; }
.u-margin-bottom-14px { margin-bottom: 14px; }
.u-gap-6px { gap: 6px; }
.u-font-size-12px { font-size: 12px; }
.u-color-var-text-dim { color: var(--text-dim); }
.u-white-space-nowrap { white-space: nowrap; }
.u-width-auto { width: auto; }
.u-max-width-560px { max-width: 560px; }
.u-text-align-left { text-align: left; }
.u-max-width-280px { max-width: 280px; }
.u-overflow-hidden { overflow: hidden; }
.u-text-overflow-ellipsis { text-overflow: ellipsis; }
.u-flex-wrap-wrap { flex-wrap: wrap; }
.u-gap-4px { gap: 4px; }
.u-font-size-11px { font-size: 11px; }
.u-margin-top-24px { margin-top: 24px; }
.u-background-none { background: none; }
.u-border-none { border: none; }
.u-color-inherit { color: inherit; }
.u-cursor-pointer { cursor: pointer; }
.u-padding-0 { padding: 0; }
.u-max-width-760px { max-width: 760px; }
.u-margin-top-20px { margin-top: 20px; }
.u-max-width-520px { max-width: 520px; }
.u-border-top-1px-solid-var-border { border-top: 1px solid var(--border); }
.u-margin-top-4px { margin-top: 4px; }
.u-padding-top-12px { padding-top: 12px; }
.u-font-size-14px { font-size: 14px; }
.u-color-var-text { color: var(--text); }
.u-font-size-16px { font-size: 16px; }
.u-width-26px { width: 26px; }
.u-height-26px { height: 26px; }
.u-margin-top-14px { margin-top: 14px; }
.u-justify-content-space-between { justify-content: space-between; }
.u-margin-0 { margin: 0; }
.u-text-align-right { text-align: right; }
.u-margin-top-6px { margin-top: 6px; }
.u-margin-top-16px { margin-top: 16px; }
.u-font-size-13px { font-size: 13px; }
.u-margin-top-10px { margin-top: 10px; }
.u-padding-12px-0 { padding: 12px 0; }
.u-cursor-default { cursor: default; }
.u-margin-right-10px { margin-right: 10px; }
.u-margin-bottom-20px { margin-bottom: 20px; }
.u-display-inline-block { display: inline-block; }
.u-max-width-640px { max-width: 640px; }
.u-margin-top-18px { margin-top: 18px; }
.u-max-height-300px { max-height: 300px; }
.u-overflow-y-auto { overflow-y: auto; }
.u-white-space-pre-wrap { white-space: pre-wrap; }
.u-background-var-panel-2 { background: var(--panel-2); }
.u-border-1px-solid-var-border { border: 1px solid var(--border); }
.u-border-radius-6px { border-radius: 6px; }
.u-padding-10px { padding: 10px; }
.u-margin-top-12px { margin-top: 12px; }
.u-width-40px { width: 40px; }
.u-height-40px { height: 40px; }
.u-align-items-flex-start { align-items: flex-start; }
.u-margin-top-3px { margin-top: 3px; }
.u-background-var-danger { background: var(--danger); }
.u-height-220px { height: 220px; }
.u-max-width-100 { max-width: 100%; }
.u-border-radius-8px { border-radius: 8px; }
.u-width-34px { width: 34px; }
.u-height-34px { height: 34px; }
.u-padding-20px { padding: 20px; }
.u-min-height-80px { min-height: 80px; }
.u-word-break-break-all { word-break: break-all; }
.u-user-select-all { user-select: all; }
.u-gap-12px { gap: 12px; }
.u-padding-12px { padding: 12px; }
.u-overflow-x-auto { overflow-x: auto; }
.u-max-width-420px { max-width: 420px; }
.u-border-color-var-danger { border-color: var(--danger); }
.u-margin-14px-0-20px { margin: -14px 0 20px; }
.u-color-var-danger { color: var(--danger); }
.u-flex-direction-column { flex-direction: column; }
.u-gap-2px { gap: 2px; }
.u-margin-10px-0-16px { margin: 10px 0 16px; }
.u-width-28px { width: 28px; }
.u-height-28px { height: 28px; }
