/* ---------- חברים (js/friends.js): לוח במסך הראשי, ניהול חברים (#friends), משחקי ידידות (#friendlies), והמשחק החי (js/live-match.js) ---------- */
/* השורה העליונה, כפתור החזרה והמטבעות מ-gallery.css. הלוחות (set-panel, set-toggle, code-input) מ-settings.css */

.fr-screen { justify-content: flex-start; align-items: stretch; gap: 2vh; padding: 3vh 2.5vw 2.5vh; }
.fr-screen.entering { animation: home-in .8s var(--ease-out) both; }
.fr-screen.active .gal-top > * { animation: gal-drop .7s var(--ease-out) backwards; }
.fr-screen.active .gal-top > :nth-child(2) { animation-delay: .1s; }
.fr-screen.active .gal-top > :nth-child(3) { animation-delay: .2s; }

.fr-body {
  flex: 1;
  min-height: 0;
  width: min(92vw, 190vh);
  align-self: center;
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  align-items: start;
  gap: 2vw;
  padding-top: 1vh;
}
.fr-body > .fr-out { grid-column: 1 / -1; width: min(60vw, 110vh); justify-self: center; }
.fr-screen.active .set-panel { animation: stand-in .8s var(--ease-out) backwards; }
.fr-screen.active .fr-body > :nth-child(2) { animation-delay: .12s; }
.fr-body .set-panel { padding: 2.4vh 1.8vw; gap: 1.6vh; }
.fr-col { display: flex; flex-direction: column; gap: 2vh; min-width: 0; max-height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #1c4fa8 transparent; }
.fr-col > .set-panel { flex: none; }

/* ---------- רשימת החברים ---------- */
.fr-list { max-height: 100%; min-height: 0; overflow: hidden; }
.fr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1vw; }
.fr-head .px { --u: max(1.8px, .36vh); }
.fr-head .fr-count { --u: max(1.4px, .27vh); opacity: .75; }
.fr-rows { display: flex; flex-direction: column; gap: 1vh; max-height: 62vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #1c4fa8 transparent; padding: .4vh .3vw; }
.fr-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr .8fr auto;
  align-items: center;
  gap: 1.2vw;
  padding: 1.1vh 1vw;
  background: rgba(6, 16, 31, .6);
  box-shadow: inset 0 0 0 2px rgba(120, 180, 255, .14);
  clip-path: var(--notch);
}
.fr-row.on { box-shadow: inset 0 0 0 2px rgba(61, 220, 132, .55); }
.fr-cols { background: none; box-shadow: none; padding: 0 1vw; font: 700 clamp(10px, 1.7vh, 18px) var(--ar-font); color: rgba(255, 255, 255, .55); }
.fr-who { display: flex; align-items: center; gap: .9vw; min-width: 0; }
.fr-crest { width: 6vh; height: 6vh; object-fit: contain; image-rendering: pixelated; flex: none; }
.fr-who-tx { display: flex; flex-direction: column; gap: .3vh; min-width: 0; }
.fr-name { font: 800 clamp(13px, 2.4vh, 25px) var(--ar-font); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-seen { display: flex; align-items: center; gap: .5vw; font: 600 clamp(10px, 1.6vh, 17px) var(--ar-font); color: rgba(255, 255, 255, .55); }
.fr-dot { width: 1.1vh; height: 1.1vh; flex: none; background: #59617a; }
.fr-row.on .fr-seen, .fr-seen.on { color: #8df0b8; }
.fr-row.on .fr-dot, .fr-seen.on .fr-dot { background: #3ddc84; box-shadow: 0 0 1vh #3ddc84; }
.fr-arena { display: flex; align-items: center; gap: .7vw; min-width: 0; }
.fr-emb { width: 5vh; height: 5vh; image-rendering: pixelated; flex: none; }
.fr-ar-tx { display: flex; flex-direction: column; gap: .2vh; }
.fr-ar-tx b { font: 900 clamp(12px, 2.2vh, 23px) var(--ar-wide); color: var(--ar, #fff); letter-spacing: .03em; }
.fr-ar-tx span { font: 600 clamp(10px, 1.6vh, 17px) var(--ar-font); color: rgba(255, 255, 255, .6); }
.fr-h2h { display: flex; align-items: baseline; justify-content: center; gap: .3vw; font: 900 clamp(14px, 2.8vh, 30px) var(--ar-wide); }
.fr-h2h .fr-w { color: #3ddc84; }
.fr-h2h .fr-d { color: #ffd54a; }
.fr-h2h .fr-l { color: #ff8a78; }
.fr-dash { color: rgba(255, 255, 255, .35); font-size: .8em; }
.fr-acts { display: flex; gap: .7vw; }
.fr-acts .set-toggle { padding: 1vh 1.2vw; align-self: center; }
.fr-acts .set-toggle .px { --u: max(1.4px, .28vh); }
.fr-empty { display: flex; flex-direction: column; align-items: center; gap: 1.2vh; padding: 5vh 2vw; text-align: center; }
.fr-empty .set-toggle { align-self: center; margin-top: 1vh; }

/* בקשות חברות: מי, ארנה, אשר / דחה. בקשות ששלחת: מי, מחכה, בטל */
.fr-reqs { box-shadow: inset 0 0 0 4px #c9a227, inset 0 0 0 7px rgba(255, 213, 74, .14); }
.fr-reqs.out { box-shadow: inset 0 0 0 4px #3b4a6c, inset 0 0 0 7px rgba(120, 180, 255, .1); }
.fr-row.fr-req { grid-template-columns: 1.5fr 1.2fr auto; }
.fr-reqs.out .fr-row.fr-req { grid-template-columns: 1.5fr 1fr auto; }
.fr-wait { font: 700 clamp(11px, 1.8vh, 19px) var(--ar-font); color: rgba(255, 255, 255, .6); }
.fr-acts .set-toggle.fr-ok { background: rgba(47, 158, 68, .6); }

.fr-empty .px { --u: max(1.5px, .3vh); display: flex; }

/* ---------- הקוד שלך והוספת חבר ---------- */
.fr-code-big {
  align-self: stretch;
  padding: 1.4vh 1vw;
  text-align: center;
  font: 400 clamp(22px, 5.4vh, 60px)/1 "Pixel", monospace;
  letter-spacing: .2em;
  white-space: nowrap;
  overflow: hidden;
  color: #ffd54a;
  background: rgba(6, 16, 31, .88);
  box-shadow: inset 0 0 0 3px #1c4fa8;
  text-shadow: 0 .5vh 0 rgba(0, 0, 0, .5);
}
.fr-code .code-row { direction: ltr; }
.fr-code .acct-status { min-height: 0; }
.fr-prize { display: flex; align-items: center; gap: .8vw; padding: 1vh 1vw; background: rgba(255, 213, 74, .08); box-shadow: inset 0 0 0 2px rgba(255, 213, 74, .35); }
.fr-prize-tx { display: flex; flex-direction: column; gap: .5vh; }
.fr-prize .px { --u: max(1.3px, .26vh); display: flex; }
.fr-coin { width: 3.4vh; height: 3.4vh; image-rendering: pixelated; flex: none; }
.fr-name-tip .px { --u: max(1.3px, .26vh); display: flex; opacity: .75; }

/* ---------- החלון: הזמנה, המתנה, פרופיל של חבר ---------- */
.fr-modal { z-index: 60; }
.cf-panel.fr-panel { width: min(52vw, 100vh); }
.fr-sub { --u: max(1.4px, .28vh); display: flex; justify-content: center; opacity: .88; }
.fr-bar { width: 100%; }
.fr-btns { flex-wrap: wrap; }
.fr-who-big { display: flex; align-items: center; gap: 1.6vw; direction: rtl; }
.fr-crest-big { width: 11vh; height: 11vh; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 1vh 1.4vh rgba(0, 0, 0, .5)); }
.fr-who-big .fr-who-tx { align-items: flex-start; gap: .6vh; }
.fr-name-big { font: 900 clamp(16px, 3.4vh, 36px) var(--ar-font); color: #fff; }
.fr-ar-line { display: flex; align-items: center; gap: .6vw; font: 800 clamp(11px, 2vh, 21px) var(--ar-wide); color: rgba(255, 255, 255, .85); }
.fr-h2h-line { font: 700 clamp(11px, 1.9vh, 20px) var(--ar-font); color: #ffd54a; }
.fr-inv .fr-who-big { animation: fr-ring 1s ease-in-out infinite alternate; }
@keyframes fr-ring { from { transform: scale(1); } to { transform: scale(1.04); } }

.cf-panel.fr-panel.fr-prof { width: min(80vw, 160vh); max-height: 92vh; gap: 1.6vh; }
.fr-prof-top { display: flex; align-items: center; justify-content: space-between; gap: 2vw; width: 100%; }
.fr-prof-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .6vh; font: 600 clamp(11px, 1.8vh, 19px) var(--ar-font); color: rgba(255, 255, 255, .75); }
.fr-prof-body { width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 1.8vh; scrollbar-width: thin; scrollbar-color: #1c4fa8 transparent; padding: .2vh .3vw; }
.fr-prof-body .px { --u: max(1.4px, .28vh); display: flex; }
.fr-stats { grid-template-columns: repeat(8, 1fr) !important; }
.fr-boards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2vw; }
.fr-board { display: flex; flex-direction: column; gap: 1vh; padding: 1.2vh .8vw; background: rgba(6, 16, 31, .55); box-shadow: inset 0 0 0 2px rgba(120, 180, 255, .14); }
.fr-board-row { display: flex; justify-content: center; gap: .6vw; min-height: 12vh; align-items: flex-start; }
.fr-lead { display: flex; flex-direction: column; align-items: center; gap: .5vh; width: 7.4vh; }
.fr-lead .card, .fr-xi-card .card { width: 100%; }
.fr-lead-n { font: 800 clamp(10px, 1.6vh, 17px) var(--ar-font); color: #ffd54a; white-space: nowrap; }
.fr-none { opacity: .6; align-self: center; }
.fr-xi { display: flex; flex-direction: column; gap: 1vh; }
.fr-xi-grid { display: grid; grid-template-columns: repeat(11, 1fr); gap: .5vw; direction: ltr; }
.fr-xi-card { aspect-ratio: .729; }
.fr-ach { display: flex; flex-direction: column; gap: 1vh; }
.fr-ach-grid { display: flex; flex-wrap: wrap; gap: .8vh .6vw; }
.fr-ach-tile { display: flex; align-items: center; gap: .5vw; padding: .5vh .7vw .5vh 1vw; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 2px rgba(255, 213, 74, .35); font: 700 clamp(10px, 1.6vh, 17px) var(--ar-font); }
.fr-ach-tile .pf-ach-icon { width: 4vh; height: 4vh; }

/* ---------- מסך "משחקים": הכרטיס של נגד חבר ---------- */
.gm-modes { grid-template-columns: repeat(3, 1fr); }
.gm-friends { --ar: #52d6ff; --ar-rgb: 82, 214, 255; }
.gm-friends .gm-bg { background: radial-gradient(ellipse at 70% 30%, rgba(82, 214, 255, .4), transparent 60%), linear-gradient(160deg, #3a1460, #0c0618 70%); }
.gm-friends .gm-title { color: var(--ar); text-shadow: 0 0 3vh rgba(var(--ar-rgb), .45); }
.gm-friends .gm-status { background: rgba(var(--ar-rgb), .2); color: #fff; }
.gm-art-friends { gap: 0; }
.gm-fr-crest { position: absolute; width: 46%; image-rendering: pixelated; filter: drop-shadow(0 1.6vh 1.6vh rgba(0, 0, 0, .55)); animation: emb-float 3.2s ease-in-out infinite; }
.gm-fr-crest.me { top: 8%; right: 4%; }
.gm-fr-crest.them { bottom: 8%; left: 4%; animation-delay: -1.6s; filter: drop-shadow(0 1.6vh 1.6vh rgba(0, 0, 0, .55)) grayscale(.3) brightness(.85); }
.gm-fr-vs { position: relative; font: 900 clamp(18px, 5vh, 56px) var(--ar-wide); color: #ffd54a; text-shadow: 0 .5vh 0 #000, 0 0 2vh rgba(255, 213, 74, .6); }
.gm-mode .gm-title { font-size: clamp(30px, 7.6vh, 96px); }

/* ---------- משחק חי ---------- */
.mt-ch.live .mt-duel.live-rows { margin-top: .4vh; }
.mt-ch.live.waiting .mt-opt, .mt-ch.live.waiting .mt-stop { pointer-events: none; }
.mt-ch.live.waiting .mt-duel-row.bot .mt-duel-st { animation: fr-wait 1s ease-in-out infinite alternate; }
@keyframes fr-wait { from { opacity: .45; } to { opacity: 1; } }
.mt-res-note.live { --u: max(1.5px, .3vh); padding: .6vh 1vw; background: rgba(82, 214, 255, .12); box-shadow: inset 0 0 0 2px rgba(82, 214, 255, .45); }

@media (prefers-reduced-motion: reduce) {
  .fr-inv .fr-who-big, .gm-fr-crest, .mt-ch.live.waiting .mt-duel-row.bot .mt-duel-st { animation: none; }
}

/* טלפון (html.phone, אותו מסך כמו במחשב בקטן): הטקסט הפיקסלי גדול יותר, ולכן יותר מקום לחלון */
html.phone .cf-panel.fr-panel { width: min(70vw, 130vh); }
html.phone .cf-panel.fr-panel.fr-prof { width: 94vw; }

/* ---------- משחקי ידידות ---------- */
.fl-body { grid-template-columns: 1.9fr 1fr; }
.fl-list .fr-row { grid-template-columns: 1.5fr 1.2fr .8fr auto; }
.fl-side { gap: 1.3vh !important; }
.fl-side .set-note { opacity: .85; }

/* ---------- הלוח "חברים" במסך הראשי (במקום לוח הפרומו). כהה ורגוע, באותה שפה כמו הלוח הגדול ---------- */
.hub-promo.hub-friends {
  display: flex;
  flex-direction: column;
  gap: 1.6vh;
  padding: 3vh 1.6vw 2.4vh;
  cursor: pointer;
  background:
    radial-gradient(120% 50% at 50% -10%, rgba(82, 214, 255, .1), transparent 60%),
    linear-gradient(180deg, rgba(40, 44, 52, .96), rgba(22, 24, 29, .97));
  box-shadow: inset 0 0 0 .2vh rgba(150, 200, 230, .16), 0 2vh 5vh rgba(0, 0, 0, .35);
  transition: transform .3s var(--ease-out), box-shadow .3s;
}
.hub-promo.hub-friends[hidden] { display: none; }
body.input-mouse .hub-friends:hover, .hub-friends.nav-focus { transform: translateY(-.5vh); box-shadow: inset 0 0 0 .25vh rgba(150, 210, 240, .45), 0 2.6vh 6vh rgba(0, 0, 0, .45); outline: none; animation: none; }
.hf-head { display: flex; align-items: center; justify-content: space-between; gap: 1vw; }
.hf-title { margin: 0; font-size: 3.6vh; font-weight: 800; line-height: 1.1; }
.hf-pill { display: flex; align-items: center; gap: .5vw; padding: .5vh .8vw; border-radius: 99px; font-size: 1.7vh; font-weight: 700; color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .07); }
.hf-pill i { width: 1vh; height: 1vh; border-radius: 50%; background: #6b7387; }
.hf-pill.on { color: #b9f5d2; background: rgba(61, 220, 132, .12); }
.hf-pill.on i { background: #3ddc84; box-shadow: 0 0 .8vh rgba(61, 220, 132, .8); }
.hf-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .7vh; overflow: hidden; }
.hf-sec { margin-top: .6vh; font-size: 1.6vh; font-weight: 700; color: rgba(255, 255, 255, .45); letter-spacing: .02em; }
.hf-row { display: flex; align-items: center; gap: .7vw; padding: .7vh .7vw; border-radius: .9vh; background: rgba(255, 255, 255, .04); }
.hf-row.on { background: rgba(255, 255, 255, .07); }
.hf-dot { width: 1vh; height: 1vh; flex: none; border-radius: 50%; background: #565d6e; }
.hf-row.on .hf-dot { background: #3ddc84; box-shadow: 0 0 .8vh rgba(61, 220, 132, .7); }
.hf-crest { width: 4.2vh; height: 4.2vh; flex: none; object-fit: contain; image-rendering: pixelated; }
.hf-row:not(.on) .hf-crest { filter: grayscale(.7) brightness(.75); }
.hf-tx { display: flex; flex-direction: column; min-width: 0; }
.hf-name { font-size: 2.1vh; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-row:not(.on) .hf-name { color: rgba(255, 255, 255, .6); }
.hf-sub { font-size: 1.55vh; color: rgba(255, 255, 255, .5); }
.hf-row.on .hf-sub { color: #9fdcf0; }
.hf-more { font-size: 1.6vh; color: rgba(255, 255, 255, .45); padding-inline-start: .7vw; }
.hf-empty { margin: 1vh 0 0; font-size: 2.1vh; line-height: 1.45; color: rgba(255, 255, 255, .7); }
.hf-req { display: flex; align-items: center; gap: .7vw; padding: .9vh .8vw; border-radius: .9vh; font-size: 1.8vh; font-weight: 700; color: #ffe08a; background: rgba(255, 213, 74, .1); box-shadow: inset 0 0 0 .18vh rgba(255, 213, 74, .4); }
.hf-req b { display: grid; place-items: center; min-width: 2.6vh; height: 2.6vh; border-radius: 99px; font-size: 1.6vh; color: #1b1405; background: #ffd54a; }
.hf-foot { display: flex; justify-content: flex-end; }
.hf-go { display: flex; align-items: center; gap: .5vw; padding: .8vh 1.1vw; border-radius: 99px; font-size: 1.8vh; font-weight: 700; color: #fff; background: rgba(255, 255, 255, .1); }
.hf-go b { font-size: 1.3em; line-height: 1; transition: translate .25s; }
body.input-mouse .hub-friends:hover .hf-go b, .hub-friends.nav-focus .hf-go b { translate: -.5vh 0; }

/* שורת שגיאה בחיבור לשרת החברים, וחברים לא מחוברים במשחקי ידידות (באפור) */
.fr-err { width: 100%; box-sizing: border-box; }
.fl-off-head { margin-top: .6vh; }
.fl-off-head .px { --u: max(1.4px, .27vh); display: flex; opacity: .6; }
.fl-off .fr-row { opacity: .55; box-shadow: inset 0 0 0 2px rgba(120, 140, 170, .12); }
.fl-off .fr-crest { filter: grayscale(.8); }
.fl-list .fr-empty { padding: 3vh 2vw; }
.fl-off .fr-row.push { opacity: .85; }
