/* Friend Battle overlay (first pass; the host/join screens get a proper design later). Pokédex look like the team
   builder: white card, red header, Jersey 15 titles. */
.fb {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(14, 18, 32, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; color: #24242c;
}
.fb[hidden] { display: none; }
.fb-card {
  width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px;
  background: #e3353c; color: #fff; border-radius: 22px 22px 0 0;
}
.fb-head h2 { margin: 0; font: 400 34px/1 'Jersey 15', system-ui, sans-serif; letter-spacing: 0.5px; }
.fb-kicker { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; opacity: 0.85; }
.fb-x { border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.fb-x:hover { background: rgba(255, 255, 255, 0.3); }
.fb-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 22px; }
.fb-note { margin: 0; font-size: 13px; color: #6b6b78; line-height: 1.4; }
.fb-note.warn { color: #c62828; font-weight: 600; }
.fb-card > .fb-note { padding: 0 20px 16px; }
.fb-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #8a8a96; }
.fb-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid #e4e4ea; border-radius: 12px;
  font: 600 16px system-ui, sans-serif; color: #24242c; background: #fafafc; outline: none;
}
.fb-input:focus { border-color: #e3353c; background: #fff; }
.fb-code { font: 400 28px/1 'Jersey 15', ui-monospace, monospace; letter-spacing: 6px; text-align: center; text-transform: uppercase; }
.fb-btn {
  border: 0; border-radius: 999px; padding: 12px 20px; font: 700 15px system-ui, sans-serif; cursor: pointer;
  background: #24242c; color: #fff; transition: transform 0.12s ease, filter 0.12s ease;
}
.fb-btn:hover { filter: brightness(1.12); }
.fb-btn:active { transform: scale(0.97); }
.fb-btn.go { background: #e3353c; font-size: 17px; padding: 14px 20px; }
.fb-btn.ghost { background: #f0f0f4; color: #24242c; }
.fb-btn.small { padding: 8px 14px; font-size: 13px; }
.fb-btn.on { background: #e3353c; }
.fb-link { border: 0; background: none; color: #e3353c; font: 600 13px system-ui, sans-serif; cursor: pointer; padding: 4px 0; align-self: flex-start; }
.fb-link:hover { text-decoration: underline; }
.fb-me { display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 16px; background: #f6f6f9; }
.fb-me-fields { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.fb-tr { display: inline-block; flex: none; background-repeat: no-repeat; background-position: 0 0; image-rendering: pixelated; }
.fb-tr-empty { display: inline-block; width: 32px; height: 64px; border-radius: 10px; border: 2px dashed #d4d4dc; flex: none; }
.fb-or { display: flex; align-items: center; gap: 10px; color: #9a9aa6; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.fb-or::before, .fb-or::after { content: ''; flex: 1; height: 1px; background: #e8e8ee; }
.fb-join { display: flex; gap: 8px; }
.fb-join .fb-input { flex: 1; min-width: 0; }
.fb-code-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fb-room-code { font: 400 44px/1 'Jersey 15', ui-monospace, monospace; letter-spacing: 6px; color: #24242c; }
.fb-share { display: flex; gap: 6px; }
.fb-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 16px; background: #f6f6f9; }
.fb-qr svg { width: 200px; height: 200px; }
.fb-qr small { font-size: 11px; color: #6b6b78; word-break: break-all; text-align: center; }
.fb-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-seat { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: #f6f6f9; border: 2px solid transparent; min-width: 0; }
.fb-seat.me { border-color: rgba(227, 53, 60, 0.35); }
.fb-seat.empty { color: #8a8a96; }
.fb-seat > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fb-seat b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-seat small { font-size: 11px; color: #8a8a96; }
.fb-seat i { font-style: normal; font-size: 12px; font-weight: 600; color: #8a8a96; }
.fb-seat i.ok { color: #2e9d47; }
.fb-seat i.off { color: #c62828; }
.fb-rules { display: flex; flex-direction: column; gap: 10px; }
.fb-rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fb-rule > span { font-size: 13px; font-weight: 600; color: #4a4a56; }
.fb-seg { display: inline-flex; background: #f0f0f4; border-radius: 999px; padding: 3px; }
.fb-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 600 13px system-ui, sans-serif; color: #4a4a56; cursor: pointer; }
.fb-seg button.on { background: #fff; color: #e3353c; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.fb-seg button:disabled { cursor: default; }
.fb-seg button:disabled:not(.on) { opacity: 0.5; }
.fb-actions { display: flex; gap: 8px; }
.fb-actions .go { flex: 1; }

/* floating button back into the room from the region screen */
.fb-chip {
  position: fixed; right: 16px; bottom: 16px; z-index: 55; border: 0; border-radius: 999px; padding: 12px 18px;
  background: #e3353c; color: #fff; font: 400 22px/1 'Jersey 15', system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.fb-chip[hidden] { display: none; }

/* team builder tray: the friend's state instead of the challenged team */
.fb-foe .fb-foe-state { font-size: 13px; font-weight: 600; padding-top: 4px; }
.pdx-start.ready { background: #2e9d47; }

/* battle: whose turn, countdown, connection */
.fb-status {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 6px 14px;
  font-size: 14px; white-space: nowrap; pointer-events: auto;
}
.fb-status[hidden] { display: none; }
.fb-status.count { color: #b8860b; }
.fb-status.warn { color: #c62828; }
.fb-mini { margin-left: 8px; border: 0; border-radius: 999px; padding: 3px 10px; background: #e3353c; color: #fff; font: 700 12px system-ui, sans-serif; cursor: pointer; }

.fb-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: #24242c; color: #fff; font: 600 14px system-ui, sans-serif;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fb-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .fb { padding: 10px; }
  .fb-seats { grid-template-columns: 1fr; }
  .fb-room-code { font-size: 38px; }
}
/* phones (the game's own 720 px layout): the pill sits under the two Pokémon cards; the tray's Battle label says Ready */
@media (max-width: 720px) {
  .fb-status { top: 150px; font-size: 13px; }
  .pdx-start[data-label]::after { content: attr(data-label); }
  .fb-foe { flex-direction: column; align-items: flex-start; gap: 2px; }
  .fb-foe .fb-foe-state { padding-top: 0; }
}
