/* global css styles */
/* used across all html files */
/* currently unfinished */

body {
  font-family: Arial, Helvetica, sans-serif;
  background: white;
  color: black;
  margin: 0;
}

/* Links are black, visited or not: this beats the browser's blue and purple in both states.
   Components that color their links (category colors, buttons, themed profiles) use class
   rules, which win over a bare element selector. */
a {
  color: black;
}

/* Mentions, hashtags and web links written in a post are light blue, visited or not. Quote and
   media cards inside posts are classed links, so they keep their own look. */
.post-content a:not([class]) {
  color: #1da1f2;
}

/* Text boxes keep the size the layout gives them; nobody can drag them bigger. */
textarea {
  box-sizing: border-box;
  max-width: 100%;
  resize: none;
}

:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

.navbar {
  width: 100%;
  height: 65px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e3e3e3;
  padding: 0 20px;
  box-sizing: border-box;
}

.nav-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.search-bar {
  box-sizing: border-box;
  width: 400px;
  max-width: 90%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 15px;
  background: #f9f9f9;
  outline: none;
  transition: all 0.2s ease;
}

.search-bar:focus {
  background: #fff;
  border-color: #bbb;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pfp {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.display-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  color: black;
}

.username {
  font-size: 13px;
  color: #777;
}

.verified {
  width: 15px;
  height: 15px;
}

.nav-right-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

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

.post-header .user-info {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column; /* stack name, username, timestamp vertically */
}

.post-header .post-author-avatar {
  display: block;
  flex-shrink: 0;
}

.post-header .post-author-avatar img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.post-header .post-author-name {
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.post-header .username {
  color: #666;
  font-size: 0.85rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.post-header .post-timestamp {
  color: #888;
  font-size: 0.75rem;
}

.post-community {
  font-size: 0.8rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.community-post-link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.post-author-name:hover,
.community-post-link:hover {
  text-decoration: underline;
}

.post-header .username-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.post-header .username-time {
  display: flex;
  flex-direction: column; /* username above timestamp */
  font-size: 0.85rem;
  color: #666;
}

.profile-pic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ccc;
}

.display-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #222;
}

.username {
  font-size: 0.9rem;
  color: #666;
}
.verified-badge {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  fill: #1d9bf0;
  margin-left: 2px;
  margin-bottom: 2px;
}

.user-menu {
  position: absolute;
  top: 65px;
  right: 0;
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  min-width: 160px;
  overflow: hidden;
  z-index: 999;
}

.user-menu a {
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  font-size: 15px;
  transition: background 0.2s;
}

.user-menu a:hover {
  background: #f5f5f5;
}

main {
  flex-grow: 1;
  padding: 20px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* notification bell styles */

#notificationBell {
  position: relative;
  margin-right: 20px;
}

#notificationBell {
  display: inline-flex;
  align-items: center;
  color: black;
  cursor: pointer;
}

#notificationIcon {
  width: 26px;
  height: 26px;
}

#notificationCount {
  position: absolute;
  top: -5px;
  right: -5px;
  background: red;
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 0.75rem;
  display: none;
}

#navUserPfp {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

/* now for the tweemoji stuff */
.twemoji {
  height: 1em;
  width: 1em;
  vertical-align: -0.1em;
}

/* everything else is handled by each individual css file */
/* home button in the top bar */
.nav-left {
  min-width: 40px;
}

.nav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: black;
}

.nav-home:hover {
  background: #f2f2f2;
}

.nav-home svg {
  width: 26px;
  height: 26px;
}

/* the top bar stays put so the sidebar can sit right under it */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* left sidebar (built by scripts/utils/sidebar.js on logged-in pages) */

body.has-sidebar {
  padding-left: 240px;
}

/* The top bar still spans the whole window, above the sidebar. */
body.has-sidebar .navbar {
  margin-left: -240px;
  width: calc(100% + 240px);
}

.sidebar {
  position: fixed;
  top: 65px;
  bottom: 0;
  left: 0;
  width: 240px;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 20px 0;
  background: white;
  border-right: 1px solid #e3e3e3;
  z-index: 50;
}

.sidebar hr {
  margin: 12px 0;
  border: none;
  border-top: 1px solid #e3e3e3;
}

.side-heading {
  margin: 0 12px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #888;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: black;
  text-decoration: none;
  font-size: 1rem;
}

.side-link:hover {
  background: #f2f2f2;
}

.side-link.active {
  font-weight: 700;
  background: #f2f2f2;
}

.side-link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.side-link.side-small {
  font-size: 0.9rem;
  color: #444;
  padding: 7px 12px;
}

.side-link.side-small svg {
  width: 18px;
  height: 18px;
}

.side-link.category svg {
  color: var(--cat);
}

/* The open category fills with its color, a shade deeper so the white text stays readable. */
.side-link.category.active {
  background: color-mix(in srgb, var(--cat) 75%, black);
  color: white;
}

.side-link.category.active svg {
  color: white;
}

.side-link.category:hover {
  background: var(--cat);
  color: white;
  box-shadow: none;
}

.side-link.category:hover svg {
  color: white;
}

/* narrow screens: the sidebar shrinks to its icons */
@media (max-width: 760px) {
  .sidebar {
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  body.has-sidebar {
    padding-left: 52px;
  }

  body.has-sidebar .navbar {
    margin-left: -52px;
    width: calc(100% + 52px);
  }

  .sidebar {
    width: 52px;
  }

  .side-link {
    justify-content: center;
    padding: 9px 0;
  }

  .side-link span,
  .side-heading {
    display: none;
  }
}

/* live notification popups (scripts/utils/liveNotifications.js) */
@media (max-width: 600px) {
  .nav-right .user-info {
    display: none;
  }
}

.toast-stack {
  position: fixed;
  top: 75px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: flex-start;
  background: white;
  border: 1px solid #e3e3e3;
  border-left: 3px solid black;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  animation: toast-in 0.2s ease-out;
}

.toast.leaving {
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 10px 0 10px 12px;
  color: black;
  text-decoration: none;
}

.toast-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
}

.toast-icon.round {
  border-radius: 50%;
  object-fit: cover;
}

.toast-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.9rem;
}

.toast-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.toast-detail {
  color: #666;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-close {
  padding: 6px 10px;
  border: none;
  background: none;
  color: #888;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  color: black;
}

/* delete / report / block under posts (scripts/utils/community.js) */

.community-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 0.85rem;
}

.community-controls button {
  padding: 0;
  border: none;
  background: none;
  color: #555;
  font: inherit;
  cursor: pointer;
}

.community-controls button:hover {
  color: black;
  text-decoration: underline;
}

/* movie, album and video game attachments in posts: the same box as sports quote cards */

.movie-quote,
.album-quote,
.videogame-quote,
.artist-quote {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
}

.movie-quote:hover,
.album-quote:hover,
.videogame-quote:hover,
.artist-quote:hover {
  border-color: #999;
}

.post-content .movie-quote img,
.post-content .album-quote img,
.post-content .videogame-quote img,
.post-content .artist-quote img,
.movie-quote img,
.album-quote img,
.videogame-quote img,
.artist-quote img {
  width: 46px;
  max-width: 46px;
  margin: 0;
  border-radius: 3px;
  object-fit: cover;
}

.movie-quote img {
  aspect-ratio: 2 / 3;
}

.album-quote img,
.artist-quote img {
  width: 56px;
  max-width: 56px;
  aspect-ratio: 1;
}

.videogame-quote img {
  aspect-ratio: 3 / 4;
}

.movie-quote span,
.album-quote span,
.videogame-quote span,
.artist-quote span {
  white-space: normal;
  font-size: 0.9rem;
}

.movie-quote small,
.album-quote small,
.videogame-quote small,
.artist-quote small {
  color: #666;
}

/* music and video players in posts (scripts/utils/postMedia.js) */

.media-embed {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 3px;
}

.media-embed.youtube {
  height: auto;
  aspect-ratio: 16 / 9;
  min-height: 200px;
}

/* a deleted post that still has replies */

.deleted-post {
  padding: 14px;
  border: 1px dashed #ccc;
  border-radius: 3px;
  color: #777;
  font-style: italic;
}

/* blocked accounts on the settings page */

.blocked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.blocked-row .button-secondary {
  padding: 5px 10px;
  font-size: 0.85rem;
}

.moderation-link {
  display: inline-block;
  margin-top: 16px;
  text-decoration: none;
}

/* moderation queue (moderation.html) */

.moderation-main {
  display: block;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px;
}

.moderation-main h1 {
  margin: 0 0 10px;
}

.moderation-status {
  color: #666;
}

.moderation-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
}

.moderation-toolbar h2 {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
}

.moderation-toolbar select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  font: inherit;
}

.audit-heading {
  margin: 0 0 6px;
  font-weight: 700;
}

#moderationWorkspace[hidden],
#moreReports[hidden],
#moreActions[hidden] {
  display: none;
}

.report-card {
  overflow-wrap: anywhere;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
}

.report-meta {
  font-size: 0.8rem;
  color: #777;
}

.report-reason {
  margin: 6px 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.report-post {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid #e3e3e3;
  color: #444;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* banned / suspended account notice under the navbar (scripts/utils/accountBan.js) */

.ban-notice {
  padding: 10px 16px;
  background: #fff4f4;
  border-bottom: 1px solid #e3e3e3;
  border-left: 3px solid #c62828;
  color: #333;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* shared dialogs and notices (scripts/utils/ui.js) */

.toast.toast-error {
  border-left-color: #c62828;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
}

.dialog {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  padding: 20px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.dialog h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.dialog-message {
  margin: 0;
  color: #444;
  overflow-wrap: anywhere;
}

.dialog-label {
  display: block;
  margin: 10px 0 5px;
  font-weight: 600;
}

.dialog textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

.dialog-error {
  margin: 8px 0 0;
  color: red;
  font-size: 0.9rem;
}

.dialog-error:empty {
  display: none;
}

.dialog-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* sandbox's two button looks: black for the main action, outlined for the rest */
.dialog-buttons button,
.button-primary,
.button-secondary {
  padding: 10px 16px;
  border: 1px solid black;
  border-radius: 3px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dialog-buttons button {
  flex: 1;
}

.dialog-cancel,
.button-secondary {
  background: white;
  color: black;
}

.dialog-confirm,
.button-primary {
  background: black;
  color: white;
}

.dialog-confirm.danger {
  background: #c62828;
  border-color: #c62828;
}

.button-primary:disabled,
.button-secondary:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Category labels are shared by feeds, profiles and threads. */
.category-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cat);
  text-decoration: none;
}

.category-label::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat);
}

.category-label:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .navbar {
    padding: 0 10px;
    gap: 6px;
  }

  .nav-right-wrapper {
    flex-shrink: 0;
  }

  #notificationBell {
    margin-right: 12px;
  }

  .nav-home {
    width: 44px;
    height: 44px;
  }

  button,
  select,
  .side-link,
  .side-link.side-small,
  .user-menu a {
    min-height: 44px;
    box-sizing: border-box;
  }

  button {
    min-width: 44px;
  }

  input,
  textarea,
  select,
  .search-bar {
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }

  main,
  .post-content,
  .side-box,
  .sports-box {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .post-actions,
  .play-composer-row,
  .game-tools,
  .league-tabs {
    flex-wrap: wrap;
  }

  .league-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    box-sizing: border-box;
  }

  .sports-page {
    width: 100%;
    padding: 16px 12px;
  }

  .dialog-backdrop .dialog,
  .modal-backdrop .modal {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}

@media (hover: none) {
  .post:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Shared wordmark stays compact enough for the phone header. */
.nav-home {
  width: auto;
  height: auto;
  min-height: 40px;
  padding: 0 5px;
  border-radius: 3px;
  font:
    italic 700 20px Arial,
    sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.brand-separator {
  margin: 0 6px;
  color: #777;
  font-style: normal;
}
.brand-category {
  font-style: normal;
  font-size: 15px;
}
.automation-label {
  display: inline-block;
  font:
    400 11px Arial,
    sans-serif;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 4px;
  vertical-align: middle;
}
@media (max-width: 760px) {
  .navbar .nav-home {
    width: auto;
    font-size: 15px;
    padding: 0 2px;
  }
  .brand-category {
    font-size: 11px;
    max-width: 70px;
    white-space: normal;
  }
  .brand-separator {
    margin: 0 3px;
  }
}

/* account bans form (moderation.html) */

.ban-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 10px 0;
}

.ban-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.ban-form input,
.ban-form select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

.ban-form label[hidden] {
  display: none;
}

/* accounts that chose square profile pictures (AccountBadges.pfpClass in scripts/utils/emoji.js).
   important: it has to beat every avatar rule's own border-radius: 50%. */
img.pfp-square {
  border-radius: 3px !important;
}

/* reposts and quotes (scripts/utils/reposts.js, Sports.quoteCard) */

.repost-label {
  margin-bottom: 6px;
  color: #777;
  font-size: 0.85rem;
}

.repost-label a {
  color: inherit;
  font-weight: bold;
  text-decoration: none;
}

.repost-label a:hover {
  text-decoration: underline;
}

.repost-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.repost-btn .repost-icon {
  display: inline-flex;
  font-size: 18px;
  opacity: 0.45;
  filter: grayscale(1);
}

.repost-btn[aria-pressed='true'] .repost-icon,
.repost-btn:hover .repost-icon {
  opacity: 1;
  filter: none;
}

.repost-btn[aria-pressed='true'] .repost-count {
  font-weight: bold;
}

.repost-btn .twemoji {
  width: 18px;
  height: 18px;
}

.repost-menu {
  position: absolute;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  min-width: 140px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.repost-menu button {
  padding: 9px 12px;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.repost-menu button:hover,
.repost-menu button:focus-visible {
  background: #f2f2f2;
}

.quote-dialog select,
.feedback-dialog select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

.quoted-post {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  text-decoration: none;
  /* Post text is pre-wrap; only the quoted text itself keeps its line breaks. */
  white-space: normal;
}

a.quoted-post:hover {
  border-color: #999;
}

.quoted-post-author {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.quoted-post-author img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.quoted-post-author span {
  overflow: hidden;
  color: #777;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quoted-post-text {
  display: block;
  margin-top: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quoted-post-image {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin-top: 8px;
  border-radius: 3px;
}

.quoted-post-unavailable {
  color: #777;
}

.home-feed-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.home-feed-tabs button[aria-pressed='true'] {
  background: black;
  color: white;
}
.audience-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}
.post-audience {
  font-size: 0.75rem;
  color: inherit;
}

.audience-picker select {
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: black;
  font: inherit;
}
@media (max-width: 760px) {
  .composer-actions .audience-picker {
    grid-area: 1 / 1 / 2 / 3;
    min-width: 0;
  }
  .composer-actions .audience-picker > span {
    display: none;
  }
  .composer-actions .audience-picker select {
    min-height: 44px;
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }
}

.moderation-community-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}
.moderation-community-search input {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}
.moderation-community-search button {
  padding: 10px;
}
#moreModerationCommunities[hidden] {
  display: none;
}
/* Shared by game, movie, artist and sports team detail pages. */
.related-communities {
  margin: 20px 0;
}

.related-community {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
}

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

.related-community > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.related-community p {
  margin: 4px 0 0;
  color: #666;
  font-size: 0.9rem;
}

.related-communities button[hidden] {
  display: none;
}

/* Read by screen readers only. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* loading screen (scripts/utils/appLoading.js): the page stays hidden until the navbar is filled */
html.app-loading body > :not(.app-loader) {
  visibility: hidden;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  transition: opacity 0.2s ease;
}

.app-loader-done {
  opacity: 0;
  pointer-events: none;
}

.app-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.app-loader-mark {
  font:
    italic 700 28px Arial,
    sans-serif;
}

.app-loader-text {
  margin: 0;
  color: #666;
}

/* Wide enough for three dots, so the line doesn't shift as they come and go. */
.app-loader-dots {
  display: inline-block;
  min-width: 16ch;
  text-align: left;
}

.app-loader-error p {
  margin: 0 0 12px;
  color: #666;
}

/* like, reply and repost (scripts/utils/postActions.js): plain icons and counts. Icons stay gray
   until hovered (when they grow and take their color) or pressed; only the count text changes. */
.post-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.post-action,
.repost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.post-action img,
.repost-btn .repost-icon {
  width: 20px;
  height: 20px;
  filter: grayscale(1);
  opacity: 0.6;
  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    opacity 0.15s ease;
}

.post-action:hover,
.post-action:focus-visible {
  text-decoration: none;
}

.post-action:hover img,
.post-action:focus-visible img,
.repost-btn:hover .repost-icon,
.repost-btn:focus-visible .repost-icon {
  transform: scale(1.2);
  opacity: 1;
  filter: none;
}

/* The gray heart is tinted red while hovered. */
.like-action:hover img,
.like-action:focus-visible img {
  filter: brightness(0) saturate(100%) invert(27%) sepia(83%) saturate(2417%) hue-rotate(337deg) brightness(91%)
    contrast(91%);
}

.like-action[aria-pressed='true'] img,
.repost-btn[aria-pressed='true'] .repost-icon {
  opacity: 1;
  filter: none;
}

.like-action:hover,
.like-action:focus-visible,
.like-action[aria-pressed='true'] {
  color: #c82333;
}

.reply-action:hover,
.reply-action:focus-visible {
  color: #1a7fc4;
}

.repost-btn:hover,
.repost-btn:focus-visible,
.repost-btn[aria-pressed='true'] {
  color: #128a48;
}

.post-action:active img,
.repost-btn:active .repost-icon {
  transform: scale(0.95);
}

.post-action:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Phones keep like, reply, repost, edit, save and share on one line, even in indented thread
   replies: tighter gaps, and 40px-wide tap targets that are still 44px tall. */
@media (max-width: 760px) {
  .post-actions {
    flex-wrap: nowrap;
    gap: 2px;
  }

  .post-action,
  .repost-btn,
  .post-icon-btn {
    justify-content: center;
    min-width: 40px;
    min-height: 44px;
    padding: 0 4px;
  }

  .post-actions .qol-post-tools {
    gap: 2px;
  }

  .post-actions .qol-post-tools .link-button {
    padding: 0 6px;
  }
}

/* link previews (scripts/utils/linkPreviews.js) */
.embedded-link,
.embedded-link-break {
  display: none;
}

.link-preview {
  display: flex;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  background: white;
  color: black;
  text-decoration: none;
  white-space: normal;
}

.link-preview:hover {
  background: #f7f7f7;
  text-decoration: none;
}

.link-preview-image {
  flex-shrink: 0;
  width: 120px;
  min-height: 100%;
  max-height: 120px;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
  background: #f2f2f2;
}

.link-preview-large {
  flex-direction: column;
}

.link-preview-large .link-preview-image {
  width: 100%;
  max-height: 280px;
  aspect-ratio: 1.91;
}

.link-preview-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.link-preview-domain {
  color: #777;
  font-size: 0.8rem;
}

.link-preview-title,
.link-preview-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.link-preview-description {
  color: #666;
}

/* GIF and image links shown under a post's text (Sports.gifImages), here and in the composer preview */
.post-link-image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  margin-top: 8px;
  border-radius: 3px;
}

/* image viewer (scripts/utils/imageViewer.js) */
.post-gallery img,
.post-inline-image,
.message-image,
.post-content .post-link-image {
  cursor: zoom-in;
}

html.image-viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  touch-action: none;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.image-viewer-stage img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 3px;
  cursor: zoom-in;
  transition: transform 0.15s ease;
  user-select: none;
}

.image-viewer-stage img.zoomed {
  cursor: zoom-out;
}

.image-viewer-close,
.image-viewer-nav {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font:
    28px/1 Arial,
    sans-serif;
  cursor: pointer;
}

.image-viewer-close:hover,
.image-viewer-nav:hover {
  background: rgba(255, 255, 255, 0.15);
}

.image-viewer-close {
  top: 12px;
  right: 12px;
}

.image-viewer-previous {
  left: 12px;
}

.image-viewer-next {
  right: 12px;
}

.image-viewer-nav[hidden] {
  display: none;
}

.image-viewer-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.9rem;
}

@media (hover: none) {
  .image-viewer-nav {
    top: auto;
    bottom: 12px;
  }
}

/* video player (scripts/utils/videoPlayer.js) */
.video-player {
  position: relative;
  overflow: hidden;
  margin-top: 8px;
  border-radius: 3px;
  background: black;
  color: white;
  line-height: 0;
}

.video-player:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

.video-player .post-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  margin: 0;
}

.video-player.fullscreen .post-video {
  height: 100%;
  max-height: none;
}

.video-big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.video-player.paused .video-big-play {
  display: flex;
}

.video-big-play svg {
  width: 30px;
  height: 30px;
  margin-left: 3px;
}

.video-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 10px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  line-height: normal;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-player.controls-visible .video-controls,
.video-player:focus-within .video-controls {
  opacity: 1;
}

.video-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.video-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: white;
  font:
    700 13px Arial,
    sans-serif;
  cursor: pointer;
}

.video-button:hover,
.video-button:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}

.video-button[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.25);
}

.video-button[hidden] {
  display: none;
}

.video-button svg {
  width: 20px;
  height: 20px;
}

.video-volume {
  display: flex;
  align-items: center;
}

.video-time {
  padding: 0 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.video-spacer {
  flex: 1;
}

.video-seek,
.video-volume-range {
  --progress: 0%;
  appearance: none;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  background: linear-gradient(to right, white var(--progress), rgba(255, 255, 255, 0.35) var(--progress));
  cursor: pointer;
}

.video-seek {
  display: block;
  width: 100%;
  margin-bottom: 4px;
}

.video-volume-range {
  width: 70px;
}

.video-seek::-webkit-slider-thumb,
.video-volume-range::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
}

.video-seek::-moz-range-thumb,
.video-volume-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: white;
}

/* Phones change volume with their buttons, so the slider makes room for the rest. */
@media (hover: none), (max-width: 520px) {
  .video-volume-range {
    display: none;
  }

  .video-button {
    min-width: 44px;
    min-height: 44px;
  }

  .video-controls {
    opacity: 0;
  }
}

/* phone navigation (scripts/utils/sidebar.js): a drawer from the top bar and a bottom tab bar */
.nav-menu-button,
.mobile-tabbar,
.sidebar-backdrop,
.mobile-search-cancel {
  display: none;
}

@media (max-width: 760px) {
  .nav-left {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .nav-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: none;
    color: black;
    cursor: pointer;
  }

  .nav-menu-button svg {
    width: 24px;
    height: 24px;
  }

  body.has-sidebar {
    padding-left: 0;
  }

  body.has-sidebar .navbar {
    margin-left: 0;
    width: 100%;
  }

  /* The header keeps the menu, the centered wordmark and the account menu; search opens from
     the tab bar over the header. */
  body.has-tabbar .nav-center {
    display: none;
  }

  body.has-tabbar .nav-home {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  body.has-tabbar.mobile-search-open .nav-center {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: white;
  }

  body.has-tabbar.mobile-search-open .search-bar {
    flex: 1;
    width: auto;
    max-width: none;
  }

  body.has-tabbar.mobile-search-open .mobile-search-cancel {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
  }

  /* The tab bar carries notifications and messages on phones. */
  body.has-tabbar #notificationBell,
  body.has-tabbar .dm-header-link {
    display: none;
  }

  body.has-tabbar {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }

  .sidebar {
    top: 0;
    z-index: 1200;
    width: min(280px, 85vw);
    padding: 16px 0 calc(16px + env(safe-area-inset-bottom));
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }

  .sidebar.sidebar-open {
    transform: none;
    visibility: visible;
  }

  .sidebar .side-link {
    justify-content: flex-start;
    padding: 9px 16px;
  }

  .sidebar .side-link span,
  .sidebar .side-heading {
    display: inline;
  }

  .sidebar .side-heading {
    display: block;
    margin: 0 16px 6px;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: block;
    background: rgba(0, 0, 0, 0.4);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  html.drawer-open {
    overflow: hidden;
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #e3e3e3;
    background: white;
  }

  .mobile-tab {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    color: #555;
  }

  .mobile-tab[aria-current='page'] {
    color: black;
  }

  .mobile-tab svg {
    width: 26px;
    height: 26px;
  }

  .mobile-tab[aria-current='page'] svg {
    stroke-width: 2.6;
  }

  .mobile-tab-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: red;
    color: white;
    font-size: 0.7rem;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
  }

  .mobile-tab-badge[hidden] {
    display: none;
  }

  .toast-stack {
    top: auto;
    bottom: calc(66px + env(safe-area-inset-bottom));
  }
}

.side-link[hidden] {
  display: none;
}

/* preview invites and feedback on the moderation page (scripts/moderationPreview.js) */
.invite-card.revoked {
  color: #888;
}

.invite-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.05em;
}

.report-card p {
  margin: 0 0 6px;
}

.feedback-message {
  white-space: pre-wrap;
}

.feedback-card select {
  margin-left: 6px;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

/* live connection lost (scripts/utils/liveNotifications.js) */
.connection-banner {
  position: fixed;
  top: 73px;
  left: 50%;
  z-index: 1500;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border-radius: 3px;
  background: #222;
  color: white;
  font-size: 0.9rem;
  transform: translateX(-50%);
}

@media (max-width: 760px) {
  .connection-banner {
    top: auto;
    bottom: calc(66px + env(safe-area-inset-bottom));
  }
}

.health-error summary {
  cursor: pointer;
  overflow-wrap: anywhere;
}

.health-error pre {
  margin: 8px 0 0;
  overflow-x: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

/* the page the service worker shows offline (pwa/offline.html) */
.offline-main {
  max-width: 420px;
  margin: 0 auto;
  padding: 18vh 16px 0;
  text-align: center;
}

.offline-main h1 {
  margin: 12px 0 8px;
  font-size: 1.4rem;
}

.offline-main p {
  margin: 0 0 16px;
  color: #666;
}

.offline-main .button-primary {
  width: auto;
  padding: 10px 18px;
}

/* Signed-out invitations to join (feeds, posts and the top bar; scripts/utils/navMenu.js) */
.signed-out-join {
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
}

.signed-out-join p {
  margin: 0 0 10px;
}

.signed-out-join-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signed-out-join-actions a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  text-decoration: none;
}

/* signed-out top bar (scripts/utils/navMenu.js): log in and sign up instead of the account menu */
.nav-auth {
  display: none;
}

html.signed-out .nav-right-wrapper,
html.signed-out .nav-center {
  display: none;
}

html.signed-out .nav-auth {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

html.signed-out .nav-auth a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  text-decoration: none;
}
