/* =========================================================
   FIGHTDLE — CHALLENGE A FRIEND
   Banner for a player arriving from a challenge link, and the panel
   on each game's result card (leaderboard, or head-to-head when there's
   no board, + "Challenge a friend").
   Neutral dark/gold so it sits inside every game's own card.
   ========================================================= */

.ch-banner {
  box-sizing: border-box;
  width: min(560px, 92%);
  margin: 12px auto;
  padding: 10px 14px;
  background: rgba(30, 30, 30, .92);
  border: 2px solid var(--gold, #c4a26a);
  border-radius: 12px;
  color: #eee;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}
.ch-banner strong { color: var(--gold-bright, #d9b77a); }

/* Some result cards outline all their text (Connections) or restyle every
   button and input; the panel opts out so it reads the same everywhere. */
.ch-panel, .ch-panel * { text-shadow: none; }
.ch-panel .ch-name { text-align: center; }

.ch-panel {
  box-sizing: border-box;
  width: 100%;   /* some cards size their children to fit; the row inside needs the card's width */
  margin: 10px auto 6px;
  font-family: var(--font-body);
  color: #eee;
  text-align: center;
}

/* Leaderboard: everyone on this challenge who has finished */
.ch-board {
  margin-bottom: 8px;
  padding: 10px 12px 8px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
}
.ch-board[hidden] { display: none; }
.ch-board__title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #bdbdbd;
}
.ch-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 264px;   /* about 7 rows; a big group chat scrolls */
  overflow-y: auto;
  text-align: left;
}
.ch-rows li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 16px;
  color: #eee;
}
.ch-rows li:first-child { border-top: 0; }
.ch-rows li.me { background: rgba(196, 162, 106, .16); border-radius: 8px; }
.ch-rows li.me .ch-n, .ch-rows li.me .ch-s { color: var(--gold-bright, #d9b77a); }
.ch-rank { text-align: center; font-size: 15px; color: #9a9a9a; }
.ch-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-crown { margin-right: 5px; }   /* whoever started the challenge */
.ch-s { font-weight: 600; white-space: nowrap; }
.ch-board__hint { margin: 8px 0 0; font-size: 14px; color: #bdbdbd; }

/* You vs them */
.ch-h2h {
  margin-bottom: 12px;
  padding: 10px 12px 8px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
}
.ch-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.ch-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-who {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #bdbdbd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-score { font-family: var(--font-display); font-size: 22px; color: #fff; }
.ch-side.me .ch-score { color: var(--gold-bright, #d9b77a); }
.ch-vs-label { font-family: var(--font-display); font-size: 15px; color: #8d8d8d; }
.ch-verdict { margin: 8px 0 0; font-size: 17px; font-weight: 600; }
.ch-verdict.win { color: var(--correct, #2ecc71); }
.ch-verdict.loss { color: #f0f0f0; }

/* Name + button */
/* Name and button share one row (it only wraps on the very narrowest
   cards), keeping the result card short. */
.ch-send { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; container-type: inline-size; }
.ch-name {
  flex: 1 1 96px;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  background: #151515;
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;   /* 16px stops iOS zooming in on focus */
}
.ch-name:focus { outline: none; border-color: var(--gold, #c4a26a); }
.ch-panel .ch-btn {   /* .ch-panel: some games give every button a width and top margin */
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  min-height: 44px;
  padding: 0 16px;
  background: var(--gold, #c4a26a);
  border: 2px solid var(--gold, #c4a26a);
  border-radius: 999px;
  color: #141414;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  white-space: nowrap;
}
@media (hover: hover) { .ch-btn:hover { background: var(--gold-bright, #d9b77a); } }
.ch-btn:disabled { opacity: .6; cursor: default; }

/* "New challenge a friend feature" speech bubble, right-aligned above the
   button with its tail pointing down at it. */
.ch-panel .ch-new {
  position: relative;
  width: max-content;
  max-width: 180px;
  margin: 2px 0 9px auto;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff;
  color: #1b1b1b;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  text-wrap: balance;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  cursor: pointer;
  animation: ch-new-bob 2.4s ease-in-out infinite;
}
.ch-panel .ch-new b { color: #b07d1e; font-weight: 800; }
.ch-panel .ch-new::after {   /* the tail */
  content: "";
  position: absolute;
  top: 100%;
  right: 54px;   /* about the middle of the button */
  border: 7px solid transparent;
  border-top-color: #fff;
}
@keyframes ch-new-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) { .ch-panel .ch-new { animation: none; } }
/* Narrow cards (Knockout on a phone has ~230px): a little less padding so
   the pair still fits on one row. */
@container (max-width: 260px) {
  .ch-panel .ch-btn { padding: 0 10px; font-size: 15px; letter-spacing: 0; }
  .ch-panel .ch-name { flex-basis: 72px; padding: 0 8px; }
}
.ch-status { min-height: 1.2em; margin: 6px 0 0; font-size: 14px; color: #bdbdbd; }
.ch-status:empty { min-height: 0; margin: 0; }   /* no gap until there's something to say */
