:root {
  --bg: #FFFBF0;
  --card: #FFFFFF;
  --card-hover: #FFFCF3;
  --border: #F0E8D0;
  --border-strong: #E5DCC0;
  --text: #2A2A2A;
  --text-muted: #6E6E6E;
  --text-soft: #9A9A9A;
  --accent: #F2C744;
  --accent-soft: #FFF1B8;
  --accent-deep: #C99A1F;
  --leaf: #87C38F;
  --leaf-deep: #5FA268;
  --heart: #F87171;
  --shadow-sm: 0 1px 2px rgba(60, 50, 20, 0.04);
  --shadow: 0 2px 12px rgba(80, 65, 25, 0.06);
  --shadow-lg: 0 12px 40px rgba(80, 65, 25, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* ============ App layout ============ */

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 251, 240, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
  gap: 20px;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--accent-deep);
}
.logo .logo-tag {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--text-soft);
  border-left: 1px solid var(--border-strong);
  padding-left: 7px;
  margin-left: 1px;
}
@media (max-width: 1000px) { .logo .logo-tag { display: none; } }

.search {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  width: 100%;
  color: var(--text-muted);
  cursor: text;
  font-size: 14px;
}

.search:focus { outline: 2px solid var(--accent-soft); }

.topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s ease;
}
.icon-btn:hover { background: var(--accent-soft); }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--heart);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 24px;
  padding: 24px 0;
  align-items: start;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar-left, .sidebar-right { display: none; }
  .topbar-inner { grid-template-columns: auto 1fr auto; }
  .search { display: none; }
}

/* ============ Sidebars ============ */

.sidebar-left, .sidebar-right {
  position: sticky;
  top: 80px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  transition: background 0.15s ease;
}
.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item .nav-icon { font-size: 18px; }

.side-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.side-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.trending-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.trending-item:last-child { border-bottom: none; }
.trending-item .tag {
  font-weight: 700;
  color: var(--accent-deep);
}
.trending-item .meta {
  color: var(--text-soft);
  font-size: 12px;
}

.suggest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.suggest-row:last-child { border-bottom: none; }
.suggest-row .who { flex: 1; min-width: 0; }
.suggest-row .name { font-weight: 600; font-size: 14px; }
.suggest-row .handle { color: var(--text-soft); font-size: 12px; }
.follow-btn {
  background: var(--text);
  color: white;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
}
.follow-btn:hover { background: #444; }
.follow-btn.following {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* ============ Center column ============ */

.center {
  min-width: 0;
}

.center-header {
  font-size: 22px;
  font-weight: 800;
  padding: 4px 0 16px;
  letter-spacing: -0.01em;
}

/* ============ Stories ============ */

.stories-bar {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.story-ring {
  flex: 0 0 auto;
  width: 66px;
  text-align: center;
  cursor: pointer;
}
.story-ring .ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  padding: 3px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--accent), #FF9F1C 55%, var(--leaf));
}
.story-ring.viewed .ring { background: var(--border-strong); }
.story-ring.add .ring { background: var(--border); }
.story-ring .ring .avatar { width: 56px; height: 56px; border: 2px solid var(--card); }
.story-ring .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-ring .add-plus {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}

.story-viewer {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 0, 0.92);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.story-viewer.open { display: flex; }
.story-stage {
  width: min(420px, 92vw);
  height: min(720px, 86vh);
  border-radius: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.story-progress {
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  display: flex; gap: 5px;
  z-index: 3;
}
.story-progress .seg {
  flex: 1; height: 3px; border-radius: 3px;
  background: rgba(255,255,255,0.35);
  overflow: hidden;
}
.story-progress .seg .fill {
  display: block; height: 100%; width: 0;
  background: #fff;
}
.story-progress .seg.done .fill { width: 100%; }
.story-progress .seg.active .fill { animation: story-fill 5s linear forwards; }
@keyframes story-fill { from { width: 0; } to { width: 100%; } }

.story-top {
  position: absolute;
  top: 22px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px;
  z-index: 3; color: #fff;
}
.story-top .name { font-weight: 700; font-size: 14px; }
.story-top .when { font-size: 12px; opacity: 0.8; }
.story-top .avatar { border: 2px solid rgba(255,255,255,0.7); }
.story-close {
  margin-left: auto;
  color: #fff; font-size: 26px; line-height: 1;
  width: 34px; height: 34px;
}
.story-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.story-card {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px;
  text-align: center;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
}
.story-card.over-photo {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  flex: none;
  z-index: 2;
  font-size: 18px;
  padding: 28px 22px 26px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0.15) 70%, transparent);
}
.story-nav {
  position: absolute; top: 0; bottom: 0; width: 35%;
  z-index: 2;
}
.story-nav.prev { left: 0; }
.story-nav.next { right: 0; }

/* ============ Composer ============ */

.composer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.composer-row {
  display: flex;
  gap: 12px;
}

.composer-body {
  flex: 1;
  min-width: 0;
}

.composer textarea {
  width: 100%;
  border: none;
  resize: none;
  background: transparent;
  outline: none;
  font-size: 17px;
  line-height: 1.4;
  padding: 8px 0 4px;
  min-height: 50px;
  max-height: 240px;
}

.composer textarea::placeholder { color: var(--text-soft); }

.composer-body { position: relative; }
.mention-pop {
  position: absolute;
  left: 0;
  top: 44px;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 240px;
}
.mention-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.mention-row:hover { background: var(--accent-soft); }
.mention-row .mn { font-weight: 600; font-size: 14px; }
.mention-row .mh { color: var(--text-soft); font-size: 12px; }

.composer-image-preview {
  position: relative;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 100%;
  display: none;
}

.composer-image-preview img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.composer-image-preview .remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.composer-tools {
  display: flex;
  gap: 4px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-deep);
  font-size: 18px;
  transition: background 0.15s;
}
.tool-btn:hover { background: var(--accent-soft); }

.post-btn {
  background: var(--accent);
  color: var(--text);
  font-weight: 800;
  padding: 9px 20px;
  border-radius: 999px;
  transition: background 0.15s, transform 0.05s;
  font-size: 15px;
}
.post-btn:hover { background: #E8BB30; }
.post-btn:active { transform: scale(0.97); }
.post-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ Poll ============ */

.poll-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.poll-opt-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--bg);
  outline: none;
  font-size: 14px;
}
.poll-opt-input:focus { border-color: var(--accent); background: var(--card); }

.tool-btn.active {
  background: var(--accent);
  color: var(--text);
}

.poll {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poll-opt {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  background: var(--card);
  transition: border-color 0.15s;
  user-select: none;
}
.poll-opt:hover { border-color: var(--accent); }
.poll-opt .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--accent-soft);
  transition: width 0.6s ease;
  z-index: 0;
}
.poll-opt.chosen .fill { background: var(--accent); }
.poll-opt .row {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.poll-opt .pct { font-weight: 800; color: var(--text-muted); }
.poll-opt.chosen .pct { color: var(--accent-deep); }
.poll-opt.chosen .label::after {
  content: " ✓";
  color: var(--accent-deep);
}
.poll.voted .poll-opt { cursor: default; }
.poll.voted .poll-opt:hover { border-color: var(--border-strong); }
.poll-total {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ============ Avatars ============ */

.avatar {
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  user-select: none;
  letter-spacing: 0.02em;
}

.avatar.face {
  background-repeat: no-repeat;
  background-color: #EFEAD8;
  color: transparent;
  font-size: 0;
  overflow: hidden;
}
.avatar.face.photo {
  background-size: cover;
  background-position: center;
}

.profile-photo-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pp-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.pp-btn:hover { background: var(--accent-soft); }
.pp-btn.primary { background: var(--accent); border-color: var(--accent); }
.pp-btn.primary:hover { background: #E8BB30; }

.avatar.sz-48 { width: 48px; height: 48px; font-size: 17px; }
.avatar.sz-40 { width: 40px; height: 40px; font-size: 15px; }
.avatar.sz-36 { width: 36px; height: 36px; font-size: 14px; }
.avatar.sz-32 { width: 32px; height: 32px; font-size: 13px; }
.avatar.sz-28 { width: 28px; height: 28px; font-size: 12px; }
.avatar.sz-64 { width: 64px; height: 64px; font-size: 22px; }
.avatar.sz-96 { width: 96px; height: 96px; font-size: 34px; }

/* ============ Posts ============ */

.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.post:hover { box-shadow: var(--shadow); }

.post-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.post-header .who { flex: 1; min-width: 0; }
.post-header .name {
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.post-header .verified {
  display: inline-block;
  width: 15px;
  height: 15px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  text-align: center;
  line-height: 15px;
  font-weight: 900;
}
.post-header .meta {
  color: var(--text-soft);
  font-size: 13px;
  display: flex;
  gap: 6px;
}
.post-header .more {
  color: var(--text-soft);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 50%;
}
.post-header .more:hover { background: var(--accent-soft); }

.post-content {
  margin: 10px 0 0;
  font-size: 15.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-image {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-image img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  justify-content: space-around;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.action:hover { background: var(--accent-soft); color: var(--text); }
.icon-heart.pop { animation: heart-pop 0.4s ease; transform-origin: center; }

.action-wrap { position: relative; display: inline-flex; }
.action.react.reacted { color: var(--heart); font-weight: 700; }
.react-emoji { font-size: 16px; line-height: 1; display: inline-block; }
.react-emoji.pop { animation: heart-pop 0.4s ease; }

.react-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 30;
}
.action-wrap:hover .react-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
.react-opt {
  font-size: 20px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.1s ease;
}
.react-opt:hover { transform: scale(1.3); background: var(--accent-soft); }

@keyframes heart-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.like-count.bump { animation: count-bump 0.25s ease; }
@keyframes count-bump {
  0% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* User's own posts get a quiet warmer halo over time */
.post.mine {
  border-color: var(--accent-soft);
  background: linear-gradient(180deg, #FFFEF4 0%, var(--card) 100%);
}

/* ============ Comments ============ */

.comments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment {
  display: flex;
  gap: 10px;
  animation: comment-in 0.35s ease;
}

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

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-bubble {
  background: #FAF7EC;
  border-radius: 14px;
  padding: 8px 12px;
  display: inline-block;
  max-width: 100%;
}

.comment-name {
  font-weight: 700;
  font-size: 13px;
  margin-right: 4px;
}

.comment-text {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.comment-meta {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 3px;
  padding-left: 4px;
}

.typing {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-soft);
  animation: comment-in 0.25s ease;
}

.typing .dots {
  display: inline-flex;
  gap: 3px;
  padding: 6px 10px;
  background: #FAF7EC;
  border-radius: 12px;
}
.typing .dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-soft);
  animation: dot-bounce 1.2s infinite ease-in-out both;
}
.typing .dots span:nth-child(2) { animation-delay: 0.15s; }
.typing .dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-3px); opacity: 1; }
}

/* ============ Ads ============ */

.ad {
  background: linear-gradient(135deg, #FFF8DC 0%, #FFF1B8 100%);
  border: 1px solid var(--border-strong);
}

.ad-tag {
  font-size: 11px;
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ad-title {
  font-weight: 800;
  font-size: 18px;
  margin: 6px 0 4px;
}

.ad-tagline {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ad-cta {
  display: inline-block;
  margin-top: 6px;
  padding: 7px 14px;
  background: var(--text);
  color: white;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* ============ Notifications panel ============ */

.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 5, 0.28);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.notif-backdrop.open { opacity: 1; pointer-events: auto; }

.panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 380px;
  max-width: 92vw;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 95;
  transform: translateX(105%);
  transition: transform 0.24s ease;
  border-radius: 0;
}
.panel.open { transform: translateX(0); }

.panel-header {
  position: sticky;
  top: 0;
  background: var(--card);
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.panel-header .hbtn {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.panel-header .hbtn:hover { background: var(--accent-soft); color: var(--text); }

.notif-filters {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 52px;
  background: var(--card);
  z-index: 1;
  border-bottom: 1px solid var(--border);
}
.notif-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--card);
}
.notif-chip.active { background: var(--accent); border-color: var(--accent); color: var(--text); }
.notif-chip:hover { background: var(--accent-soft); }

.notif-day {
  padding: 12px 18px 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.panel-row {
  padding: 12px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.panel-row:last-child { border-bottom: none; }
.panel-row.unread { background: #FFFBEC; }
.panel-row .who { flex: 1; min-width: 0; font-size: 14px; }
.panel-row .who b { font-weight: 700; }
.panel-row .when { color: var(--text-soft); font-size: 12px; }

.panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-soft);
}

/* ============ Profile page ============ */

.profile-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-banner {
  height: 120px;
  background: linear-gradient(135deg, var(--accent) 0%, #FFE873 60%, var(--leaf) 130%);
  border-radius: var(--radius);
  margin: -24px -24px 0;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.profile-meta {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-top: -48px;
}

.profile-meta .avatar {
  border: 4px solid var(--card);
  box-shadow: var(--shadow-sm);
}

.profile-info { flex: 1; padding-bottom: 8px; }
.profile-info .name {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-info .handle {
  color: var(--text-soft);
  font-size: 14px;
}

.profile-bio {
  margin-top: 14px;
  font-size: 15px;
}

.profile-stats {
  display: flex;
  gap: 22px;
  margin-top: 14px;
}
.profile-stats .stat {
  font-size: 14px;
  color: var(--text-muted);
}
.profile-stats .stat b {
  color: var(--text);
  font-weight: 800;
  margin-right: 4px;
}

/* ============ Modal ============ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 5, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 460px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal p {
  color: var(--text-muted);
  margin: 0 0 14px;
}

.modal label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin: 14px 0 6px;
}

.modal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  outline: none;
}
.modal input[type="text"]:focus { border-color: var(--accent); }

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}
.btn.primary {
  background: var(--accent);
  color: var(--text);
}
.btn.primary:hover { background: #E8BB30; }
.btn.ghost {
  color: var(--text-muted);
}
.btn.ghost:hover { background: var(--accent-soft); }

/* ============ Loading / availability state ============ */

.loading-screen {
  display: none;
  padding: 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.loading-screen.show { display: block; }
.loading-screen h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}
.loading-screen p { color: var(--text-muted); margin: 0; }
.loading-bar {
  margin: 14px auto 0;
  max-width: 280px;
  height: 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
}
.loading-bar .fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ============ Toast ============ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ Misc ============ */

.hidden { display: none !important; }
.row-gap-12 { display: flex; flex-direction: column; gap: 12px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-soft);
}

/* ============ DM dock + chat heads ============ */

.dm-dock {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.dm-heads {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
}

.dm-head {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  transition: transform 0.12s ease;
}
.dm-head:hover { transform: translateY(-3px); }
.dm-head .avatar { border: 3px solid var(--card); }

.dm-head-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--heart);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4caf50;
  border: 2px solid var(--card);
}

.dm-head-x {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.dm-head:hover .dm-head-x { display: inline-flex; }

.dm-collapse {
  align-self: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.dm-collapse:hover { background: var(--accent-soft); }

.dm-launcher {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.dm-launcher:hover { background: #E8BB30; }

.dm-picker {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 320px;
  max-height: 60vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.16s ease;
}
.dm-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
}
.dm-picker input {
  margin: 10px 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  outline: none;
  font-size: 14px;
}
.dm-picker input:focus { border-color: var(--accent); }
.dm-picker-list { overflow-y: auto; padding: 4px 6px 10px; }
.dm-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dm-picker-row:hover { background: var(--accent-soft); }
.dm-picker-row .name { font-weight: 600; font-size: 14px; }
.dm-picker-row .handle { font-size: 12px; color: var(--text-soft); }

.presence { color: var(--text-soft); font-size: 12px; }
.presence.online { color: #3c9a40; font-weight: 600; }

.dm-seen {
  align-self: flex-end;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
  padding-right: 2px;
}

.dm-head.muted::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-soft);
  border: 2px solid var(--card);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4z'/%3E%3Cpath d='M4 3l17 17' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/12px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3z'/%3E%3C/svg%3E") center/12px no-repeat;
}

/* ============ DM window ============ */

.dm-window {
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 460px;
  max-height: calc(100vh - 90px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.18s ease;
}

.dm-window-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #FFFDF4, var(--card));
}
.dm-window-header .who { flex: 1; min-width: 0; }
.dm-window-header .name {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dm-window-header .handle {
  font-size: 12px;
  color: var(--text-soft);
}
.dm-window-header .hbtn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.dm-window-header .hbtn:hover { background: var(--accent-soft); color: var(--text); }
.dm-window-header .hbtn.active { color: var(--heart); }

.dm-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.dm-msg {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.dm-msg.bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.dm-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.dm-msg-time {
  font-size: 10px;
  color: var(--text-soft);
  align-self: center;
  margin: 2px 0;
}

.dm-typing {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 9px 12px;
  display: inline-flex;
  gap: 3px;
}
.dm-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-soft);
  animation: dot-bounce 1.2s infinite ease-in-out both;
}
.dm-typing span:nth-child(2) { animation-delay: 0.15s; }
.dm-typing span:nth-child(3) { animation-delay: 0.3s; }

.dm-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.dm-footer input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--bg);
  outline: none;
  font-size: 14px;
}
.dm-footer input:focus { border-color: var(--accent); background: var(--card); }
.dm-send {
  background: var(--accent);
  color: var(--text);
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
}
.dm-send:hover { background: #E8BB30; }
.dm-send:disabled { opacity: 0.4; cursor: not-allowed; }

.dm-muted-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  padding: 4px 0;
}

@media (max-width: 560px) {
  .dm-window { width: calc(100vw - 32px); height: calc(100vh - 100px); }
}

/* ============ Icons ============ */

.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.i-14 { width: 14px; height: 14px; }
.i-16 { width: 16px; height: 16px; }
.i-18 { width: 18px; height: 18px; }
.i-20 { width: 20px; height: 20px; }
.i-22 { width: 22px; height: 22px; }
.i-24 { width: 24px; height: 24px; }

.action .icon { stroke-width: 2; }
.action.liked .icon-heart { fill: var(--heart); stroke: var(--heart); }
.action.liked { color: var(--heart); }

/* ============ Clickable profile-link ============ */

.clickable {
  cursor: pointer;
}
.clickable.name:hover { text-decoration: underline; }
.avatar.clickable:hover { opacity: 0.85; transition: opacity 0.15s; }

/* ============ Inline comment composer ============ */

.comment-composer {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cc-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--bg);
  outline: none;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.cc-input:focus {
  border-color: var(--accent);
  background: var(--card);
}

.cc-submit {
  background: var(--accent);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  transition: background 0.15s;
}
.cc-submit:hover { background: #E8BB30; }
.cc-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--accent-soft);
}

/* User's own comment bubble — distinguish softly */
.comment.is-user .comment-bubble {
  background: var(--accent-soft);
}

/* ============ Bot profile (other people) ============ */

.back-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 14px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
}
.back-btn:hover { background: var(--accent-soft); }

.profile-actions {
  margin-top: 14px;
}
.profile-actions .follow-btn {
  padding: 8px 18px;
  font-size: 14px;
}
