/* 👥 Bạn bè (friends.js) – tiền tố fr- */
.friends { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; padding-bottom: 28px; }
.fr-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.fr-head p { margin: 0; color: var(--muted); line-height: 1.45; }
.fr-note { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft, rgba(91, 61, 245, .1)); line-height: 1.45; }
.fr-note .link { font-weight: 800; }
.fr-av { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); }
.fr-av svg { width: 38px; height: 38px; }
/* thẻ của mình */
.fr-me { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, var(--surface), var(--surface)); background: linear-gradient(135deg, color-mix(in srgb, #5b3df5 12%, var(--surface)), var(--surface)); }
.fr-me .fr-av { width: 64px; height: 64px; } .fr-me .fr-av svg { width: 54px; height: 54px; }
.fr-me-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fr-name { display: flex; gap: 6px; }
.fr-name input { flex: 1; min-width: 0; font-weight: 800; font-size: 1.05rem; }
.fr-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fr-code small { width: 100%; color: var(--muted); font-size: .78rem; }
.fr-code b { font: 800 1.35rem/1.1 var(--font-mono, monospace); letter-spacing: .1em; color: var(--accent, #5b3df5); user-select: all; -webkit-user-select: all; }
.fr-code button { min-height: 36px; padding: 0 12px; font-size: .84rem; }
/* tìm bạn */
.fr-find h2, .fr-sec h2 { margin: 0 0 8px; font-size: 1.05rem; }
.fr-sec h2 small { color: var(--muted); font-weight: 600; }
.fr-find-f { display: flex; gap: 8px; }
.fr-find-f input { flex: 1; min-width: 0; font: 700 1.05rem var(--font-mono, monospace); letter-spacing: .08em; text-transform: uppercase; }
.fr-find-f input::placeholder { text-transform: none; letter-spacing: 0; font: 500 .92rem var(--font-sans, inherit); }
.fr-find .hint { margin: 8px 0 0; }
.fr-found { margin-top: 10px; padding: 8px; border-radius: 14px; border: 2px dashed var(--accent, #5b3df5); }
.fr-msg { min-height: 1.2em; margin: 8px 0 0; font-weight: 700; } .fr-msg.ok { color: var(--ok, #16a34a); } .fr-msg.error { color: var(--danger, #d23c36); }
/* danh sách */
.fr-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.fr-sec .fr-row:first-of-type, .fr-found .fr-row { border-top: 0; }
.fr-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-who b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-who small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.fr-who .fr-on { color: #16a34a; font-weight: 700; }
:root[data-theme="dark"] .fr-who .fr-on { color: #4ade80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fr-who .fr-on { color: #4ade80; } }
.fr-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.fr-btns button { min-height: 38px; padding: 0 12px; font-size: .86rem; white-space: nowrap; }
.fr-btns button.link { padding: 0 8px; }
.fr-tag { font-weight: 800; font-size: .85rem; color: var(--muted); } .fr-tag.ok { color: var(--ok, #16a34a); }
.fr-safe { margin: 0; text-align: center; }
@media (max-width: 520px) {
  .fr-me { flex-direction: column; align-items: stretch; text-align: center; } .fr-me .fr-av { align-self: center; }
  .fr-code { justify-content: center; }
  .fr-row { flex-wrap: wrap; } .fr-btns { width: 100%; justify-content: flex-start; padding-left: 56px; }
}
/* chấm đếm lời mời trên thẻ "👥 Bạn bè" */
.fr-tab { position: relative; }
.fr-n { display: inline-block; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: .7rem; line-height: 18px; text-align: center; vertical-align: middle; }
.fr-n[hidden] { display: none; }

/* 🏆 Bảng xếp hạng bạn bè */
.fr-rk-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.fr-rk-tabs button { padding: 6px 12px; border-radius: 99px; font-size: .85rem; font-weight: 700; }
.fr-rk-tabs button.on { background: var(--accent, #5b3df5); border-color: var(--accent, #5b3df5); color: #fff; }
.fr-rk-list { display: flex; flex-direction: column; gap: 6px; }
.fr-rk-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line, rgba(0, 0, 0, .08)); }
.fr-rk-row.me { background: var(--accent-soft, rgba(91, 61, 245, .1)); border-color: var(--accent, #5b3df5); }
.fr-rk-m { width: 30px; flex: none; text-align: center; font-size: 1.3rem; }
.fr-rk-n { font-size: .95rem; font-weight: 800; color: var(--muted); }
.fr-rk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-rk-name small { color: var(--muted); font-weight: 600; }
.fr-rk-v { flex: none; font-weight: 800; white-space: nowrap; }
.fr-rank .fr-av { width: 36px; height: 36px; }

/* 👤 Hồ sơ + 🏅 huy hiệu */
.fr-rk-row[data-fr="prof"] { cursor: pointer; }
.fr-rk-row[data-fr="prof"]:hover { border-color: var(--accent, #5b3df5); }
.fr-prof { width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); overflow-y: auto; padding: 18px 16px; border: 0; border-radius: 18px; position: relative; }
.fr-pf-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.fr-pf-head { display: flex; align-items: center; gap: 14px; margin: 0 40px 12px 0; }
.fr-pf-head .fr-av { width: 64px; height: 64px; flex: none; }
.fr-pf-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.fr-pf-head h2 small, .fr-pf-head > div > small { color: var(--muted); font-weight: 600; font-size: .85rem; }
.fr-pf-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.fr-pf-st { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--accent-soft, rgba(91, 61, 245, .1)); text-align: center; }
.fr-pf-st b { font-size: 1.05rem; white-space: nowrap; }
.fr-pf-st small { color: var(--muted); font-size: .72rem; line-height: 1.25; }
.fr-prof h3 { margin: 6px 0 8px; font-size: 1.05rem; }
.fr-prof h3 small { color: var(--muted); }
.fr-pf-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.fr-bd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line, rgba(0, 0, 0, .1)); text-align: center; opacity: .45; filter: grayscale(1); }
.fr-bd.on { opacity: 1; filter: none; border-color: #f5b301; background: linear-gradient(160deg, rgba(245, 179, 1, .16), transparent); }
.fr-bd i { font-style: normal; font-size: 1.6rem; line-height: 1.2; }
.fr-bd b { font-size: .82rem; line-height: 1.2; }
.fr-bd small { color: var(--muted); font-size: .7rem; line-height: 1.25; }
@media (max-width: 520px) { .fr-pf-stats { grid-template-columns: repeat(3, 1fr); } .fr-pf-badges { grid-template-columns: repeat(2, 1fr); } }
/* ⚔️ Mời đấu: chọn 🧩 Rubik hay ♟️ Cờ vua (friends.js pickGame) */
.fr-inv { width: min(460px, calc(100vw - 20px)); padding: 18px 16px; border: 0; border-radius: 18px; position: relative; }
.fr-inv h2 { margin: 0 40px 12px 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.fr-iv-big { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 12px 14px; border-radius: 14px; text-align: left; margin-bottom: 10px; }
.fr-iv-big small, .fr-iv-chess small { color: var(--muted); font-weight: 600; }
.fr-iv-chess { padding: 12px 14px; border-radius: 14px; background: var(--surface-2, rgba(120, 120, 140, .1)); }
.fr-iv-chess div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.fr-iv-chess button { padding: 10px 6px; border-radius: 12px; }
