/* Sıralama (ranking.js) — AGENTS.md §4.2: absolute, inset 0, no vh/vw; the rows scroll in a short window. */
.rnk-overlay {
  position: absolute;
  inset: 0;
  z-index: 10040; /* above the floating chat button (9995) and the menu drawer (9999) */
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5%, 36px);
  background: rgba(2, 6, 23, 0.66);
}
.rnk-card {
  position: relative;
  width: 100%;
  max-width: 980px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.rnk-head {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: clamp(14px, 2.5%, 24px) 70px clamp(12px, 2%, 18px) clamp(14px, 2.5%, 26px);
  border-bottom: 1.5px solid #e2e8f0;
  background: linear-gradient(180deg, #f0f9ff, #ffffff);
}
.rnk-title-wrap { display: flex; align-items: center; gap: 12px; }
.rnk-icon { width: 48px; height: 48px; display: grid; place-items: center; font-size: 26px; border-radius: 14px; background: #e0f2fe; }
.rnk-title { margin: 0; font-size: 24px; font-weight: 900; }
.rnk-sub { font-size: 13px; font-weight: 700; color: #64748b; }
.rnk-head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rnk-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: #f1f5f9; }
.rnk-tab {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}
.rnk-tab.active { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #ffffff; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35); }
.rnk-close {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #f1f5f9;
  color: #475569;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.rnk-close:hover { background: #fee2e2; border-color: #ef4444; color: #ef4444; }
/* window tabs on top of the card: the chosen list is the open window (same colour as the sheet, no line between) */
.rnk-kinds {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 4px;
  padding: 10px 72px 0 14px; background: #64748b;
}
.rnk-kind {
  flex: 0 1 auto; min-width: 0; padding: 11px 22px 12px; border: none; border-radius: 14px 14px 0 0;
  background: #e2e8f0; color: #475569; font-size: 16px; font-weight: 900; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rnk-kind { position: relative; }
.rnk-kind:hover { background: #f1f5f9; }
/* the open window: the sheet's colour + a blue top edge and blue text, so the chosen list is plain to see */
.rnk-kind.active {
  background: #f0f9ff; color: #0369a1; box-shadow: inset 0 4px 0 #0284c7, 0 -3px 10px rgba(2, 132, 199, 0.25);
}
.rnk-kind:not(.active) { background: #94a3b8; color: #f1f5f9; }
.rnk-kind:not(.active):hover { background: #a3b1c4; }
/* the one-time "new" dot (DotWizard NEWS) sits inside the tab's corner (the tab clips its overflow) */
.rnk-kind[data-free-dot]::after { top: 7px; right: 8px; }
.rnk-row.rnk-row-below { grid-template-columns: 52px minmax(0, 1fr); }
.rnk-row-below .rnk-c-team { font-size: 14px; font-weight: 800; color: #0369a1; }
.rnk-table-wrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px clamp(10px, 2%, 22px); }
.rnk-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1.6fr) minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.rnk-row[data-team-profile]:hover { background: #f0f9ff; border-color: #7dd3fc; }
.rnk-row-head { border: none; background: transparent; padding-top: 2px; padding-bottom: 2px; margin: 0; font-size: 12px; font-weight: 900; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
.rnk-row.is-top { background: linear-gradient(90deg, #fffbeb, #ffffff); border-color: #fde68a; }
.rnk-row.is-me { background: linear-gradient(90deg, #e0f2fe, #f0f9ff); border-color: #38bdf8; }
.rnk-c-rank { font-size: 18px; font-weight: 900; text-align: center; }
.rnk-c-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rnk-crest { flex-shrink: 0; display: inline-flex; }
.rnk-flag { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; flex: none; }
.rnk-team-name, .rnk-c-mgr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rnk-team-name { font-weight: 900; }
.rnk-c-mgr { color: #475569; }
.rnk-c-ovr { text-align: center; font-size: 17px; font-weight: 900; color: #0369a1; }
.rnk-rows.is-loading { opacity: 0.5; }
.rnk-mine { position: sticky; bottom: -8px; background: #ffffff; padding: 4px 0 8px; }
.rnk-mine[hidden] { display: none; }
.rnk-mine-gap { padding: 4px 6px; font-size: 12px; font-weight: 900; color: #0369a1; text-transform: uppercase; letter-spacing: 0.4px; }
.rnk-empty { padding: 34px 10px; text-align: center; font-size: 15px; font-weight: 700; color: #64748b; }
.rnk-foot {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px clamp(14px, 2.5%, 26px);
  border-top: 1.5px solid #e2e8f0;
  background: #f8fafc;
}
.rnk-me { font-size: 15px; font-weight: 900; color: #0369a1; }
/* a narrow window (phone, large UI scale): the manager column goes, the ID gets smaller */
@container game (max-width: 900px) {
  .rnk-row { grid-template-columns: 40px minmax(0, 1fr) 46px; gap: 6px; padding: 8px 8px; font-size: 14px; }
  .rnk-c-mgr { display: none; }
}
