@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: 1500;
  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-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-images.single { grid-template-columns: 1fr; }
.post-images.single img { border-radius: 10px; }

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

/* ── 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-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.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.modal-overlay.open { display: flex; }

.modal-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  object-fit: contain;
}

/* ── 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 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: 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);
  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;
}

/* ── 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);
}
