/* ==========================================================================
   RANKING, KPI, WYKRESY, MODAL PROFILU, KALENDARZ & SKELETON LOADERS
   ========================================================================== */

/* Skeleton Loaders przy starcie */
@keyframes skeletonShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skel {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, #121214 25%, #1e1e22 50%, #121214 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skel-kpi-num { width: 72px; height: 28px; margin: 6px 0 2px; border-radius: 8px; }
.skel-kpi-foot { width: 120px; height: 13px; margin-top: 4px; }
.skel-line { height: 14px; border-radius: 5px; }
.skel-pill { width: 32px; height: 20px; border-radius: 9999px; }
.skel-bar {
  width: 100%;
  background: linear-gradient(90deg, #121214 25%, #1e1e22 50%, #121214 75%);
  background-size: 200% 100%;
  border-radius: 4px 4px 2px 2px;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}

/* Kontrolki: Wyszukiwarka i Archiwum */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 9999px;
  padding: 8px 16px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--neutral-500); }
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-white);
  font-size: 0.9rem;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--neutral-500); }
.search-clear {
  color: var(--neutral-500);
  font-size: 0.85rem;
  padding: 0 4px;
  display: none;
}
.search-clear.visible { display: inline-block; }
.search-clear:hover { color: var(--color-white); }

/* Siatka KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 860px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 14px;
  padding: 16px 18px;
}
.kpi-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neutral-500);
  font-weight: 600;
}
.kpi-number {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-white);
  margin: 6px 0 2px 0;
}
.kpi-foot {
  font-size: 0.78rem;
  color: var(--neutral-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-number-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.kpi-number-row .kpi-number { margin: 0; }
.rec-chip {
  display: none;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  transition: background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.rec-chip.visible { display: inline-flex; }
.rec-chip.is-neutral { color: var(--neutral-300); background: var(--neutral-900); border-color: var(--neutral-800); }
.rec-chip:hover { background: rgba(74, 222, 128, 0.2); border-color: rgba(74, 222, 128, 0.55); }
.rec-chip.is-neutral:hover { background: var(--neutral-800); border-color: var(--neutral-600); }
.profile-modal.rec-modal { min-width: min(420px, calc(100vw - 32px)); max-width: min(460px, calc(100vw - 32px)); }

/* Siatka główna */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 960px) { .dashboard-grid { grid-template-columns: 1fr; } }

.stack-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.box.fill-height {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.box.fill-height .table-scroll { flex: 1; }

.box-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--neutral-900);
  gap: 10px;
  flex-wrap: wrap;
  min-height: 44px;
}
.box-header-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--neutral-500);
}

/* Zmiana pozycji w rankingu globalnym */
.rank-shift {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 9999px;
  vertical-align: middle;
}
.shift-up { color: #4ade80; background: rgba(74, 222, 128, 0.1); }
.shift-down { color: #f87171; background: rgba(248, 113, 113, 0.1); }
.shift-same { color: var(--neutral-600); }
.shift-new { color: #60a5fa; background: rgba(96, 165, 250, 0.12); letter-spacing: 0.04em; }

/* Klikalny nick otwierający profil */
.driver-link {
  color: var(--color-white);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
  border-bottom: 1px solid transparent;
}
.driver-link:hover { border-bottom-color: var(--neutral-500); }

/* Wykres aktywności serwera */
.chart-wrap {
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chart-bars {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
  height: 112px;
  align-items: end;
  padding-top: 12px;
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
  position: relative;
}
.chart-bar {
  width: 100%;
  min-height: 4px;
  background: var(--neutral-800);
  border-radius: 4px 4px 2px 2px;
  transition: background 0.2s ease, height 0.35s ease;
}
.chart-col:hover .chart-bar,
.chart-col.is-peak .chart-bar { background: var(--color-white); }
.chart-col.is-today .chart-bar { background: #4ade80; }
.chart-day {
  font-size: 0.62rem;
  color: var(--neutral-500);
  line-height: 1;
}
.chart-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #171717;
  border: 1px solid var(--neutral-700);
  color: var(--color-white);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.chart-col:hover .chart-tooltip { opacity: 1; }
.chart-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--neutral-400);
  border-top: 1px solid var(--neutral-900);
  padding-top: 10px;
}

/* Paginacja */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--neutral-900);
  font-size: 0.78rem;
  color: var(--neutral-400);
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}
.page-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.page-btn {
  padding: 5px 11px;
  border-radius: 9999px;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  color: var(--neutral-300);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.page-btn:hover:not(:disabled) {
  background: var(--neutral-800);
  color: var(--color-white);
  border-color: var(--neutral-600);
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rank-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  color: var(--neutral-400);
}
.rank-1 { color: #facc15; border-color: rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.08); }
.rank-2 { color: #e5e5e5; border-color: rgba(229, 229, 229, 0.3); background: rgba(229, 229, 229, 0.06); }
.rank-3 { color: #fb923c; border-color: rgba(251, 146, 60, 0.3); background: rgba(251, 146, 60, 0.08); }

.id-pill {
  font-size: 0.7rem;
  color: var(--neutral-500);
  margin-left: 6px;
  font-weight: 500;
}

.delta-positive {
  color: #4ade80;
  font-weight: 600;
}

.table-scroll { width: 100%; overflow-x: auto; }
.text-right { text-align: right; }
.empty-cell {
  text-align: center;
  color: var(--neutral-500);
  padding: 24px 18px;
  font-size: 0.82rem;
}

tr.highlight-row td {
  background-color: rgba(255, 255, 255, 0.05);
  border-top: 1px solid var(--neutral-700);
  border-bottom: 1px solid var(--neutral-700);
}

/* --- MODAL PROFILU KIEROWCY --- */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.profile-overlay.open {
  display: flex;
  animation: fadeScale 0.18s ease-out;
}
.profile-modal {
  width: fit-content;
  min-width: min(480px, calc(100vw - 32px));
  max-width: min(540px, calc(100vw - 32px));
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9);
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
}
.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-white);
  line-height: 1.2;
}
.profile-sub {
  font-size: 0.82rem;
  color: var(--neutral-400);
  margin-top: 4px;
}
.close-modal-btn {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  color: var(--neutral-400);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.close-modal-btn:hover {
  color: var(--color-white);
  border-color: var(--neutral-600);
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.p-stat-box {
  background: var(--neutral-950);
  border: 1px solid var(--neutral-800);
  border-radius: 12px;
  padding: 12px 14px;
}
.p-stat-lbl {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neutral-500);
  font-weight: 600;
}
.p-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-white);
  margin-top: 4px;
}
.p-stat-note {
  font-size: 0.72rem;
  color: var(--neutral-400);
  margin-top: 2px;
}
.profile-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.profile-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neutral-500);
  font-weight: 600;
}

.open-deck-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}
.open-deck-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.badges-list.is-empty {
  display: block;
}

.mini-tcg-chip {
  --mc-accent: #a1a1aa;
  --mc-rgb: 161, 161, 170;

  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: #111114;
  border: 1px solid rgba(var(--mc-rgb), 0.38);
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.mini-tcg-chip:hover {
  transform: translateY(-1.5px);
  border-color: rgba(var(--mc-rgb), 0.8);
  background: #18181c;
  box-shadow: 0 4px 12px -3px rgba(var(--mc-rgb), 0.3);
}

.mini-tcg-chip.tier-1 { --mc-accent: #fde047; --mc-rgb: 250, 204, 21; background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), #111114); }
.mini-tcg-chip.tier-2 { --mc-accent: #f4f4f5; --mc-rgb: 244, 244, 245; }
.mini-tcg-chip.tier-3 { --mc-accent: #fdba74; --mc-rgb: 251, 146, 60; background: linear-gradient(135deg, rgba(251, 146, 60, 0.12), #111114); }
.mini-tcg-chip.tier-ruby { --mc-accent: #fda4af; --mc-rgb: 244, 63, 94; background: linear-gradient(135deg, rgba(244, 63, 94, 0.14), #111114); }
.mini-tcg-chip.tier-monthly { --mc-accent: #6ee7b7; --mc-rgb: 52, 211, 153; background: linear-gradient(135deg, rgba(52, 211, 153, 0.12), #111114); }
.mini-tcg-chip.tier-top10 { --mc-accent: #c4b5fd; --mc-rgb: 168, 85, 247; }
.mini-tcg-chip.tier-top50 { --mc-accent: #93c5fd; --mc-rgb: 96, 165, 250; }

.mini-tcg-chip .chip-icon {
  width: 13px;
  height: 13px;
  color: var(--mc-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-tcg-chip .chip-icon svg {
  width: 100%;
  height: 100%;
}
.mini-tcg-chip .chip-serial {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(var(--mc-rgb), 0.14);
  color: var(--mc-accent);
}

/* Historia firm w profilu */
.career-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.career-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--neutral-950);
  border: 1px solid var(--neutral-800);
  font-size: 0.8rem;
  gap: 16px;
}
.career-company {
  font-weight: 600;
  color: var(--color-white);
  word-break: break-word;
}
.career-dates {
  font-size: 0.72rem;
  color: var(--neutral-400);
  flex-shrink: 0;
}
.career-current {
  color: #4ade80;
  font-weight: 600;
}

/* --- Kalendarz (wybór dnia / tygodnia / miesiąca / zakresu) --- */
.view-picker { display: flex; gap: 10px; align-items: center; position: relative; }

.cal-btn {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  color: var(--neutral-300);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.cal-btn svg { width: 18px; height: 18px; }
.cal-btn:hover, .cal-btn[aria-expanded="true"] {
  border-color: var(--neutral-500);
  background: var(--neutral-900);
  color: var(--color-white);
}
.cal-btn.is-active { color: #4ade80; border-color: rgba(74, 222, 128, 0.45); }
.cal-btn.is-active::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
}

.cal-popover {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9);
  z-index: 60;
}
.cal-popover.open { display: block; animation: fadeScale 0.16s ease-out; transform-origin: top right; }

.cal-modes { display: flex; width: 100%; margin-bottom: 10px; }
.cal-modes .picker-btn { flex: 1; text-align: center; padding: 6px 4px; }

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.02em; color: var(--color-white); }

.cal-grid { display: grid; grid-template-columns: 26px repeat(7, 1fr); gap: 3px; }
.cal-dow {
  text-align: center;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--neutral-500);
  text-transform: uppercase;
  padding: 4px 0;
}
.cal-wk {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--neutral-500);
  border-radius: 7px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.cal-wk:hover:not(:disabled) { color: var(--color-white); border-color: var(--neutral-600); background: var(--neutral-900); }
.cal-wk.is-selected { color: #050505; background: var(--color-white); }
.cal-wk:disabled { opacity: 0.2; cursor: not-allowed; }

.cal-day {
  aspect-ratio: 1;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--neutral-300);
  background: rgba(74, 222, 128, 0);
  transition: border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.cal-day.lvl-0 { background: rgba(255, 255, 255, 0.03); }
.cal-day.lvl-1 { background: rgba(74, 222, 128, 0.09); }
.cal-day.lvl-2 { background: rgba(74, 222, 128, 0.18); }
.cal-day.lvl-3 { background: rgba(74, 222, 128, 0.29); }
.cal-day.lvl-4 { background: rgba(74, 222, 128, 0.42); color: var(--color-white); }
.cal-day.no-data { color: var(--neutral-600); }
.cal-day.is-out { opacity: 0.45; }
.cal-day.is-today { border-color: var(--neutral-500); }
.cal-day:hover:not(:disabled) { border-color: var(--neutral-400); color: var(--color-white); }
.cal-day:disabled { opacity: 0.16; cursor: not-allowed; background: transparent; }
.cal-day.in-range { background: rgba(255, 255, 255, 0.16); color: var(--color-white); }
.cal-day.range-start, .cal-day.range-end { background: var(--color-white); color: #050505; }
.cal-day.is-pending { outline: 1.5px dashed var(--color-white); outline-offset: -2px; }

.cal-hint { font-size: 0.72rem; color: var(--neutral-500); margin: 10px 0 8px; line-height: 1.35; min-height: 1em; }
.cal-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cal-chip {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  color: var(--neutral-300);
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.cal-chip:hover { border-color: var(--neutral-500); color: var(--color-white); }
.cal-chip.active { background: var(--neutral-800); color: var(--color-white); border-color: var(--neutral-600); }

.cal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--neutral-900);
  flex-wrap: wrap;
}
.cal-sel-label { font-size: 0.78rem; font-weight: 700; color: var(--color-white); white-space: nowrap; }
.cal-sel-meta { font-size: 0.7rem; color: var(--neutral-400); margin-top: 2px; }
.cal-foot-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cal-empty { padding: 18px 8px; text-align: center; color: var(--neutral-500); font-size: 0.82rem; }

@media (max-width: 639px) {
  .controls-bar { flex-direction: column; align-items: stretch; }
  .select-dark { width: 100%; }
  .view-picker .select-dark { flex: 1; width: auto; min-width: 0; }
  .cal-day { min-height: 38px; }
}

/* ==========================================================================
   KOLEKCJA KART W PROFILU (grupy + podsumowanie + zwijanie)
   ========================================================================== */
.badges-list:not(.is-empty) {
  display: block;
  margin-bottom: 18px;
}

.coll-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.coll-tile {
  --ct-rgb: 161, 161, 170;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "ico num" "lbl lbl";
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  text-align: left;
  background: linear-gradient(135deg, rgba(var(--ct-rgb), 0.10), #0e0e11);
  border: 1px solid rgba(var(--ct-rgb), 0.28);
  transition: transform 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.coll-tile:hover { transform: translateY(-1px); border-color: rgba(var(--ct-rgb), 0.6); }
.coll-tile-ico { grid-area: ico; width: 15px; height: 15px; color: rgb(var(--ct-rgb)); display: inline-flex; }
.coll-tile-ico svg { width: 100%; height: 100%; }
.coll-tile-num { grid-area: num; font-size: 1.15rem; font-weight: 800; line-height: 1; justify-self: end; }
.coll-tile-lbl {
  grid-area: lbl;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--neutral-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coll-group {
  --ct-rgb: 161, 161, 170;
  padding: 10px 12px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--neutral-950);
  border: 1px solid var(--neutral-800);
  border-left: 3px solid rgba(var(--ct-rgb), 0.7);
  transition: background 0.4s ease;
}
.coll-group.is-flash { background: rgba(var(--ct-rgb), 0.10); }
.coll-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.coll-group-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--neutral-300);
}
.coll-group-count {
  font-size: 0.64rem;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(var(--ct-rgb), 0.15);
  color: rgb(var(--ct-rgb));
  letter-spacing: 0;
}
.coll-toggle {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  color: var(--neutral-300);
  border: 1px solid var(--neutral-700);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.coll-toggle:hover { color: #fff; border-color: var(--neutral-500); }

/* ----- Siatka miniatur prawdziwych kart ----- */
.coll-cards {
  --mc-w: 92px;
  --mc-s: 0.2584; /* 92 / 356 (szerokość karty w talii) */
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--mc-w));
  justify-content: space-between;
  gap: 12px 8px;
}
.coll-group:not(.is-expanded) .mini-card.is-extra { display: none; }

.mini-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: var(--mc-w);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mini-card-frame {
  position: relative;
  width: var(--mc-w);
  height: calc(var(--mc-w) * 1.47);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.85);
}
.mini-card:hover .mini-card-frame,
.mini-card:focus-visible .mini-card-frame {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 12px 24px -8px rgba(var(--ct-rgb, 255, 255, 255), 0.55);
}
.mini-card-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 356px;
  height: 523px;
  transform: scale(var(--mc-s));
  transform-origin: top left;
  pointer-events: none;
}
/* karta w miniaturze: bez animacji pulsu (oszczędność GPU przy wielu kartach) */
.mini-card-stage .tcg-card { animation: none !important; box-shadow: none; }
.mini-card-cap {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--neutral-400);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mini-card:hover .mini-card-cap { color: #fff; }

@media (max-width: 480px) {
  .coll-summary { grid-template-columns: repeat(3, 1fr); }
  .coll-tile-lbl { font-size: 0.58rem; }
  .coll-cards { --mc-w: 84px; --mc-s: 0.2360; } /* 84 / 356 -> 3 w rzędzie na telefonie */
}

/* Pasek przycisków talii: jedna linia przewijana poziomo (przy 30+ kartach) */
.deck-overlay .deck-pills-bar {
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  width: min(440px, calc(100vw - 32px));
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-700) transparent;
  -webkit-overflow-scrolling: touch;
}
.deck-overlay .deck-slot-btn { flex-shrink: 0; white-space: nowrap; }

/* ==========================================================================
   HISTORIA REKORDÓW DOBOWYCH W MODALU
   ========================================================================== */
.rec-history-list {
  margin-bottom: 0;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}
.rec-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--neutral-950);
  border: 1px solid var(--neutral-800);
  font-size: 0.8rem;
  gap: 12px;
}
.rec-history-item.is-current {
  border-color: rgba(74, 222, 128, 0.38);
  background: rgba(74, 222, 128, 0.05);
}
.rec-history-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rec-history-meta {
  font-size: 0.7rem;
  color: var(--neutral-400);
}
.rec-history-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.rec-history-delta {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}