/* Profiles and avatars. Colors come only from the theme variables in app.css. */

/* avatars: the generated SVG and the photo always fill the round .avatar box */
.avatar-gen, .avatar-photo { background: var(--panel-2); }
.avatar > svg, .avatar > img { display: block; width: 100%; height: 100%; }

/* profile header */
.profile-top { display: flex; align-items: center; gap: 20px; }
.profile-pic { flex: none; line-height: 0; }
.profile-pic .avatar { width: 128px !important; height: 128px !important; box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--line); }
.profile-live .profile-pic .avatar { box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--accent); }
.profile-id { flex: 1; min-width: 0; }
.profile-id h1 { font-size: 1.75rem; margin: 0; overflow-wrap: anywhere; }
.profile-handle { margin: 2px 0 10px; overflow-wrap: anywhere; }
.profile-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .92rem; }
.profile-stats b { color: var(--text); font-size: 1.1rem; margin-right: 2px; }
.profile-bio { margin: 16px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.profile-online { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--accent); }
.profile-online-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.profile-actions { margin-top: 16px; }
.profile-actions .btn, .profile-actions button { min-height: 44px; }
.profile-actions .tag { font-size: .9rem; padding: 6px 12px; margin: 0; }

/* favorite games grid and recent shelf */
.profile-games, .profile-shelf, .profile-clubs, .profile-people { list-style: none; margin: 0; padding: 0; }
.profile-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.profile-game { display: flex; flex-direction: column; gap: 6px; color: var(--text); border-radius: 10px; }
a.profile-game:hover { text-decoration: none; }
a.profile-game:hover .profile-game-title { text-decoration: underline; }
.cover.profile-cover { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 10px; font-size: 1.6rem; }
.profile-game-title { font-weight: 600; font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }

/* a sideways shelf: thin visible scrollbar, plus arrow buttons added by script when it overflows */
.profile-shelf-wrap { position: relative; }
.profile-shelf { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 10px; margin: -2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--muted) var(--panel-2); }
.profile-shelf::-webkit-scrollbar { height: 8px; }
.profile-shelf::-webkit-scrollbar-track { background: var(--panel-2); border-radius: 4px; }
.profile-shelf::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 4px; }
.profile-shelf-item { flex: 0 0 116px; scroll-snap-align: start; }
.profile-shelf-item .profile-game { gap: 2px; height: 100%; }
.profile-shelf-item .cover { margin-bottom: 4px; }
.profile-shelf-btn {
  position: absolute; top: 56px; z-index: 2; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  background: var(--panel); color: var(--text); border: var(--line-width) solid var(--muted); box-shadow: 0 4px 14px var(--shadow);
}
.profile-shelf-btn[hidden] { display: none; }
.profile-shelf-btn:disabled { opacity: 0; pointer-events: none; }
.profile-shelf-prev { left: -8px; }
.profile-shelf-next { right: -8px; }
a.profile-game:focus-visible, a.profile-club:focus-visible, a.profile-top-row:focus-visible, a.profile-friend-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
a.profile-game:hover .cover, a.profile-top-row:hover .cover, a.profile-club:hover .cover, a.profile-hist-cover:hover .cover { box-shadow: 0 0 0 2px var(--accent); }
.profile-play { margin-top: 8px; width: 100%; min-height: 44px; }

.profile-tags { margin: 0; }
.profile-tags .tag { font-size: .85rem; padding: 4px 10px; }
.profile-subs { margin: 8px 0 0; }

/* clubs: the whole row is the link */
.profile-clubs li + li { border-top: var(--line-width) solid var(--line); }
.profile-club { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 56px; color: var(--text); border-radius: 10px; }
a.profile-club:hover { text-decoration: none; }
a.profile-club:hover .profile-club-name { text-decoration: underline; }
.profile-club .cover { width: 40px; border-radius: 8px; font-size: .9rem; }
.profile-club-main { display: flex; flex-direction: column; min-width: 0; }
.profile-club-name { font-weight: 600; overflow-wrap: anywhere; }

/* mutual friends */
.profile-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 12px; }
.profile-people a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 2px; color: var(--text); text-align: center; font-size: .85rem; border-radius: 10px; }
.profile-people a:hover { text-decoration: none; background: var(--panel-2); }
.profile-people span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* stats */
.profile-statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.profile-statgrid div { background: var(--panel-2); border: var(--line-width) solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; }
.profile-statgrid dt { color: var(--muted); font-size: .82rem; line-height: 1.3; }
.profile-statgrid dd { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; line-height: 1.1; color: var(--text); }
.profile-unit { font-size: .9rem; font-weight: 600; color: var(--muted); }
.profile-facts { list-style: none; margin: 0; padding: 0; color: var(--muted); }
.profile-facts li { margin-bottom: 4px; }
.profile-facts strong { color: var(--text); }
.profile-sub { margin: 20px 0 8px; padding-top: 16px; border-top: var(--line-width) solid var(--line); font-size: 1rem; }
.profile-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.profile-top-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 0; min-height: 56px; color: var(--text); border-radius: 10px; }
a.profile-top-row:hover { text-decoration: none; }
a.profile-top-row:hover .profile-top-title { text-decoration: underline; }
.profile-top-row .cover { width: 40px; border-radius: 6px; }
.profile-top-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-top-title { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-top-count { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* weekly availability */
.profile-both { margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: var(--line-width) solid var(--line); }
.profile-both h3 { margin-bottom: 4px; }
.profile-both p { margin: 0; }
.profile-both .avail-faces a, .profile-both .avail-faces-more { box-shadow: 0 0 0 2px var(--panel-2); }

/* play history */
.profile-hist-filter label { margin-top: 0; }
.profile-hist-filter { margin-bottom: 8px; }
.profile-hist { list-style: none; margin: 0; padding: 0; }
.profile-hist-row { display: flex; gap: 12px; padding: 12px 0; align-items: flex-start; }
.profile-hist-row + .profile-hist-row { border-top: var(--line-width) solid var(--line); }
.profile-hist-cover { flex: none; line-height: 0; border-radius: 8px; }
.profile-hist-cover .cover { width: 48px; }
.profile-hist-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.profile-hist-title { font-weight: 600; overflow-wrap: anywhere; }
.profile-hist-title a { color: var(--text); display: inline-block; padding: 2px 0; }
.profile-hist-with { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.profile-hist-with a { font-weight: 600; }
.profile-hist-with .small a { display: inline-block; padding: 4px 0; }

/* friends list rows: the picture and text are one link to the profile */
.profile-friend-link { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 56px; color: var(--text); border-radius: 10px; }
.profile-friend-link:hover { text-decoration: none; color: var(--text); }
.profile-friend-link:hover .title { text-decoration: underline; }
.profile-friend-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.profile-friend-name { overflow-wrap: anywhere; }
.profile-friend-now { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--good-text); }
.profile-friend-face { display: inline-flex; border-radius: 50%; flex: none; }

/* photo and bio page */
.profile-edit-photo { display: flex; gap: 20px; align-items: flex-start; }
.profile-edit-preview { display: flex; align-items: flex-end; gap: 12px; flex: none; }
.profile-edit-photo .grow { flex: 1; min-width: 0; }
.profile-edit-photo label:first-of-type { margin-top: 0; }
.profile-file { display: block; width: 100%; padding: 10px; min-height: 44px; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.profile-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-edit-buttons { margin: 14px 0 12px; }
.profile-edit-buttons button, .profile-edit-photo button { min-height: 44px; }
.profile-count-full { color: var(--warn); }

@media (max-width: 560px) {
  .profile-top { gap: 14px; }
  .profile-pic .avatar { width: 96px !important; height: 96px !important; }
  .profile-id h1 { font-size: 1.4rem; }
  .profile-games { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .profile-shelf-item { flex-basis: 104px; }
  .profile-statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-top-row { grid-template-columns: 40px minmax(0, 1fr); }
  .profile-top-count { grid-column: 2; text-align: left; margin-top: -6px; }
  .profile-shelf-btn { display: none; }
  .profile-edit-photo { flex-direction: column; }
  .profile-actions .btn, .profile-actions form, .profile-actions button { flex: 1 1 auto; }
}

/* favorites: keep the Play buttons level when a title wraps */
.profile-games li { display: flex; flex-direction: column; }
.profile-games .profile-game { flex: 1; }
