/* ====== SEARCH TAB (как было) ====== */
.search-wrap h2{
  font-size:18px;font-weight:700;color:#fff;margin:0 0 12px;
}
.search-row .search-input{
  height:40px;padding:0 12px;border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:#1c1c28;color:#fff;outline:none;
  transition:border-color .2s ease;
}
.search-row .search-input:focus{ border-color:rgba(255,255,255,.22); }
#user-search-btn{
  height:40px;padding:0 14px;border-radius:12px;border:none;
  background:#3b82f6;color:#fff;font-weight:600;cursor:pointer;
  transition:transform .08s ease, opacity .2s ease;
}
#user-search-btn:active{ transform:translateY(1px); }
#user-search-btn:disabled{ opacity:.6; cursor:default; }
#user-search-result[hidden]{ display:none; }
#user-search-result .usr-card{
  background:#1f1f2b;border:1px solid rgba(255,255,255,.06);
  border-radius:16px; box-shadow:0 6px 20px rgba(0,0,0,.25);
}
#usr-res-name{font-size:15px; }
#usr-res-balance{ color:#bdbdc7;font-size:13px; }
#usr-res-profile{
  height:36px;padding:0 12px;border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background:#2a2a38;color:#fff;font-weight:600;cursor:pointer;
}
@media (hover: hover) and (pointer: fine){
  #usr-res-profile:hover{ border-color:rgba(255,255,255,.2); }
}

/* ===== PROFILE MODAL (фикс скролла) ===== */

/* скрыта */
#profile-modal { display:none !important; }

/* открыта */
#profile-modal.pf-modal--open {
  display:block !important;
  position:fixed; inset:0;
  z-index:2147483000;
}

/* ✅ локальные переменные ТОЛЬКО для профайл-модалки (вместо :root) */
#profile-modal{
  --pf-header-h: 70px; /* высота верхней шапки */
  --pf-nav-h:    82px; /* высота нижней панели */
}

/* фон */
#profile-modal .pf-modal__backdrop {
  position:absolute; inset:0;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  z-index:0;
}

/* окно */
#profile-modal .pf-modal__dialog {
  position:fixed;
  left:12px; right:12px;
  top:    calc(env(safe-area-inset-top,0px) + var(--pf-header-h));
  bottom: calc(env(safe-area-inset-bottom,0px) + var(--pf-nav-h));
  background:#171724; color:#fff;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 12px 40px rgba(0,0,0,.45);
  display:flex; flex-direction:column;
  overflow:hidden;
  z-index:1;
}

/* крестик */
#profile-modal .pf-modal__close {
  position:absolute; right:10px; top:10px;
  width:34px; height:34px; border:none; border-radius:10px;
  background:rgba(255,255,255,.08); color:#fff; cursor:pointer;
  z-index:2;
}
@media (hover: hover) and (pointer: fine){
  #profile-modal .pf-modal__close:hover { background:rgba(255,255,255,.14); }
}

/* шапка профиля */
#profile-modal .pf-profile-head {
  flex:0 0 auto;
  display:flex; gap:12px; align-items:center;
  padding:14px; background:#171724;
}
#profile-modal .pf-avatar {
  width:56px; height:56px; flex:0 0 56px;
  border-radius:12px; background:#2b2b3b center/cover no-repeat;
  box-shadow:0 4px 14px rgba(0,0,0,.28);
}

/* табы */
#profile-modal .pf-tabs {
  flex:0 0 auto;
  display:flex; gap:8px;
  padding:8px 12px 10px; background:#171724;
  border-bottom:1px solid rgba(255,255,255,.06);
}
#profile-modal .pf-tab {
  padding:8px 12px; border-radius:10px;
  background:transparent; border:1px solid transparent;
  color:#d9d9e3; font-weight:600; cursor:pointer;
}
#profile-modal .pf-tab--active {
  background:#222235; color:#fff; border-color:rgba(255,255,255,.1);
}

/* контент */
#profile-modal .pf-grids {
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
  display:flex;
}
#profile-modal .pf-grid {
  flex:1 1 auto;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
  padding:12px;
  padding-bottom: calc(var(--pf-nav-h) + 32px);
}
#profile-modal .pf-grid--hidden { display:none; }
#profile-modal .pf-empty {
  color:#bdbdc7; text-align:center; padding:16px;
}

/* карточки */
#profile-modal .pf-grid .farm-pigeon { border-radius:16px; }
#profile-modal .pf-grid .farm-pigeon .item-name {
  font-size:14px; line-height:1.2;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#profile-modal .pf-grid .farm-pigeon p { font-size:12px; }

/* desktop */
@media (min-width:768px){
  #profile-modal .pf-modal__dialog {
    left:50%; top:50%; right:auto; bottom:auto;
    width:min(720px,92vw); height:min(85vh,800px);
    transform:translate(-50%,-50%);
  }
  #profile-modal .pf-grid {
    grid-template-columns:repeat(auto-fill,minmax(136px,1fr));
    gap:12px; padding:14px;
    padding-bottom:20px;
  }
}

/* === FIX: карточки в профиле не растягиваются по высоте === */
#profile-modal .pf-grid{
  align-items: start;
  grid-auto-rows: max-content;
}

#profile-modal .pf-grid .farm-pigeon{
  align-self: start;
  height: auto !important;
  min-height: 0 !important;
  flex: initial !important;
}

#profile-modal .pf-grid .farm-pigeon{
  max-height: 260px;
  overflow: hidden;
}

#profile-modal .pf-grid .farm-pigeon img{
  width: 100%;
  height: 110px;
  object-fit: contain;
  display: block;
}


/* steal confirm overlay - must be above #profile-modal (2147483000) */
.pf-steal-confirm-overlay{
  position: fixed;
  inset: 0;
  z-index: 2147483646; /* выше чем 2147483000 */
  display: none;

  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  pointer-events: auto; /* ✅ блокирует клики насквозь */
}

.pf-steal-confirm-overlay.is-open{
  display: flex;
}

.pf-steal-confirm{
  width: min(92vw, 340px);
  border-radius: 16px;
  background: #171724;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  padding: 14px;
  color: #fff;
}

.pf-steal-confirm .pf-steal-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

.pf-steal-confirm button{
  flex:1 1 auto;
  height: 40px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
}
.pf-steal-confirm .pf-btn-cancel{ background:#2a2a38; color:#fff; }
.pf-steal-confirm .pf-btn-ok{ background:#ef4444; color:#fff; }

/* ====== бывшие инлайн-стили из index.html (поиск игрока) ====== */
#search-tab .search-wrap{ padding: 16px; }
#search-tab .search-wrap h2{ margin: 0 0 12px; }
#search-tab .search-row{ display: flex; gap: 8px; }
#search-tab #user-search-input{ flex: 1; }
#search-tab #user-search-result{ margin-top: 16px; }
#search-tab .usr-card{
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: #1f1f2b;
}
#search-tab #usr-res-avatar{
  width: 48px; height: 48px; border-radius: 10px;
  background-color: #2b2b3b; background-size: cover; background-position: center;
  flex: 0 0 48px;
}
#search-tab .usr-meta{ display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#search-tab #usr-res-name{
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw;
}
#search-tab #usr-res-balance{ opacity: .8; }
#search-tab .usr-actions{ margin-left: auto; }
#profile-modal .pf-empty{ opacity: .7; padding: 16px; text-align: center; }

/* ===== Профиль игрока = «в гостях» (4.1.1) =====
   Полноэкранный, выглядит как главная: тот же фон, карточка, витрина на 10 мест, кнопка внизу. */

/* фон — как у главной (background.css + profile.css) */
#profile-modal .pf-modal__backdrop{
  background:
    linear-gradient(rgba(var(--bg-dim-color), var(--bg-dim-top)), rgba(var(--bg-dim-color), var(--bg-dim-bottom))),
    var(--bg-image) center / cover no-repeat;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@media (max-aspect-ratio: 3/4){
  #profile-modal .pf-modal__backdrop{
    background-size: 100% 100%, auto 130%;
    background-position: 0 0, 50% 100%;
  }
}

/* слой: над вкладками, но под шапкой игры (z 10) и нижней панелью (z 1000) —
   так профиль выглядит как ещё один экран игры. Модалка голубя, тосты и подтверждение кражи — выше. */
#profile-modal.pf-modal--open{ z-index: 9; }

#profile-modal .pf-modal__dialog.pf-visit{
  inset: 0;
  top: 0; bottom: 0; left: 0; right: 0;
  width: auto; height: auto;
  max-height: none;
  transform: none;
  /* сверху — как у главной, снизу — место под нижнюю панель */
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 84px);
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  /* 4.2: как главная — ровно один экран, витрина ужимается по высоте */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* карточка гостя — как .home-card на главной */
#profile-modal .pf-visit__card{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 430px;
  margin: 0 auto;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(28,36,62,.9);
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}
#profile-modal .pf-visit__top{
  display: flex;
  align-items: center;
  gap: 10px;
}
#profile-modal .pf-visit .pf-avatar{
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px;
  box-shadow: none;
}
#profile-modal .pf-visit .pf-head-meta{ flex: 1 1 auto; min-width: 0; }
#profile-modal .pf-visit .pf-title{
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#profile-modal .pf-visit .pf-sub{
  font-size: 11px;
  font-weight: 700;
  color: #a9adc9;
}
#profile-modal .pf-visit .pf-modal__close{
  position: static;
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  font-size: 16px;
  font-weight: 900;
}
#profile-modal .pf-visit__chips{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
#profile-modal .pf-chip{
  height: 34px;
  box-sizing: border-box;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
#profile-modal .pf-chip .chip-feather{ width: 16px; height: 16px; }
#profile-modal .pf-chip--income{
  background: rgba(74,222,128,.12);
  border-color: rgba(74,222,128,.3);
  color: #8ff0b4;
  font-size: 13px;
}

/* витрина — те же размеры и места, что #main-tab .sc-stage */
#profile-modal .pf-visit__card{ flex: 0 0 auto; width: 100%; }
#profile-modal .pf-sc{
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  container-type: size;
}
#profile-modal .pf-sc__stage{
  position: relative;
  width: 100%;
  aspect-ratio: 390 / 372;
  margin: 36px auto 0;
  flex: 0 0 auto;
}
@supports (container-type: size){
  /* 36px — надпись «Витрина N» (62px, если занят задний ряд — ставит JS), 30px — подсказка снизу */
  #profile-modal .pf-sc__stage{ width: min(100%, calc((100cqh - 62px - 30px) * 390 / 372)); }
}
#profile-modal .pf-sc__label{
  position: absolute;
  left: 8px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20,22,44,.78);
  font-size: 12px;
  font-weight: 900;
  color: #fff;
}
#profile-modal .pf-sc__stage.is-empty .pf-sc__label{ display: none; }
#profile-modal .pf-sc__slot{
  position: absolute;
  aspect-ratio: 1;
  transform: translate(-50%, 0);
}
#profile-modal .pf-sc__pg{
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#profile-modal .pf-sc__pg img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  transform-origin: 50% 95%;
  animation: pfScIdle 2.4s ease-in-out infinite;
  animation-delay: var(--sc-delay, 0s);
}
#profile-modal .pf-sc__pg:active img{ transform: scale(1.06,.94); }
#profile-modal .pf-sc__pg.rarity-epic      img{ filter: drop-shadow(0 0 7px rgba(178,76,255,.75)); }
#profile-modal .pf-sc__pg.rarity-legendary img{ filter: drop-shadow(0 0 9px rgba(255,200,60,.9)); }
#profile-modal .pf-sc__pg.rarity-mythical  img{ filter: drop-shadow(0 0 11px rgba(255,102,204,.9)); }
#profile-modal .pf-sc__pg.rarity-exclusive img{ filter: drop-shadow(0 0 9px rgba(63,209,192,.9)); }

/* над головой голубя: [Бета][II] */
#profile-modal .pf-sc__badges{
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: -2px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  white-space: nowrap;
}
#profile-modal .pf-sc__tag{
  position: absolute;
  left: 50%;
  top: calc(100% - 9px);
  transform: translateX(-50%);
  z-index: 1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(20,190,170,.92);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
}
#profile-modal .pf-sc__tier{
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  color: #3a1d00;
  background: linear-gradient(180deg, #fff1c2, #ffb347);
  box-shadow: 0 2px 5px rgba(80,40,0,.45);
}
#profile-modal .pf-sc__empty{
  position: absolute;
  left: 50%;
  top: 70%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20,22,44,.78);
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
}
#profile-modal .pf-sc__hint{
  margin-top: 22px; /* ниже таблички «Бета» под лапками */
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
#profile-modal .pf-sc__hint[hidden]{ display: none; }

@keyframes pfScIdle{ 0%,100%{ transform: scale(1,1); } 50%{ transform: scale(1.04,.96); } }
@media (prefers-reduced-motion: reduce){
  #profile-modal .pf-sc__pg img{ animation: none; }
}

/* тосты («Украдено!», «У игрока щит») должны быть видны поверх профиля и модалки */
body .notification{ z-index: 2147483647; }

/* ===== СОСЕДИ (4.2) — во вкладке поиска, над поиском по нику ===== */
#search-tab .nb-wrap{ padding: 16px 16px 4px; }
#search-tab .nb-head{ display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
#search-tab .nb-head h2{ margin: 0; font-size: 18px; font-weight: 800; color: #fff; }
#search-tab .nb-timer{ font-size: 12px; font-weight: 700; color: #9aa3c7; white-space: nowrap; }
#search-tab .nb-sub{ margin: 4px 0 12px; font-size: 13px; color: #b7bdd8; }
#search-tab .nb-list{ display: flex; flex-direction: column; gap: 8px; }
#search-tab .nb-card{
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 68px; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.07); border-radius: 16px;
  background: #1f1f2b; color: #fff; text-align: left; font-family: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, border-color .2s ease;
}
#search-tab .nb-card:active{ transform: scale(.985); }
#search-tab .nb-card:disabled{ opacity: .7; }
@media (hover: hover) and (pointer: fine){ #search-tab .nb-card:hover{ border-color: rgba(255,255,255,.18); } }
#search-tab .nb-ava{
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 900; font-size: 18px; color: #fff;
  background: #33385a center / cover no-repeat;
}
#search-tab .nb-meta{ display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
#search-tab .nb-name{ font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-tab .nb-info{ font-size: 12px; color: #b7bdd8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-tab .nb-info b{ color: #4ade80; font-weight: 800; }
#search-tab .nb-best{ position: relative; flex: 0 0 52px; width: 52px; height: 52px; }
#search-tab .nb-best img{ width: 100%; height: 100%; object-fit: contain; display: block; }
#search-tab .nb-best.rarity-epic img{ filter: drop-shadow(0 0 5px rgba(178,76,255,.8)); }
#search-tab .nb-best.rarity-legendary img{ filter: drop-shadow(0 0 6px rgba(255,200,60,.9)); }
#search-tab .nb-best.rarity-mythical img{ filter: drop-shadow(0 0 7px rgba(255,102,204,.9)); }
#search-tab .nb-best.rarity-exclusive img{ filter: drop-shadow(0 0 6px rgba(63,209,192,.9)); }
#search-tab .nb-best i{
  position: absolute; right: -2px; top: -2px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 900;
  color: #3a1d00; background: linear-gradient(180deg, #fff1c2, #ffb347);
}
#search-tab .nb-go{ flex: 0 0 auto; font-size: 22px; color: #6b7299; line-height: 1; }
#search-tab .nb-card.is-skel{ pointer-events: none; background: linear-gradient(90deg, #1f1f2b 0%, #2a2a3a 50%, #1f1f2b 100%); background-size: 200% 100%; animation: nbSkel 1.2s linear infinite; }
@keyframes nbSkel{ from{ background-position: 200% 0; } to{ background-position: -200% 0; } }
#search-tab .nb-empty{
  padding: 16px; border-radius: 16px; border: 1px dashed rgba(255,255,255,.14);
  font-size: 13px; color: #b7bdd8; text-align: center;
}
@media (prefers-reduced-motion: reduce){ #search-tab .nb-card.is-skel{ animation: none; } }
