/* =============================================================== FRIENDS ==
   The friends button on home, the friends screen, the challenge sheet and the
   incoming-challenge toast. Social is teal, so it never reads as a mode. */

.friendsIcon {
  width: 30px;
  height: 30px;
  flex: none;
  fill: #fff;
  stroke: #0b5f63;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.friendsIcon__back { fill: #b8fff1; }

/* ---------- Home: beside "my cards" ---------- */

.homeFoot:has(.friendsBtn:not([hidden])) {
  grid-template-columns: 1fr auto;
  gap: 10px;
}

/* Sharing the row: "my cards" keeps its label on one line. */
.homeFoot:has(.friendsBtn:not([hidden])) .cardsBtn { gap: 10px; padding-inline: 14px; }
.homeFoot:has(.friendsBtn:not([hidden])) .cardsBtn__label {
  white-space: nowrap;
  font-size: clamp(16px, 4.8vw, 21px);
}

.friendsBtn {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-width: 78px;
  padding: 8px 12px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #4fe0c8 0%, #17a99a 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 6px 0 #0b6f69, 0 14px 22px -8px rgba(0, 0, 0, .45);
  touch-action: manipulation;
  transition: transform .09s ease-out, box-shadow .09s ease-out;
}

.friendsBtn[hidden] { display: none; }

.friendsBtn:active {
  transform: translateY(5px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 1px 0 #0b6f69;
}

.friendsBtn__label {
  font: 700 15px/1 var(--font-display);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}

.friendsBtn__badge {
  position: absolute;
  top: -8px;
  left: -6px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ff4d6d;
  font: 800 13px/1 var(--font-ui);
  animation: friends-pop 1.6s ease-in-out infinite;
}

.friendsBtn__badge[hidden] { display: none; }

@keyframes friends-pop {
  0%, 70%, 100% { transform: scale(1); }
  80% { transform: scale(1.18); }
}

/* ---------- The screen ---------- */

.screen--friends {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #145f73 0%, #1b3f79 55%, #1d2461 100%);
}

.screen--friends .modal { position: fixed; }

.friends__coins { margin-inline-start: auto; }

.friends__scroll {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.friendAdd { display: grid; gap: 8px; }

.friendAdd__row { display: flex; gap: 8px; }

.friendAdd__input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font: 600 16px/1.2 var(--font-he);
}

.friendAdd__input::placeholder { color: rgba(255, 255, 255, .55); }
.friendAdd__input:focus { outline: none; border-color: #4fe0c8; background: rgba(255, 255, 255, .16); }

.friendAdd__btn { flex: none; padding: 12px 18px; }

.friendAdd__status {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(79, 224, 200, .15);
  border: 1px solid rgba(79, 224, 200, .45);
  color: #b8fff1;
  font: 600 14px/1.4 var(--font-he);
}

.friendAdd__status.is-bad {
  background: rgba(255, 90, 120, .12);
  border-color: rgba(255, 90, 120, .35);
  color: #ffb3c1;
}

.friendAdd__status[hidden],
.friends__block[hidden] { display: none; }

.friends__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 600 18px/1.2 var(--font-display);
}

.friends__count {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  font: 800 12px/1.4 var(--font-ui);
}

.friends__count:empty { display: none; }

.friends__empty {
  margin: 0;
  text-align: center;
  color: var(--text-2);
  font: 600 14px/1.45 var(--font-he);
}

.friendList {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .07);
}

.friend__avatar { --size: 44px; }

/* Online: a green dot on the picture. */
.friend { position: relative; }

.friend[data-online]::after {
  content: '';
  position: absolute;
  top: 40px;
  right: 10px;
  width: 13px;
  height: 13px;
  border: 2.5px solid #1d3f79;
  border-radius: 50%;
  background: #8a93b8;
}

.friend[data-online="true"]::after { background: #3ee07a; }
.friend[data-online="false"] .friend__avatar { filter: grayscale(.6); opacity: .8; }

.friend__who {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.friend__who b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 17px/1.2 var(--font-he);
}

.friend__who small {
  font: 600 12.5px/1.2 var(--font-he);
  color: var(--text-2);
}

.friend__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.friend__actions .btn { padding: 9px 14px; font-size: 14px; }

.friend__challenge:disabled { opacity: .4; }

.friend__remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--text-2);
  font-size: 14px;
}

/* ---------- The challenge sheet ---------- */

.challenge__pick { display: grid; gap: 14px; }
.challenge__pick[hidden],
.challenge__wait[hidden],
.sheet__note[hidden] { display: none; }

.stakeChoice { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }

.stakeChoice .choice__opt:not(:first-child)::before {
  content: '';
  justify-self: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, #ffd35a 55%, #e0960f);
  box-shadow: 0 2px 0 #a86800;
}

.challenge__wait { display: grid; gap: 6px; }

.challenge__vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.challenge__vs .avatar { --size: 64px; }

.challenge__vs .avatar:last-child { animation: friends-wait 1.2s ease-in-out infinite; }

@keyframes friends-wait {
  50% { transform: translateY(-5px); }
}

.challenge__pot {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe07a, #f0a014);
  color: #5a3000;
  font: 700 20px/1.1 var(--font-display);
  box-shadow: 0 3px 0 #a86800;
  direction: ltr;
}

.challenge__wait .modal__body { text-align: center; }

/* ---------- The incoming challenge ---------- */

.inviteToast {
  position: fixed;
  z-index: 60;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: center;
  width: min(440px, calc(100% - 24px));
  padding: 12px 14px;
  border: 2px solid rgba(79, 224, 200, .6);
  border-radius: 22px;
  background: linear-gradient(180deg, #1a6f80, #1b3f79);
  color: #fff;
  box-shadow: 0 8px 0 #0f2a55, 0 20px 40px -10px rgba(0, 0, 0, .6);
  transform: translateX(-50%);
  animation: toast-in .4s var(--ease-out, ease-out) both;
}

.inviteToast[hidden] { display: none; }

@keyframes toast-in {
  from { transform: translate(-50%, -30px); opacity: 0; }
}

.inviteToast .avatar { --size: 48px; }

.inviteToast__body { display: grid; gap: 2px; min-width: 0; }

.inviteToast__text { margin: 0; font: 700 16px/1.3 var(--font-he); }

.inviteToast__meta {
  margin: 0;
  font: 600 13px/1.3 var(--font-he);
  color: #b8fff1;
}

.inviteToast__timer { height: 4px; margin: 4px 0 0; }
.inviteToast__timer .searchBar__fill { background: linear-gradient(90deg, #4fe0c8, #b8fff1); }

.inviteToast__actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inviteToast__actions .btn { padding: 10px 12px; }

@media (prefers-reduced-motion: reduce) {
  .friendsBtn__badge,
  .challenge__vs .avatar:last-child,
  .inviteToast { animation: none; }
}
