* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: #eef3fa;
  color: #0f172a;
}

.xp-toast {
  position: fixed;
  top: max(62px, calc(52px + env(safe-area-inset-top)));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(16, 22, 45, 0.92);
  color: #86efac;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(134, 239, 172, 0.35);
  pointer-events: none;
  max-width: min(92vw, 360px);
  text-align: center;
}

.xp-toast.hidden {
  display: none;
}

.hidden {
  display: none;
}

.topbar {
  height: 56px;
  background: #10162d;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand {
  font-weight: 800;
}

.user-name {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 700;
}

.user-name-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name-btn:hover {
  color: #fff;
}

.user-name-btn.hidden {
  display: none;
}

.menu-btn {
  display: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.header-nav-backdrop,
.header-nav-top,
.header-nav-user,
.header-nav-close {
  display: none;
}

.header-nav-panel {
  display: flex;
  align-items: center;
}

.header-nav-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#adminNavLink {
  color: #fbbf24;
}

.read-lang-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cbd5e1;
}

.read-lang-select {
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  max-width: 140px;
}

.post-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
}

.post-title-row .post-title {
  flex: 1;
  margin: 0;
}

.translate-btn {
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}

.translate-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
}

.translate-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.translate-box {
  margin: 8px 0 10px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  font-size: 13px;
}

.translate-box.hidden {
  display: none;
}

.translate-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.translate-result {
  margin: 0;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.translate-fallback-link {
  color: #1d4ed8;
  font-weight: 700;
}

.translate-fallback-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #64748b;
}

.post-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.post-text-wrap .post-text {
  width: 100%;
}

.reply-translate-btn {
  padding: 2px 6px;
  font-size: 11px;
  vertical-align: middle;
}

.reply-translate-box {
  margin-top: 4px;
}

.header-nav-link,
.header-nav-rp {
  flex-shrink: 0;
}

.topbar-search {
  flex-shrink: 0;
  margin-left: auto;
}

.search-box-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  min-height: 32px;
  line-height: 1.2;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.search-trigger:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

.search-trigger:active {
  background: rgba(255, 255, 255, 0.08);
}

.search-trigger.active {
  border-color: rgba(147, 197, 253, 0.55);
  background: rgba(59, 130, 246, 0.22);
  color: #e0f2fe;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 0 1px rgba(96, 165, 250, 0.2);
}

.search-lens-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.9);
}

.search-trigger.active .search-lens-icon {
  color: #93c5fd;
}

.search-trigger-label {
  white-space: nowrap;
}

.search-clear {
  border: 0;
  background: #ef4444;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 700;
}

.search-clear:hover {
  background: #dc2626;
}

@media (min-width: 769px) {
  .topbar-search .search-trigger {
    min-width: 148px;
  }

  .topbar {
    gap: 8px;
  }

  .topbar-search {
    margin-left: 0;
    order: 2;
  }

  .header-nav {
    order: 3;
    margin-left: auto;
  }

  .brand-wrap {
    order: 1;
  }
}

.post-card-search-hit {
  outline: 2px solid #2f7df6;
  outline-offset: 2px;
}

.buy-btn,
.sign-btn {
  padding: 7px 12px;
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  cursor: pointer;
}

.buy-btn {
  background: #4f9df9;
  min-height: 32px;
  line-height: 1.2;
}

.sign-btn {
  background: #22c55e;
}

.sign-btn.secondary {
  background: #2563eb;
}

.auth-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-inline input {
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  outline: none;
  width: 130px;
}

.rp-badge {
  background: #fbbf24;
  color: #1c1917;
  font-weight: 800;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
}

.signout-btn {
  padding: 6px 10px;
  border: 1px solid #475569;
  background: transparent;
  color: #cbd5e1;
  font-size: 11px;
  border-radius: 999px;
  cursor: pointer;
}

.page-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 10px 40px;
}

.core-column {
  max-width: 760px;
  margin: 0 auto;
}

.feed-scope-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.feed-scope-toggle {
  display: inline-flex;
  align-self: flex-start;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.scope-chip {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.scope-chip.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
}

.feed-scope-hint {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.post-scope-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.post-scope-tag.post-scope-local {
  color: #b45309;
  background: #fffbeb;
}

.topic-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  border: 0;
  background: #b9d8fb;
  color: #123a72;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  background: #2f7df6;
  color: #fff;
}

.submit-panel,
.profile-panel,
.post-card {
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  margin-bottom: 16px;
}

.score-line {
  font-size: 12px;
  color: #475569;
  display: grid;
  gap: 5px;
}

.badge-label {
  display: inline-block;
  border: 1px solid #0f172a;
  padding: 3px 8px;
  border-radius: 2px;
  width: max-content;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.composer-wrap {
  position: relative;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.post-title-input {
  width: 100%;
  border: 0;
  outline: none;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid #e2e8f0;
}

.composer-wrap textarea {
  width: 100%;
  border: 0;
  outline: 0;
  resize: vertical;
  padding: 16px 14px 12px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  min-height: 120px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.attach-menu-wrap {
  position: relative;
}

.attach-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.attach-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.attach-dropdown {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 50;
  min-width: 200px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attach-dropdown.hidden {
  display: none;
}

.attach-option {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #0f172a;
}

.attach-option:hover {
  background: #f1f5f9;
}

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.attach-preview.hidden {
  display: none;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 4px 8px;
  border-radius: 999px;
}

.attach-chip-remove {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.post-btn {
  border: 0;
  background: #4f9df9;
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.post-attachments {
  margin-top: 10px;
}

.post-attachments.hidden {
  display: none;
}

.post-attachments-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-attach-image img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.post-attach-audio audio {
  width: 100%;
  margin-top: 4px;
}

.post-attach-label {
  font-size: 12px;
  color: #64748b;
}

.post-attach-doc a {
  color: #2563eb;
  font-weight: 600;
  font-size: 14px;
}

.post-attach-video iframe {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}

.post-attach-video a {
  color: #2563eb;
  font-weight: 600;
}

.composer-foot,
.feed-header-row,
.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-foot {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}

.star-row {
  letter-spacing: 2px;
  color: #f59e0b;
}

.rp-cost-note {
  font-size: 11px;
  color: #64748b;
  margin-top: 5px;
}

.tab {
  border: 0;
  border-radius: 10px;
  padding: 7px 16px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.tab.active {
  background: #2f7df6;
  color: #fff;
}

.hero-feed {
  display: grid;
  gap: 14px;
}

.feed-empty {
  margin: 24px 0;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.post-card {
  border-radius: 12px;
}

.post-meta {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 7px;
  gap: 6px;
  flex-wrap: wrap;
}

.post-actions-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.post-actions-btn {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.post-actions-btn:hover,
.post-actions-btn[aria-expanded="true"] {
  background: #f1f5f9;
  color: #334155;
}

.post-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 60;
  min-width: 140px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-actions-menu.hidden {
  display: none;
}

.post-actions-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.post-actions-item:hover {
  background: #f1f5f9;
}

.post-actions-item--danger {
  color: #dc2626;
}

.post-actions-item--danger:hover {
  background: #fef2f2;
}

.post-edit-panel {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.post-edit-panel.hidden {
  display: none;
}

.post-edit-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.post-edit-title,
.post-edit-topic,
.post-edit-body {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.post-edit-count {
  margin: 0;
  font-size: 11px;
  color: #64748b;
  text-align: right;
}

.post-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.post-edit-save,
.post-edit-cancel {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.post-edit-save {
  background: #2f7df6;
  color: #fff;
}

.post-edit-cancel {
  background: #e2e8f0;
  color: #334155;
}

.post-author-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.post-author-name {
  font-weight: 700;
  color: #1d4ed8;
}

.reply-author-line {
  line-height: 1.45;
}

.reply-author-line .xp-badge {
  vertical-align: middle;
  margin: 0 2px;
}

/* XP tier badges (public) */
.xp-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}

.xp-badge--compact {
  padding: 2px 8px;
  font-size: 10px;
}

.xp-badge--explorer {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.xp-badge--innovator {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.xp-badge--visionary {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #c4b5fd;
}

.xp-badge--architect {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #b45309;
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.25);
}

.profile-title-row,
.author-modal-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-title-row h2,
.author-modal-title-row h3 {
  margin: 0;
}

.user-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(52vw, 220px);
}

.user-name-btn .xp-badge-slot:not(.hidden) {
  flex-shrink: 0;
}

.post-author-link {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-author-link:hover {
  color: #1e40af;
}

.author-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.author-modal.hidden {
  display: none;
}

.post-card.is-locked .post-content {
  display: none;
}

.post-card.is-unlocked .lock-box,
.post-card.is-owner .lock-box {
  display: none;
}

.author-modal-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.author-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
}

.author-modal-stars-wrap {
  margin: 10px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.author-modal-stars {
  display: flex;
  gap: 4px;
  font-size: 22px;
  line-height: 1;
}

.author-modal-stars.no-stars {
  font-size: 13px;
  color: #94a3b8;
}

.author-star.filled {
  color: #f59e0b;
}

.author-star.empty {
  color: #e2e8f0;
}

.author-modal-star-label {
  font-size: 12px;
  color: #64748b;
}

.author-modal-xp,
.author-modal-views,
.author-modal-replies {
  margin: 8px 0;
  color: #334155;
}

.author-modal-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: 12px;
}

.profile-note {
  font-size: 13px;
  color: #475569;
  margin: 4px 0 0;
}

.profile-edit-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 14px;
}

.profile-edit-title {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}

.profile-edit-hint {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.profile-field {
  display: grid;
  gap: 6px;
}

.profile-field > span {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.profile-field textarea,
.profile-field select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

.profile-field textarea {
  resize: vertical;
  min-height: 88px;
}

.profile-char-count {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}

.profile-field-hint {
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

.profile-notify-fieldset {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.profile-notify-fieldset legend {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  padding: 0 6px;
}

.profile-notify-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.profile-notify-row input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.profile-save-btn.secondary {
  margin-top: 14px;
  background: #e2e8f0;
  color: #334155;
}

.profile-save-btn.secondary:hover {
  background: #cbd5e1;
}

.profile-save-btn {
  border: 0;
  background: #2f7df6;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}

.profile-save-btn:disabled {
  opacity: 0.6;
}

.profile-save-msg {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.profile-save-msg.ok {
  color: #15803d;
}

.profile-save-msg.err {
  color: #b91c1c;
}

.author-modal-bio {
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.author-modal-extra {
  font-size: 12px;
  color: #475569;
  margin: 4px 0 0;
}

.stat-readonly {
  color: #1d4ed8;
}

.post-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
}

.post-rating-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.post-stars {
  display: inline-flex;
  gap: 2px;
  font-size: 16px;
  line-height: 1;
}

.post-stars .star.filled {
  color: #f59e0b;
}

.post-stars .star.empty {
  color: #e2e8f0;
}

.post-rating-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.lock-box {
  height: 160px;
  border: 1px solid #8aa0b9;
  background: linear-gradient(180deg, #f1f5f9, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 7px;
}

.lock-icon {
  font-size: 48px;
  opacity: 0.5;
}

.unlockBtn,
.replyBtn,
.vote-btn {
  border: 0;
  background: #2f7df6;
  color: #fff;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.post-topic-tag {
  display: inline-block;
  border: 1px solid #111827;
  padding: 3px 7px;
  font-size: 11px;
  width: max-content;
  margin: 5px 0 9px;
  background: #fff;
}

.post-text {
  font-size: 13px;
  line-height: 1.5;
}

.comment-block {
  margin-top: 10px;
  border-top: 1px solid #e2e8f0;
  padding-top: 7px;
}

.comment-title {
  font-size: 12px;
  font-weight: 700;
}

.comment-info {
  font-size: 10px;
  color: #64748b;
  margin: 4px 0 7px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.reply-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.reply-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reply-attach-preview.hidden {
  display: none;
}

.reply-attachments {
  margin: 6px 0 8px;
}

.reply-attachments:empty {
  display: none;
}

.reply-vote-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.reply-body-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-form input,
.comment-form textarea.commentInput {
  flex: 1;
  min-width: 160px;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  resize: vertical;
}

.comment-form textarea.commentInput {
  min-height: 56px;
  max-height: 140px;
  line-height: 1.4;
}

.comment-list {
  display: grid;
  gap: 8px;
}

.reply-item {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.reply-meta {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 4px;
}

.reply-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.vote-btn.down {
  background: #ef4444;
}

.vote-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-card {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 20px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.stat span {
  display: block;
  font-size: 11px;
  color: #64748b;
}

.stat strong {
  font-size: 22px;
}

/* ——— Mobile & tablet ——— */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  z-index: 50;
}

.buy-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 32px;
}

.sign-btn.secondary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}

.topic-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -4px;
  padding-bottom: 4px;
}

.topic-scroll::-webkit-scrollbar {
  display: none;
}

.token-fold {
  border: 1px solid #dbe7f3;
}

.token-fold-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #1d4ed8;
  list-style: none;
}

.token-fold-summary::-webkit-details-marker {
  display: none;
}

.token-fold-summary::before {
  content: '▸ ';
  color: #64748b;
}

.token-fold[open] .token-fold-summary::before {
  content: '▾ ';
}

.token-fold-body {
  margin: 10px 0 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.hint-mobile {
  display: none;
}

.hint-desktop {
  margin: 0;
}

.composer-panel {
  margin-bottom: 12px;
}

.feed-header-row {
  position: sticky;
  top: 56px;
  z-index: 40;
  background: #eef3fa;
  padding: 8px 0;
  margin-bottom: 4px;
  gap: 8px;
}

.unlockBtn,
.replyBtn,
.vote-btn,
.chip,
.tab,
.post-btn,
.signout-btn {
  touch-action: manipulation;
}

.reply-row {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

body.nav-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .menu-btn {
    display: grid;
    place-items: center;
  }

  .topbar {
    height: 52px;
    min-height: 52px;
    padding-top: 6px;
    padding-bottom: 6px;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .brand-wrap {
    flex: 1;
    min-width: 0;
  }

  .brand {
    font-size: 15px;
  }

  .user-name {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .header-nav {
    position: fixed;
    inset: 0;
    z-index: 200;
    margin: 0;
    pointer-events: none;
  }

  .header-nav.open {
    pointer-events: auto;
  }

  .header-nav-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .header-nav.open .header-nav-backdrop {
    opacity: 1;
  }

  .header-nav-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100%;
    background: #fff;
    color: #0f172a;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.18);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
  }

  .header-nav.open .header-nav-panel {
    transform: translateX(0);
  }

  .header-nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #10162d;
    color: #fff;
  }

  .header-nav-title {
    font-weight: 800;
    font-size: 16px;
  }

  .header-nav-close {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    cursor: pointer;
  }

  .header-nav-user {
    display: block;
    margin: 0;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
  }

  .header-nav-items {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 24px;
    flex: 1;
    overflow-y: auto;
  }

  .topbar-search {
    margin-left: auto;
    margin-right: 2px;
    z-index: 60;
    pointer-events: auto;
  }

  .topbar-search .search-trigger {
    padding: 7px 10px;
    min-height: 36px;
    max-width: min(42vw, 160px);
  }

  .topbar-search .search-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 88px;
    font-size: 11px;
  }

  .topbar-search .search-trigger:not(.active) .search-trigger-label {
    display: none;
  }

  .topbar-search .search-trigger.active .search-trigger-label {
    display: inline;
  }

  .topbar-search .search-lens-icon {
    width: 16px;
    height: 16px;
  }

  .topbar-search .search-clear {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .header-nav-link,
  .header-nav-rp,
  .header-nav-items .auth-inline {
    display: flex;
    align-items: center;
    width: calc(100% - 28px);
    margin: 6px 14px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    justify-content: flex-start;
    min-height: 48px;
    box-sizing: border-box;
  }

  .header-nav-items .buy-btn {
    background: #4f9df9;
    color: #fff;
  }

  .header-nav-items .sign-btn.secondary {
    background: #2563eb;
    color: #fff;
    width: 100%;
    justify-content: center;
  }

  .header-nav-items .signout-btn {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
  }

  .header-nav-rp {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    justify-content: center;
  }

  .header-nav-items .auth-inline {
    background: transparent;
    padding: 0;
    margin: 6px 14px;
  }

  .header-nav-items .auth-inline .sign-btn {
    width: 100%;
  }

  .page-shell {
    padding: 10px 12px 32px;
  }

  .topic-row {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: max-content;
    gap: 8px;
    margin-bottom: 0;
  }

  .chip {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    min-height: 36px;
  }

  .submit-panel,
  .profile-panel,
  .post-card {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  .hint-desktop {
    display: none;
  }

  .hint-mobile {
    display: block;
    margin: 0;
    font-size: 12px;
    color: #64748b;
  }

  .composer-wrap textarea {
    min-height: 100px;
    font-size: 16px;
  }

  .post-title-input {
    font-size: 16px;
  }

  .post-btn {
    min-height: 40px;
    padding: 10px 18px;
    font-size: 13px;
  }

  .star-row {
    display: none;
  }

  .lock-box {
    height: auto;
    min-height: 140px;
    padding: 16px 12px;
  }

  .unlockBtn,
  .replyBtn {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 13px;
    width: 100%;
    max-width: 280px;
  }

  .comment-form {
    flex-direction: column;
    align-items: stretch;
  }

  .reply-form-actions {
    flex-direction: row;
    justify-content: space-between;
  }

  .comment-form input,
  .comment-form textarea.commentInput {
    min-width: 0;
    width: 100%;
    font-size: 16px;
    padding: 12px 14px;
  }

  .comment-form .replyBtn {
    width: 100%;
    max-width: none;
  }

  .post-title {
    font-size: 17px;
  }

  .post-text {
    font-size: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat strong {
    font-size: 20px;
  }

  .feed-header-row {
    position: relative;
    top: 0;
  }
}

@media (max-width: 480px) {
  .user-name {
    display: none;
  }

  .author-modal-card {
    padding: 20px 18px;
    margin: 8px;
    max-height: 85vh;
    overflow-y: auto;
  }

  .author-modal-close {
    min-width: 44px;
    min-height: 44px;
    top: 4px;
    right: 4px;
  }
}

@media (min-width: 769px) {
  .token-fold > .token-fold-summary {
    display: none;
  }

  .token-fold-body {
    margin: 0;
  }
}