/* Category discovery tools: filtering, sorting, incremental reveal and comparison. */

body.page-category,
body.page-ranking.ranking-detail-v2 {
  --category-ink: var(--site-ink, #263746);
  --category-muted: var(--site-muted, #665f55);
  --category-green: var(--site-green, #27ae60);
  --category-green-deep: var(--site-green-deep, #1f8d50);
  --category-navy: var(--site-navy, #2c3e50);
  --category-coral: var(--site-coral, #e07a45);
  --category-cream: var(--site-cream, #faf6f0);
  --category-gold: var(--site-gold, #bd8b36);
  --category-border: var(--site-border, #e6dccb);
  --category-shadow: var(--site-shadow-soft, 0 7px 22px rgba(74, 58, 38, 0.08));
}

/* Ranking details reuse the category explorer controls without leaking into legacy rankings. */
body.page-ranking.ranking-detail-v2 #categoryExplorer {
  max-width: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 98% 0%, rgba(39, 174, 96, 0.13), transparent 15rem),
    radial-gradient(circle at 0% 100%, rgba(224, 122, 69, 0.08), transparent 14rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(250, 246, 240, 0.95));
}

body.page-ranking.ranking-detail-v2 .category-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: #9a572f;
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

body.page-ranking.ranking-detail-v2 .category-section-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  flex: 0 0 18px;
  background: var(--category-coral);
  border-radius: 99px;
}

body.page-ranking.ranking-detail-v2 .category-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 13px;
}

body.page-ranking.ranking-detail-v2 .category-results-head h2 {
  margin: 0;
  color: var(--category-navy);
  font-size: clamp(1.18rem, 2.2vw, 1.45rem);
  font-weight: 900;
  line-height: 1.35;
}

body.page-ranking.ranking-detail-v2 #categoryExplorer :where(.category-status-tabs, .category-control-grid),
body.page-ranking.ranking-detail-v2 .ranking-results,
body.page-ranking.ranking-detail-v2 .ranking-item-list {
  max-width: 100%;
  min-width: 0;
}

body.page-ranking.ranking-detail-v2 #categoryExplorer :where(button, label, select, input) {
  min-width: 0;
}

body.page-ranking.ranking-detail-v2 [data-compare-item] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--category-navy);
  background: #fff;
  border: 1.5px solid #cfd8d2;
  border-radius: 10px;
  box-shadow: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

body.page-ranking.ranking-detail-v2 [data-compare-item]::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--category-green-deep);
  background: #e8f7ee;
  border-radius: 50%;
  font-size: 0.82rem;
  line-height: 1;
}

body.page-ranking.ranking-detail-v2 [data-compare-item]:hover,
body.page-ranking.ranking-detail-v2 [data-compare-item]:focus-visible {
  color: var(--category-green-deep);
  background: #fbfffc;
  border-color: rgba(39, 174, 96, 0.52);
}

body.page-ranking.ranking-detail-v2 [data-compare-item].is-selected,
body.page-ranking.ranking-detail-v2 [data-compare-item][aria-pressed="true"] {
  color: #fff;
  background: var(--category-green-deep);
  border-color: var(--category-green-deep);
}

body.page-ranking.ranking-detail-v2 [data-compare-item].is-selected::before,
body.page-ranking.ranking-detail-v2 [data-compare-item][aria-pressed="true"]::before {
  content: "✓";
  color: var(--category-green-deep);
  background: #fff;
}

body.page-ranking.ranking-detail-v2 [data-compare-item][aria-disabled="true"]:not(.is-selected) {
  opacity: 0.52;
  cursor: not-allowed;
}

#categoryExplorer {
  position: relative;
  isolation: isolate;
  margin: 0 0 20px;
  padding: clamp(18px, 2.5vw, 26px);
  color: var(--category-ink);
  background:
    radial-gradient(circle at 98% 0%, rgba(39, 174, 96, 0.10), transparent 15rem),
    radial-gradient(circle at 0% 100%, rgba(224, 122, 69, 0.07), transparent 14rem),
    rgba(255, 255, 255, 0.98);
  border: 1px solid var(--category-border);
  border-radius: 20px;
  box-shadow: var(--category-shadow);
}

#categoryExplorer::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--category-green), var(--category-gold));
  border-radius: 20px 0 0 20px;
}

#categoryExplorer :where(h2, h3) {
  color: var(--category-navy);
  font-weight: 900;
  line-height: 1.35;
}

#categoryExplorer :where(.category-explorer-head, .category-explorer-heading, .category-section-heading),
.page-category .category-purpose .category-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

#categoryExplorer :where(.category-explorer-head, .category-explorer-heading, .category-section-heading) > div,
.page-category .category-purpose .category-section-heading > div {
  min-width: 0;
}

#categoryExplorer :where(.category-explorer-head, .category-explorer-heading, .category-section-heading) h2,
.page-category .category-purpose .category-section-heading h2 {
  margin: 0 0 5px;
  font-size: clamp(1.14rem, 2vw, 1.36rem);
}

#categoryExplorer :where(.category-explorer-head, .category-explorer-heading, .category-section-heading) p,
#categoryExplorer .category-explorer-lead,
.page-category .category-purpose .category-section-heading p {
  margin: 0;
  color: var(--category-muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.7;
}

#categoryExplorer :where(.category-status-group, .category-explorer-status, .category-status-tabs, [data-category-status-group]) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px;
  background: #f4f0e9;
  border: 1px solid #ebe1d4;
  border-radius: 14px;
}

#categoryExplorer [data-category-status] {
  min-height: 42px;
  padding: 8px 15px;
  color: #5f5a52;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#categoryExplorer [data-category-status]:hover {
  color: var(--category-green-deep);
  background: rgba(255, 255, 255, 0.72);
}

#categoryExplorer [data-category-status].is-active,
#categoryExplorer [data-category-status][aria-pressed="true"] {
  color: #fff;
  background: var(--category-navy);
  border-color: var(--category-navy);
  box-shadow: 0 6px 14px rgba(44, 62, 80, 0.18);
}

#categoryExplorer [data-category-status]:active {
  transform: translateY(1px);
}

#categoryExplorer :where(.category-explorer-controls, .category-filter-grid, .category-control-grid) {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

#categoryExplorer :where(.category-explorer-field, .category-filter-field) {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

#categoryExplorer .category-control-grid > label {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

#categoryExplorer :where(.category-explorer-field, .category-filter-field) > label,
#categoryExplorer label[for="categoryPriceMax"],
#categoryExplorer label[for="categoryQuantity"],
#categoryExplorer label[for="categorySort"],
#categoryExplorer label[for="categoryBudget"] {
  color: var(--category-navy);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.35;
}

#categoryExplorer .category-control-grid > label > span:first-child {
  color: var(--category-navy);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.35;
}

#categoryExplorer .category-budget-input {
  position: relative;
  display: block;
}

#categoryExplorer .category-budget-input input {
  padding-right: 38px;
}

#categoryExplorer .category-budget-input em {
  position: absolute;
  top: 50%;
  right: 13px;
  color: #706b63;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  transform: translateY(-50%);
  pointer-events: none;
}

#categoryExplorer :where(select, input[type="number"], input[type="text"]) {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 9px 38px 9px 12px;
  color: var(--category-ink);
  background-color: #fff;
  border: 1.5px solid #d9d1c5;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(74, 58, 38, 0.04);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.3;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#categoryExplorer select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6f766f 50%),
    linear-gradient(135deg, #6f766f 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

#categoryExplorer :where(select, input[type="number"], input[type="text"]):hover {
  border-color: #b9cdbf;
}

#categoryExplorer :where(select, input[type="number"], input[type="text"]):focus-visible {
  outline: 0;
  border-color: var(--category-green);
  box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.14);
}

#categoryExplorer :where(.category-field-help, .category-explorer-field small) {
  color: #7a746b;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.45;
}

#categoryExplorer .category-control-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding-top: 14px;
  border-top: 1px solid #eee5d8;
}

#categoryExplorer .category-control-footer a {
  color: var(--category-green-deep);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

#categoryExplorer .category-control-footer a:hover,
#categoryExplorer .category-control-footer a:focus-visible {
  color: var(--category-navy);
}

#categoryExplorer :where(.category-explorer-results, .category-results-row) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding-top: 14px;
  border-top: 1px solid #eee5d8;
}

#categoryResultCount {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 0;
  padding: 5px 11px;
  color: var(--category-green-deep);
  background: #eaf8ef;
  border: 1px solid #cfe9d8;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.page-category .category-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 13px;
}

.page-category .category-results-head h2 {
  margin: 0;
  color: var(--category-navy);
  font-size: clamp(1.18rem, 2.2vw, 1.45rem);
  font-weight: 900;
  line-height: 1.35;
}

.page-category .category-purpose {
  margin: 0 0 20px;
  padding: clamp(18px, 2.5vw, 26px);
  background:
    radial-gradient(circle at 96% 4%, rgba(224, 122, 69, 0.11), transparent 14rem),
    linear-gradient(145deg, #fffdf9, #fff8ef);
  border: 1px solid #ead8bf;
  border-radius: 20px;
  box-shadow: var(--category-shadow);
}

.page-category .category-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: #9a572f;
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.page-category .category-section-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--category-coral);
  border-radius: 99px;
}

.page-category .category-purpose-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.page-category .category-purpose-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  grid-template-rows: minmax(92px, auto) auto;
  gap: 11px 12px;
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #eadfce;
  border-radius: 15px;
  box-shadow: 0 6px 17px rgba(94, 67, 39, 0.07);
}

.page-category .category-purpose-card > :where(img, .category-purpose-placeholder) {
  width: 82px;
  height: 82px;
  object-fit: contain;
  background: #fff;
  border-radius: 11px;
  box-shadow: 0 3px 11px rgba(44, 62, 80, 0.08);
}

.page-category .category-purpose-placeholder {
  display: grid;
  place-items: center;
  font-size: 1.55rem;
}

.page-category .category-purpose-card > div {
  min-width: 0;
}

.page-category .category-purpose-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 5px;
  padding: 3px 8px;
  color: #8a4d2f;
  background: #fff0e6;
  border: 1px solid #f1d2c0;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 900;
}

.page-category .category-purpose-card h3 {
  display: -webkit-box;
  margin: 0 0 4px;
  overflow: hidden;
  color: var(--category-navy);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-category .category-purpose-card h3 a {
  color: inherit;
  text-decoration: none;
}

.page-category .category-purpose-card h3 a:hover,
.page-category .category-purpose-card h3 a:focus-visible {
  color: var(--category-green-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-category .category-purpose-card p {
  margin: 0 0 3px;
  color: var(--category-muted);
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1.45;
}

.page-category .category-purpose-card strong {
  color: var(--category-green-deep);
  font-size: 0.76rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.page-category .category-purpose-card > [data-compare-item] {
  grid-column: 1 / -1;
  width: 100%;
}

#categoryResetFilters {
  min-height: 40px;
  padding: 7px 12px;
  color: var(--category-navy);
  background: #fff;
  border: 1px solid #d8cdbc;
  border-radius: 10px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

#categoryResetFilters:hover:not(:disabled) {
  color: var(--category-green-deep);
  background: #f7fcf9;
  border-color: rgba(39, 174, 96, 0.42);
}

#categoryResetFilters:disabled {
  opacity: 0.45;
  cursor: default;
}

#categoryItemList [data-category-item][hidden],
#categoryEmptyState[hidden],
#categoryLoadMore[hidden],
#categoryCompareTray[hidden],
#categoryCompareDialog[hidden] {
  display: none !important;
}

#categoryItemList [data-category-item] {
  scroll-margin-top: 84px;
}

.page-category [data-compare-item] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--category-navy);
  background: #fff;
  border: 1.5px solid #cfd8d2;
  border-radius: 10px;
  box-shadow: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.page-category [data-compare-item]::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--category-green-deep);
  background: #e8f7ee;
  border-radius: 50%;
  font-size: 0.82rem;
  line-height: 1;
}

.page-category [data-compare-item]:hover,
.page-category [data-compare-item]:focus-visible {
  color: var(--category-green-deep);
  background: #fbfffc;
  border-color: rgba(39, 174, 96, 0.52);
}

.page-category [data-compare-item].is-selected,
.page-category [data-compare-item][aria-pressed="true"] {
  color: #fff;
  background: var(--category-green-deep);
  border-color: var(--category-green-deep);
}

.page-category [data-compare-item].is-selected::before,
.page-category [data-compare-item][aria-pressed="true"]::before {
  content: "✓";
  color: var(--category-green-deep);
  background: #fff;
}

.page-category [data-compare-item][aria-disabled="true"]:not(.is-selected) {
  opacity: 0.52;
  cursor: not-allowed;
}

#categoryLoadMore {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(420px, 100%);
  min-height: 50px;
  margin: 22px auto 30px;
  padding: 10px 20px;
  color: var(--category-green-deep);
  background: #fff;
  border: 1.5px solid rgba(39, 174, 96, 0.38);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(39, 174, 96, 0.09);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#categoryLoadMore:hover,
#categoryLoadMore:focus-visible {
  color: #fff;
  background: var(--category-green-deep);
  border-color: var(--category-green-deep);
  box-shadow: 0 10px 24px rgba(39, 174, 96, 0.20);
  transform: translateY(-1px);
}

#categoryEmptyState {
  margin: 18px 0 28px;
  padding: clamp(28px, 5vw, 48px) 20px;
  color: var(--category-muted);
  background: #fffdf9;
  border: 1px dashed #d7c9b7;
  border-radius: 18px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 750;
}

#categoryEmptyState :where(strong, h2, h3) {
  display: block;
  margin-bottom: 6px;
  color: var(--category-navy);
  font-size: 1rem;
  font-weight: 900;
}

#categoryEmptyState [data-reset-category-filters] {
  min-height: 44px;
  margin-top: 14px;
  padding: 8px 15px;
  color: #fff;
  background: var(--category-green-deep);
  border: 1px solid var(--category-green-deep);
  border-radius: 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

#categoryEmptyState [data-reset-category-filters]:hover,
#categoryEmptyState [data-reset-category-filters]:focus-visible {
  background: #176d3c;
  border-color: #176d3c;
}

.category-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

body.has-category-compare-tray {
  padding-bottom: 112px;
}

#categoryCompareTray {
  position: fixed;
  z-index: 980;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 16px;
  width: min(1088px, calc(100% - 32px));
  margin: 0 auto;
  color: #fff;
  background: rgba(44, 62, 80, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 17px;
  box-shadow: 0 18px 45px rgba(25, 36, 48, 0.28);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.category-compare-tray-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  min-height: 78px;
  padding: 11px 13px 11px 17px;
}

.category-compare-summary {
  display: grid;
  gap: 1px;
  min-width: 150px;
}

.category-compare-summary strong {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.category-compare-summary span {
  color: #dbe4e8;
  font-size: 0.68rem;
  font-weight: 700;
}

.category-compare-selected-list {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
}

.category-compare-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 230px;
  min-height: 38px;
  padding: 5px 5px 5px 10px;
  color: var(--category-navy);
  background: #fffaf3;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  font-size: 0.70rem;
  font-weight: 850;
  line-height: 1.3;
}

.category-compare-chip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-compare-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-left: 5px;
  padding: 0;
  color: #596573;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.category-compare-chip-remove:hover,
.category-compare-chip-remove:focus-visible {
  color: #9c3f2c;
  background: #feece8;
}

.category-compare-tray-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-compare-clear,
.category-compare-open {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.category-compare-clear {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.38);
}

.category-compare-clear:hover,
.category-compare-clear:focus-visible {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.62);
}

.category-compare-open {
  color: #fff;
  background: var(--category-green);
  border: 1px solid var(--category-green);
  box-shadow: 0 7px 17px rgba(39, 174, 96, 0.28);
}

.category-compare-open:hover:not(:disabled),
.category-compare-open:focus-visible:not(:disabled) {
  background: var(--category-green-deep);
  border-color: var(--category-green-deep);
}

.category-compare-open:disabled {
  opacity: 0.48;
  box-shadow: none;
  cursor: default;
}

#categoryCompareDialog {
  color: var(--category-ink);
}

dialog#categoryCompareDialog {
  width: min(980px, calc(100% - 28px));
  max-width: none;
  max-height: min(88vh, 820px);
  margin: auto;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

dialog#categoryCompareDialog::backdrop {
  background: rgba(28, 39, 49, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#categoryCompareDialog:not(dialog) {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(28, 39, 49, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#categoryCompareDialog:not(dialog).is-open {
  display: grid;
}

.category-compare-dialog-panel {
  width: 100%;
  max-height: min(88vh, 820px);
  overflow: hidden;
  background: #fffdf9;
  border: 1px solid rgba(230, 220, 203, 0.92);
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(24, 33, 43, 0.30);
}

#categoryCompareDialog:not(dialog) .category-compare-dialog-panel {
  width: min(980px, 100%);
}

.category-compare-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 17px;
  background:
    radial-gradient(circle at 94% 0%, rgba(39, 174, 96, 0.13), transparent 12rem),
    linear-gradient(135deg, #fffaf3, #f5fbf7);
  border-bottom: 1px solid var(--category-border);
}

.category-compare-dialog-header h2 {
  margin: 0 0 4px;
  color: var(--category-navy);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 900;
  line-height: 1.3;
}

.category-compare-dialog-header p {
  margin: 0;
  color: var(--category-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.55;
}

.category-compare-dialog-close {
  min-width: 68px;
  min-height: 42px;
  padding: 7px 12px;
  color: var(--category-navy);
  background: #fff;
  border: 1px solid #d8cdbc;
  border-radius: 10px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}

.category-compare-dialog-close:hover,
.category-compare-dialog-close:focus-visible {
  color: #963f2b;
  background: #fff9f6;
  border-color: rgba(224, 122, 69, 0.46);
}

.category-comparison-table-scroll {
  max-height: calc(min(88vh, 820px) - 100px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.category-comparison-table-scroll:focus-visible {
  outline: 3px solid rgba(39, 174, 96, 0.26);
  outline-offset: -3px;
}

.category-comparison-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--category-ink);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.category-comparison-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.category-comparison-table :where(th, td) {
  min-width: 190px;
  padding: 13px 14px;
  border-right: 1px solid #eee5da;
  border-bottom: 1px solid #eee5da;
  vertical-align: middle;
  text-align: left;
}

.category-comparison-table :where(th, td):last-child {
  border-right: 0;
}

.category-comparison-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: var(--category-navy);
  background: #f7f2ea;
  font-weight: 900;
  vertical-align: top;
}

.category-comparison-table :where(thead th:first-child, tbody th) {
  position: sticky;
  z-index: 3;
  left: 0;
  min-width: 138px;
  width: 138px;
  color: #5d5a55;
  background: #fbf8f3;
  font-size: 0.74rem;
  font-weight: 900;
}

.category-comparison-table thead th:first-child {
  z-index: 4;
  background: #f2ece3;
}

.category-comparison-table tbody td {
  background: #fff;
  font-weight: 750;
}

.category-comparison-table tbody tr:nth-child(even) td {
  background: #fdfbf8;
}

.category-comparison-product {
  display: block;
  min-height: 2.7em;
  margin-bottom: 9px;
  color: var(--category-navy);
  font-size: 0.80rem;
  font-weight: 900;
  line-height: 1.4;
}

.category-comparison-remove {
  min-height: 34px;
  padding: 5px 9px;
  color: #8f4d36;
  background: #fff8f4;
  border: 1px solid #edcdbf;
  border-radius: 8px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}

.category-comparison-remove:hover,
.category-comparison-remove:focus-visible {
  color: #fff;
  background: var(--category-coral);
  border-color: var(--category-coral);
}

.category-comparison-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 13px;
  color: #fff;
  background: var(--category-green-deep);
  border-radius: 9px;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 900;
}

.category-comparison-link:hover,
.category-comparison-link:focus-visible {
  color: #fff;
  background: #176d3c;
}

body.category-dialog-open {
  overflow: hidden;
}

body.has-category-compare-tray :where(#backToTop, .back-to-top) {
  bottom: 112px;
}

body.has-category-compare-tray .year-end-banner {
  display: none !important;
}

@media (max-width: 840px) {
  #categoryExplorer :where(.category-explorer-controls, .category-filter-grid, .category-control-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-category .category-purpose-grid {
    grid-template-columns: 1fr;
  }

  .page-category .category-purpose-card {
    grid-template-columns: 86px minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
  }

  .page-category .category-purpose-card > :where(img, .category-purpose-placeholder) {
    width: 86px;
    height: 86px;
  }

  .page-category .category-purpose-card > [data-compare-item] {
    grid-column: auto;
    width: auto;
  }

  .category-compare-tray-inner {
    grid-template-columns: minmax(130px, auto) minmax(0, 1fr) auto;
  }

  .category-compare-selected-list {
    gap: 5px;
  }

  .category-compare-chip {
    max-width: 170px;
  }

  .category-compare-clear {
    display: none;
  }
}

@media (max-width: 640px) {
  #categoryExplorer {
    margin-bottom: 16px;
    padding: 17px 15px 16px;
    border-radius: 16px;
  }

  #categoryExplorer::before {
    width: 4px;
    border-radius: 16px 0 0 16px;
  }

  #categoryExplorer :where(.category-explorer-head, .category-explorer-heading, .category-section-heading),
  .page-category .category-purpose .category-section-heading {
    display: block;
    margin-bottom: 14px;
  }

  #categoryExplorer :where(.category-status-group, .category-explorer-status, .category-status-tabs, [data-category-status-group]) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
  }

  #categoryExplorer [data-category-status] {
    min-height: 44px;
    padding: 7px 5px;
    font-size: 0.72rem;
  }

  #categoryExplorer :where(.category-explorer-controls, .category-filter-grid, .category-control-grid) {
    gap: 11px 9px;
    margin-bottom: 12px;
  }

  #categoryExplorer :where(select, input[type="number"], input[type="text"]) {
    min-height: 48px;
    padding-left: 10px;
    font-size: 0.80rem;
  }

  #categoryExplorer :where(.category-explorer-results, .category-results-row) {
    align-items: stretch;
    min-height: 0;
    padding-top: 12px;
  }

  #categoryResultCount {
    min-height: 40px;
    border-radius: 10px;
  }

  #categoryResetFilters {
    min-height: 42px;
  }

  .page-category [data-compare-item] {
    min-height: 44px;
  }

  #categoryLoadMore {
    min-height: 52px;
    margin-top: 18px;
  }

  .page-category .category-purpose {
    padding: 17px 15px;
    border-radius: 16px;
  }

  .page-category .category-purpose-card {
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
  }

  .page-category .category-purpose-card > :where(img, .category-purpose-placeholder) {
    width: 76px;
    height: 76px;
  }

  .page-category .category-purpose-card > [data-compare-item] {
    grid-column: 1 / -1;
    width: 100%;
  }

  body.has-category-compare-tray {
    padding-bottom: 150px;
  }

  #categoryCompareTray {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    width: calc(100% - 16px);
    border-radius: 15px;
  }

  .category-compare-tray-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    min-height: 0;
    padding: 10px;
  }

  .category-compare-summary {
    min-width: 0;
  }

  .category-compare-summary span {
    font-size: 0.64rem;
  }

  .category-compare-selected-list {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .category-compare-selected-list::-webkit-scrollbar {
    display: none;
  }

  .category-compare-chip {
    max-width: 180px;
    flex: 0 0 auto;
  }

  .category-compare-tray-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .category-compare-open {
    min-height: 46px;
    padding-inline: 17px;
  }

  dialog#categoryCompareDialog {
    width: calc(100% - 14px);
    max-height: calc(100dvh - 20px);
  }

  #categoryCompareDialog:not(dialog) {
    align-items: end;
    padding: 7px;
  }

  .category-compare-dialog-panel,
  #categoryCompareDialog:not(dialog) .category-compare-dialog-panel {
    max-height: calc(100dvh - 20px);
    border-radius: 17px;
  }

  .category-compare-dialog-header {
    gap: 12px;
    padding: 15px 14px 13px;
  }

  .category-compare-dialog-header p {
    max-width: 250px;
    font-size: 0.68rem;
  }

  .category-compare-dialog-close {
    min-width: 58px;
    min-height: 44px;
    padding-inline: 9px;
  }

  .category-comparison-table-scroll {
    max-height: calc(100dvh - 112px);
  }

  .category-comparison-table {
    min-width: 650px;
  }

  .category-comparison-table :where(th, td) {
    min-width: 168px;
    padding: 11px 10px;
  }

  .category-comparison-table :where(thead th:first-child, tbody th) {
    min-width: 112px;
    width: 112px;
  }

  body.has-category-compare-tray :where(#backToTop, .back-to-top) {
    bottom: 148px;
  }
}

@media (max-width: 340px) {
  #categoryExplorer :where(.category-explorer-controls, .category-filter-grid, .category-control-grid) {
    grid-template-columns: 1fr;
  }

  #categoryExplorer :where(.category-field-help, .category-explorer-field small) {
    display: none;
  }
}

@media (max-width: 640px) {
  body.page-ranking.ranking-detail-v2 .category-results-head {
    align-items: flex-start;
    margin: 18px 0 11px;
  }

  body.page-ranking.ranking-detail-v2 .category-results-head h2 {
    font-size: 1.12rem;
  }

  body.page-ranking.ranking-detail-v2 #categoryExplorer .category-status-tabs {
    width: 100%;
    overflow: hidden;
  }

  body.page-ranking.ranking-detail-v2 #categoryExplorer [data-category-status] {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  body.page-ranking.ranking-detail-v2 [data-compare-item] {
    min-height: 48px;
    padding-inline: 7px;
    font-size: 0.72rem;
    white-space: normal;
  }
}

@media (max-width: 340px) {
  body.page-ranking.ranking-detail-v2 #categoryExplorer .category-status-tabs {
    gap: 3px;
  }

  body.page-ranking.ranking-detail-v2 #categoryExplorer [data-category-status] {
    padding-inline: 3px;
    font-size: 0.66rem;
  }

  body.page-ranking.ranking-detail-v2 .category-results-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  body.page-ranking.ranking-detail-v2 #categoryResultCount {
    padding-inline: 8px;
    font-size: 0.70rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #categoryExplorer *,
  #categoryCompareTray *,
  #categoryCompareDialog * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  #categoryExplorer,
  #categoryCompareTray,
  #categoryCompareDialog,
  #categoryLoadMore,
  [data-compare-item] {
    display: none !important;
  }

  body.has-category-compare-tray {
    padding-bottom: 0;
  }
}
