/* Redtune shared UI primitives. Keep page CSS focused on layout/content. */

[hidden],
.search-page [hidden],
.rt-select-menu[hidden],
[data-filter-scope][hidden] {
  display: none !important;
}

.rt-site-menu:not(.is-open) {
  visibility: hidden;
  pointer-events: none;
}

.rt-site-menu.is-open {
  visibility: visible;
  pointer-events: auto;
}

.rt-native-select-source {
  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;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

select:not(.rt-native-select-source) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

select::-ms-expand {
  display: none;
}

.rt-select,
.rt24-live-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.rt-select-button,
.rt24-live-select-button {
  width: 100%;
  min-height: 46px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  background: rgba(255, 255, 255, .82);
  color: var(--rt-text);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
  transition: border-color 160ms var(--rt-ease), background-color 160ms var(--rt-ease), box-shadow 160ms var(--rt-ease);
}

.rt-select-button:hover,
.rt24-live-select-button:hover {
  border-color: var(--rt-line-strong);
  background: #fff;
}

.rt-select.is-open .rt-select-button,
.rt24-live-select.is-open .rt24-live-select-button {
  border-color: rgba(15, 127, 143, .36);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 127, 143, .08);
}

.rt-select-button:focus-visible,
.rt24-live-select-button:focus-visible {
  outline: 0;
  border-color: rgba(15, 127, 143, .5);
  box-shadow: 0 0 0 4px rgba(15, 127, 143, .1);
}

.rt-select-button span[aria-hidden="true"] {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  color: var(--rt-muted);
  font-size: 0;
  transition: transform 160ms var(--rt-ease);
}

.rt-select-button[aria-expanded="true"] span[aria-hidden="true"] {
  transform: translateY(2px) rotate(-135deg);
}

.rt24-live-select-button::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--rt-muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms var(--rt-ease);
}

.rt24-live-select.is-open .rt24-live-select-button::after {
  transform: translateY(2px) rotate(-135deg);
}

.rt-select-menu,
.rt24-live-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 80;
  width: max(100%, 220px);
  max-height: min(54vh, 420px);
  padding: 6px;
  overflow: auto;
  display: grid;
  gap: 3px;
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 48px rgba(16, 24, 40, .12);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.rt24-live-select-menu {
  display: none;
}

.rt24-live-select.is-open .rt24-live-select-menu {
  display: grid;
}

.rt-select-option,
.rt24-live-select-option {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--rt-radius) - 3px);
  background: transparent;
  color: var(--rt-text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
}

.rt-select-option:hover,
.rt-select-option:focus-visible,
.rt-select-option.is-active,
.rt24-live-select-option:hover,
.rt24-live-select-option:focus-visible,
.rt24-live-select-option.is-active {
  outline: 0;
  background: rgba(17, 19, 24, .055);
  color: var(--rt-text);
}

.rt-select-option.is-active,
.rt24-live-select-option.is-active {
  font-weight: 500;
}

.rt-filter-group[aria-label="指標しきい値"] {
  gap: 12px;
}

.rt-filter-buttons,
.rt-search-choice,
.rt-search-filter-buttons {
  align-items: stretch;
}

.rt-filter-group[aria-label="検索対象"] .rt-filter-buttons,
.rt-filter-group[aria-label="チャンネル条件"] .rt-search-choice,
.rt-filter-group[aria-label="動画条件"] .rt-search-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.rt-filter-group[aria-label="指標しきい値"] .rt-search-filter-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 188px));
  justify-content: start;
  gap: 10px;
}

.rt-filter-group[aria-label="動画条件"] .rt-search-choice {
  grid-template-columns: minmax(96px, .5fr) repeat(3, minmax(86px, 1fr));
  align-items: center;
}

.rt-filter-group[aria-label="動画条件"] .rt-search-choice::before {
  color: var(--rt-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.rt-filter-group[aria-label="動画条件"] .rt-search-choice[data-choice-group="videoKind"]::before {
  content: "公開形式";
}

.rt-filter-group[aria-label="動画条件"] .rt-search-choice[data-choice-group="promotion"]::before {
  content: "プロモーション";
}

.rt-filter-group[aria-label="動画条件"] .rt-search-choice[data-choice-group="premiere"]::before {
  content: "プレミア公開";
}

.rt-filter-group[aria-label="チャンネル条件"] .rt-search-choice button,
.rt-filter-group[aria-label="動画条件"] .rt-search-choice button,
.rt-filter-group[aria-label="検索対象"] .rt-filter-buttons button,
.rt-filter-group[aria-label="指標しきい値"] .rt-search-filter-buttons button {
  width: 100%;
  justify-content: center;
}

.rt-field-chip,
.rt-search-choice button,
.rt-search-filter-buttons button {
  box-shadow: none;
}

.rt-field-chip.is-active,
.rt-search-choice button.is-active,
.rt-search-filter-buttons button.is-active,
.rt-field-chip.has-selection,
.rt-search-choice button.has-selection,
.rt-search-filter-buttons button.has-selection {
  border-color: rgba(15, 127, 143, .28);
  background: rgba(236, 252, 255, .88);
  color: var(--rt-accent-ink);
}

.rtci-select-wrap,
.rt340-select-wrap,
.rt24-select-wrap,
.rt-rank-field {
  min-width: 0;
}

.rt-pagination,
.rt-search-pagination,
#rt-search-pagination,
.rtci-pagination,
.rt24-pagination,
.rt340-pagination,
.rt-rank-pagination,
[data-rt-pagination],
[data-live-pagination] {
  margin-top: clamp(34px, 5vw, 64px);
  margin-bottom: clamp(42px, 6vw, 82px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.rt-pagination a,
.rt-pagination button,
.rt-pagination span,
.rt-search-pagination a,
.rt-search-pagination button,
.rt-search-pagination span,
#rt-search-pagination a,
#rt-search-pagination button,
#rt-search-pagination span,
.rtci-pagination a,
.rtci-pagination button,
.rtci-pagination span,
.rt24-pagination a,
.rt24-pagination button,
.rt24-pagination span,
.rt340-pagination a,
.rt340-pagination button,
.rt340-pagination span,
.rt-rank-pagination a,
.rt-rank-pagination button,
.rt-rank-pagination span,
[data-rt-pagination] a,
[data-rt-pagination] button,
[data-rt-pagination] span,
[data-live-pagination] a,
[data-live-pagination] button,
[data-live-pagination] span {
  appearance: none;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rt-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .76);
  color: var(--rt-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 160ms var(--rt-ease), border-color 160ms var(--rt-ease), color 160ms var(--rt-ease), transform 160ms var(--rt-ease);
}

.rt-pagination a:hover,
.rt-pagination button:hover,
.rt-search-pagination a:hover,
.rt-search-pagination button:hover,
#rt-search-pagination a:hover,
#rt-search-pagination button:hover,
.rtci-pagination a:hover,
.rtci-pagination button:hover,
.rt24-pagination a:hover,
.rt24-pagination button:hover,
.rt340-pagination a:hover,
.rt340-pagination button:hover,
.rt-rank-pagination a:hover,
.rt-rank-pagination button:hover,
[data-rt-pagination] a:hover,
[data-rt-pagination] button:hover,
[data-live-pagination] a:hover,
[data-live-pagination] button:hover {
  border-color: var(--rt-line-strong);
  background: #fff;
  color: var(--rt-ink);
}

.rt-pagination [aria-current="page"],
.rt-search-pagination [aria-current="page"],
#rt-search-pagination [aria-current="page"],
.rtci-pagination [aria-current="page"],
.rt24-pagination [aria-current="page"],
.rt340-pagination [aria-current="page"],
.rt-rank-pagination [aria-current="page"],
[data-rt-pagination] [aria-current="page"],
[data-live-pagination] [aria-current="page"] {
  border-color: var(--rt-ink);
  background: var(--rt-ink);
  color: #fff;
}

.rt-page-arrow {
  position: relative;
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 0;
}

.rt-page-arrow::before {
  content: "";
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.rt-page-prev::before {
  transform: translateX(2px) rotate(-135deg);
}

.rt-page-next::before {
  transform: translateX(-2px) rotate(45deg);
}

.rt-page-control[aria-disabled="true"],
.rt-page-control.is-disabled {
  pointer-events: none;
  opacity: .42;
}

@media (max-width: 760px) {
  .rt-filter-group[aria-label="動画条件"] .rt-search-choice {
    grid-template-columns: 1fr;
  }

  .rt-filter-group[aria-label="動画条件"] .rt-search-choice::before {
    margin-top: 4px;
  }
}

.rt24-inline-metric,
.channel-metric {
  display: inline-flex;
  align-items: baseline;
  gap: .12em;
  max-width: 100%;
  white-space: nowrap;
}

.rt24-inline-metric .rt24-unit,
.channel-metric__unit,
.rtci-total-unit {
  font-size: .46em;
  font-weight: 400;
  color: var(--rt-muted);
  line-height: 1;
}
