@import url('jtb-premium.css');
@import url('dark-theme.css');
@import url('site-extras.css');

:root {
  --jtb-yellow: #ffcc00;
  --jtb-yellow-hover: #e6b800;
  --jtb-yellow-soft: #fff8d6;
  --jtb-black: #1c1e21;
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --border: #dddfe2;
  --text: #050505;
  --text-muted: #65676b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --topbar-h: 56px;
  --bottomnav-h: 56px;
  --sidebar-w: clamp(240px, 18vw, 320px);
  --content-max: 1680px;
  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  max-width: 100vw;
}
body {
  margin: 0; padding: 0;
  max-width: 100vw;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font-family: inherit; }

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #fff 0%, var(--bg-page) 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  border: 1px solid var(--border);
}
.topbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  margin-right: 4px;
}
.topbar-logo picture {
  display: block;
  line-height: 0;
}
.topbar-logo img {
  height: 44px;
  width: auto;
  max-width: none;
  object-fit: contain;
  display: block;
  border-radius: 0;
  background: transparent;
}

@media (min-width: 1024px) {
  .topbar-logo img {
    height: 40px;
    width: auto;
    max-width: none;
    object-fit: contain;
  }
}
.auth-logo {
  width: min(280px, 88vw);
  height: auto;
  margin: 0 auto 24px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
}
.auth-card h1 { font-size: 1.35rem; margin: 0 0 8px; text-align: center; }
.auth-card p.sub { color: var(--text-muted); text-align: center; margin: 0 0 24px; font-size: 0.95rem; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 1rem;
  background: var(--bg-card); color: var(--text);
}
.form-control::placeholder { color: var(--text-muted); opacity: 1; }
.form-control:focus { outline: none; border-color: var(--jtb-yellow); box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.25); }
select.form-control { cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius); padding: 12px 20px;
  font-weight: 700; font-size: 1rem; cursor: pointer; transition: 0.15s;
}
.btn-primary { background: var(--jtb-yellow); color: var(--jtb-black); width: 100%; }
.btn-primary:hover { background: var(--jtb-yellow-hover); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.auth-divider { text-align: center; color: var(--text-muted); margin: 20px 0; font-size: 0.85rem; }

/* ── App shell (Facebook desktop web) ── */
.app-shell {
  min-height: 100vh;
  padding-top: var(--topbar-h);
  max-width: 100vw;
}

.feed-container,
#app.feed-container {
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.feed-skeleton-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 8px);
  padding: 16px;
  margin-bottom: 16px;
  animation: feedSkeletonPulse 1.2s ease-in-out infinite;
}

.feed-skeleton-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feed-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-page, #f0f2f5);
  flex-shrink: 0;
}

.feed-skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.feed-skeleton-lines span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-page, #f0f2f5);
}

.feed-skeleton-lines span:first-child { width: 38%; }
.feed-skeleton-lines span:last-child { width: 22%; }

.feed-skeleton-body {
  height: 120px;
  border-radius: 8px;
  background: var(--bg-page, #f0f2f5);
  margin-bottom: 12px;
}

.feed-skeleton-actions {
  height: 18px;
  width: 55%;
  border-radius: 999px;
  background: var(--bg-page, #f0f2f5);
}

.feed-skeleton--stories {
  display: flex;
  gap: 12px;
  padding: 16px;
  min-height: 120px;
}

.feed-skeleton--stories::before,
.feed-skeleton--stories::after {
  content: '';
  width: 72px;
  height: 96px;
  border-radius: 12px;
  background: var(--bg-page, #f0f2f5);
  flex-shrink: 0;
  animation: feedSkeletonPulse 1.2s ease-in-out infinite;
}

@keyframes feedSkeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 16px; z-index: 1000;
  max-width: 100vw;
  overflow-x: clip;
  overflow-y: visible;
}
.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-search {
  position: relative; width: clamp(160px, 22vw, 320px);
}
.topbar-search input {
  width: 100%; border: none; background: var(--bg-page); border-radius: 50px;
  padding: 10px 16px 10px 36px; font-size: 0.95rem;
}
.topbar-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.9rem;
}
.topbar-center {
  display: flex; align-items: stretch; justify-content: center; gap: 4px;
}
.topbar-nav-item {
  width: 112px; height: 56px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.4rem; border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0; transition: 0.15s;
}
.topbar-nav-item:hover { background: var(--bg-page); }
.topbar-nav-item.active {
  color: var(--jtb-yellow-hover); border-bottom-color: var(--jtb-yellow);
}
.topbar-search-toggle { display: none; }
.profile-menu-btn {
  display: flex; align-items: center; gap: 2px; border: none; background: var(--bg-page);
  border-radius: 20px; padding: 2px 6px 2px 2px; cursor: pointer;
}
.profile-menu-btn:hover { background: #e4e6eb; }
.profile-menu-btn .fa-caret-down { font-size: 0.7rem; color: var(--text-muted); margin-right: 4px; }
.profile-menu-wrap { position: relative; }
.profile-dropdown {
  position: absolute; right: 0; left: auto; top: calc(100% + 8px);
  width: min(300px, calc(100vw - 24px)); max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--topbar-h, 56px) - 12px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card, #fff); color: var(--text, #1c1e21);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  padding: 8px; z-index: 1100; border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.profile-dropdown a {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px;
  min-height: 44px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.95rem;
  color: var(--text, #1c1e21);
}
.profile-dropdown a:hover { background: var(--bg-page); color: var(--text, #1c1e21); }
.profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.profile-dropdown i { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-page);
  color: var(--text, #1c1e21);
  display: flex; align-items: center; justify-content: center; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--bg-page);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; font-size: 1.1rem; color: var(--text);
}
.icon-btn:hover { background: #e4e6eb; }
.badge-count {
  position: absolute; top: -2px; right: -2px; background: #e41e3f; color: #fff;
  font-size: 0.65rem; font-weight: 800; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.layout-grid {
  width: 100%;
  max-width: var(--content-max);
  margin: 20px auto 0;
  padding: 0 clamp(12px, 2.5vw, 28px) 24px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--sidebar-w);
  gap: 20px;
  align-items: flex-start;
}
main { min-width: 0; width: 100%; }

.feed-center,
.feed-stack,
#welcome-slot {
  min-width: 0;
}

/* Desktop sticky sidebars — ancestors need overflow:visible or sticky breaks. */
@media (min-width: 992px) {
  html,
  body,
  .app-shell:not(.messenger-page),
  #app,
  .feed-container,
  #app.feed-container {
    overflow: visible !important;
  }

  .layout-grid {
    align-items: start !important;
  }

  #sidebar-left,
  #sidebar-right {
    position: sticky;
    top: calc(var(--topbar-h) + 12px);
    align-self: start;
    max-height: calc(100vh - var(--topbar-h) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #bcc0c4 transparent;
    z-index: 10;
  }

  #sidebar-left > .sidebar-left,
  #sidebar-right > .sidebar-right {
    position: static;
    max-height: none;
    overflow: visible;
  }

  #sidebar-left { padding-right: 4px; }
  #sidebar-right { padding-left: 4px; }
  #sidebar-left::-webkit-scrollbar,
  #sidebar-right::-webkit-scrollbar { width: 6px; }
  #sidebar-left::-webkit-scrollbar-thumb,
  #sidebar-right::-webkit-scrollbar-thumb {
    background: #bcc0c4;
    border-radius: 8px;
  }
}

@media (max-width: 991px) {
  html,
  body,
  .app-shell:not(.messenger-page),
  .feed-container,
  #app.feed-container {
    overflow-x: clip;
  }
}

/* Profile — full-width content, no empty side columns */
.profile-page .layout-grid {
  grid-template-columns: 1fr;
  max-width: min(100%, 1100px);
}
.profile-page .layout-grid > div:empty { display: none; }

/* Messenger — Facebook-style full layout */
.messenger-page.app-shell {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.messenger-page .layout-grid {
  grid-template-columns: 1fr;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  align-items: stretch;
}
.messenger-page #sidebar-left,
.messenger-page #sidebar-right {
  display: none;
}
.messenger-page main {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messenger-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg-card, #fff);
}

@media (max-width: 1280px) {
  .layout-grid { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); }
  .sidebar-right,
  #sidebar-right { display: none; }
}
@media (max-width: 1023px) {
  .topbar-center,
  nav.topbar-center {
    display: none !important;
  }

  :root {
    --topbar-h: 56px;
  }

  .topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    grid-template-columns: 1fr auto;
    padding: 0 12px;
    align-items: center;
  }
}

@media (max-width: 992px) {
  .layout-grid {
    grid-template-columns: 1fr;
    margin-top: 16px;
    padding: 0 16px 24px;
    gap: 16px;
  }
  .messenger-page .layout-grid {
    margin-top: 0;
    padding: 0;
    gap: 0;
    height: 100%;
    min-height: 0;
  }
  .sidebar-left,
  #sidebar-left { display: none; }
  .topbar-nav-item { flex: 1; width: auto; height: 48px; font-size: 1.25rem; }
  .topbar-search { width: 100%; max-width: 200px; }
}
@media (max-width: 768px) {
  .layout-grid {
    margin-top: 16px;
    padding: 0 12px 20px;
    gap: 16px;
  }
  .messenger-page .layout-grid {
    margin-top: 0;
    padding: 0;
    gap: 0;
  }
  .feed-center,
  main.feed-center {
    padding: 0;
  }

  [data-page="settings"] .settings-tabs {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    width: calc(100% + 40px);
  }
}
@media (max-width: 600px) {
  .topbar {
    padding-left: 8px;
    padding-right: 8px;
    column-gap: 6px;
  }
  .topbar-left {
    min-width: 0;
    gap: 4px;
  }
  .topbar-logo {
    width: 42px;
    height: 42px;
    margin-right: 0;
    overflow: hidden;
    justify-content: center;
  }
  .topbar-logo picture {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
  }
  .topbar-logo img {
    flex: 0 0 auto;
    width: auto;
    height: 70px;
    max-width: none;
    object-fit: contain;
    object-position: center top;
    border-radius: 0;
  }
  .topbar-right {
    gap: 4px;
    min-width: 0;
    flex-shrink: 0;
  }
  .topbar-right .icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1rem;
  }
  .profile-menu-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .profile-menu-btn .avatar-sm {
    width: 36px;
    height: 36px;
  }
  .profile-menu-btn .fa-caret-down { display: none; }
  .topbar-search { max-width: 140px; }
  .topbar-nav-item { height: 44px; font-size: 1.1rem; }
  .card-pad { padding: 14px 16px; }
  .composer-actions button { font-size: 0; gap: 0; padding: 10px; }
  .composer-actions button i { font-size: 1.25rem; }
  .profile-page .profile-cover { height: 200px; }
  .profile-page .profile-avatar { width: 120px; height: 120px; }
  .profile-page .profile-avatar-wrap { left: 16px; bottom: -60px; }
  .profile-page .profile-head { padding: 72px 16px 16px; }
  .profile-page .profile-tabs { padding: 0 12px; }

  [data-page="settings"] .settings-tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
  }

  .topbar-search { display: none; }
  .topbar-search-toggle { display: flex; }

  .fb-dropdown:not(#fb-messenger-dd):not(#fb-notif-dd):not(#fb-apps-dd),
  .profile-dropdown {
    max-width: calc(100vw - 24px) !important;
    width: min(360px, calc(100vw - 24px)) !important;
  }

  .mobile-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    padding: calc(var(--topbar-h) + 8px) 12px 12px;
  }
  .mobile-search-overlay.hidden { display: none; }
  .mobile-search-sheet {
    background: var(--bg-card, #fff);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: calc(100vh - var(--topbar-h) - 24px);
    display: flex;
    flex-direction: column;
  }
  .mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .mobile-search-field {
    flex: 1;
    position: relative;
  }
  .mobile-search-field i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
  }
  .mobile-search-field input {
    width: 100%;
    border: none;
    background: var(--bg-page);
    border-radius: 999px;
    padding: 12px 14px 12px 36px;
    font-size: 1rem;
  }
  .mobile-search-results {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
  }
  .mobile-search-results .search-item {
    padding: 12px 10px;
    min-height: 44px;
  }

  .earn-stats { grid-template-columns: 1fr; }
  .earn-game-grid { grid-template-columns: 1fr; }
  .pymk-scroll { padding: 12px 16px 16px; }
}

@media (min-width: 1024px) {
  .topbar-center {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding-left: 6px;
    padding-right: 6px;
    column-gap: 3px;
  }
  .topbar-logo,
  .topbar-logo picture {
    width: 38px;
    height: 38px;
  }
  .topbar-logo img { height: 64px; }
  .topbar-right { gap: 2px; }
  .topbar-right .icon-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 0.95rem;
  }
  .profile-menu-btn,
  .profile-menu-btn .avatar-sm {
    width: 34px;
    height: 34px;
  }
  .topbar-center { gap: 0; }
}
@media (min-width: 1400px) {
  .post-body { font-size: 1.05rem; }
  .post-header .name { font-size: 1.05rem; }
  .card-pad { padding: 18px 24px; }
}

.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden;
  width: 100%;
}
.card-pad { padding: 16px 20px; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.95rem;
}
.sidebar-link:hover { background: #e4e6eb; }
.sidebar-link > i {
  width: 36px; height: 36px; border-radius: 50%; background: var(--jtb-yellow-soft);
  display: flex; align-items: center; justify-content: center; color: #b8860b; font-size: 1rem;
}
.sidebar-user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.sidebar-heading {
  font-size: 1.05rem; font-weight: 700; color: var(--text-muted);
  padding: 12px 12px 8px; margin-top: 8px;
}
.contact-avatar-wrap { position: relative; flex-shrink: 0; }
.contact-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-page);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem;
}
.sponsored-box { margin-top: 16px; }
.sponsored-item { display: flex; gap: 12px; padding: 8px 12px; }
.sponsored-thumb {
  width: 120px; height: 120px; border-radius: var(--radius); flex-shrink: 0;
}
.sponsored-item p { margin: 4px 0 0; font-size: 0.8rem; color: var(--text-muted); }

/* Stories — Facebook web circles */
.stories-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 16px;
  scrollbar-width: none;
}
.stories-row::-webkit-scrollbar { display: none; }
.story-item {
  flex: 0 0 auto; text-align: center; cursor: pointer;
  width: clamp(56px, 14vw, 64px);
}
.story-item .story-ring-wrap {
  width: clamp(56px, 14vw, 64px);
  height: clamp(56px, 14vw, 64px); border-radius: 50%; padding: 2px;
  background: linear-gradient(45deg, var(--jtb-yellow), #e6b800);
  margin: 0 auto 4px;
  position: relative;
}
.story-item.create .story-ring-wrap {
  background: var(--border); padding: 2px; position: relative;
}
.story-item.create .story-inner {
  background: var(--bg-page); border: 2px dashed var(--border);
}
.story-inner {
  width: 100%; height: 100%; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem; color: var(--text-muted); overflow: hidden;
}
/* Story cover art fills the circle so the ring never frames blank space. */
.story-cover {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; display: block; background: var(--bg-page);
}
.story-item.create .story-plus-icon {
  position: absolute; bottom: 2px; right: 2px; width: 20px; height: 20px;
  background: var(--jtb-yellow); border-radius: 50%; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
}
.story-label { font-size: 0.72rem; font-weight: 600; color: var(--text); max-width: clamp(56px, 14vw, 64px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Composer — Facebook web */
.composer { padding: 12px 16px 0; display: flex; align-items: center; gap: 8px; }
.composer input {
  flex: 1; border: none; background: var(--bg-page); border-radius: 20px;
  padding: 10px 16px; font-size: 0.95rem; cursor: pointer;
}
.composer-divider { height: 1px; background: var(--border); margin: 12px 16px 0; }
.composer-actions {
  display: flex; justify-content: space-around; padding: 8px 12px 12px;
}
.composer-actions button {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: var(--radius);
  font-weight: 600; color: var(--text-muted); cursor: pointer; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.composer-actions button:hover { background: var(--bg-page); }
.composer-actions button i { font-size: 1.2rem; }
.composer-actions .ico-live { color: #e41e3f; }
.composer-actions .ico-photo { color: #42b72a; }
.composer-actions .ico-feel { color: #f7b928; }

/* Post */
.post-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px 0; }
.post-header .meta { flex: 1; }
.post-header .name { font-weight: 700; font-size: 0.95rem; }
.post-header .time { font-size: 0.8rem; color: var(--text-muted); }
.post-body { padding: 12px 16px; line-height: 1.5; font-size: 0.95rem; }
.post-stats {
  padding: 10px 16px; color: var(--text-muted); font-size: 0.85rem;
  display: flex; justify-content: space-between; align-items: center;
}
.post-stats .reactions { display: flex; align-items: center; gap: 6px; }
.reaction-icons { display: flex; }
.reaction-icons span {
  width: 18px; height: 18px; border-radius: 50%; font-size: 0.6rem;
  display: flex; align-items: center; justify-content: center; margin-left: -4px;
  border: 2px solid #fff;
}
.reaction-icons .r-like { background: #1877f2; color: #fff; }
.reaction-icons .r-love { background: #e41e3f; color: #fff; }
.post-actions { display: flex; padding: 4px 8px 8px; border-top: 1px solid var(--border); margin: 0 8px; }
.post-actions button {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: var(--radius);
  font-weight: 600; color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.post-actions button:hover { background: var(--bg-page); }
.post-actions button.liked { color: #1877f2; }
.verified { color: var(--jtb-yellow-hover); margin-left: 4px; font-size: 0.85rem; }

/* People you may know */
.pymk-scroll { display: flex; gap: 16px; overflow-x: auto; padding: 16px 20px 20px; }
.pymk-card {
  flex: 0 0 clamp(220px, 30vw, 320px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: #fff;
}
.pymk-card .body { padding: 16px; }
.pymk-card .btn-add {
  width: 100%; margin-top: 10px; background: var(--jtb-yellow); border: none;
  padding: 10px; border-radius: var(--radius); font-weight: 700; cursor: pointer; font-size: 0.95rem;
}
.pymk-card .btn-add--sent,
.pymk-card .btn-add:disabled {
  background: var(--bg-page, #f0f2f5);
  color: var(--text-muted, #65676b);
  cursor: default;
  opacity: 1;
}

/* Profile — full-width content (see fb-polish.css for layout) */
.profile-page .profile-cover { height: clamp(220px, 35vw, 400px); max-width: 100%; margin: 0 auto; background: #bcc0c4 center/cover no-repeat; position: relative; }
.profile-page .profile-avatar-wrap { position: absolute; left: clamp(16px, 4vw, 32px); bottom: -76px; }
.profile-page .profile-avatar { width: clamp(120px, 18vw, 180px); height: clamp(120px, 18vw, 180px); border-radius: 50%; border: 5px solid #fff; object-fit: cover; background: var(--bg-page); }
.profile-page .profile-head {
  max-width: 100%; margin: 0 auto; padding: 84px clamp(16px, 4vw, 32px) 20px; background: #fff;
  border-bottom: 1px solid var(--border);
}
.profile-page .profile-tabs {
  max-width: 100%; margin: 0 auto; display: flex; gap: 4px; padding: 0 clamp(16px, 4vw, 32px);
  background: #fff; border-bottom: 1px solid var(--border);
}

.profile-cover { height: 280px; background: linear-gradient(135deg, var(--jtb-yellow-soft), #fff); position: relative; }
.profile-avatar-wrap { position: absolute; left: 24px; bottom: -48px; }
.profile-avatar { width: 168px; height: 168px; border-radius: 50%; border: 5px solid #fff; object-fit: cover; background: var(--bg-page); }
.profile-head { padding: 56px 24px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.profile-tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; }
.profile-tabs a {
  padding: 14px 16px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.profile-tabs a.active { color: var(--jtb-yellow-hover); border-bottom-color: var(--jtb-yellow); }
.tab-panel { display: none; padding: 16px 0; }
.tab-panel.active { display: block; }

/* Profile photos / videos — Facebook-style 3-column grid */
.profile-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
}
.profile-photo-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: var(--bg-page);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
}
.profile-photo-item img,
.profile-photo-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-video-item .profile-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 1.5rem;
  pointer-events: none;
}
.profile-photos-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  background: var(--bg-page);
  border-radius: var(--radius-lg);
}
.profile-photos-empty i {
  font-size: 2.5rem;
  color: #ccd0d5;
  margin-bottom: 12px;
  display: block;
}
.profile-photos-empty p {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--jtb-black);
}
@media (max-width: 600px) {
  .profile-photos-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Earn sub-pages — profile-only access, no full Facebook chrome */
body.earn-sub-page .earn-sub-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.earn-sub-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.earn-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--jtb-black);
  text-decoration: none;
  white-space: nowrap;
}
.earn-back-link:hover { color: var(--jtb-yellow-hover); }
.earn-sub-title {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.earn-feed-link { width: auto !important; padding: 8px 14px !important; }
.earn-sub-grid main { width: 100%; max-width: 100%; }

/* Earn hub (profile only) */
.earn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.earn-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: 0.15s; min-height: 140px;
}
.earn-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: var(--jtb-yellow); }
.earn-card-icon {
  width: 48px; height: 48px; border-radius: 12px; background: var(--jtb-yellow-soft);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  margin-bottom: 12px; color: #b8860b;
}
.earn-card h4 { margin: 0 0 4px; font-size: 1rem; }
.earn-card p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.earn-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.earn-stat {
  background: var(--bg-page); border-radius: var(--radius); padding: 16px; text-align: center;
}
.earn-stat .val { font-size: 1.35rem; font-weight: 800; color: var(--jtb-black); }
.earn-stat .lbl { font-size: 0.8rem; color: var(--text-muted); }
.streak-bar {
  background: var(--jtb-yellow-soft); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px;
  border: 1px solid rgba(255, 204, 0, 0.4);
}

.hidden { display: none !important; }
body.modal-open { overflow: hidden; }

.online-dot {
  position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
  background: #31a24c; border: 2px solid #fff; border-radius: 50%;
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: min(560px, 96vw);
  max-height: 90vh; overflow: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border); gap: 12px;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; color: var(--text); }
.modal-body { padding: 16px; color: var(--text); }
.modal-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}
.modal-footer .btn { width: auto; min-width: 120px; }
.modal-header .icon-btn {
  flex-shrink: 0;
  color: var(--text);
  background: var(--bg-page);
}
.modal-header .icon-btn:hover { background: var(--border); }

#jtb-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--jtb-black); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem; z-index: 100000; opacity: 0; pointer-events: none;
  transition: 0.25s;
}
#jtb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Search */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px;
  background: #fff; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  max-height: 320px; overflow: auto; z-index: 100;
}
.search-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
}
.search-item:hover { background: var(--bg-page); }
.search-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--jtb-yellow-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem;
}
.search-empty { padding: 16px; color: var(--text-muted); text-align: center; }

/* Stories extras */
.story-plus {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 36px; background: var(--jtb-yellow); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; border: 3px solid #fff;
}
.story-bg {
  width: 100%; height: 100%; background: linear-gradient(180deg,var(--jtb-yellow-soft),#e4e6eb);
  display: flex; align-items: center; justify-content: center;
}
.story-avatar-light { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Posts */
.post-card { margin-bottom: 20px; width: 100%; }
.post-avatar {
  width: clamp(40px, 5vw, 48px); height: clamp(40px, 5vw, 48px); border-radius: 50%; background: var(--bg-page);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
}
.post-actions .save-btn { flex: 0 0 48px; }
.post-actions .save-btn.saved { color: var(--jtb-yellow-hover); }
.comments-section {
  display: none;
  flex-direction: column;
  padding: 0 0 12px;
  border-top: 1px solid var(--border);
  max-height: min(480px, 70vh);
}
.comments-section.open {
  display: flex !important;
}
.comments-list {
  flex: 1 1 auto;
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #bcc0c4 transparent;
}
.comments-list::-webkit-scrollbar { width: 6px; }
.comments-list::-webkit-scrollbar-thumb {
  background: #bcc0c4;
  border-radius: 8px;
}
.comments-empty {
  margin: 12px 0;
  text-align: center;
}
.comment-item { padding: 8px 0; font-size: 0.9rem; border-bottom: 1px solid var(--bg-page); }
.comment-time { color: var(--text-muted); font-size: 0.75rem; margin-left: 8px; }
.comment-form,
.comment-input-area {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
  margin: 0;
  padding: 10px 16px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-card, #fff);
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.comment-form input {
  flex: 1; border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px;
}
.comment-form button {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--jtb-yellow); cursor: pointer;
}

.pymk-photo {
  height: clamp(140px, 22vw, 220px); background: var(--jtb-yellow-soft); display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: clamp(1.5rem, 4vw, 2.5rem); color: #b8860b;
}

/* Page tabs */
.page-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; height: 0; }
.page-tabs a {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  flex: 0 0 auto;
  white-space: nowrap;
  text-decoration: none;
}
.page-tabs a.active { color: var(--jtb-yellow-hover); border-bottom-color: var(--jtb-yellow); }
.tab-section { display: none; }
.tab-section.active { display: block; }
[data-page="friends"] .tab-section.active {
  display: block !important;
}
[data-page="friends"] .tab-section.d-none {
  display: none !important;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  max-width: 100%;
}
.friend-avatar {
  width: clamp(56px, 10vw, 72px); height: clamp(56px, 10vw, 72px); border-radius: 50%; background: var(--jtb-yellow-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; font-size: 1rem;
}
.friend-meta { flex: 1; min-width: 0; }
.friend-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.friend-row-actions .btn {
  white-space: nowrap;
}
@media (max-width: 768px) {
  [data-page="friends"] .page-tabs {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    width: calc(100% + 40px);
  }
  .friend-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .friend-row-actions {
    width: 100%;
    margin-left: calc(clamp(56px, 10vw, 72px) + 12px);
  }
  .friend-row-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 0.82rem !important;
  }
}
@media (max-width: 600px) {
  [data-page="friends"] .page-tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
  }
  .friend-row-actions {
    margin-left: 0;
  }
}
.muted { color: var(--text-muted); font-size: 0.85rem; }
.btn-sm { width: auto !important; padding: 8px 16px !important; font-size: 0.9rem !important; }

/* Messenger */
.messenger-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.chat-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg-card, #fff);
}
.messenger-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}
.messenger-list-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}
.messenger-new-btn {
  width: 36px !important;
  height: 36px !important;
}
.messenger-search {
  margin: 0 12px 8px;
  width: calc(100% - 24px);
  max-width: calc(100% - 24px);
  box-sizing: border-box;
}
.messenger-active-tray-wrap {
  padding: 0 12px 10px;
  flex-shrink: 0;
}
.messenger-active-tray-wrap.hidden {
  display: none;
}
.messenger-active-tray {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.messenger-active-tray::-webkit-scrollbar { display: none; }
.messenger-active-user {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 64px;
  padding: 0;
  text-align: center;
}
.messenger-active-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  margin: 0 auto 4px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}
.messenger-active-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messenger-active-initials {
  font-size: 0.75rem;
  font-weight: 800;
}
.messenger-active-name {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 12px;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.chat-item:hover, .chat-item.active { background: var(--bg-page); }
.chat-item-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.chat-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.chat-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.chat-list-empty {
  padding: 16px 12px;
  text-align: center;
}
.chat-thread-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-card, #fff);
}
.chat-thread-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chat-thread-view--empty {
  align-items: center;
  justify-content: center;
}
.chat-back-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-page);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-back-btn:hover { background: #e4e6eb; }

@media (max-width: 1023px) {
  .messenger-layout {
    grid-template-columns: 1fr;
    position: relative;
    overflow: hidden;
  }
  .chat-list-panel,
  .chat-thread-panel {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    transition: transform 0.28s ease, opacity 0.28s ease;
  }
  .messenger-layout.messenger-view-list .chat-thread-panel {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
  }
  .messenger-layout.messenger-view-thread .chat-list-panel {
    transform: translateX(-28%);
    opacity: 0;
    pointer-events: none;
  }
  .messenger-layout:not(.messenger-view-thread) .chat-thread-panel {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
  }
  .messenger-layout.messenger-view-thread .chat-thread-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  .chat-back-btn { display: inline-flex; }
}
@media (min-width: 1024px) {
  .chat-back-btn { display: none; }
}
.chat-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
.chat-header-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.chat-header-action-btn {
  text-decoration: none;
  color: inherit;
}
.chat-header-profile {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  flex: 1;
  text-decoration: none; color: inherit; cursor: pointer;
  border-radius: 8px; padding: 4px 6px; margin: -4px -6px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.chat-header-profile:hover { background: var(--bg-page); }
.chat-header-profile:hover .chat-header-name { text-decoration: underline; }
.chat-header-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--bg-page);
}
.chat-header-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.chat-header-name {
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: min(100%, 280px);
}
.online-label { color: #31a24c; font-size: 0.8rem; font-weight: 600; }
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.chat-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 18px; font-size: 0.95rem; line-height: 1.4;
}
.chat-bubble > .chat-bubble-time {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.chat-bubble .chat-reel-preview span {
  margin-top: 0;
}
.chat-bubble.mine { align-self: flex-end; background: var(--jtb-yellow); color: var(--jtb-black); position: relative; }
.chat-msg-del {
  position: absolute; top: 4px; left: -28px; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; opacity: 0; padding: 2px; font-size: 0.7rem;
}
.chat-bubble.mine:hover .chat-msg-del { opacity: 1; }
.chat-msg-del:hover { color: #c00; }
.chat-bubble.theirs { align-self: flex-start; background: var(--bg-page); }
.chat-image { max-width: 220px; border-radius: 12px; display: block; margin-bottom: 4px; cursor: pointer; }
.chat-post-card {
  display: block; text-decoration: none; color: inherit; background: rgba(0,0,0,0.06);
  border-radius: 12px; padding: 10px; margin-bottom: 6px; border: 1px solid var(--border);
}
.chat-bubble.mine .chat-post-card { background: rgba(0,0,0,0.08); }
.chat-post-card p { margin: 4px 0 0; font-size: 0.85rem; }

/* Compact reel preview in Messenger (TikTok / IG style) */
.chat-bubble--reel {
  padding: 4px;
  background: transparent !important;
  max-width: min(220px, 72vw);
  box-shadow: none;
}
.chat-bubble--reel .chat-bubble-text {
  display: block;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9375rem;
  line-height: 1.35;
}
.chat-bubble--reel.mine .chat-bubble-text {
  background: var(--jtb-yellow);
  color: var(--jtb-black);
}
.chat-bubble--reel.theirs .chat-bubble-text {
  background: var(--bg-page);
}
.chat-bubble--reel .chat-bubble-time {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.chat-bubble--reel.mine .chat-bubble-time {
  color: rgba(0, 0, 0, 0.55);
  text-align: right;
}

/* Messenger message reactions — lightweight Facebook-style toolbar */
.chat-bubble-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 72%;
  align-self: flex-start;
}
.chat-bubble-wrap.mine { align-self: flex-end; }
.chat-bubble-wrap .chat-bubble { max-width: 100%; }
.chat-msg-react-toolbar {
  position: absolute;
  top: -18px;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 20px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}
.chat-bubble-wrap.mine .chat-msg-react-toolbar { right: 0; }
.chat-bubble-wrap.theirs .chat-msg-react-toolbar { left: 0; }
.chat-msg-react-toolbar.open,
.chat-bubble-wrap:hover .chat-msg-react-toolbar { display: flex; }
@media (max-width: 1023px) {
  .chat-bubble-wrap:hover .chat-msg-react-toolbar:not(.open) { display: none; }
}
.chat-msg-react-btn {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.12s ease;
}
.chat-msg-react-btn:hover { transform: scale(1.2); }
.chat-msg-react-btn.active { background: rgba(255, 204, 0, 0.25); }
.chat-msg-reactions {
  margin-top: 2px;
  font-size: 0.75rem;
  align-self: flex-end;
}
.chat-bubble-wrap.theirs .chat-msg-reactions { align-self: flex-start; }
.chat-react-summary {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.chat-react-emoji { font-size: 0.85rem; line-height: 1; }
.chat-react-count { color: var(--text-muted); font-size: 0.7rem; margin-left: 2px; }
.chat-reel-preview-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 9 / 16;
  min-height: 180px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.5rem;
}

.chat-reel-preview {
  display: block;
  width: min(220px, 100%);
  max-width: 220px;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #0f0f0f;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-reel-preview:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.chat-reel-preview--unavailable {
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px dashed var(--border);
  box-shadow: none;
}

.chat-reel-preview-media {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: linear-gradient(160deg, #1c1e21 0%, #3a3b3c 100%);
  overflow: hidden;
}

.chat-reel-preview-thumb,
.chat-reel-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.chat-reel-preview-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  padding-left: 3px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.chat-reel-preview-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.chat-reel-preview-creator-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--jtb-yellow-soft, #fff3bf);
  color: var(--jtb-black, #050505);
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.chat-reel-preview-caption {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.chat-reel-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-reel-preview-handle {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Story reply reference in Messenger */
.chat-bubble--story {
  padding: 4px;
  background: transparent !important;
  max-width: min(200px, 68vw);
  box-shadow: none;
}
.chat-bubble--story .chat-bubble-text {
  display: block;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9375rem;
  line-height: 1.35;
}
.chat-bubble--story.mine .chat-bubble-text {
  background: var(--jtb-yellow);
  color: var(--jtb-black);
}
.chat-bubble--story.theirs .chat-bubble-text {
  background: var(--bg-page);
}
.chat-story-preview {
  width: min(120px, 100%);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--jtb-yellow, #ffcc00);
  background: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.chat-story-preview-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}
.chat-story-preview-fallback {
  width: 100%;
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.25rem;
}
.chat-story-preview-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
}

.chat-seen-label { text-align: right; font-size: 0.7rem; color: var(--text-muted); padding: 4px 16px 0; flex-shrink: 0; }
.chat-typing {
  flex-shrink: 0;
}
.chat-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
  flex-shrink: 0; width: 100%; box-sizing: border-box; min-width: 0;
  background: var(--bg-card, #fff);
}
.chat-input .chat-input-field,
.chat-input input[type="text"] {
  flex: 1 1 auto; flex-grow: 1; min-width: 0;
  border: none; background: var(--bg-page); border-radius: 20px;
  padding: 10px 16px; color: var(--text); font: inherit;
}
.chat-input .chat-input-field:focus,
.chat-input input[type="text"]:focus { outline: 2px solid rgba(255, 204, 0, 0.45); }
.chat-input .chat-input-tool {
  flex: 0 0 auto; flex-shrink: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chat-input .chat-send-btn,
.chat-input > button:not(.icon-btn) {
  flex: 0 0 auto; flex-shrink: 0;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 50%; border: none; background: var(--jtb-yellow); color: var(--jtb-black);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chat-input .chat-send-btn:hover,
.chat-input > button:not(.icon-btn):hover { filter: brightness(0.95); }
@media (max-width: 480px) {
  .chat-input { gap: 6px; padding: 8px 10px; }
  .chat-input .chat-input-tool { width: 34px; height: 34px; }
  .chat-header-name { max-width: 160px; }
  .chat-bubble { max-width: 85%; }
}
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.chat-empty i { color: var(--jtb-yellow); margin-bottom: 16px; }
.chat-item.has-unread strong { font-weight: 800; }
.chat-item-meta { flex: 1; min-width: 0; }
.chat-item-meta small {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-unread {
  background: var(--jtb-yellow); color: #1c1e21; font-size: 0.7rem; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 5px;
}
.chat-avatar-wrap { position: relative; }
.chat-online-dot {
  position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
  background: #31a24c; border: 2px solid #fff; border-radius: 50%;
}
.chat-audio { width: min(220px, 70vw); margin: 4px 0; display: block; }
.chat-emoji-bar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px;
  border-top: 1px solid var(--border); background: #fff;
  flex-shrink: 0;
}
.chat-emoji-btn {
  border: none; background: transparent; font-size: 1.25rem; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
}
.chat-emoji-btn:hover { background: var(--bg-page); }
.chat-input .icon-btn {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%; border: none;
  background: var(--bg-page); cursor: pointer; color: var(--text-muted, #65676b);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; touch-action: manipulation;
}
.chat-input .icon-btn:hover { background: #e4e6eb; color: #1c1e21; }
.chat-input .icon-btn.recording {
  background: #e41e3f; color: #fff; animation: chatMicPulse 1s ease infinite;
}
@keyframes chatMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228,30,63,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(228,30,63,0); }
}
.chat-voice-hint {
  text-align: center; font-size: 0.8rem; color: #e41e3f; font-weight: 600;
  padding: 4px 12px 10px; flex-shrink: 0;
}
.chat-bubble.mine > .chat-bubble-time { color: rgba(0,0,0,0.55); }

/* Notifications */
.notif-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
}
.notif-item.unread { background: var(--jtb-yellow-soft); }
.notif-item i {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* Groups */
.group-cover {
  height: 100px; background: var(--jtb-yellow-soft); border-radius: 8px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center; color: #b8860b;
}
#groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.group-cover {
  height: clamp(120px, 18vw, 180px); background: var(--jtb-yellow-soft); border-radius: 8px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center; color: #b8860b;
}

/* Reels browse grid on main reels page */
#reels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.reel-card { cursor: pointer; border-radius: var(--radius-lg); overflow: hidden; background: #fff; border: 1px solid var(--border); width: 100%; }
.reel-thumb {
  aspect-ratio: 9/16; min-height: 220px; background: linear-gradient(180deg, #1c1e21, #3a3b3c);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem;
}
.reel-meta { padding: 12px 14px; font-size: 0.9rem; }

/* Market */
#market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.market-img {
  height: clamp(180px, 25vw, 260px); background: var(--bg-page); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 2rem;
}

/* Earn tap */
.tap-circle {
  width: 140px; height: 140px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--jtb-yellow); font-size: 3rem; color: var(--jtb-black);
  box-shadow: 0 4px 20px rgba(255,204,0,0.4); transition: transform 0.1s;
}
.tap-circle:active { transform: scale(0.95); }
.earn-game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.earn-game-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 12px;
  background: #fff; cursor: pointer; text-align: center;
}
.earn-game-card:hover { border-color: var(--jtb-yellow); background: var(--jtb-yellow-soft); }
.earn-game-card i { font-size: 1.5rem; color: #b8860b; display: block; margin-bottom: 8px; }
.reel-meta span { color: var(--text-muted); display: block; }

.friend-chip {
  display: inline-block; background: var(--bg-page); padding: 6px 12px; border-radius: 20px;
  margin: 4px; font-size: 0.85rem; font-weight: 600;
}

.auth-error { color: #e41e3f; font-size: 0.85rem; text-align: center; margin-top: 12px; }
.auth-forgot { text-align: center; margin-top: 12px; font-size: 0.85rem; }
.auth-forgot a { color: var(--jtb-yellow-hover); font-weight: 600; }

/* Optimistic pending / upload feedback */
.post-card--pending,
.post-card--failed {
  position: relative;
}

.jtb-pending-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  pointer-events: none;
}

.reel-slide--pending .jtb-pending-overlay {
  pointer-events: none;
  background: transparent;
  backdrop-filter: none;
}

.jtb-pending-overlay--compact {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  border-radius: 14px;
  pointer-events: none;
}

.jtb-pending-overlay--compact .jtb-pending-inner {
  color: #fff;
  padding: 14px 18px;
  min-width: 140px;
}

.jtb-pending-overlay--compact .jtb-pending-inner i.fa-spin {
  color: #fff;
}

.jtb-pending-overlay--compact .jtb-pending-bar {
  background: rgba(255, 255, 255, 0.25);
}

.jtb-pending-overlay--compact .jtb-pending-bar > span {
  background: var(--jtb-yellow, #ffcc00);
}

.jtb-pending-overlay--compact.jtb-pending-overlay--failed,
.jtb-pending-overlay--failed.jtb-pending-overlay--compact {
  pointer-events: auto;
}

.post-card--pending .jtb-pending-overlay,
.reel-slide--pending .jtb-pending-overlay--failed {
  pointer-events: auto;
}

.jtb-pending-overlay--failed {
  background: rgba(255, 255, 255, 0.88);
}

.jtb-pending-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #1c1e21);
}

.jtb-pending-inner i.fa-spin {
  font-size: 1.25rem;
  color: var(--jtb-yellow-hover, #b8860b);
}

.jtb-pending-bar {
  width: min(160px, 60vw);
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.jtb-pending-bar > span {
  display: block;
  height: 100%;
  background: var(--jtb-yellow, #ffcc00);
  border-radius: 4px;
  transition: width 0.15s ease;
}

.jtb-pending-bar--indeterminate > span {
  width: 40% !important;
  animation: jtbPendingIndeterminate 1.1s ease-in-out infinite;
}

@keyframes jtbPendingIndeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.jtb-pending-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  pointer-events: auto;
}

.story-item--uploading .story-ring-wrap {
  opacity: 0.85;
}

.story-item--uploading .story-inner::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--jtb-yellow, #ffcc00);
  border-radius: 50%;
  animation: jtbspin 0.7s linear infinite;
  z-index: 3;
  pointer-events: none;
}

.story-item--uploading .story-inner {
  position: relative;
}

.story-item--failed .story-label {
  color: #e41e3f;
}

@keyframes jtbspin {
  to { transform: rotate(360deg); }
}
