.cs-selector {
  --bg-start: #e6ecf5;
  --bg-end: #dce3ef;
  --card-bg: rgba(255,255,255,0.88);
  --card-border: rgba(255,255,255,0.92);
  --accent: #0068B6;
  --accent-soft: #818cf8;
  --feature: #7c3aed;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  position: relative;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--bg-start) 0%, var(--bg-end) 100%);
  padding: 36px 32px 44px;
}
/* Elevate the chip selector's parent container above table containers
   that follow in DOM. Both share .top-block-container.top-full-width-background
   with z-index: 1, but the table's later DOM position means it paints on top
   and covers any overflowing tooltip. */
.top-block-container:has(.cs-selector) {
  z-index: 2;
}
.cs-selector * { box-sizing: border-box; }

/* Decorative blobs live in their own clipped wrapper so tooltips can overflow freely */
.cs-blobs {
  position: absolute; inset: 0;
  border-radius: 20px;
  overflow: hidden;
  pointer-events: none;
}
.cs-blobs::before {
  content: '';
  position: absolute; top: -20%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.07) 0%, transparent 70%);
}
.cs-blobs::after {
  content: '';
  position: absolute; bottom: -20%; left: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(129,140,248,0.06) 0%, transparent 70%);
}

/* ---- Header ---- */
.cs-header {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; gap: 20px; flex-wrap: wrap;
}
.cs-header-left { flex: 1; min-width: 200px; }
.cs-header-left .cs-title {
  font-size: var(--font-size-h2);
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.3px;
}
.cs-header-left p {
  font-size: var(--font-size-p);
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Filter pills ---- */
.cs-filters {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0;
  position: relative; z-index: 2;
  padding: 2px 0;
}
.cs-filter-group {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px;
}
.cs-filter-divider {
  width: 1px;
  height: 28px;
  background: rgba(148,163,184,0.25);
  margin: 0 10px;
  flex-shrink: 0;
}
.cs-filter {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: var(--font-size-p);
  font-weight: 500;
  cursor: pointer; user-select: none;
  transition: all 0.25s cubic-bezier(0.22,1,0.36,1);
  background: var(--card-bg);
  border: 1px solid rgba(148,163,184,0.25);
  color: var(--text-secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  backdrop-filter: blur(6px);
  line-height: 1.4;
}
/* ---- Distinct active colors for two filter groups ---- */
.cs-group-series .cs-filter:hover {
  background: #fff;
  border-color: var(--accent);
}
.cs-group-feature .cs-filter:hover {
  background: #fff;
  border-color: var(--feature);;
}
.cs-group-series .cs-filter.active {
  background: var(--accent);
  border-color: var(--accent);
}
.cs-group-feature .cs-filter.active {
  background: var(--feature);;
  border-color: var(--feature);;
}
.cs-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.30);
}

/* ---- Carousel (2-row horizontal pagination) ---- */
.cs-carousel {
  position: relative;
  z-index: 2;
}
.cs-grid-wrapper {
  position: relative;
  padding-top: 8px;
  clip-path: inset(-300px 0 -600px 0);
}

/* ---- Card grid & horizontal track ---- */
.cs-grid {
  display: block;
}
.cs-track {
  display: flex;
  flex-wrap: nowrap;
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.cs-page {
  display: grid;
  gap: 16px;
  flex-shrink: 0;
  align-content: start;
}

/* ---- Carousel arrows ---- */
.cs-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 10;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(148,163,184,0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--text-secondary);
  transition: all 0.2s;
  user-select: none;
  line-height: 1;
  padding: 0;
}
.cs-arrow:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(99,102,241,0.30);
}
.cs-arrow.hidden { display: none; }
.cs-arrow-prev { left: -16px; }
.cs-arrow-next { right: -16px; }

/* ---- IC Card ---- */
.cs-card {
  position: relative;
  display: flex; flex-direction: column;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 22px 18px 16px;
  transition: all 0.35s cubic-bezier(0.22,1,0.36,1);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.04),
    0 0 0 1px rgba(255,255,255,0.5);
  animation: csFadeIn 0.4s ease forwards;
  opacity: 0;
}
.cs-card:hover {
  transform: translateY(-6px);
  background: #fff;
  border-color: rgba(99,102,241,0.20);
  box-shadow:
    0 12px 40px rgba(99,102,241,0.08),
    0 4px 20px rgba(0,0,0,0.05),
    0 0 0 1px rgba(255,255,255,0.8);
  z-index: 1;
}
.cs-card.cs-tooltip-below:hover {
  z-index: 5;
}

/* NEW badge */
.cs-badge {
  position: absolute; top: 12px; right: 14px;
  padding: 2px 10px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; box-shadow: 0 2px 8px rgba(245,158,11,0.35);
  display: none;
  line-height: 1.4;
}
.cs-badge.show { display: block; }

/* Chip name — flush left */
.cs-name {
  font-size: 17px; font-weight: 700; color: var(--text-primary);
  margin: 0 0 12px; padding-right: 46px;
  letter-spacing: -0.2px;
}

/* Feature list — left aligned, dot flush with name */
.cs-features {
  list-style: none !important;
  margin: 0 0 14px;
  padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  flex: 1; min-height: 0;
}
.cs-features li {
  list-style: none !important;
  font-size: var(--font-size-p);
  color: var(--text-secondary);
  padding: 0;
  margin-left: 0 !important;
  display: flex; align-items: center; gap: 6px;
}
.cs-features li::before {
  display: inline-block;
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  position: static;
  margin: 0;
  padding: 0;
}

/* View Details — centered, no arrow */
.cs-link {
  display: block; text-align: center;
  font-size: var(--font-size-p);
  color: var(--accent);
  text-decoration: none; padding: 10px 0 4px;
  border-top: 1px solid rgba(0,0,0,0.07);
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.cs-link:hover {
  color: var(--accent-soft);
  background: rgba(99,102,241,0.06);
  border-radius: 8px;
  border-top-color: rgba(99,102,241,0.15);
}

/* Tooltip — full feature list */
.cs-tooltip {
  position: absolute;
  left: 0; right: 0;
  width: auto;
  background: rgba(30,41,59,0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
  max-width: none;
  opacity: 0; visibility: hidden;
  transition: all 0.2s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none; z-index: 30;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
/* Above (bottom row cards — tooltip shows above) */
.cs-tooltip-above .cs-tooltip {
  bottom: calc(100% + 8px);
  top: auto;
}
/* Below (top row cards — tooltip shows below) */
.cs-tooltip-below .cs-tooltip {
  top: calc(100% + 8px);
  bottom: auto;
}
/* Tooltip arrow — points away from card */
.cs-tooltip-above .cs-tooltip::after,
.cs-tooltip-below .cs-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-style: solid;
}
/* Above tooltip: arrow points DOWN (toward the card below) */
.cs-tooltip-above .cs-tooltip::after {
  bottom: -8px;
  border-width: 8px 8px 0 8px;
  border-color: rgba(30,41,59,0.97) transparent transparent transparent;
}
/* Below tooltip: arrow points UP (toward the card above) */
.cs-tooltip-below .cs-tooltip::after {
  top: -8px;
  border-width: 0 8px 8px 8px;
  border-color: transparent transparent rgba(30,41,59,0.97) transparent;
}
.cs-card:hover .cs-tooltip {
  opacity: 1; visibility: visible;
}
.cs-card.cs-tooltip-above:hover .cs-tooltip {
  transform: translateY(-2px);
}
.cs-card.cs-tooltip-below:hover .cs-tooltip {
  transform: translateY(2px);
}
.cs-tooltip ul {
  list-style: none !important; margin: 0; padding: 0;
}
.cs-tooltip li {
  list-style: none !important;
  font-size: 13px;
  color: #e2e8f0;
  padding: 3px 0;
  white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.cs-tooltip li::before {
  content: '\00B7';
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-soft);
  background: none;
  width: auto; height: auto;
  border-radius: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* No results */
.cs-empty {
  position: relative; z-index: 2;
  grid-column: 1 / -1;
  text-align: center; padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 15px;
  display: none;
}

/* Animation */
@keyframes csFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .cs-selector { padding: 24px 16px 32px; }
  .cs-card { padding: 20px 14px 14px; }
  .cs-name { font-size: 15px; padding-right: 44px; }

  /* Filter: vertical divider → horizontal line + more row spacing */
  .cs-filters { row-gap: 6px; }
  .cs-filter-divider {
    width: 100%; height: 1px;
    margin: 2px 0;
    flex-shrink: 0;
  }
  .cs-tooltip { padding: 10px 4px; }
  .cs-page { gap: 12px; }
}
@media (max-width: 480px) {
  .cs-page { gap: 10px; }
}
