.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 18vw, 400px);
  gap: 24px;
  align-items: start;
  padding: 20px 20px 0;
  box-sizing: border-box;
}

.profile-shell {
  min-width: 0;
}

.banner {
  width: 100%;
  height: clamp(140px, 12vw, 220px);
  background-size: cover;
  background-position: center;
  border-radius: 3px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  margin-top: -32px;
  padding: 0 16px 14px;
  overflow-wrap: anywhere;
}

.profile-pic {
  width: 96px;
  height: 96px;
  border-radius: 100px;
  border: 4px solid white;
  object-fit: cover;
  background: white;
}

.post-profile-pic {
  width: 50px;
  height: 50px;
  border-radius: 100px;
  border: 4px solid white;
  object-fit: cover;
  background: white;
}

.name-section {
  text-align: left;
  min-width: 0;
}

.name-section .display-name {
  font-size: 1.5rem;
  font-weight: bold;
}

.profile-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
}

/* follow and the 🚫 block button, side by side */
.profile-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

#followBtn {
  flex-shrink: 0;
  padding: 7px 12px;
}

#blockBtn {
  padding: 7px 9px;
  line-height: 1;
}

#blockBtn[hidden] {
  display: none;
}

#blockBtn .twemoji {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

#blockBtn[aria-pressed='true'] {
  border-color: #c62828;
}

#followBtn.is-following {
  background: black;
  color: white;
}

#bio {
  margin-top: 8px;
  color: #555;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

#followCounts {
  margin-top: 8px;
  color: #444;
  font-size: 0.85rem;
}

.profile-presence {
  margin-top: 8px;
  color: #777;
  font-size: 0.8rem;
}

.profile-presence:empty {
  display: none;
}

.profile-presence.online {
  color: #2e7d32;
}

.profile-presence.online::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: currentColor;
}

.profile-setting-note {
  font-size: 0.85rem;
  color: #777;
}

#username {
  font-size: 0.9rem;
  color: #666;
  margin-top: 2px;
}

.verified-badge {
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle;
  margin-left: 4px;
}

.post-verified-badge {
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle;
  margin-left: 0px;
}

.posts {
  max-width: 600px;
  margin: 20px auto;
  padding: 0 10px;
}

.post {
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 15px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}

.post:hover {
  transform: translateY(-2px);
}

.post-content {
  word-wrap: break-word;
  margin-top: 8px;
  font-size: 1rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin-top: 8px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #555;
}

.twemoji {
  height: 1em;
  width: 1em;
  vertical-align: -0.1em;
}
.follow-count-link {
  color: inherit;
  text-decoration: none;
}

.follow-count-link:hover {
  text-decoration: underline;
}

/* posts on the left, the sports box on the right */

.profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 25%, 340px);
  justify-content: start;
  align-items: start;
  gap: 24px;
  padding: 0;
}

.profile-body .profile-tabs,
.profile-body .posts {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.profile-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
  min-width: 0;
}

.profile-main {
  min-width: 0;
}

/* Narrow screens: the sports box sits above the posts. */
@media (max-width: 960px) {
  .profile-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .profile-side {
    order: -1;
  }
}

@media (max-width: 760px) {
  .profile-layout {
    padding: 10px 10px 0;
  }

  .profile-info {
    padding-left: 8px;
    padding-right: 8px;
  }

  .banner {
    height: 96px;
  }

  #followBtn {
    padding: 7px 9px;
    font-size: 0.85rem;
  }
}

.profile-discovery {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.profile-discovery-card {
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  padding: 16px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-discovery-card h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.discovery-note {
  color: #777;
  font-size: 0.8rem;
  margin: 0 0 12px;
}

.discovery-entry {
  display: block;
  border-top: 1px solid #eee;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}

.discovery-entry:first-child {
  border-top: 0;
  padding-top: 0;
}

.discovery-entry:last-child {
  padding-bottom: 0;
}

.discovery-entry strong,
.discovery-entry small {
  display: block;
}

.discovery-entry strong {
  font-size: 0.9rem;
}

.discovery-entry small {
  font-size: 0.8rem;
  color: #777;
  margin-top: 4px;
}

.discovery-snippet {
  margin: 5px 0;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discovery-entry:hover strong,
.discovery-person-link:hover strong {
  text-decoration: underline;
}

.discovery-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.discovery-person-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.discovery-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.discovery-person-link > span {
  min-width: 0;
}

.discovery-person-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discovery-person button {
  padding: 6px 9px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.discovery-person button[aria-pressed='true'] {
  background: black;
  color: white;
}

.discovery-more {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.85rem;
  color: #666;
}

.discovery-more[hidden] {
  display: none;
}

@media (max-width: 1250px) {
  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-discovery {
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  }
}

/* posts / replies tabs */

.profile-tabs {
  display: flex;
  max-width: 600px;
  margin: 20px auto 0;
  padding: 0 10px;
  border-bottom: 1px solid #e3e3e3;
}

.profile-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font: inherit;
  font-weight: 600;
  color: #777;
  cursor: pointer;
}

.profile-tab:hover {
  background: #f9f9f9;
}

.profile-tab.active {
  color: black;
  border-bottom-color: black;
}

.replying-to {
  font-size: 0.8rem;
  color: #666;
  margin-top: 6px;
}

.replying-to a {
  color: black;
  text-decoration: none;
}

/* edit profile popup */

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

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

.modal {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 20px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: Arial, Helvetica, sans-serif;
}

.modal h2 {
  margin: 0 0 10px;
  text-align: center;
}

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

.modal input[type='text'],
.modal input[type='url'],
.modal textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
  font-size: 1rem;
}

.modal textarea {
}

.modal input[type='file'] {
  max-width: 100%;
  margin-top: 5px;
  font: inherit;
  font-size: 0.85rem;
}

.edit-banner {
  height: 90px;
  border-radius: 3px;
  background: #ddd center / cover no-repeat;
}

.edit-pfp {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
}

.modal-status {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: red;
}

.modal-status:empty {
  display: none;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-buttons button {
  flex: 1;
  padding: 10px;
  border: 1px solid black;
  border-radius: 3px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: white;
  color: black;
}

.modal-buttons button[type='submit'] {
  background: black;
  color: white;
}

.modal-buttons button:disabled {
  opacity: 0.6;
  cursor: default;
}

body.modal-open {
  overflow: hidden;
}

.profile-movie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 300px;
}

.profile-movie-grid > a {
  min-width: 0;
  overflow-wrap: anywhere;
  scroll-snap-align: start;
}

.profile-movie-grid > a[hidden],
.favorite-navigation[hidden] {
  display: none;
}

.profile-movie-grid.favorites-expanded {
  max-width: none;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: min(130px, calc((100% - 12px) / 2));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
}

.favorite-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 3px;
  background: #eee;
  margin-bottom: 5px;
}

#favoriteAlbumsBox .favorite-placeholder {
  aspect-ratio: 1;
}

#favoriteGamesBox .favorite-placeholder {
  aspect-ratio: 3 / 4;
}

.favorite-controls,
.favorite-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.favorite-navigation {
  margin: 0;
}

.favorite-controls button {
  padding: 7px 10px;
  font-size: 0.85rem;
}
.profile-movie-grid a {
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
}
.profile-movie-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 5px;
}
.profile-box-settings {
  margin-top: 16px;
}
.edit-note {
  margin: 4px 0 0;
  color: #777;
  font-size: 0.85rem;
}
.profile-box-settings label {
  font-weight: normal;
}

.profile-shell {
  border-radius: 3px;
}
.profile-shell.profile-themed {
  color: var(--profile-text);
}
/* Links take the profile's text color. :where() keeps this as weak as the sitewide black, so
   buttons and colored labels keep their own colors. */
:where(.profile-themed) a {
  color: var(--profile-text);
}
.profile-themed
  :is(#bio, #username, #followCounts, .profile-presence, .empty-posts, .profile-tab, .post-username, .post-time) {
  color: inherit;
}
.profile-themed :is(.sports-box, .post, .post-card) {
  background: transparent;
  color: inherit;
}
.profile-themed .profile-tab.active {
  color: inherit;
  border-bottom-color: currentColor;
}
.profile-themed .profile-tab:hover {
  background: transparent;
  color: inherit;
}
.profile-colors input[type='color'] {
  width: 64px;
  height: 44px;
  padding: 3px;
  cursor: pointer;
}
.profile-colors #gradientEndField[hidden] {
  display: none;
}
.profile-color-preview {
  padding: 20px;
  min-height: 100px;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin: 16px 0;
}
.profile-color-preview p {
  color: inherit;
}

/* a profile you blocked, or that blocked you (profile.js showBlockedProfile) */
.blocked-profile {
  padding: 24px 16px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  text-align: center;
}
.blocked-profile p {
  margin: 6px 0 14px;
  color: #666;
}
.blocked-reading {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid #c62828;
  background: #fafafa;
  color: #555;
  font-size: 0.9rem;
}

.profile-shell.profile-themed #displayName,
.profile-themed .post-header .username,
.profile-themed .post-header .post-timestamp,
.profile-themed .post-actions,
.profile-themed .community-controls button,
.profile-themed .sports-box a {
  color: inherit;
}

.profile-friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-body[hidden],
.profile-discovery[hidden] {
  display: none;
}
.profile-heading-row {
  flex-wrap: wrap;
}

.profile-actions {
  margin-left: auto;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.persona-banner {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e3e3e3;
  font-size: 14px;
}
.persona-banner[hidden],
.persona-switcher[hidden] {
  display: none;
}
.persona-banner a {
  text-decoration: none;
}
.persona-switcher {
  position: relative;
}
.persona-switcher summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
}
.persona-switcher summary::-webkit-details-marker {
  display: none;
}
.persona-switcher nav {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  width: 220px;
  max-width: calc(100vw - 85px);
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 2px 8px #0002;
}
.persona-switcher nav a {
  display: block;
  padding: 12px;
  color: black;
  text-decoration: none;
}
.persona-switcher nav a:hover,
.persona-switcher nav a:focus {
  background: #f4f4f4;
}
.persona-review,
.persona-track {
  padding: 10px 0;
  border-bottom: 1px solid #e3e3e3;
  overflow-wrap: anywhere;
}
.persona-review:last-child,
.persona-track:last-child {
  border-bottom: 0;
}
.persona-review p {
  margin: 4px 0;
}
.persona-track small,
.playing-game-row small {
  display: block;
  color: #666;
  font-size: 12px;
}

.profile-social-link {
  display: block;
  color: inherit;
  padding: 8px 0;
  overflow-wrap: anywhere;
}
.profile-social-link + .profile-social-link {
  border-top: 1px solid #e3e3e3;
}
.profile-social-link strong,
.profile-social-link small {
  display: block;
}
.profile-social-link small {
  color: #666;
  margin-top: 3px;
}
#profileLinksBox[hidden],
#profileLinksEmpty[hidden],
#editSocialLinks[hidden] {
  display: none;
}
.profile-social-edit-row {
  margin: 12px 0;
}
.profile-social-edit-row input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
}

#sportsBox [data-sports-item][hidden],
#sportsBox .players-section-title[hidden] {
  display: none;
}
.sports-box-more {
  margin-top: 12px;
}

.profile-tabs {
  flex-wrap: wrap;
}
.profile-review-title {
  font-size: 1.05rem;
  margin: 12px 0 8px;
}
.profile-review-title a {
  color: inherit;
}
.profile-review-content {
  margin-top: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Signed out, the boxes column needs an account (scripts/profile.js). */
.profile-side[hidden] {
  display: none;
}
