@import url('/fontsource/quicksand/latin-400.css');
@import url('/fontsource/quicksand/latin-600.css');
@import url('/fontsource/quicksand/latin-700.css');
@import url('/fontsource/lora/latin-400.css');
@import url('/fontsource/lora/latin-600.css');
@import url('/fontsource/jetbrains-mono/latin-400.css');
@import url('/fontsource/jetbrains-mono/latin-600.css');

/* ── SVG icon base ── */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* Heart: outlined → filled on liked state */
.btn-like .icon-heart      { fill: none; transition: fill 0.15s; }
.btn-like.liked .icon-heart { fill: currentColor; }

/* Check in poll results */
.poll-mine-check { margin-left: 0.3em; }
.icon-check { vertical-align: -0.2em; }

/* Bio @mention links */
.bio-mention {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.bio-mention:hover { text-decoration: underline; }

:root {
  --outline:        rgba(0, 0, 0, 0.18);
  --outline-strong: rgba(0, 0, 0, 0.40);
  --outline-fill:   rgba(0, 0, 0, 0.04);
}

body.theme-dark {
  --outline:        rgba(255, 255, 255, 0.22);
  --outline-strong: rgba(255, 255, 255, 0.45);
  --outline-fill:   rgba(255, 255, 255, 0.06);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font, system-ui, sans-serif);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ── Nav ── */
.nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-search {
  flex: 1;
  max-width: 320px;
}

.nav-search input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 0.35rem 0.85rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.nav-search input:focus {
  border-color: var(--accent);
  background: var(--outline-fill);
}

.nav-search input::placeholder { color: var(--subtext); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.nav-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links a {
  color: var(--subtext);
  font-size: 0.88rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.nav-logout {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--subtext);
  padding: 0.3rem 0.8rem;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.83rem;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-logout:hover { color: var(--text); border-color: var(--outline-strong); background: var(--outline-fill); }

/* ── Layout ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ── Buttons ── */
.btn {
  padding: 0.42rem 1rem;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }

.btn-primary  { background: transparent; color: var(--link); border: 1px solid var(--link); font-weight: 700; }
.btn-ghost    { background: transparent; color: var(--subtext); border: 1px solid var(--outline); }
.btn-danger   { background: transparent; color: #e0245e; border: 1px solid #e0245e; }
.btn-follow   { background: transparent; color: var(--link); border: 1px solid var(--link); font-weight: 700; }
.btn-unfollow { background: transparent; color: var(--text); border: 1px solid var(--outline); }

.btn-primary:hover, .btn-follow:hover {
  background: var(--accent);
  color: var(--accent-text);
  opacity: 1;
}
.btn-ghost:hover, .btn-unfollow:hover { border-color: var(--outline-strong); background: var(--outline-fill); }
.btn-danger:hover { background: rgba(224, 36, 94, 0.1); }

.btn-like {
  background: transparent;
  color: var(--subtext);
  border: 1px solid var(--outline);
  padding: 0.35rem 0.75rem;
}

.btn-like.liked { color: #e0245e; border-color: #e0245e; background: rgba(224, 36, 94, 0.06); }
.btn-like:hover { border-color: #e0245e; color: #e0245e; }

/* ── Compose box ── */
.compose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.compose-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.compose-textarea-wrap {
  position: relative;
  flex: 1;
}

.compose textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  resize: none;
  font-family: inherit;
  min-height: 72px;
  padding: 0.1rem 0 1.4rem 0;
}

.compose textarea::placeholder { color: var(--subtext); }

.char-count-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 0.72rem;
  color: var(--subtext);
  background: var(--surface);
  padding: 0.1rem 0.45rem;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}

.char-count-overlay.warn { color: #e0a020; }
.char-count-overlay.over { color: #e0245e; }

.compose-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

/* ── Tag picker ── */
.tag-picker {
  margin-top: 0.6rem;
  padding-left: 50px;
}

.tag-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.tag-picker-selected:empty { display: none; }

.tag-picker-dropdown {
  display: inline-block;
}

.tag-picker-dropdown summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 0.25rem 0.7rem;
  color: var(--subtext);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}

.tag-picker-dropdown summary::-webkit-details-marker { display: none; }
.tag-picker-dropdown summary:hover { color: var(--accent); border-color: var(--accent); }
.tag-picker-dropdown[open] summary { background: var(--bg); }

.tag-picker-categories {
  margin-top: 0.6rem;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.tag-picker-cat { margin-bottom: 0.85rem; }
.tag-picker-cat:last-child { margin-bottom: 0; }

.tag-picker-cat-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtext);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.tag-picker-cat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag-chip-pickable, .tag-chip-selected {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  color: var(--subtext);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-chip-pickable:hover { color: var(--accent); border-color: var(--accent); }
.tag-chip-pickable.selected {
  background: rgba(74, 158, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  cursor: default;
}

.tag-chip-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.tag-chip-selected::after {
  content: " ×";
  margin-left: 0.2rem;
  opacity: 0.7;
}

.tag-chip-selected:hover { opacity: 0.85; }

/* ── Hashtags on post-card ── */
.post-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}

.hashtag {
  font-size: 0.78rem;
  color: var(--link);
  background: var(--outline-fill);
  border-radius: 10px;
  padding: 0.1rem 0.55rem;
  transition: background 0.15s;
}

.hashtag:hover {
  background: rgba(74, 158, 255, 0.18);
}

/* ── Add friend form ── */
.add-friend-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.add-friend-form input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.add-friend-form input:focus { border-color: var(--accent); background: var(--outline-fill); }

/* ── Beta toggles ── */
.beta-badge {
  display: inline-block;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.beta-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.beta-toggle:hover { border-color: var(--accent); background: rgba(255,255,255,0.02); }

.beta-toggle input[type=checkbox] {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.beta-toggle-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.beta-toggle-desc {
  font-size: 0.8rem;
  color: var(--subtext);
  margin-top: 0.15rem;
}

/* ── Beta: compact density ── */
body.beta-compact .post-card { padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; }
body.beta-compact .post-content { font-size: 0.92rem; line-height: 1.45; margin-bottom: 0.5rem; }
body.beta-compact .post-avatar, body.beta-compact .avatar-placeholder { width: 32px; height: 32px; font-size: 0.85rem; }
body.beta-compact .post-header { margin-bottom: 0.4rem; }

.compose-options {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.compose-options summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--subtext);
  padding: 0.25rem 0;
  list-style: none;
  user-select: none;
  transition: color 0.15s;
}

.compose-options summary::-webkit-details-marker { display: none; }

.compose-options summary::before {
  content: "›";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s;
}

.compose-options[open] summary::before { transform: rotate(90deg); }
.compose-options summary:hover { color: var(--text); }

.compose-options-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.option-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.option-group { margin-bottom: 0.25rem; }

.option-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtext);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.option-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  color: var(--subtext);
  font-family: inherit;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.option-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--outline-fill); }
.option-btn input[type=file] { display: none; }

.format-hint {
  font-size: 0.7rem;
  color: var(--subtext);
}

.format-hint code {
  background: rgba(255,255,255,0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-size: 0.95em;
}

#img-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

#img-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
}

/* ── Post card ── */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.post-card:hover { border-color: var(--accent); }

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
}

.post-author:hover .post-display-name { color: var(--accent); }

.avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-display-name {
  font-weight: 600;
  font-size: 0.93rem;
  transition: color 0.15s;
}

.post-username { color: var(--subtext); font-size: 0.78rem; }

.post-time-head { color: var(--subtext); font-size: 0.75rem; white-space: nowrap; }

.post-content {
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 0.75rem;
  font-size: 0.97rem;
}

.post-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.post-code code { background: transparent; padding: 0; }

.post-inline-code {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
}

.post-quote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.85rem;
  margin: 0.5rem 0;
  color: var(--subtext);
  font-style: italic;
  background: rgba(255,255,255,0.02);
  border-radius: 0 6px 6px 0;
}

.post-spoiler {
  background: var(--text);
  color: var(--text);
  padding: 0 0.25rem;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.post-spoiler.revealed {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: text;
  user-select: text;
}

.post-mention {
  color: var(--link);
  font-weight: 600;
  background: var(--outline-fill);
  padding: 0 0.25rem;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}

.post-mention:hover {
  background: var(--outline-strong);
  opacity: 0.92;
}

.mention-popup {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  width: 320px;
  max-width: calc(100vw - 16px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 9999;
  pointer-events: none;
  animation: mentionPopupIn 0.14s ease-out;
}

.mention-popup-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.mention-popup-avatar-placeholder {
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.mention-popup-meta {
  min-width: 0;
  flex: 1;
}

.mention-popup-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-popup-username {
  font-size: 0.74rem;
  color: var(--subtext);
  margin-bottom: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-popup-nickname-tag {
  font-size: 0.72rem;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 0.2rem;
}
.mention-popup-bio {
  font-size: 0.8rem;
  color: var(--subtext);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@keyframes mentionPopupIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--subtext);
}

.post-tag-location {
  background: rgba(74, 158, 255, 0.08);
  border-color: rgba(74, 158, 255, 0.3);
}

.post-tag-scheduled {
  background: rgba(255, 200, 80, 0.08);
  border-color: rgba(255, 200, 80, 0.3);
  color: #e8b048;
}

.compose-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.compose-extra-input {
  flex: 1;
  min-width: 180px;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.compose-extra-input:focus { border-color: var(--accent); background: var(--outline-fill); }

.post-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  overflow: hidden;
}

.post-images img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.post-images img:hover { opacity: 0.9; }
.post-img-wrap { position: relative; display: contents; }
.post-images.single .post-img-wrap { display: block; }
.post-img-delete {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}
.post-img-wrap:hover .post-img-delete { display: flex; }
.post-img-delete:hover { background: rgba(200,40,40,0.85); }
.post-images.single { grid-template-columns: 1fr; }
.post-images.single img { border-radius: 10px; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Like count (inside like button, click opens who-liked) ── */
.like-count-clickable { cursor: pointer; }
.like-count-clickable:hover .like-count { text-decoration: underline; }

/* ── Bookmark button active state ── */
.btn-bookmark.bookmarked { color: var(--accent); }

/* ── Reactions ── */
.post-reactions {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.reaction-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.55rem; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 0.82rem; cursor: pointer; transition: background 0.12s, border-color 0.12s;
  color: var(--text);
}
.reaction-pill:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--accent); }
.reaction-pill.mine  { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Reaction picker popup ── */
.reaction-picker {
  position: absolute; z-index: 1100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 0.3rem 0.5rem;
  display: flex; gap: 0.2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: mentionPopupIn 0.12s ease-out;
}
.reaction-picker-btn {
  font-size: 1.3rem; background: none; border: none;
  cursor: pointer; padding: 0.15rem 0.3rem; border-radius: 8px;
  transition: background 0.1s, transform 0.1s; line-height: 1;
}
.reaction-picker-btn:hover { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); transform: scale(1.25); }

/* ── Quote embed ── */
.quote-embed {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 0.8rem; margin-bottom: 0.75rem;
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
  cursor: default;
}
.quote-embed-header {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.35rem; font-size: 0.82rem;
}
.quote-embed-avatar {
  width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.quote-embed-avatar-placeholder {
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  color: var(--accent-text); display: flex; align-items: center;
  justify-content: center; font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
}
.quote-embed-name { font-weight: 600; color: var(--text); }
.quote-embed-handle { color: var(--subtext); text-decoration: none; }
.quote-embed-handle:hover { text-decoration: underline; }
.quote-embed-content {
  font-size: 0.88rem; color: var(--text); line-height: 1.45;
  word-break: break-word; overflow-wrap: break-word;
  overflow: hidden; max-width: 100%;
}
.quote-embed-content pre, .quote-embed-content code {
  white-space: pre-wrap; word-break: break-all;
}

/* ── Quote compose form (inline) ── */
.quote-compose {
  margin-top: 0.6rem; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); display: none;
}
.quote-compose.open { display: block; }
.quote-compose textarea {
  width: 100%; min-height: 72px; resize: vertical;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit;
  padding: 0.5rem 0.65rem; font-size: 0.9rem; box-sizing: border-box;
}
.quote-compose-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

/* ── Who-liked popup ── */
.who-liked-popup {
  position: fixed; z-index: 1500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.75rem;
  width: 260px; max-width: calc(100vw - 16px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: mentionPopupIn 0.14s ease-out;
}
.who-liked-title { font-size: 0.8rem; font-weight: 600; color: var(--subtext); margin-bottom: 0.5rem; }
.who-liked-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; }
.who-liked-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; text-decoration: none; color: var(--text); }
.who-liked-row:hover { color: var(--accent); }
.who-liked-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.who-liked-placeholder { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.who-liked-empty { font-size: 0.82rem; color: var(--subtext); }

/* ── Custom status ── */
.profile-status { font-size: 0.83rem; color: var(--subtext); margin-bottom: 0.5rem; font-style: italic; }
.mention-popup-status { font-size: 0.75rem; color: var(--subtext); font-style: italic; margin-bottom: 0.2rem; }

/* ── Forms (login / register) ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1rem;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 380px;
}

.form-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.form-card .subtitle {
  color: var(--subtext);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--subtext);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  background: var(--outline-fill);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.error-msg {
  background: rgba(224, 36, 94, 0.12);
  border: 1px solid #e0245e;
  color: #e0245e;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.success-msg {
  background: rgba(0, 200, 100, 0.1);
  border: 1px solid #00c864;
  color: #00c864;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.form-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--subtext);
}

.form-link a { color: var(--link); }

/* ── Profile page ── */
.profile-banner {
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: -44px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--nav-bg) 100%);
}

.profile-banner img { width: 100%; height: 100%; object-fit: cover; }

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  padding-top: 54px;
  margin-bottom: 1.25rem;
  position: relative;
}

.profile-avatar-wrap {
  position: absolute;
  top: -40px;
  left: 1rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  background: var(--accent);
  display: block;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2rem;
  border: 4px solid var(--surface);
}

.profile-actions-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.profile-display-name { font-size: 1.2rem; font-weight: 700; }
.profile-username-tag { color: var(--subtext); font-size: 0.88rem; margin-bottom: 0.6rem; }
.profile-nicknames { font-size: 0.8rem; color: var(--subtext); margin-bottom: 0.6rem; }
.profile-nicknames summary { cursor: pointer; user-select: none; display: inline; }
.profile-nicknames summary:hover { color: var(--text); }
.profile-nicknames-list { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.profile-nickname { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--link); padding: 0.15rem 0.5rem; border-radius: 99px; font-size: 0.78rem; text-decoration: none; transition: opacity 0.15s; }
.profile-nickname:hover { opacity: 0.75; }
.profile-bio { font-size: 0.92rem; color: var(--text); margin-bottom: 0.75rem; }

.profile-stats {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--subtext);
}

.profile-stats strong { color: var(--text); }

/* ── Settings ── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.settings-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}

.theme-card {
  border-radius: 10px;
  padding: 0.85rem 0.5rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}

.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--accent); }

.theme-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}

.theme-card.locked:hover { transform: none; }

.premium-badge,
.tier-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.premium-badge,
.tier-badge.tier-premium {
  background: linear-gradient(135deg, #C9A227, #f0d050);
  color: #1a0a2e;
}

.tier-badge.tier-mid {
  background: linear-gradient(135deg, #6b89ff, #00ffff);
  color: #0a1430;
}

/* ── Inline badges (next to display names) ── */
.badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  margin-left: 0.25em;
  vertical-align: -0.1em;
  font-size: 0.95em;
  color: var(--link);
  font-variant-emoji: text;
  -webkit-font-smoothing: antialiased;
  line-height: 1;
}

.badge-inline img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(0);
}

/* ── Badge picker grid (settings) ── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.badge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--outline);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.badge-card:hover { border-color: var(--accent); background: var(--outline-fill); }

.badge-card.checked {
  border-color: var(--accent);
  background: var(--outline-fill);
}

.badge-card.locked {
  cursor: not-allowed;
  opacity: 0.55;
}

.badge-card.locked:hover { border-color: var(--outline); background: transparent; }

.badge-card input[type=checkbox] {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  accent-color: var(--accent);
}

.badge-icon-large {
  font-size: 2rem;
  line-height: 1;
  font-variant-emoji: text;
  color: var(--link);
}

.badge-icon-large img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.badge-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-desc {
  font-size: 0.7rem;
  color: var(--subtext);
  line-height: 1.3;
}

.badge-lock {
  font-size: 0.65rem;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-card img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin-bottom: 0.4rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.theme-card-name {
  font-size: 0.78rem;
  font-weight: 500;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  transition: background 0.15s;
}

.file-label:hover { background: rgba(255,255,255,0.05); }
.file-label input { display: none; }

/* ── User row (discover) ── */
.user-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.15s;
}

.user-row:hover { border-color: var(--accent); }

.user-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.user-info:hover .post-display-name { color: var(--accent); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  color: var(--subtext);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

/* ── Image modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: zoom-out;
}
.modal-overlay.open { display: flex; }

.modal-inner {
  position: relative;
  display: inline-flex;
  cursor: default;
  max-width: min(88vw, calc(100vw - 120px));
  max-height: 92vh;
}
#modal-img {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  border-radius: 8px;
  object-fit: contain;
  user-select: none;
}

/* ── Image viewer nav arrows ── */
.modal-nav {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
  backdrop-filter: blur(4px);
}
.modal-nav:hover  { background: rgba(0,0,0,0.75); }
.modal-nav:disabled { opacity: 0.18; cursor: default; pointer-events: none; }

/* ── Author chip (bottom-left) ── */
.modal-author {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  backdrop-filter: blur(6px);
  color: #fff;
  text-decoration: none;
  max-width: 200px;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-author:hover { background: rgba(0,0,0,0.8); }
.modal-author-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.modal-author-avatar-ph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.modal-author-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-author-handle {
  font-size: 0.7rem;
  opacity: 0.65;
  white-space: nowrap;
}

/* ── Image counter (bottom-right) ── */
.modal-counter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  border-radius: 10px;
  padding: 3px 9px;
  color: #fff;
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* ── Image viewer action menu ── */
.modal-actions {
  position: absolute;
  top: 10px;
  right: 10px;
}
.modal-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  backdrop-filter: blur(4px);
}
.modal-menu-btn:hover { background: rgba(0,0,0,0.75); }
.modal-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 1;
  animation: menuPop 0.12s ease;
}
.modal-menu.open { display: block; }
@keyframes menuPop {
  from { opacity: 0; transform: scale(0.93) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  white-space: nowrap;
}
.modal-menu-item:hover { background: var(--bg); }
.modal-menu-close { color: var(--subtext); }
.modal-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--subtext);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Profile meta row (location/link) ── */
.profile-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--subtext);
  margin-bottom: 0.75rem;
}

.profile-meta-row a { transition: opacity 0.15s; }
.profile-meta-row a:hover { opacity: 0.8; }

/* ── Polls ── */
.poll {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.poll-option {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.poll-option:hover {
  border-color: var(--accent);
  background: rgba(255,255,255,0.03);
}

.poll-result {
  position: relative;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
}

.poll-result.mine { border-color: var(--accent); }

.poll-result-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  opacity: 0.18;
  transition: width 0.3s;
}

.poll-result.mine .poll-result-fill { opacity: 0.32; }

.poll-result-label {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 0.85rem;
  font-size: 0.88rem;
  color: var(--text);
}

.poll-pct { font-weight: 600; color: var(--subtext); }
.poll-result.mine .poll-pct { color: var(--accent); }

.poll-meta {
  font-size: 0.75rem;
  color: var(--subtext);
  margin-top: 0.4rem;
}

.poll-input {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.poll-input:focus { border-color: var(--accent); background: var(--outline-fill); }

.poll-duration {
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

/* ── Comments ── */
.comments-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
}

.comment-form textarea {
  width: 100%;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.comment-form textarea:focus { border-color: var(--accent); background: var(--outline-fill); }

.comment {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 600;
}

.comment-author:hover { color: var(--accent); }

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-time { color: var(--subtext); font-size: 0.75rem; }

.comment-body {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 32px;
}

.comment-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.3rem;
  padding-left: 32px;
}

.comment-reply-btn,
.comment-delete-btn {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.comment-reply-btn:hover { color: var(--accent); }
.comment-delete-btn:hover { color: #e0245e; }

.comment-reply-form {
  margin: 0.5rem 0 0.5rem 32px;
}

.comment-reply-form textarea {
  width: 100%;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 50px;
  outline: none;
}

.comment-children {
  margin-left: 32px;
}

/* ── Color pickers ── */
.color-picker {
  width: 48px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--outline);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

/* ── Buttons (small) ── */
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

.back-link {
  display: inline-block;
  color: var(--subtext);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

.post-card-broken {
  border-style: dashed;
  border-color: var(--outline);
  opacity: 0.75;
}

/* ── Banner cropper (settings) ── */
.banner-cropper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.banner-preview-frame {
  position: relative;
  width: 100%;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--outline);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.banner-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: grab;
}

.banner-preview-frame img:active { cursor: grabbing; }

.banner-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}

.banner-placeholder-text {
  position: absolute;
  color: var(--subtext);
  font-size: 0.85rem;
}

.banner-cropper-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.banner-position-control {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.banner-position-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.banner-position-control input[type=range] {
  accent-color: var(--accent);
  width: 100%;
  cursor: pointer;
}

/* ── Theme welcome overlay (premium switch) ── */
.theme-welcome {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 2000;
  pointer-events: none;
  background: rgba(0, 0, 0, 0);
  animation: welcomeFade 2s cubic-bezier(.4, 0, .2, 1) forwards;
}

.theme-welcome img {
  width: clamp(220px, 28vw, 300px);
  height: clamp(220px, 28vw, 300px);
  max-width: 500px;
  max-height: 500px;
  opacity: 0;
  transform: scale(0.7);
  filter: drop-shadow(0 0 50px #C9A227);
  animation: welcomeLogo 2s cubic-bezier(.4, 0, .2, 1) forwards;
}

.theme-welcome-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #C9A227;
  text-shadow: 0 0 30px rgba(201, 162, 39, 0.6);
  opacity: 0;
  animation: welcomeText 2s cubic-bezier(.4, 0, .2, 1) forwards;
}

@keyframes welcomeFade {
  0%   { background: rgba(0, 0, 0, 0); }
  15%  { background: rgba(0, 0, 0, 0.7); }
  70%  { background: rgba(0, 0, 0, 0.7); }
  100% { background: rgba(0, 0, 0, 0); visibility: hidden; }
}

@keyframes welcomeLogo {
  0%   { opacity: 0; transform: scale(0.65) rotate(-4deg); }
  18%  { opacity: 1; transform: scale(1) rotate(0deg); }
  70%  { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.08); }
}

@keyframes welcomeText {
  0%   { opacity: 0; transform: translateY(8px); }
  25%  { opacity: 0; transform: translateY(8px); }
  40%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .theme-welcome,
  .theme-welcome img,
  .theme-welcome-text {
    animation-duration: 0.4s;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--subtext); }

/* ════════════════════════════════════════
   EMBEDDED KEYS
   ════════════════════════════════════════ */

.embedded-key {
  font-family: monospace;
  font-size: 0.88em;
  border-radius: 4px;
  padding: 0.1em 0.35em;
  cursor: default;
  border: 1px solid transparent;
  position: relative;
}
.embedded-key-valid {
  color: #22c55e;
  border-color: #22c55e55;
  background: #22c55e11;
}
.embedded-key-expired {
  color: #e0245e;
  border-color: #e0245e55;
  background: #e0245e11;
  text-decoration: line-through;
  text-decoration-color: #e0245e88;
}
.embedded-key-hidden {
  color: #f59e0b;
  border-color: #f59e0b55;
  background: #f59e0b11;
}
.embedded-key-unknown,
.embedded-key-unresolved {
  color: var(--subtext);
  border-color: var(--border);
  background: var(--outline-fill);
}

/* Key hover popup */
.key-popup {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 9000;
}
.key-popup-tier {
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.key-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.2rem;
  color: var(--subtext);
}
.key-popup-row strong { color: var(--text); }
.key-popup-status {
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.key-popup-status.valid      { color: #22c55e; }
.key-popup-status.expired    { color: #e0245e; }
.key-popup-status.hidden-key { color: #f59e0b; }
.key-popup-toggle {
  margin-top: 0.5rem;
  width: 100%;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
}

/* Recovered key banner */
.recovered-key-banner {
  margin: 1rem auto;
  max-width: 640px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.recovered-key-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.recovered-key-code {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  word-break: break-all;
  user-select: all;
}

/* ════════════════════════════════════════
   STATS PAGE
   ════════════════════════════════════════ */

.stats-page-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.stats-totals {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stats-total-item {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}
.stats-total-num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}
.stats-total-label {
  font-size: 0.8rem;
  color: var(--subtext);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.6rem;
}
.stats-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Hall of fame */
.hof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.hof-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 0.75rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s;
}
.hof-card:hover { border-color: var(--accent); }
.hof-icon { font-size: 1.4rem; }
.hof-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}
.hof-avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}
.hof-name {
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.hof-stat { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.hof-label { font-size: 0.72rem; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.04em; }

/* Activity chart */
.chart-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.chart-tab {
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--subtext);
  transition: border-color 0.15s, color 0.15s;
}
.chart-tab:hover { color: var(--text); border-color: var(--accent); }
.chart-tab.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.activity-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.chart-bar-wrap {
  flex: 1;
  min-width: 14px;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 3px;
}
.chart-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}
.chart-label {
  font-size: 0.58rem;
  color: var(--subtext);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  max-width: 48px;
}
.chart-empty { font-size: 0.88rem; color: var(--subtext); padding: 1rem 0; text-align: center; }

/* Rankings */
.stats-rankings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.stats-rank-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color 0.1s;
}
.rank-row:last-child { border-bottom: none; }
.rank-row:hover .rank-name { color: var(--accent); }
.rank-row-first .rank-num { color: var(--accent); font-weight: 700; }
.rank-num {
  font-size: 0.78rem;
  color: var(--subtext);
  min-width: 24px;
  text-align: right;
}
.rank-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.rank-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 0.88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub  { font-size: 0.75rem; color: var(--subtext); }
.rank-count { text-align: right; flex-shrink: 0; }
.rank-count strong { display: block; font-size: 0.92rem; color: var(--accent); }
.rank-count span   { font-size: 0.7rem; color: var(--subtext); }

/* ════════════════════════════════════════
   AVATAR CROPPER
   ════════════════════════════════════════ */

.avatar-cropper-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.35rem;
  align-items: flex-start;
}
#avatar-crop-canvas {
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: grab;
  display: block;
  touch-action: none;
}
#avatar-crop-canvas:active { cursor: grabbing; }
.avatar-crop-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 200px;
}
.avatar-crop-controls input[type="range"] { flex: 1; }
.avatar-crop-label { font-size: 0.8rem; color: var(--subtext); white-space: nowrap; }
.avatar-crop-hint  { font-size: 0.75rem; color: var(--subtext); margin: 0.1rem 0 0; }

/* ════════════════════════════════════════
   PROFILE ANIMATIONS
   ════════════════════════════════════════ */

.profile-banner-area { position: relative; }

.profile-anim-img {
  pointer-events: none;
  object-fit: contain;
}

/* Keyframes */
@keyframes panim-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes panim-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes panim-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.18); opacity: 0.72; }
}
@keyframes panim-bounce {
  0%, 100% { transform: translateY(0);     animation-timing-function: cubic-bezier(0.8,0,1,1); }
  50%       { transform: translateY(-14px); animation-timing-function: cubic-bezier(0,0,0.2,1); }
}
@keyframes panim-glitch {
  0%, 88%, 100% { transform: translate(0,0); filter: none; }
  90% { transform: translate(-3px,  2px); filter: hue-rotate(90deg) brightness(1.4); }
  92% { transform: translate( 3px, -2px); filter: hue-rotate(-90deg); }
  94% { transform: translate(-2px,  3px); filter: brightness(1.7); }
  96% { transform: translate( 2px, -1px); filter: hue-rotate(180deg); }
  98% { transform: translate( 0,    2px); filter: none; }
}
@keyframes panim-wiggle {
  0%, 100% { transform: rotate(0deg);  }
  15%       { transform: rotate(-10deg); }
  30%       { transform: rotate( 10deg); }
  45%       { transform: rotate( -7deg); }
  60%       { transform: rotate(  7deg); }
  75%       { transform: rotate( -3deg); }
  90%       { transform: rotate(  3deg); }
}

.profile-anim-float  { animation: panim-float  3s   ease-in-out infinite; }
.profile-anim-spin   { animation: panim-spin   10s  linear      infinite; }
.profile-anim-pulse  { animation: panim-pulse  2.2s ease-in-out infinite; }
.profile-anim-bounce { animation: panim-bounce 1.3s             infinite; }
.profile-anim-glitch { animation: panim-glitch 5s   linear      infinite; }
.profile-anim-wiggle { animation: panim-wiggle 2.8s ease-in-out infinite; }

/* Positions */
.profile-anim-pos-banner-corner {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  z-index: 1;
}
.profile-anim-pos-beside-name {
  display: inline-block;
  width: 26px;
  height: 26px;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.profile-anim-pos-below-avatar {
  display: block;
  width: 44px;
  height: 44px;
  margin-top: 0.4rem;
}
.profile-anim-pos-card-corner {
  position: absolute;
  top: 8px;
  right: 1rem;
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.25));
}
.profile-anim-pos-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  z-index: 200;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}

/* Animation picker in settings */
.anim-picker-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.anim-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 60px;
}
.anim-option:hover { border-color: var(--accent); }
.anim-option.selected { border-color: var(--accent); background: var(--outline-fill); }
.anim-option input[type="radio"] { display: none; }
.anim-preview-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  pointer-events: none;
}
.anim-none-box {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--subtext);
}
.anim-option-label {
  font-size: 0.75rem;
  color: var(--subtext);
  text-align: center;
}
.anim-pos-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.anim-pos-option {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  cursor: pointer;
}

/* ════════════════════════════════════════
   BETA FEATURES
   ════════════════════════════════════════ */

/* ── Wide layout ── */
@media (min-width: 900px) {
  body.beta-wide-layout .container { max-width: 860px; }
}

/* ── Glassmorphism ── */
body.beta-glass .post-card {
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
body.beta-glass.theme-dark .post-card {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.13);
}
body.beta-glass:not(.theme-dark) .post-card {
  background: rgba(255,255,255,0.55);
  border-color: rgba(0,0,0,0.09);
}

/* ── No avatars ── */
body.beta-no-avatars .post-avatar,
body.beta-no-avatars .post-card .avatar-placeholder { display: none; }
body.beta-no-avatars .post-author { gap: 0; }

/* ── Bubble posts ── */
body.beta-bubble-posts .post-card {
  border-radius: 18px 18px 18px 4px;
  border-left: 3px solid var(--accent);
}

/* ── Large text ── */
body.beta-large-text { font-size: 1.1rem; }
body.beta-large-text .post-content { font-size: 1.05rem; line-height: 1.65; }

/* ── Rainbow borders ── */
body.beta-rainbow .post-card:nth-child(6n+1) { border-color: hsl(  0, 55%, 65%); }
body.beta-rainbow .post-card:nth-child(6n+2) { border-color: hsl( 38, 65%, 60%); }
body.beta-rainbow .post-card:nth-child(6n+3) { border-color: hsl(100, 48%, 55%); }
body.beta-rainbow .post-card:nth-child(6n+4) { border-color: hsl(200, 58%, 60%); }
body.beta-rainbow .post-card:nth-child(6n+5) { border-color: hsl(270, 52%, 65%); }
body.beta-rainbow .post-card:nth-child(6n)   { border-color: hsl(320, 58%, 65%); }
body.beta-rainbow .post-card:hover { border-color: var(--accent); }

/* ── Keyboard shortcuts: focused card highlight ── */
body.beta-keyboard .post-card.kb-focused {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Collapse long posts ── */
.post-content.collapsed {
  max-height: 7.5em;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
}
.btn-show-more {
  display: none;
  font-size: 0.82rem;
  color: var(--link);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.15rem 0;
  margin-top: 0.2rem;
}
body.beta-collapse .btn-show-more { display: block; }

/* ── Online dot ── */
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  margin-left: 0.35rem;
  vertical-align: middle;
  box-shadow: 0 0 5px #22c55e99;
  flex-shrink: 0;
}
body:not(.beta-show-online) .online-dot { display: none; }

/* ── Word count ── */
.compose-word-count {
  font-size: 0.75rem;
  color: var(--subtext);
  margin-left: 0.4rem;
  opacity: 0.85;
}

/* ── Confetti particles ── */
@keyframes confetti-fly {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--cx), var(--cy)) scale(0) rotate(var(--cr)); opacity: 0; }
}
.confetti-piece {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fly 0.65s ease-out forwards;
}

/* ═══════════════════════════════════════════════
   Embedded hardware chips (cpu: / gpu:)
═══════════════════════════════════════════════ */
.embedded-hw {
  display: inline-block;
  padding: 0.1em 0.42em;
  border-radius: 5px;
  font-size: 0.82em;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.embedded-cpu {
  color: #60a5fa;
  background: #60a5fa12;
  border-color: #60a5fa44;
}
.embedded-cpu:hover {
  background: #60a5fa22;
  border-color: #60a5fa88;
}
.embedded-gpu {
  color: #a78bfa;
  background: #a78bfa12;
  border-color: #a78bfa44;
}
.embedded-gpu:hover {
  background: #a78bfa22;
  border-color: #a78bfa88;
}

/* ── Hardware popup ── */
.hw-popup {
  position: absolute;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  width: 310px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.24);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.hw-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.hw-popup-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.25;
}
.hw-popup-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15em 0.55em;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.hw-popup-badge.cpu { background: #60a5fa22; color: #60a5fa; }
.hw-popup-badge.gpu { background: #a78bfa22; color: #a78bfa; }
.hw-popup-arch {
  font-size: 0.75rem;
  color: var(--subtext);
}
.hw-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem 0.75rem;
  margin-top: 0.1rem;
}
.hw-popup-row {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.hw-popup-label {
  font-size: 0.68rem;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hw-popup-val {
  font-size: 0.83rem;
  color: var(--text);
  font-weight: 600;
}
.hw-popup-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.1rem 0;
}
.hw-popup-msrp {
  font-size: 0.75rem;
  color: var(--subtext);
}
.hw-popup-unknown {
  font-size: 0.82rem;
  color: var(--subtext);
  font-style: italic;
}

/* ── Hardware autocomplete dropdown ── */
.hw-ac-dropdown {
  position: fixed;
  z-index: 9998;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  width: 340px;
  max-height: 280px;
  overflow-y: auto;
}
.hw-ac-item {
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  align-items: center;
}
.hw-ac-item:last-child { border-bottom: none; }
.hw-ac-item.selected, .hw-ac-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.hw-ac-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.hw-ac-id {
  font-size: 0.72rem;
  color: var(--subtext);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.hw-ac-sub {
  font-size: 0.72rem;
  color: var(--subtext);
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════
   Embedded setting chips
═══════════════════════════════════════════════ */
.embedded-setting {
  display: inline-block;
  padding: 0.1em 0.45em;
  border-radius: 5px;
  font-size: 0.82em;
  font-family: 'JetBrains Mono', monospace;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.embedded-setting:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: var(--accent);
}

/* ── Setting popup ── */
.setting-popup {
  position: absolute;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  width: 280px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.setting-popup-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.setting-popup-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.setting-popup-tab {
  font-size: 0.75rem;
  color: var(--subtext);
}
.setting-popup-desc {
  font-size: 0.82rem;
  color: var(--subtext);
  line-height: 1.45;
}
.setting-popup-open {
  margin-top: 0.25rem;
  text-align: center;
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  display: block;
}
.setting-popup-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.1rem;
  gap: 0.5rem;
}
.setting-popup-state {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}
.setting-popup-state.on  { background: #22c55e22; color: #22c55e; }
.setting-popup-state.off { background: color-mix(in srgb, var(--subtext) 15%, transparent); color: var(--subtext); }
.setting-popup-toggle-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.setting-popup-toggle-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ── Setting autocomplete dropdown ── */
.setting-ac-dropdown {
  position: fixed;
  z-index: 9998;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  width: 300px;
  overflow: hidden;
}
.setting-ac-item {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.5rem;
}
.setting-ac-item:last-child { border-bottom: none; }
.setting-ac-item.selected, .setting-ac-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.setting-ac-label {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  grid-column: 1;
  grid-row: 1;
}
.setting-ac-tab {
  font-size: 0.72rem;
  color: var(--subtext);
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}
.setting-ac-desc {
  font-size: 0.75rem;
  color: var(--subtext);
  grid-column: 1 / -1;
  grid-row: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Custom emoji in posts ── */
.post-emoji {
  width: 1.5em;
  height: 1.5em;
  vertical-align: -0.35em;
  display: inline-block;
  object-fit: contain;
}
.post-emoji-only {
  font-size: 2.5rem;
  line-height: 1.3;
  display: block;
}
.post-emoji-only .post-emoji {
  width: 2.5rem;
  height: 2.5rem;
  vertical-align: -0.4rem;
}

/* ── Emoji autocomplete dropdown ── */
.emoji-ac-dropdown {
  position: absolute;
  z-index: 1200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  min-width: 160px;
  overflow: hidden;
}
.emoji-ac-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text);
}
.emoji-ac-item:last-child { border-bottom: none; }
.emoji-ac-item.selected, .emoji-ac-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.emoji-ac-preview { width: 28px; height: 28px; object-fit: contain; }

/* ── Setting highlight animation (settings page) ── */
@keyframes setting-flash {
  0%   { background: color-mix(in srgb, var(--accent) 30%, transparent); outline: 2px solid var(--accent); }
  70%  { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: 2px solid var(--accent); }
  100% { background: transparent; outline: 2px solid transparent; }
}
.setting-highlight {
  border-radius: 8px;
  animation: setting-flash 2.5s ease-out forwards;
}

/* ═══════════════════════════════════════════════
   Profile Style settings — style chips
═══════════════════════════════════════════════ */
.style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.4rem;
}
.style-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--subtext);
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.style-chip:hover { border-color: var(--accent); color: var(--text); }
.style-chip.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  font-weight: 600;
}

/* ── Advanced expand (details/summary) ── */
.adv-expand {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.adv-expand-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  list-style: none;
  user-select: none;
}
.adv-expand-toggle::-webkit-details-marker { display: none; }
.adv-expand-toggle::before { content: '▶'; font-size: 0.65rem; color: var(--subtext); transition: transform 0.2s; }
details.adv-expand[open] .adv-expand-toggle::before { transform: rotate(90deg); }
.adv-expand-body {
  padding: 0.75rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ── Avatar shape classes (global) ── */
.avatar-sq        { border-radius: 6px !important; }
.avatar-squircle  { border-radius: 22% !important; }

/* ── Profile stat visibility classes ── */
.profile-stat-followers, .profile-stat-following, .profile-stat-posts { }

/* ── Banner expand ── */
.profile-banner { transition: height 0.3s ease; }
.profile-banner.banner-expanded { height: 360px; }
.banner-expand-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.7rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  line-height: 1.6;
  transition: background 0.15s;
}
.banner-expand-btn:hover { background: rgba(0,0,0,0.65); }

/* ── New comment flash ── */
@keyframes comment-appear {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.comment-new { animation: comment-appear 0.3s ease; }

/* ── Notification bell (nav) ── */
.nav-notif-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Notifications page ── */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.notif-unseen { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.notif-item:hover { background: var(--outline-fill); }
.notif-icon {
  font-size: 1rem;
  min-width: 1.5rem;
  text-align: center;
  margin-top: 0.1rem;
  color: var(--accent);
}
.notif-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.notif-text { font-size: 0.88rem; color: var(--text); line-height: 1.4; }
.notif-actor { font-weight: 700; color: var(--text); }
.notif-actor:hover { color: var(--accent); }
.notif-snippet {
  font-size: 0.78rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
.notif-snippet:hover { color: var(--accent); }
.notif-view-link { font-size: 0.78rem; color: var(--accent); }
.notif-time {
  font-size: 0.75rem;
  color: var(--subtext);
  white-space: nowrap;
  margin-top: 0.15rem;
}

/* ── Beta group count badge ── */
.beta-group-count {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 1px 7px;
  border-radius: 8px;
}

/* ── Beta: monochrome mode ── */
.beta-monochrome .container { filter: saturate(0.15); }

/* ── Beta: post fade-in ── */
@keyframes post-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.beta-fadein .post-card {
  animation: post-fade-in 0.4s ease both;
}

/* ── Beta: focus mode ── */
.beta-focus .nav-search { display: none; }
.beta-focus .nav-links a[href="/friends"],
.beta-focus .nav-links a[href="/users"],
.beta-focus .nav-links a[href="/stats"],
.beta-focus .nav-links a[href="/scheduled"],
.beta-focus .nav-links a[href="/notifications"],
.beta-focus .nav-links a[href="/settings"] { display: none; }

/* ── Beta: hide like counts ── */
.beta-hide-likes .btn-like .like-count { display: none; }

/* ── Beta: sticky compose ── */
.beta-sticky-compose .compose-box {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: var(--bg);
  box-shadow: 0 4px 16px var(--outline);
}

/* ══════════════════════════════════════════
   Messenger
   ══════════════════════════════════════════ */

/* Nav message button */
.nav-icon-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: inherit;
}
.nav-icon-btn:hover { color: var(--accent); }

/* Conv list dropdown */
.conv-list-panel {
  position: fixed;
  top: 52px;
  width: 320px;
  max-height: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conv-list-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.conv-list-body {
  overflow-y: auto;
  flex: 1;
}
.conv-list-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--subtext);
  font-size: 0.85rem;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: var(--bg); }
.conv-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.conv-item-avatar-ph {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.conv-item-info { flex: 1; min-width: 0; }
.conv-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item-preview {
  font-size: 0.78rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item-unread {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Chat windows container */
#chat-windows-root {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1500;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  gap: 0;
}

/* Individual chat window */
.chat-window {
  width: 304px;
  height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.15);
  pointer-events: all;
  position: fixed;
  bottom: 0;
  transition: height 0.18s ease;
  overflow: hidden;
}
.chat-window.minimized { height: 46px; }

/* Window header */
.chat-win-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}
.chat-win-header:active { cursor: grabbing; }
.chat-win-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-win-avatar-ph {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.chat-win-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  box-shadow: 0 0 4px #22c55e88;
}
.chat-win-info { flex: 1; min-width: 0; }
.chat-win-name {
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.chat-win-handle {
  font-size: 0.72rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-win-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.chat-win-controls button {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.chat-win-controls button:hover { background: var(--bg); color: var(--text); }

/* Messages area */
.chat-win-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.chat-win-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scroll-behavior: smooth;
}
.chat-win-messages::-webkit-scrollbar { width: 4px; }
.chat-win-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Message bubbles */
.chat-msg {
  max-width: 72%;
  padding: 6px 11px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
  animation: chat-msg-appear 0.15s ease;
}
@keyframes chat-msg-appear {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.mine {
  background: var(--chat-mine-bg, var(--accent));
  color: var(--chat-mine-text, var(--accent-text));
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.theirs {
  background: var(--chat-their-bg, var(--bg));
  border: 1px solid var(--border);
  color: var(--chat-their-text, var(--text));
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg-time {
  font-size: 0.65rem;
  color: var(--subtext);
  margin-top: 1px;
}
.chat-msg.mine .chat-msg-time { text-align: right; }

/* Input row */
.chat-win-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.chat-win-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.83rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.chat-win-input:focus { border-color: var(--accent); }
.chat-win-input::placeholder { color: var(--subtext); }
.chat-win-send {
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Chat window appear / disappear animations */
@keyframes chat-win-appear {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes chat-win-disappear {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(18px); }
}
.chat-window { animation: chat-win-appear 0.66s cubic-bezier(0.34, 1.56, 0.64, 1); }
.chat-window.closing { animation: chat-win-disappear 0.57s ease forwards; }

/* Settings share row */
.settings-share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Settings import modal */
.settings-import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fade-in 0.15s ease;
}
.settings-import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  width: 380px;
  max-width: 94vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
}
.settings-import-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.settings-import-subtitle {
  font-size: 0.8rem;
  color: var(--subtext);
  margin: 0 0 1rem;
}
.settings-import-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}
.settings-import-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
}
.settings-import-key {
  flex: 1;
  color: var(--subtext);
}
.settings-import-val {
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-import-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-import-actions {
  display: flex;
  gap: 8px;
}
.settings-import-result {
  margin-top: 0.75rem;
  font-size: 0.83rem;
}

/* ── Chat: image attach + preview ── */
.chat-win-attach {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.chat-win-attach:hover { color: var(--accent); }

.chat-win-img-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 0;
  flex-shrink: 0;
}
.chat-win-preview-img {
  max-height: 80px;
  max-width: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.chat-win-img-clear {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.chat-win-img-clear:hover { color: var(--text); background: var(--bg); }

/* ── Chat: message images ── */
.chat-msg-img {
  display: block;
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  cursor: pointer;
  object-fit: cover;
  margin-top: 4px;
  transition: opacity 0.15s;
}
.chat-msg-img:hover { opacity: 0.88; }
.chat-msg.img-only {
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

/* ── Chat: rich text formatting ── */
.chat-msg a { color: var(--link); text-decoration: underline; }
.chat-msg .post-mention { color: var(--accent); text-decoration: none; font-weight: 600; }
.chat-msg .post-mention:hover { text-decoration: underline; }
.chat-msg code, .chat-msg .post-inline-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.82em;
  font-family: monospace;
}
.chat-msg.mine code, .chat-msg.mine .post-inline-code {
  background: rgba(0,0,0,0.15);
  border-color: rgba(0,0,0,0.2);
}
.chat-msg .post-spoiler {
  background: currentColor;
  border-radius: 3px;
  cursor: pointer;
}
.chat-msg .post-spoiler.revealed { background: transparent; }
.chat-msg .post-emoji { width: 1.3em; height: 1.3em; vertical-align: -0.3em; }

/* Chat bubble color gear button */
.chat-win-gear {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  margin-right: 2px;
}
.chat-win-gear:hover { color: var(--text); background: var(--bg); }

/* Color picker panel inside chat window */
.chat-win-color-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78rem;
}
.chat-win-color-panel.open { display: flex; }
.chat-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-color-row label {
  flex: 1;
  color: var(--subtext);
  font-size: 0.78rem;
}
.chat-color-row input[type="color"] {
  width: 28px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px;
  background: var(--bg);
  cursor: pointer;
}
.chat-color-reset {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.chat-color-reset:hover { color: var(--text); background: var(--bg); }

/* ── Message toast notifications ── */
.msg-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 300px;
}
.msg-toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 38px 14px 13px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  pointer-events: all;
  position: relative;
  overflow: hidden;
  animation: toastIn 0.42s cubic-bezier(0.34, 1.48, 0.64, 1) both;
  transition: box-shadow 0.15s;
}
.msg-toast:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14); }
.msg-toast.out   { animation: toastOut 0.22s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(64px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); max-height: 100px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(48px); max-height: 0;   margin-bottom: -10px; }
}

.msg-toast-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.msg-toast-avatar-ph {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}
.msg-toast-body    { flex: 1; min-width: 0; }
.msg-toast-label   { font-size: 0.67rem; font-weight: 600; color: var(--subtext); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1px; }
.msg-toast-name    { font-weight: 700; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-toast-preview { font-size: 0.8rem; color: var(--subtext); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.msg-toast-x {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 6px;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.msg-toast-x:hover { opacity: 1; background: var(--bg); }

.msg-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 0 16px;
  animation: toastBarDrain 5s linear forwards;
}
@keyframes toastBarDrain {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ═══════════════════════════════════════════════
   Status / performance heatmap page
═══════════════════════════════════════════════ */
.status-page { max-width: 860px; }

.status-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.status-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.3rem; }

.status-uptime-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}
.status-uptime-badge.good { background: #22c55e18; color: #22c55e; }
.status-uptime-badge.warn { background: #fbbf2418; color: #d97706; }
.status-uptime-badge.bad  { background: #ef444418; color: #ef4444; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

.status-summary-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.status-stat { display: flex; flex-direction: column; align-items: flex-end; }
.status-stat-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.status-stat-val.status-val-error { color: #ef4444; }
.status-stat-label {
  font-size: 0.68rem;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* Controls */
.status-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}
.status-tabs-group { display: flex; gap: 0.2rem; }
.status-tab, .status-cat-tab {
  display: inline-block;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--subtext);
  border: 1px solid var(--border);
  transition: background 0.12s, color 0.12s;
}
.status-tab.active, .status-cat-tab.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
.status-tab:hover:not(.active), .status-cat-tab:hover:not(.active) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}

/* Grid header (quarter labels) */
.status-grid-header {
  display: grid;
  grid-template-columns: 72px repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 2px;
}
.status-grid-timecol { /* spacer */ }
.status-grid-qlabel {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--subtext);
  line-height: 1.3;
}
.status-grid-qlabel span { font-weight: 400; font-size: 0.6rem; }

/* Grid rows */
.status-grid { display: flex; flex-direction: column; gap: 3px; margin-bottom: 1rem; }
.status-grid-row {
  display: grid;
  grid-template-columns: 72px repeat(4, 1fr);
  gap: 3px;
  align-items: center;
}
.status-grid-timelabel {
  font-size: 0.7rem;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 4px;
}

/* Heat cells */
.status-cell {
  height: 22px;
  border-radius: 4px;
  transition: opacity 0.1s, transform 0.1s;
  cursor: default;
}
.status-cell:hover { opacity: 0.75; transform: scaleY(1.15); }
.status-empty  { background: color-mix(in srgb, var(--border) 70%, transparent); }
.status-green  { background: #22c55e; }
.status-lime   { background: #86efac; }
.status-yellow { background: #fbbf24; }
.status-orange { background: #f97316; }
.status-red    { background: #ef4444; }

/* Legend */
.status-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--subtext);
  margin-bottom: 2rem;
}
.status-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.status-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Category breakdown */
.status-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text);
}
.status-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.status-breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
.status-breakdown-name {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.status-breakdown-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--subtext);
  margin-bottom: 0.5rem;
}
.status-bd-err { color: #ef4444; font-weight: 600; }
.status-breakdown-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.status-bd-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.status-bd-bar-fill.green  { background: #22c55e; }
.status-bd-bar-fill.lime   { background: #86efac; }
.status-bd-bar-fill.yellow { background: #fbbf24; }
.status-bd-bar-fill.orange { background: #f97316; }
.status-bd-bar-fill.red    { background: #ef4444; }

/* ── chat: and page: embeds ────────────────────────────────────────────── */
.embedded-chat {
  display: inline-block;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: monospace;
  font-size: 0.87em;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.embedded-chat:hover { background: rgba(34, 197, 94, 0.22); }

.embedded-page {
  display: inline-block;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: monospace;
  font-size: 0.87em;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.embedded-page:hover { background: rgba(251, 191, 36, 0.22); }

/* ── Chatroom list ──────────────────────────────────────────────────────── */
.chatrooms-list { display: flex; flex-direction: column; gap: 0.75rem; }
.chatroom-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.chatroom-card-info { flex: 1; min-width: 0; }
.chatroom-card-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.15rem; }
.chatroom-card-desc { color: var(--subtext); font-size: 0.875rem; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatroom-card-meta { color: var(--subtext); font-size: 0.8rem; }

/* ── Chatroom page ──────────────────────────────────────────────────────── */
.chatroom-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 0.75rem;
}
.chatroom-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}
.chatroom-header-info { flex: 1; min-width: 0; }
.chatroom-header-name { font-weight: 700; font-size: 1.1rem; }
.chatroom-header-meta { font-size: 0.82rem; color: var(--subtext); }
.chatroom-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.chatroom-empty { color: var(--subtext); text-align: center; padding: 2rem 0; font-size: 0.9rem; }
.chatroom-msg {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  transition: background 0.1s;
}
.chatroom-msg:hover { background: var(--surface); }
.chatroom-msg-new { animation: comment-appear 0.2s ease; }
.chatroom-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}
.chatroom-msg-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 2px;
}
.chatroom-msg-body { flex: 1; min-width: 0; }
.chatroom-msg-header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.1rem; flex-wrap: wrap; }
.chatroom-msg-name { font-weight: 600; font-size: 0.88rem; color: var(--text); text-decoration: none; }
.chatroom-msg-name:hover { text-decoration: underline; }
.chatroom-msg-time { font-size: 0.75rem; color: var(--subtext); }
.chatroom-msg-content { font-size: 0.93rem; word-break: break-word; line-height: 1.45; }
.chatroom-input-row {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  align-items: flex-end;
}
.chatroom-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.93rem;
  font-family: var(--font);
  resize: none;
  line-height: 1.4;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
}
.chatroom-input:focus { outline: none; border-color: var(--accent); }

/* ── Comment images ─────────────────────────────────────────────────────── */
.comment-img-wrap { margin-top: 0.4rem; }
.comment-img {
  max-width: 280px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  border: 1px solid var(--border);
}
.comment-paste-preview { margin-top: 0.4rem; }
.comment-paste-preview img { max-height: 100px; max-width: 160px; border-radius: 6px; }

/* ── Chatroom image messages ─────────────────────────────────────────────── */
.chatroom-msg-img-wrap { margin-top: 0.35rem; }
.chatroom-msg-img {
  max-width: 280px;
  max-height: 220px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  border: 1px solid var(--border);
}
.chatroom-paste-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}
.chatroom-paste-img { max-height: 80px; max-width: 140px; border-radius: 6px; }

/* ── Chatroom emoji picker ───────────────────────────────────────────────── */
.chatroom-emoji-btn { font-size: 1.1rem; padding: 0.3rem 0.5rem; }
.chatroom-emoji-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  display: flex;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 200;
}
.chatroom-emoji-item {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
}
.chatroom-emoji-item:hover { background: var(--border); border-color: var(--accent); }
.chatroom-emoji-item img { width: 32px; height: 32px; object-fit: contain; display: block; }

/* ── Tux status card ─────────────────────────────────────────────────────── */
.tux-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.tux-status-left { flex: 1; min-width: 180px; }
.tux-status-models { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.tux-model-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--subtext);
}
.tux-model-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb, 99,102,241), 0.1);
}

/* ── Tux typing indicator ────────────────────────────────────────────────── */
.tux-typing-indicator { opacity: 0.75; }
.tux-thinking-dots { display: flex; gap: 4px; align-items: center; height: 1.2em; }
.tux-thinking-dots span {
  display: block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: tux-bounce 1.2s ease-in-out infinite;
}
.tux-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.tux-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tux-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   ROOMS — shared components
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Room list ─────────────────────────────────────────────────────────────── */
.rooms-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.room-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: border-color 0.15s;
}
.room-card:hover { border-color: var(--accent); }
.room-card-locked { opacity: 0.6; }
.room-card-icon {
  width: 96px; height: 96px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; flex-shrink: 0;
}
.room-card-info { flex: 1; min-width: 0; }
.room-card-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.1rem; }
.room-card-desc { color: var(--subtext); font-size: 0.85rem; margin-bottom: 0.2rem; }
.room-card-meta { color: var(--subtext); font-size: 0.78rem; }
.room-card-action { flex-shrink: 0; }
.room-badge-locked {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.2rem 0.75rem;
  font-size: 0.78rem; color: var(--subtext);
}

/* ── Room locked page ──────────────────────────────────────────────────────── */
.room-locked-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem 2rem;
  text-align: center;
}
.room-locked-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.room-locked-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 0.5rem; }
.room-locked-desc { color: var(--subtext); font-size: 0.92rem; margin-bottom: 0.75rem; }
.room-locked-badge {
  display: inline-block; background: #ef444420;
  color: #ef4444; border: 1px solid #ef444440;
  border-radius: 20px; padding: 0.25rem 0.9rem; font-size: 0.82rem; font-weight: 600;
}

/* ── Room page header ─────────────────────────────────────────────────────── */
.room-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 0 0.85rem; border-bottom: 2px solid var(--room-color, var(--accent));
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.room-header-left { display: flex; align-items: center; gap: 0.75rem; }
.room-header-icon { font-size: 1.8rem; line-height: 1; }
.room-header-name { font-size: 1.3rem; font-weight: 800; margin: 0; color: var(--room-color, var(--accent)); }
.room-header-meta { font-size: 0.82rem; color: var(--subtext); margin-top: 0.15rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.room-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Tech room ─────────────────────────────────────────────────────────────── */
.tech-my-rig {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 1rem; margin-bottom: 0.75rem;
  font-size: 0.88rem;
}
.tech-rig-label { color: var(--subtext); font-size: 0.8rem; }
.tech-rig-name { font-weight: 700; }
.tech-chip {
  display: inline-block; background: var(--bg);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 0.15rem 0.55rem; font-size: 0.74rem; color: var(--subtext);
  font-family: monospace; white-space: nowrap;
}
.tech-post-wrapper { position: relative; }
.tech-post-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.tech-setup-preview {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 0.75rem;
}

/* ── Tech setup select ─────────────────────────────────────────────────────── */
.form-select {
  width: 100%; padding: 0.55rem 0.85rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 0.9rem;
}
.form-select:focus { outline: none; border-color: var(--accent); }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text); }

/* ── Politics room layout ──────────────────────────────────────────────────── */
.politics-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  align-items: start;
}
@media (max-width: 840px) {
  .politics-layout { grid-template-columns: 1fr; }
  .politics-chat-panel { order: -1; max-height: 380px; }
}

/* ── Politics chat panel ───────────────────────────────────────────────────── */
.politics-chat-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; display: flex; flex-direction: column;
  height: calc(100vh - 80px); max-height: 780px;
  position: sticky; top: 68px; overflow: hidden;
}
.politics-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.politics-chat-messages {
  flex: 1; overflow-y: auto; padding: 0.5rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}

/* ── Politics badges ───────────────────────────────────────────────────────── */
.politics-badge {
  display: inline-flex; align-items: center;
  background: color-mix(in srgb, #8b5cf6 12%, var(--surface));
  border: 1px solid #8b5cf620; border-radius: 20px;
  padding: 0.15rem 0.55rem; font-size: 0.73rem; font-weight: 600;
  color: #8b5cf6; white-space: nowrap;
}
.party-badge { /* color/bg set inline */ }
.compass-badge { color: var(--subtext); background: var(--bg); border-color: var(--border); }
.politics-post-badges { display: flex; gap: 0.35rem; margin-bottom: 0.35rem; flex-wrap: wrap; }
.politics-my-badge {
  display: inline-flex; align-items: center;
  border: 1px solid; border-radius: 20px;
  padding: 0.12rem 0.55rem; font-size: 0.72rem; font-weight: 600;
}

/* ── Politics chat name ─────────────────────────────────────────────────────  */
.politics-chat-name { font-weight: 600; font-size: 0.88rem; text-decoration: none; cursor: pointer; }
.politics-chat-name:hover { text-decoration: underline; }
.politics-chat-abbrev {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  border: 1px solid currentColor; border-radius: 3px;
  padding: 0 3px; margin-left: 0.3rem; opacity: 0.85;
}

/* ── Politics user sidebar ─────────────────────────────────────────────────── */
.politics-user-sidebar {
  position: fixed; right: 0; top: 0; height: 100vh; width: 320px;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 500; flex-direction: column;
  overflow-y: auto; box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  animation: sidebar-slide 0.2s ease;
}
@keyframes sidebar-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.politics-sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 499;
}
.politics-sidebar-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; cursor: pointer;
  color: var(--subtext); font-size: 1.3rem; line-height: 1;
  padding: 0.25rem; border-radius: 4px;
}
.politics-sidebar-close:hover { background: var(--bg); color: var(--text); }
.politics-sidebar-profile { padding: 2rem 1.25rem 1.5rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.politics-sidebar-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 0.75rem; }
.politics-sidebar-avatar-placeholder {
  width: 72px; height: 72px; border-radius: 50%; background: var(--accent);
  color: var(--accent-text); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700; margin-bottom: 0.75rem;
}
.politics-sidebar-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.15rem; }
.politics-sidebar-handle { font-size: 0.85rem; color: var(--subtext); margin-bottom: 0.5rem; }
.politics-sidebar-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; margin-bottom: 0.75rem; }
.politics-sidebar-bio { font-size: 0.87rem; color: var(--subtext); margin: 0.5rem 0; max-width: 260px; word-break: break-word; }
.politics-sidebar-stats { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--subtext); margin-top: 0.5rem; }
.politics-sidebar-compass-wrap { margin: 0.75rem 0; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.politics-sidebar-compass-svg { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.politics-sidebar-compass-label { font-size: 0.78rem; color: var(--subtext); }

/* ── Politics setup ────────────────────────────────────────────────────────── */
.compass-setup-wrap { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.compass-setup-grid { flex-shrink: 0; }
.compass-svg { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); display: block; }
.compass-setup-list {
  flex: 1; min-width: 220px; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.compass-option {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.3rem 0.5rem; border-radius: 6px; cursor: pointer;
  transition: background 0.1s;
}
.compass-option:hover { background: var(--bg); }
.compass-option input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); }
.compass-option-label { display: flex; flex-direction: column; }
.compass-option-fullname { font-size: 0.82rem; color: var(--text); }
.compass-option-xy { font-size: 0.74rem; color: var(--subtext); font-family: monospace; }

/* ── Party picker ──────────────────────────────────────────────────────────── */
.party-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.party-option {
  flex: 1; min-width: 120px; cursor: pointer;
}
.party-option input[type="radio"] { display: none; }
.party-option-inner {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.75rem 0.5rem; border: 2px solid var(--border);
  border-radius: 10px; transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.party-option input:checked + .party-option-inner {
  border-color: var(--party-color); background: color-mix(in srgb, var(--party-color) 10%, var(--surface));
}
.party-option:hover .party-option-inner { border-color: var(--party-color); }
.party-abbrev { font-size: 1.2rem; font-weight: 800; color: var(--party-color); }
.party-name { font-size: 0.78rem; color: var(--subtext); margin-top: 0.15rem; }

/* ── Status page — uptime legend ───────────────────────────────────────────── */
.status-cell.status-down { background: #1f1f1f; border-color: #333; }
.status-uptime-reliability .status-dot { background: #22c55e; }
.status-uptime-reliability.good .status-dot { background: #22c55e; }
.status-uptime-reliability.warn .status-dot { background: #f59e0b; }
.status-uptime-reliability.bad  .status-dot { background: #ef4444; }
.status-uptime-legend {
  display: flex; flex-direction: column; gap: 0.3rem;
  margin-top: 0.75rem; font-size: 0.82rem; color: var(--subtext);
}
.status-uptime-legend-item { display: flex; align-items: center; gap: 0.5rem; }
.status-uptime-swatch {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; flex-shrink: 0;
}
.uptime-swatch { background: #3b82f6; }
.reliability-swatch { background: #22c55e; }

/* ── Compose room select ───────────────────────────────────────────────────── */
.compose-room-wrap { display: flex; align-items: center; gap: 0.5rem; }
.compose-room-select {
  border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.5rem;
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 0.82rem;
  cursor: pointer;
}
.compose-room-select:focus { outline: none; border-color: var(--accent); }

/* ── Room logo images ─────────────────────────────────────────────────────── */
.room-logo-img { width: 64px; height: 64px; object-fit: contain; display: block; }
.room-logo-lg  { width: 80px; height: 80px; }
.room-header-logo { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }

/* ── Bookmark popup ──────────────────────────────────────────────────────────── */
.bookmark-popup {
  position: absolute; z-index: 9999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
  display: flex; flex-direction: column; overflow: hidden;
  min-width: 220px;
}
.bookmark-popup-opt {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.75rem 1rem; background: none; border: none;
  cursor: pointer; text-align: left; color: var(--text);
  transition: background 0.12s;
}
.bookmark-popup-opt:not(:last-child) { border-bottom: 1px solid var(--border); }
.bookmark-popup-opt:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.bookmark-popup-opt strong { font-size: 0.9rem; font-weight: 700; }
.bookmark-popup-opt span { font-size: 0.78rem; color: var(--subtext); }

/* ── Snapshot / private bookmark cards ──────────────────────────────────────── */
.snapshot-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
  position: relative;
}
.snapshot-card-gone { opacity: 0.72; border-style: dashed; }
.snapshot-card-head {
  display: flex; align-items: flex-start; gap: 0.65rem; margin-bottom: 0.75rem;
}
.snapshot-card-avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.snapshot-card-meta {
  flex: 1; display: flex; flex-direction: column; gap: 0.05rem; min-width: 0;
}
.snapshot-card-name {
  font-weight: 700; font-size: 0.9rem; color: var(--text); text-decoration: none;
}
.snapshot-card-name:hover { text-decoration: underline; }
.snapshot-card-user { font-size: 0.78rem; color: var(--subtext); }
.snapshot-card-ts   { font-size: 0.75rem; color: var(--subtext); }
.snapshot-card-badges { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.snapshot-badge {
  font-size: 0.72rem; padding: 0.18rem 0.5rem; border-radius: 20px;
  font-weight: 600; white-space: nowrap;
}
.snapshot-badge-private { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.snapshot-badge-gone    { background: #ef444420; color: #ef4444; }
.snapshot-badge-link    {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--link); text-decoration: none;
}
.snapshot-badge-link:hover { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.snapshot-card-content { font-size: 0.93rem; line-height: 1.55; margin-bottom: 0.6rem; word-break: break-word; }
.snapshot-images { margin-top: 0.5rem; }
.snapshot-card-saved-at {
  font-size: 0.73rem; color: var(--subtext); margin-top: 0.6rem; text-align: right;
}

/* ── Profile tabs ────────────────────────────────────────────────────────────── */
.profile-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin: 1rem 0 0.1rem;
}
.profile-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 0.55rem 1rem; cursor: pointer; font-size: 0.88rem; font-weight: 600;
  color: var(--subtext); transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.profile-tab-count {
  font-size: 0.75rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.05rem 0.45rem; margin-left: 0.35rem;
  font-weight: 500; color: var(--subtext);
}
.profile-tab-pane { padding-top: 0.75rem; }

/* ── Dev console ─────────────────────────────────────────────────────────────── */
.dev-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.dev-terminal {
  width: 720px; max-width: 96vw; height: 500px; max-height: 88vh;
  background: #0e0e0e; border: 1px solid #2a2a2a; border-radius: 10px;
  font-family: 'Courier New', 'Consolas', monospace; font-size: 0.83rem;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 60px rgba(74,222,128,.08), 0 20px 60px rgba(0,0,0,.6);
}
.dev-terminal-bar {
  background: #1a1a1a; padding: 0.45rem 0.75rem; border-bottom: 1px solid #252525;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.dev-terminal-bar-dots { display: flex; gap: 0.4rem; }
.dev-terminal-bar-dot  { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dev-close-btn {
  background: none; border: none; color: #555; cursor: pointer; font-size: 0.82rem;
  padding: 0 0.2rem; line-height: 1;
}
.dev-close-btn:hover { color: #ccc; }
.dev-output {
  flex: 1; overflow-y: auto; padding: 0.75rem 0.9rem; scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.dev-line { margin: 0 0 0.15rem; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.dev-line-info { color: #6b7280; font-style: italic; }
.dev-line-cmd  { color: #4ade80; }
.dev-line-out  { color: #d1d5db; }
.dev-line-err  { color: #f87171; }
.dev-prompt-line {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.9rem; border-top: 1px solid #1e1e1e; flex-shrink: 0;
}
.dev-prompt-sym   { color: #4ade80; font-weight: 700; flex-shrink: 0; user-select: none; }
.dev-prompt-input {
  flex: 1; background: none; border: none; outline: none;
  color: #e5e7eb; font-family: inherit; font-size: inherit; caret-color: #4ade80;
}
.dev-prompt-input::placeholder { color: #374151; }

/* ── Dev console — revised ───────────────────────────────────────────────────── */
.dev-dot {
  width: 13px; height: 13px; border-radius: 50%; display: inline-block; cursor: pointer;
  transition: opacity 0.1s; flex-shrink: 0;
}
.dev-dot:hover { opacity: 0.75; }
#dev-dot-red    { background: #ff5f57; }
#dev-dot-yellow { background: #febc2e; }
#dev-dot-green  { background: #28c840; }
.dev-title-text { font-size: 0.72rem; color: #555; pointer-events: none; }
.dev-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.dev-terminal-max {
  width:  100vw !important; height: 100vh !important;
  max-width: 100vw !important; max-height: 100vh !important;
  border-radius: 0 !important; position: fixed; top: 0; left: 0;
}
/* Mask input without triggering password managers */
.dev-prompt-input.dev-masked { -webkit-text-security: disc; letter-spacing: 0.1em; }
/* Logo splash in terminal */
.dev-splash { padding: 0.4rem 0 0.6rem; text-align: center; }
.dev-splash img { height: 52px; width: auto; opacity: 0.85; }

/* ── Live perf chart ─────────────────────────────────────────────────────────── */
.perf-live-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); min-width: 140px;
}
.perf-tt-time { font-weight: 700; color: var(--subtext); margin-bottom: 0.3rem; font-size: 0.75rem; }
.perf-tt-row  { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.15rem; }
.perf-tt-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.perf-tt-ms   { margin-left: auto; font-weight: 600; color: var(--text); }
.perf-live-legend {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.6rem; font-size: 0.78rem; color: var(--subtext);
}
.perf-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.perf-legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.perf-range-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ── Dev console — draggable window ─────────────────────────────────────────── */
@keyframes devFadeIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}
@keyframes devOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.dev-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,0.45);
  pointer-events: none;           /* let clicks pass through backdrop */
  animation: devOverlayIn 0.15s ease-out;
}
.dev-terminal {
  /* positioned by JS; pointer-events restored */
  pointer-events: all;
  position: fixed;
  height: 500px; max-height: 88vh;
  background: #0e0e0e; border: 1px solid #2a2a2a; border-radius: 10px;
  font-family: 'Courier New', 'Consolas', monospace; font-size: 0.83rem;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 60px rgba(74,222,128,.06), 0 24px 64px rgba(0,0,0,.7);
  animation: devFadeIn 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  user-select: none;
}
.dev-terminal-max {
  position: fixed !important; inset: 0 !important;
  width: 100vw !important; height: 100vh !important;
  max-height: 100vh !important; border-radius: 0 !important;
}
.dev-terminal-bar {
  background: #1a1a1a; padding: 0.45rem 0.75rem; border-bottom: 1px solid #252525;
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; cursor: grab;
}
.dev-terminal-bar:active { cursor: grabbing; }
.dev-terminal-bar-dots { display: flex; gap: 0.4rem; flex-shrink: 0; }
.dev-dot { width: 13px; height: 13px; border-radius: 50%; cursor: pointer; transition: opacity 0.1s; }
.dev-dot:hover { opacity: 0.72; }
#dev-dot-red    { background: #ff5f57; }
#dev-dot-yellow { background: #febc2e; }
#dev-dot-green  { background: #28c840; }
.dev-title-text { font-size: 0.72rem; color: #555; flex: 1; text-align: center; pointer-events: none; }
.dev-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.dev-output {
  flex: 1; overflow-y: auto; padding: 0.75rem 0.9rem;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
  user-select: text;
}
.dev-line { margin: 0 0 0.15rem; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.dev-line-info { color: #6b7280; font-style: italic; }
.dev-line-cmd  { color: #4ade80; }
.dev-line-out  { color: #d1d5db; }
.dev-line-err  { color: #f87171; }
.dev-prompt-line {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.9rem; border-top: 1px solid #1e1e1e; flex-shrink: 0;
  user-select: none;
}
.dev-prompt-sym { color: #4ade80; font-weight: 700; flex-shrink: 0; }
.dev-prompt-input {
  flex: 1; background: none; border: none; outline: none;
  color: #e5e7eb; font-family: inherit; font-size: inherit; caret-color: #4ade80;
  user-select: text;
}
.dev-prompt-input::placeholder { color: #374151; }
.dev-prompt-input.dev-masked { -webkit-text-security: disc; letter-spacing: 0.1em; }
.dev-splash { padding: 0.5rem 0 0.5rem; text-align: center; }
.dev-splash img { height: 48px; width: auto; opacity: 0.8; }
.dev-close-btn { display: none; }  /* legacy — replaced by dots */

/* ── Mobile UI beta ──────────────────────────────────────────────────────────── */
/* Hide desktop nav, adjust layout */
.beta-mobile .nav { display: none !important; }
.beta-mobile body { padding-top: 0; }
.beta-mobile main.container,
.beta-mobile .container { max-width: 100% !important; padding-left: 0; padding-right: 0; }
.beta-mobile main { padding-bottom: 72px !important; }

/* Full-width post cards, flush edges */
.beta-mobile .post-card {
  border-radius: 0 !important;
  border-left: none !important; border-right: none !important;
  margin-bottom: 4px;
}

/* Bigger touch targets on actions */
.beta-mobile .post-actions .btn { min-height: 44px; padding: 0 0.85rem; }
.beta-mobile .btn { min-height: 42px; }

/* Compose area full-width */
.beta-mobile .compose-box { border-radius: 0; border-left: none; border-right: none; }

/* Profile header tighter on mobile */
.beta-mobile .profile-banner { border-radius: 0 !important; }
.beta-mobile .profile-card { padding: 0 1rem 1rem; }

/* Settings cards full-width */
.beta-mobile .settings-card { border-radius: 0; border-left: none; border-right: none; }

/* ── Bottom navigation bar ──────────────────────────────────────────────────── */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  height: 62px;
  background: var(--nav-bg); border-top: 1px solid var(--border);
  display: none;                /* only shown when beta-mobile is active */
  align-items: center; justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.beta-mobile .mobile-bottom-nav { display: flex; }

.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--subtext); text-decoration: none; font-size: 0.62rem; font-weight: 500;
  padding: 0.4rem 0.8rem; border-radius: 10px; transition: color 0.15s;
  flex: 1; min-width: 0;
}
.mobile-nav-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.mobile-nav-btn.active { color: var(--accent); }
.mobile-nav-btn:hover  { color: var(--text); }

.mobile-nav-fab {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: var(--accent-text);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 16px rgba(0,0,0,.3);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-bottom: 6px;
}
.mobile-nav-fab:active { transform: scale(0.93); box-shadow: 0 1px 6px rgba(0,0,0,.3); }

/* ════════════════════════════════════════════════════════════════════════════
   TuxClub HD — Exclusive beta effects
   ════════════════════════════════════════════════════════════════════════════ */

/* Deep OLED */
.beta-deep-oled,
.beta-deep-oled .nav,
.beta-deep-oled .post-card,
.beta-deep-oled .settings-card,
.beta-deep-oled .compose-box { background: #000 !important; }
.beta-deep-oled { --bg: #000; --surface: #050505; --nav-bg: #000; --border: #1a1a1a; }

/* Post glow */
.beta-post-glow .post-card {
  box-shadow: 0 0 0 1px var(--border), 0 4px 20px color-mix(in srgb, var(--accent) 18%, transparent) !important;
  transition: box-shadow 0.2s;
}
.beta-post-glow .post-card:hover {
  box-shadow: 0 0 0 1px var(--accent), 0 6px 32px color-mix(in srgb, var(--accent) 30%, transparent) !important;
}

/* Ambient glass */
.beta-ambient-blur .post-card {
  background: color-mix(in srgb, var(--surface) 55%, transparent) !important;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent) !important;
}

/* Hacker font */
.beta-hacker-font .post-content,
.beta-hacker-font .comment-body,
.beta-hacker-font textarea[name="content"] {
  font-family: 'Courier New', Consolas, monospace !important;
  font-size: 0.88em;
}

/* Dim media */
.beta-dim-images .post-image,
.beta-dim-images img.post-image { filter: brightness(0.55) saturate(0.8); transition: filter 0.2s; }
.beta-dim-images .post-image:hover { filter: brightness(1) saturate(1); }

/* Wide cards */
.beta-wide-cards .post-card { max-width: 100%; }
.beta-wide-cards .container { max-width: 900px !important; }
