:root {
  --content-width: min(92%, 1560px);
  --side-panel-width: 340px;
  --side-panel-max-width: calc(100% - 20px);
  --panel-border: 1px solid var(--line-soft);
  --legend-grid-columns: 20px 30px minmax(0, 1fr);
  --legend-grid-gap: 10px;
  --tooltip-background: rgba(0, 0, 0, 0.8);
  --desktop-map-height: 680px;
  --mobile-map-height: 400px;
  --search-max-height: 540px;
  --search-body-max-height: 488px;
  --mobile-search-max-height: 1100px;
  --legend-max-height: min(calc(100vh - 144px), 480px);
  --legend-collapsed-height: 44px;
  --jsc-scroll-compensation: 0px;
  --chart-frame-max-height: 920px;
  --chart-canvas-height: 800px;
  --font-body: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: Consolas, "Cascadia Mono", "Yu Gothic UI", monospace;
  --page-bg: #eef3f6;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-muted: #edf3f7;
  --text-main: #22313f;
  --text-muted: #607181;
  --line-soft: #d6e0e8;
  --accent: #386f9e;
  --accent-soft: #e7f1f8;
  --panel-radius: 13px;
  --panel-shadow: 0 12px 30px rgba(28, 45, 62, 0.12);
  --motion-fast: 0.12s ease;
  --motion-base: 0.16s ease;
  --press-transform: scale(0.985);
  --focus-ring: 2px solid rgba(56, 111, 158, 0.42);
}

html,
body {
  overflow-anchor: none;
}

body.is-image-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
  padding-right: var(--image-modal-scrollbar-compensation, 0px);
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(93, 143, 178, 0.16), transparent 34rem),
    linear-gradient(180deg, #f7fafc 0%, var(--page-bg) 45%, #e9eff3 100%);
  min-height: max(200vh, var(--jsc-tab-scroll-min-height, 0px));
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

button,
.button-like,
.filter-dropdown-trigger,
.select-mode-option span,
.tab-header li,
.filter-dropdown-action-button,
.popup-nav-button,
.prefecture-detail-button,
.maplibregl-ctrl button {
  transition:
    background-color var(--motion-fast),
    border-color var(--motion-fast),
    color var(--motion-fast),
    opacity var(--motion-fast),
    box-shadow var(--motion-fast),
    transform 0.08s ease;
}

button:not(:disabled):active,
.button-like:not(:disabled):active,
.filter-dropdown-trigger:active,
.select-mode-option span:active,
.tab-header li:active,
.filter-dropdown-action-button:not(:disabled):active,
.popup-nav-button:not(:disabled):active,
.prefecture-detail-button:not(:disabled):active,
.maplibregl-ctrl button:not(:disabled):active {
  transform: var(--press-transform);
  box-shadow: inset 0 2px 4px rgba(20, 34, 47, 0.18) !important;
}

button:focus-visible,
.button-like:focus-visible,
.filter-dropdown-trigger:focus-visible,
.select-mode-option input:focus-visible + span,
.tab-header li:focus-visible,
.filter-dropdown-action-button:focus-visible,
.popup-nav-button:focus-visible,
.prefecture-detail-button:focus-visible,
.maplibregl-ctrl button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

button:disabled,
.button-like:disabled,
.filter-dropdown-action-button:disabled,
.popup-nav-button:disabled,
.prefecture-detail-button:disabled,
.maplibregl-ctrl button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

body.is-filter-updating :where(
  .filter-dropdown-portal,
  .filter-dropdown-backdrop,
  .filter-dropdown-trigger,
  .filter-dropdown-clear,
  .select-mode-option,
  .marker-filter-checkbox,
  .legend input,
  .legend button:not(.legend-toggle-button),
  .tab-header li,
  .graph-view-radio-group label,
  .chart-prefecture-sort-control,
  #reset-button,
  #reset-page-button,
  #download-map-button,
  #box-select-toggle,
  #box-select-clear,
  #download-filtered-csv-button,
  #download-taxon-csv-button,
  #update-history-filter-clear,
  .species-image-open-button
) ,
body.is-navigation-queue-active :where(
  .filter-dropdown-portal,
  .filter-dropdown-backdrop,
  .filter-dropdown-trigger,
  .filter-dropdown-clear,
  .select-mode-option,
  .marker-filter-checkbox,
  .legend input,
  .legend button:not(.legend-toggle-button),
  .tab-header li,
  .graph-view-radio-group label,
  .chart-prefecture-sort-control,
  #reset-button,
  #reset-page-button,
  #download-map-button,
  #box-select-toggle,
  #box-select-clear,
  #download-filtered-csv-button,
  #download-taxon-csv-button,
  #update-history-filter-clear,
  .species-image-open-button
) {
  pointer-events: none;
}

body.is-filter-updating :where(
  .nav-button,
  .species-image-strip-button,
  .image-modal-nav,
  .popup-nav-button
) ,
body.is-navigation-queue-active :where(
  .nav-button,
  .species-image-strip-button,
  .image-modal-nav,
  .popup-nav-button
) {
  pointer-events: auto;
}

body.is-filter-updating:not(.is-navigation-queue-active) :where(
  .filter-dropdown-trigger,
  .select-mode-option,
  .marker-filter-checkbox,
  .legend input,
  .graph-view-radio-group label,
  #reset-button,
  #reset-page-button,
  #download-map-button,
  .species-image-open-button
) {
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


header {
  text-align: center; /* タイトルをセンターに配置 */
  margin: calc(18px + var(--jsc-scroll-compensation, 0px)) auto 16px; /* 上部の余白 */
  padding: 58px 20px 12px;
  width: 100%;
  position: relative;
  box-sizing: border-box;
}

/* タイトルのフォントサイズを調整 */
header h1 {
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
  color: var(--text-main);
  line-height: 1.32;
  max-width: var(--content-width);
  margin: 0 auto;
  letter-spacing: 0.01em;
}

#mapid,
.tab-container {
  width: var(--content-width);
  margin: 0 auto;
}

#mapid {
  position: relative; /* 地図を基準とする */
  top: 0;
  bottom: 0;
  height: var(--desktop-map-height);
  margin-bottom: 8px;
  z-index: 1;
  overflow-anchor: none;
}

.maplibregl-ctrl-bottom-left {
  z-index: 2 !important;
}


.search-container,
.legend {
  width: var(--side-panel-width);
  max-width: var(--side-panel-max-width);
  background: #fff;
  border: var(--panel-border);
  box-sizing: border-box;
  overflow-anchor: none;
}

.search-container {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  box-shadow: 0 10px 26px rgba(26, 43, 58, 0.16);
  z-index: 30;
  display: flex;
  flex-direction: column;
  transition: max-height 0.18s ease;
  max-height: var(--search-max-height);
  overflow: hidden;
}

.search-header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 12px 9px;
  border-bottom: 1px solid #d6dde5;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #fdfefe 0%, #eef3f7 100%);
  box-sizing: border-box;
}

.search-header .toggle-button {
  margin-right: 8px; /* タイトルとの間隔 */

}

.search-body {
  max-height: var(--search-body-max-height) !important;
  padding: 8px;
  overflow-y: auto;     /* 縦スクロールを有効に */
  scrollbar-gutter: stable;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f6f9fb 100%);
}


.search-container.closed {
  max-height: 40px; /* 高さめEにして隠ぁE*/
  overflow: hidden;
}


.toggle-button {
  position: absolute;
  right: 12px;
  bottom: 10px;
  background: transparent;
  border: none;
  font-size: 17px;
  color: #5f6c79;
  cursor: pointer;
  transition: transform 0.18s ease; /* 回転アニメーション */
  transform: rotate(180deg);
}

/* 三角印が回転した状慁E*/
.toggle-button.rotate {
  transform: rotate(360deg); /* 180度回転 */
}

#reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 31px;
  padding: 5px 12px;
  border: 1px solid #c2cdd8;
  border-radius: 8px;
  background: #f3f6f9;
  color: #314252;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

#reset-button::before,
#reset-page-button::before {
  content: "\21BA";
  flex: 0 0 auto;
  font-size: 0.95em;
  line-height: 1;
}

.maplibregl-popup {
  z-index: 100;
}

.maplibregl-popup-content {
  overflow: hidden;
  border: 1px solid rgba(49, 66, 82, 0.18);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20, 34, 47, 0.24);
  z-index: 50;
  width: min(30vw, 420px);
  min-width: min(280px, calc(100vw - 36px));
  padding: 0;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal; /* 折り返しを有効にする */
}

.maplibregl-popup-close-button,
.mapboxgl-popup-close-button {
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #586a7a;
  font-size: 0;
  line-height: 1;
  position: absolute;
}

.maplibregl-popup-close-button::before,
.maplibregl-popup-close-button::after,
.mapboxgl-popup-close-button::before,
.mapboxgl-popup-close-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.maplibregl-popup-close-button::before,
.mapboxgl-popup-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.maplibregl-popup-close-button::after,
.mapboxgl-popup-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.maplibregl-popup-close-button:hover,
.mapboxgl-popup-close-button:hover {
  background: rgba(221, 229, 236, 0.9);
  color: #213447;
}

.popup-link-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.popup-link-label {
  font-weight: bold;
}

.popup-link-pill {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0b4a6f;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
  line-height: inherit;
  white-space: normal;
}

.popup-link-pill:hover {
  color: #083753;
  background: transparent;
}

.reference-link-pill {
  margin-left: 6px;
}

.reference-url-link {
  margin-left: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.popup-note-reference-heading {
  font-weight: 400;
  margin-top: 2px;
}

.popup-note-reference-list {
  margin: 3px 0 0 1.6em;
  padding: 0;
}

.popup-note-reference {
  margin: 2px 0;
  padding-left: 0.1em;
}

.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right {
  z-index: 31; /*attributionをlegendより手前に表示*/
}

.marker-scope-control .marker-scope-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  padding: 0;
}

.marker-scope-control .marker-scope-button:disabled {
  color: #9aa4ad;
  cursor: default;
}

.marker-scope-control .marker-scope-button:disabled .marker-scope-icon {
  opacity: 0.68;
}

.marker-scope-icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.map-download-control .map-download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  padding: 0;
  color: #24313d;
}

.map-download-icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}


.select-box-divider-one {
  border-top: 1px solid #d8e0e7;
  margin: 2px 0 0;
}


.select-box-divider-two {
  border-top: 1px solid #d8e0e7;
  margin: 2px 0 0;
}

.species-image-preview {
  display: none;
  margin: 2px 0 4px;
  padding: 8px;
  border: 1px solid #d7e1ea;
  border-radius: 8px;
  background: #f8fbfd;
}

.selected-image-gallery {
  --species-image-card-width: clamp(118px, 11vw, 148px);
  --species-image-card-height: 92px;
  width: auto;
  min-height: calc(var(--species-image-card-height) + 14px);
  margin: 3px 0 0;
  padding: 3px 0 5px;
  border-top: 1px solid rgba(204, 216, 226, 0.72);
  box-sizing: border-box;
  grid-area: gallery;
}

.selected-image-gallery.is-loading {
  pointer-events: none;
}

.selected-image-gallery.is-empty {
  display: grid;
  place-items: center;
}

.selected-image-gallery-empty-message {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.selected-image-gallery[hidden] {
  display: none !important;
}

.species-image-preview[hidden] {
  display: none;
}

#species-list.is-higher-taxonomy-hidden .higher-taxonomy {
  display: none !important;
}

#species-list li {
  display: block;
  box-sizing: border-box;
}

.species-list-label {
  min-width: 0;
}

.species-list-rank-label {
  color: var(--text-muted);
  font-size: 0.9em;
  font-weight: 700;
}

.species-list-note {
  display: inline;
  margin-left: 0.65em;
  color: #64748b;
  font-size: 0.92em;
  text-align: inherit;
  overflow-wrap: anywhere;
}

#species-list.is-species-note-hidden .species-list-note {
  display: none;
}

.species-image-preview-heading {
  margin: 0 0 6px;
  color: #2b4053;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.species-image-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--species-image-card-width);
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 1px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scrollbar-width: none;
  box-sizing: border-box;
}

.species-image-strip.is-scrollable {
  justify-content: start;
}

.species-image-strip::-webkit-scrollbar {
  display: none;
}

.species-image-strip-frame {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: calc(var(--species-image-card-height) + 4px);
  box-sizing: border-box;
}

.species-image-strip-actions {
  position: relative;
  display: block;
  align-self: center;
  width: 28px;
  height: var(--species-image-card-height);
}

.species-image-strip-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 44px;
  border: 1px solid #c5d2df;
  border-radius: 8px;
  background: #f8fbfd;
  color: #2d5877;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.species-image-strip-button::before,
.image-modal-nav::before {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  border: solid currentColor;
  border-width: 0 2.2px 2.2px 0;
  box-sizing: border-box;
}

.species-image-strip-button--prev::before,
.image-modal-nav--prev::before {
  transform: translateX(2px) rotate(135deg);
}

.species-image-strip-button--next::before,
.image-modal-nav--next::before {
  transform: translateX(-2px) rotate(-45deg);
}

.species-image-strip-button:hover,
.species-image-strip-button:focus-visible {
  border-color: #3b78a8;
  background: #eef6fb;
}

.species-image-strip-button:not(:disabled):active {
  transform: none;
  border-color: #8aa8bf;
  background: #dbe7f0;
  color: #244f6d;
  filter: brightness(.94);
  box-shadow: none !important;
}

.species-image-strip-actions .species-image-strip-button--next {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.species-image-strip-actions .species-image-strip-button--next:active {
  transform: translate(-50%, -50%);
}

.species-image-strip-button:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.species-image-strip-actions .species-image-strip-button--next:disabled {
  transform: translate(-50%, -50%);
}

.species-image-strip-button[hidden] {
  visibility: hidden;
  display: inline-flex !important;
}

.species-image-card {
  display: grid;
  min-width: 0;
  color: #24384a;
  text-decoration: none;
}

.species-image-card img {
  width: var(--species-image-card-width);
  height: var(--species-image-card-height);
  object-fit: contain;
  object-position: center;
  border: 1px solid #c7d5e1;
  border-radius: 6px;
  background: #e8eef4;
}

.species-image-card img.mirrored {
  transform: scaleX(-1);
}

.species-image-card span {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.species-image-card:hover img,
.species-image-card:focus-visible img {
  border-color: #3b78a8;
  box-shadow: 0 0 0 2px rgba(59, 120, 168, 0.18);
}

.legend {
  position: absolute;
  bottom: 28px;
  right: 10px;
  padding: 0;
  font-size: 14px;
  z-index: 29;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.18s ease; /* 高さの変化をスムーズに */
  max-height: var(--legend-max-height); /* 初期状態では最大高さ */
  width: max-content;
  min-width: 236px;
  max-width: min(316px, calc(100vw - 28px));
  border: var(--panel-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  box-shadow: 0 10px 26px rgba(26, 43, 58, 0.16);
}


.legend-item {
  display: grid;
  grid-template-columns: var(--legend-grid-columns);
  align-items: center;
  column-gap: var(--legend-grid-gap);
}

.legend-header {
  display: flex;
  align-items: center;
  min-height: var(--legend-collapsed-height);
  padding: 8px 12px;
  margin: 0;
  font-weight: bold;
  position: relative;
  border-bottom: 1px solid #d6dde5;
  background: linear-gradient(180deg, #fdfefe 0%, #eef3f7 100%);
  box-sizing: border-box;
}

.legend-header::before {
  content: none;
}

.legend-header {
  border-radius: 12px 12px 0 0;
}

.legend-item input[type="checkbox"],
.choropleth-legend-title input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
}

.legend-header span {
  min-width: 0;
  text-align: left;
}

.legend-toggle-button {
  position: absolute;
  right: 12px;
  bottom: 10px;
}


.legend.collapsed {
  max-height: var(--legend-collapsed-height);
  overflow: hidden;
}

.legend.collapsed .legend-header {
  border-bottom: 0;
  border-radius: 12px;
}

.legend:not(.collapsed) {
  max-height: none;
  overflow: visible;
}

.legend > .legend-item {
  margin-inline: 10px;
}

.legend > .legend-item:first-of-type {
  margin-top: 10px;
}

.legend > .legend-item:last-of-type {
  margin-bottom: 10px;
}

.legend-item .marker {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto; /* 上下左右の中央配置 */
}

.legend-item-text {
  position: relative;
  display: inline-block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.legend-item-text::after {
  content: none;
  display: none;
}

.legend-item-text[data-tooltip]:not([data-tooltip=""])::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin: auto;
  background: var(--tooltip-background);
  color: white;
  padding: 5px 8px;
  font-size: 12px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 200px;
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(20, 34, 47, 0.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
  z-index: 50; /* 地図より前面に表示 */
}

.legend-item-text[data-tooltip]:not([data-tooltip=""]):hover::after {
  opacity: 1;
  visibility: visible;
  display: block;
}

.marker-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate3d(-9999px, -9999px, 0);
  background: var(--tooltip-background);
  color: white;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  will-change: transform;
  display: none; /* 初期状態では非表示 */
}


.marker-star {
  width: 20px;
  height: 20px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  border: none;
}


.marker-cross {
  width: 14px;
  height: 14px;
  clip-path: polygon(
    0% 12%, 12% 0%, 50% 38%, 88% 0%, 100% 12%, 62% 50%,
    100% 88%, 88% 100%, 50% 62%, 12% 100%, 0% 88%, 38% 50%
  );
  border: none;
}


.marker-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 3px solid #047857;
}


.marker-square {
  width: 10px;
  height: 10px;
  border-radius: 0;
  border: 3px solid #052e16;
}

/* カラーバリエーション */
.marker.blue {
  background-color: #047857;
}

.marker.purple {
  background-color: #10b981;
}

.marker.pink {
  background-color: #0f766e;
}

.marker.gray {
  background-color: #94a3b8;
}

.marker.red {
  background-color: #16a34a;
  border-color: #052e16;
}

.marker.normal-record {
  background-color: #22c55e;
  border-color: #052e16;
}

.marker.white {
  background-color: #dcfce7;
  border: 3px solid #047857;
}

.legend-accuracy-list {
  display: grid;
  gap: 6px;
}

.legend-accuracy-item {
  grid-template-columns: 14px 48px minmax(0, 1fr);
  column-gap: 7px;
}

.legend-accuracy-symbols {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.legend-fill-swatch {
  display: inline-block;
  width: 17px;
  height: 13px;
  border: 1px solid rgba(0, 0, 0, 0.42);
  border-radius: 2px;
  box-sizing: border-box;
}

.legend-fill-swatch-normal {
  background: rgba(34, 197, 94, 0.9);
}

.legend-fill-swatch-accuracy {
  background: rgba(203, 213, 225, 0.76);
}


.popup-title-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  column-gap: 7px;
  margin-bottom: 1px;
  padding-right: 18px;
}

.popup-title-marker {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -1px;
}

.popup-title-marker.kind-type {
  width: 24px;
  height: 24px;
}

.popup-title-marker svg {
  width: 100%;
  height: 100%;
  display: block;
}

.popup-title-text {
  min-width: 0;
}

#checkbox-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#checkbox-container label {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

#checkbox-container input[type="checkbox"] {
  margin: 2px 4px 2px 4px;
  width: auto;
}


.select-container {
  --filter-control-height: 26px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  gap: 3px; /* ボタンとの間隔 */
}

.filter-primary-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid #d9e1e8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.map-filter-title {
  font-size: 12px;
  font-weight: 700;
  color: #526170;
}

.search-body > .map-filter-container,
.search-body > #box-select-buttons,
.search-body > .year-filter,
.search-body > #checkbox-container {
  padding: 6px 8px;
  border: 1px solid #d9e1e8;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.map-filter-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-mode-toggle {
  --select-mode-option-height: 30px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin: 0 0 3px;
  padding: 3px;
  border: 1px solid #c9d3dd;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: none;
}

.filter-primary-group #reset-button {
  margin-top: 2px;
}

.select-mode-option {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

.select-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.select-mode-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: var(--select-mode-option-height);
  min-height: 0;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  box-sizing: border-box;
  background: transparent;
  color: #5b6875;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--motion-base),
    color var(--motion-base),
    border-color var(--motion-base),
    box-shadow var(--motion-base),
    transform 0.08s ease;
}

.select-mode-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(56, 89, 124, 0.22);
}

.select-mode-option span:hover {
  background: rgba(56, 111, 158, 0.08);
}

.select-mode-option input:checked + span:hover {
  background: var(--accent);
}

.select-mode-option input:focus-visible + span,
.filter-dropdown-action-button:focus-visible {
  outline: 2px solid #2d6ca2;
  outline-offset: 2px;
}


.select-box-title {
  background-color: transparent;
  color: #263746;
  font-size: 14px;
  font-weight: bold;
  text-align: left;
  padding: 0;
  margin: 0;
  border-bottom: none;
}

.select-container select {
  flex-grow: 1;
  width: 0px;
  max-width: none;
  min-width: 200px;
  height: 24px;
  font-size: 14px;
  padding: 2px;
  box-sizing: border-box;
}

.filter-select-native {
  display: none;
}

.filter-dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
  min-width: 0;
  font-size: 14px;
}

.filter-dropdown-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--filter-control-height);
  min-height: 0;
  border: 1px solid #cbd6df;
  border-radius: 4px;
  background: #fff;
  color: var(--text-main);
  text-align: left;
  font: inherit;
  padding: 2px 38px 2px 8px;
  box-sizing: border-box;
  cursor: pointer;
  touch-action: pan-y;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.filter-dropdown-trigger:hover {
  border-color: #9fb3c5;
  background: #fbfdff;
}

.filter-dropdown-trigger:focus-visible {
  outline: 2px solid rgba(56, 111, 158, 0.28);
  outline-offset: 1px;
}

.filter-dropdown-trigger.is-placeholder {
  color: #666;
}

.filter-dropdown-trigger-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-clear {
  position: absolute;
  right: 3px;
  top: calc(50% + 1px);
  transform: translateY(-50%);
  width: 28px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  user-select: none;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 1;
  border-radius: 4px;
  z-index: 2;
  touch-action: manipulation;
}

.filter-dropdown-clear:hover {
  color: #e60000;
  background: rgba(230, 0, 0, 0.06);
}

.filter-dropdown-clear:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
}

.filter-dropdown-clear:not(:disabled):active {
  transform: translateY(-50%) scale(0.94) !important;
}

.filter-dropdown-clear[hidden],
.filter-dropdown-arrow[hidden] {
  display: none !important;
}

.filter-dropdown-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-30%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #666;
  pointer-events: none;
  transition: transform 0.16s ease;
}

.filter-dropdown.is-open .filter-dropdown-arrow {
  transform: translateY(-30%) rotate(180deg);
}

.filter-dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: transparent;
  cursor: default;
  touch-action: none;
}

.filter-dropdown-backdrop[hidden] {
  display: none !important;
}

.filter-dropdown-portal {
  position: fixed;
  z-index: 2000;
}

.filter-dropdown-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid #aaa;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: contain;
}

.filter-dropdown-sheet-header {
  display: none;
}

.filter-dropdown-sheet-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-main);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-sheet-close {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #c6d0da;
  border-radius: 50%;
  background: #f2f5f8;
  color: #40505f;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.filter-dropdown-sheet-close:hover {
  border-color: #aab7c4;
  background: #e8eef4;
  color: #263746;
}

.filter-dropdown-search {
  width: 100%;
  height: 28px;
  padding: 4px 6px;
  font: inherit;
  box-sizing: border-box;
}

.filter-dropdown-options {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-gutter: stable;
  max-height: min(320px, 50vh);
  border: 1px solid #ddd;
  overscroll-behavior: contain;
}

.filter-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100%;
  width: max-content;
  box-sizing: border-box;
  padding: 6px 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  transition:
    background-color var(--motion-fast),
    color var(--motion-fast);
}

.filter-dropdown-option-label {
  display: block;
}

.filter-dropdown-option-count {
  color: #6b7280;
  font-size: 0.82rem;
  margin-left: auto;
  padding-left: 1rem;
  white-space: nowrap;
}

.filter-dropdown-option-checkbox {
  margin: 0;
  pointer-events: none;
}

.filter-dropdown-options.is-virtualized .filter-dropdown-virtual-spacer {
  display: block;
  flex: 0 0 auto;
  min-width: 1px;
  padding: 0;
  pointer-events: none;
}

.filter-dropdown-options.is-virtualized .filter-dropdown-option {
  min-height: 34px;
  height: 34px;
}

.filter-dropdown-options.is-virtualized .filter-dropdown-option-label {
  overflow: hidden;
  max-width: min(68vw, 720px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.filter-dropdown-panel[data-select-mode="single"] .filter-dropdown-actions {
  display: none !important;
}

.filter-dropdown-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.filter-dropdown-menu-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.filter-dropdown-action-button {
  min-height: 0;
  padding: 4px 8px;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  background: #fff;
  color: #52525b;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.filter-dropdown-action-button:hover {
  border-color: #e4e4e7;
  background: #f4f4f5;
  color: #18181b;
}

.filter-dropdown-action-primary {
  border-color: #e4e4e7;
  background: #fff;
  color: #52525b;
  box-shadow: none;
}

.filter-dropdown-action-primary:hover {
  border-color: #e4e4e7;
  background: #f4f4f5;
  color: #18181b;
}

.filter-dropdown-option:hover {
  background: #dfefff;
}

.filter-dropdown-option.is-highlighted {
  background: #dfefff;
}

.filter-dropdown-option.is-selected {
  font-weight: bold;
  background-image: linear-gradient(90deg, rgba(56, 111, 158, 0.12), transparent 70%);
}

.filter-dropdown-empty {
  color: #666;
  padding: 6px 2px 2px;
}

.filter-dropdown-portal.is-bottom-sheet {
  top: auto !important;
  right: 0;
  bottom: 0;
  left: 0 !important;
  width: 100% !important;
  padding: 0 8px max(8px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-panel {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 10px;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-search {
  min-height: 40px;
  font-size: 16px;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-options {
  max-height: none;
  overflow-x: hidden;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-option {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 8px;
  line-height: 1.35;
  white-space: normal;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-option-label {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-options.is-virtualized .filter-dropdown-option {
  min-height: 48px;
  height: 48px;
  line-height: 1.25;
  white-space: nowrap;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-options.is-virtualized .filter-dropdown-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-portal.is-bottom-sheet .filter-dropdown-actions-footer {
  padding-top: 6px;
  background: #fff;
}

.dual-range-slider {
  --dual-range-slider-thumb-size: 16px;
  --dual-range-slider-input-offset: -8px;
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.dual-range-slider-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: #d9d9d9;
}

.dual-range-slider-fill {
  position: absolute;
  top: 0;
  height: 6px;
  border-radius: 999px;
  background: #4a89dc;
}

.dual-range-slider-input {
  position: absolute;
  left: var(--dual-range-slider-input-offset);
  width: calc(100% + var(--dual-range-slider-thumb-size));
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range-slider-input::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.dual-range-slider-input::-moz-range-track {
  height: 6px;
  background: transparent;
}

.dual-range-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--dual-range-slider-thumb-size);
  height: var(--dual-range-slider-thumb-size);
  margin-top: -5px;
  border-radius: 50%;
  border: 1px solid #3d6fb7;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
}

.dual-range-slider-input::-moz-range-thumb {
  width: var(--dual-range-slider-thumb-size);
  height: var(--dual-range-slider-thumb-size);
  border-radius: 50%;
  border: 1px solid #3d6fb7;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
}

.dual-range-slider[data-disabled="true"] {
  opacity: 0.55;
}

.dual-range-slider[data-disabled="true"] .dual-range-slider-input::-webkit-slider-thumb {
  cursor: not-allowed;
}

.dual-range-slider[data-disabled="true"] .dual-range-slider-input::-moz-range-thumb {
  cursor: not-allowed;
}

/* 左右ボタンのスタイル */
.nav-button {
  flex: 0 0 var(--filter-control-height, 26px);
  width: var(--filter-control-height, 26px);
  height: var(--filter-control-height, 26px);
  padding: 0;
  border: 1px solid #c8d0d8;
  border-radius: 7px;
  background: #f2f5f8;
  color: #415160;
  cursor: pointer;
  touch-action: manipulation;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: calc(var(--filter-control-height, 26px) - 2px);
  margin-left: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}


.nav-button:hover {
  background: #e7edf3;
}

.nav-button:not(:disabled):active {
  transform: none;
  border-color: #8aa8bf;
  background: #dbe7f0;
  color: #244f6d;
  filter: brightness(.94);
  box-shadow: none !important;
}

.filter-navigation-buttons {
  display: contents;
}

.nav-button svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.selected-label-bar {
  position: relative;
  z-index: 60;
  width: var(--content-width);
  margin: 0 auto;
  overflow: visible;
}

#selected-labels {
  --selected-image-gallery-slot-height: 178px;
  width: calc(var(--content-width) - 20px);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  display: none;
  white-space: pre-line; /* 改行を有効匁E*/
  overflow-wrap: break-word;
  border: var(--panel-border);
  overflow-anchor: none;
}

.record-info-wrapper {
  display: flex;
  justify-content: flex-end;
  gap: 1em;
  font-weight: normal;
  font-size: 90%;
  margin-top: 0.3em;
}

.record-info-block {
  white-space: nowrap;
}

/* Shared visual polish for the map summary strip. */
#selected-labels {
  width: 100%;
  margin: 0;
  padding: 8px 14px;
  text-align: left;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 6px 18px rgba(28, 45, 62, 0.09);
  box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    ". info"
    "label label"
    "gallery gallery";
  align-items: start;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 2px 12px;
}

#selected-labels.has-filter-labels {
  min-height: 0;
  font-size: 18px;
  line-height: 26px;
}

#selected-labels.is-initial-gallery-reserved {
  display: grid;
  min-height: var(--selected-image-gallery-slot-height);
}

#selected-labels.has-image-gallery-slot {
  min-height: var(--selected-image-gallery-slot-height);
}

.selected-label-list {
  display: block;
  grid-area: label;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  justify-self: stretch;
  align-self: start;
  text-align: center;
  overflow-wrap: anywhere;
}

#selected-labels a {
  color: #245f8d;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.record-info-wrapper {
  grid-area: info;
  justify-self: end;
  align-self: start;
  gap: 6px;
  color: #6f8192;
  font-size: 11px;
  margin-top: 0;
  margin-right: -9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.record-info-block {
  padding: 1px 7px;
  border: 1px solid #e4ebf1;
  border-radius: 999px;
  background: rgba(248, 251, 253, 0.72);
  font-weight: 600;
  line-height: 1.45;
}

#selected-labels.has-filter-labels .record-info-wrapper {
  font-size: 11px;
}

#selected-labels.selected-label-stack {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    ". info"
    "label label"
    "gallery gallery";
}

#selected-labels.selected-label-stack .selected-label-list {
  justify-self: stretch;
}


.tab-container {
  background: #fff;
  border: var(--panel-border);
  box-sizing: border-box;
}


.tab-header {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  border-bottom: 2px solid #ccc;
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.tab-header li {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  background-color: #f5f5f5;
  border-right: 1px solid #ccc;
  font-weight: bold;
  user-select: none;
}

.tab-header li:last-child {
  border-right: none;
}


.tab-header li.active {
  background-color: #e1e1e1;
}


.tab-content {
  display: none;  /* 非表示にしておき、active だけ表示 */
  padding: 20px;
  box-sizing: border-box;
}


.tab-content.active {
  display: block;
}

.tab-container {
  overflow: hidden;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(28, 45, 62, 0.08);
}

.tab-header {
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fdfefe 0%, #eef3f7 100%);
}

.tab-header li {
  padding: 11px 14px;
  color: #33485b;
  background: transparent;
  border-right: 1px solid var(--line-soft);
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab-header li:hover {
  background: rgba(56, 111, 158, 0.08);
}

.tab-header li.active {
  color: #102b42;
  background: #ffffff;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-content {
  background: #ffffff;
}

.tab-content.tab-list-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-list-heading {
  margin: 0;
}

.download-panel-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: none;
}

.download-note,
.download-summary,
.download-empty-message {
  margin: 0;
  line-height: 1.6;
}

.download-summary strong {
  font-size: 1.05em;
}

.download-empty-message {
  color: #666;
}

#download-filtered-csv-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}

#download-filtered-csv-button::before {
  content: "\2193";
  flex: 0 0 auto;
  font-weight: 700;
}

#download-filtered-csv-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tab-list {
  margin: 0;
  padding-left: 1.5em;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#prefecture-list,
#island-list {
  line-height: 1.55;
}

#prefecture-list li,
#island-list li {
  padding: 2px 0;
}

.location-map-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-left: 10px;
  padding: 1px 8px;
  border: 1px solid #a8b4bf;
  border-radius: 999px;
  font-size: 0.82em;
  line-height: 1.35;
  font-weight: 600;
  text-decoration: none;
  vertical-align: 0.08em;
  white-space: nowrap;
  background: #fbfcfd;
  color: #24556f;
}

.location-map-link-pill:hover {
  background: #eef5f9;
  border-color: #7f9caf;
  color: #123f58;
}

.location-map-link-pill::after {
  content: "\2197";
  font-size: 0.9em;
  line-height: 1;
}

.tab-list-plain {
  list-style: none;
  padding-left: 0;
  padding-right: 0.5em;
}

.tab-reference-list li {
  font-size: 13px;
  padding: 3px 0;
}

.tab-reference-list li a,
.tab-reference-list-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

#chart-container {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 600px;
  width: 100%;
  min-height: 200px;
  max-height: 400px;
  position: relative;
}

#chart-wrapper {
  display: flex;          /* 横並びにする */
  gap: 10px;
  justify-content: center;
  align-items: center;
}

#chart-area {
  position: relative;
  width: 100%;
}

#prefecture-chart-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

#prefecture-chart-wrapper {
  flex: 1 1 auto;
  min-width: 0;
}


.chart-container-scroll {
  width: 100%;
  max-height: var(--chart-frame-max-height);
  overflow-x: auto;         /* 横スクロールを許可 */
  overflow-y: hidden;       /* 縦スクロールは要らなければ隠ぁE*/
  margin: 14px 0;           /* 上下余白 (お好みで) */
  border: var(--panel-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
  position: relative;
}


#prefecture-chart,
#year-chart {
  width: 100%;
  margin: 0 auto;
}

.chart-svg-host {
  position: relative;
  display: block;
}

.chart-svg-host svg {
  display: block;
}

.chart-svg-host svg text {
  font-family: var(--font-body);
}

#prefecture-chart,
#year-chart {
  height: auto;
}

#prefecture-chart.chart-svg-host,
#year-chart.chart-svg-host {
  min-height: 0;
}

.chart-top-legend {
  display: block;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid #e0e7ee;
  border-radius: 10px;
  background: #fdfefe;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

.chart-side-legend {
  flex: 0 0 clamp(180px, 22vw, 260px);
  max-width: 260px;
  max-height: var(--chart-frame-max-height);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 14px 0;
  padding: 12px;
  border: var(--panel-border);
  border-radius: 12px;
  background: #fdfefe;
  box-sizing: border-box;
}

.chart-side-legend:empty {
  display: none;
}

.chart-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
}

.chart-side-legend .chart-legend-list {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.chart-legend-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
}

.chart-legend-page-button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.chart-legend-page-button:disabled {
  color: #94a3b8;
  cursor: default;
  background: #f8fafc;
}

.chart-legend-page-label {
  min-width: 52px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.chart-legend-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  font-size: 13px;
  line-height: 1.35;
  padding: 2px 4px;
  border-radius: 7px;
  transition: background-color 0.15s ease, font-weight 0.15s ease;
}

.chart-legend-item.is-clickable {
  cursor: pointer;
}

.chart-legend-item.is-clickable:hover {
  background: rgba(0, 0, 0, 0.04);
}

.chart-legend-item.is-clickable:focus-visible {
  outline: 2px solid rgba(52, 112, 196, 0.45);
  outline-offset: 1px;
}

.chart-legend-item.is-active {
  background: rgba(255, 214, 10, 0.18);
  font-weight: bold;
}

.chart-legend-item.is-disabled {
  opacity: 0.42;
}

.chart-legend-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  margin-top: 2px;
}

.chart-legend-swatch-line {
  width: 18px;
  height: 0;
  margin-top: 9px;
  border: none;
  border-top: 3px solid #000;
  background: transparent;
}

.chart-legend-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tab-heading-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 1px 10px;
  border: 1px solid #d0dbe5;
  border-radius: 999px;
  background: #f5f9fc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.tab-source-note {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e0e7ee;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.tab-source-note a {
  color: #245f8e;
  word-break: break-all;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
  color: #666;
  text-align: center;
  box-sizing: border-box;
}

#chart-tooltip {
  position: fixed;
  display: none;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  z-index: 2000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}



#classification-radio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px 12px;
  margin: 10px auto;
  padding: 9px 12px;
  background: #f9fbfd;
  border: var(--panel-border);
  border-radius: 12px;
  font-size: 14px;
}

.prefecture-chart-control-group {
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 8px 10px 9px;
  border: 1px solid #d7e2eb;
  border-radius: 10px;
  background: #fff;
}

.prefecture-chart-control-title {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.prefecture-chart-control-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
}

#classification-radio label,
.classification-radio label {
  margin-right: 1em;
  white-space: nowrap;
}

#classification-radio label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 0;
}

#classification-radio label[hidden] {
  display: none !important;
}

.chart-prefecture-sort-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.chart-prefecture-sort-control label {
  display: inline-flex;
  align-items: center;
  margin-right: 0;
  justify-content: center;
}

.chart-prefecture-sort-control.is-disabled {
  opacity: 0.55;
}

.chart-prefecture-sort-control.is-disabled label {
  cursor: not-allowed;
}

.chart-prefecture-sort-control input[type="checkbox"] {
  margin-right: 0.35em;
}

@media (max-width: 720px) {
  #classification-radio {
    grid-template-columns: 1fr;
  }

  #prefecture-chart-legend.chart-side-legend {
    display: none;
  }
}

.prefecture-chart-hover {
  transition: opacity 0.15s ease, filter 0.15s ease, stroke-width 0.15s ease;
}

.prefecture-chart-hover.is-active {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(32, 48, 64, 0.45));
}

.prefecture-chart-hover.is-dimmed {
  opacity: 0.28;
}

.prefecture-chart-bar.is-active {
  opacity: 1;
  stroke: #111;
  stroke-width: 2;
}

#touch-hint {
  position: absolute;
  top: 50%;                 /* 地図の中央あたりに表示する侁E*/
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;            /* 地図より前面に表示 */

  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;

  display: none;            /* 初期状態で非表示 */
  pointer-events: none;
}

.external-chart-title {
  text-align: center;
  font-size: 16px;      /* 適度なサイズ */
  font-weight: bold;    /* 太孁E*/
  margin: 18px 0 10px;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.chart-divider {
  height: 6px;
  border: 0;
  border-radius: 999px;
  margin: 34px 0 30px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(184, 201, 215, 0.32) 18%, rgba(139, 167, 188, 0.38) 50%, rgba(184, 201, 215, 0.32) 82%, transparent 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}


#year-chart-wrapper {
  min-height: 0;
  overflow-y: auto;
}



.popup-wrapper {
  display: flex;
  flex-direction: column;
  color: #25384a;
  min-height: 0;
  overflow: hidden;
  max-height: unset; /* ↁEJSで設定すめE*/
}


.popup-scroll-container {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 12px 14px;
  border: 0;
  scrollbar-gutter: stable both-edges;
  box-sizing: border-box;
  line-height: 1.48;
  overscroll-behavior: contain;
}

.popup-scroll-container,
.popup-scroll-container * {
  max-width: 100%;
  box-sizing: border-box;
}

.popup-detail-line,
.popup-reference-line,
.popup-note-reference,
.popup-title-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
}

.popup-title-text {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  line-height: 1.35;
}

.popup-title-japanese,
.popup-title-scientific {
  display: block;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}

.popup-title-scientific {
  font-weight: 700;
  font-style: normal;
}

.popup-title-scientific .popup-scientific-name {
  font-style: italic;
}

.popup-title-scientific .non-italic {
  font-style: normal;
}

.popup-scroll-container a,
.reference-url-link {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
}


.popup-nav-fixed {
  display: grid;
  grid-template-columns: minmax(68px, 1fr) minmax(78px, auto) minmax(68px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  background: #f6f9fc;
  flex-shrink: 0;
  user-select: none;
  box-sizing: border-box;
}

.popup-wrapper--below .popup-nav-fixed {
  padding-right: 38px;
  border-bottom: 1px solid #d8e1ea;
}

.popup-wrapper--above .popup-nav-fixed {
  border-top: 1px solid #d8e1ea;
}

.popup-wrapper--above .popup-scroll-container {
  padding-right: 38px;
}

.popup-nav-button {
  min-width: 68px;
  max-width: 100%;
  padding: 5px 12px;
  border: 1px solid #c3ced9;
  border-radius: 999px;
  background: #fff;
  color: #25384a;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 34, 47, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-nav-button:hover {
  border-color: #8ea4b8;
  background: #eef5fb;
}

.popup-nav-button:focus-visible {
  outline: 2px solid #2f7fb4;
  outline-offset: 2px;
}

.popup-nav-button-prev {
  justify-self: start;
}

.popup-nav-button-next {
  justify-self: end;
}

.popup-nav-counter {
  min-width: 78px;
  padding: 3px 8px;
  border: 1px solid #d8e1ea;
  border-radius: 999px;
  background: #fff;
  color: #586a7a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.year-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.year-filter label {
  font-size: 14px;
  cursor: pointer;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#publication-year-slider {
  margin: 0 8px; /* Keep the enlarged input and thumb inside the filter panel. */
}

.year-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.year-inputs input[type="text"] {
  width: 60px; /* サイズをお好みで */
  font-size: 12px;
  text-align: right;
}

.chart-options-box {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  align-items: center;
  justify-content: center;
  padding: 0.5em;
  border: var(--panel-border);
  border-radius: 6px;
  margin-bottom: 1em;
}

#graph-view-control {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.graph-view-control-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.chart-control-label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.graph-view-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

#graph-view-control {
  align-items: stretch;
  padding: 10px 12px;
  border-color: var(--line-soft);
  border-radius: 12px;
  background: #f9fbfd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.graph-view-control-inner {
  width: 100%;
  gap: 8px 10px;
}

.chart-control-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
}

.chart-control-label::before {
  content: "";
  width: 7px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
}

.chart-control-scope {
  margin-right: auto;
  padding: 2px 8px;
  border: 1px solid #d7e2eb;
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.graph-view-radio-group {
  gap: 6px;
  margin-left: auto;
  justify-content: flex-end;
}

.graph-view-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 0;
  padding: 4px 9px;
  border: 1px solid #d1dbe4;
  border-radius: 999px;
  background: #fff;
  color: #445668;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.graph-view-radio-group label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #173b58;
  font-weight: 700;
}

.species-list-options {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-left: auto;
}

#toggle-higher-taxonomy-label,
#toggle-species-note-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0;
  font-weight: normal;
  font-size: 0.95em;
}

#toggle-higher-taxonomy,
#toggle-species-note {
  margin: 0;
}

.filter-body-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.filter-body-disabled input,
.filter-body-disabled select,
.filter-body-disabled button {
  pointer-events: none;
}

#language-switcher {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  text-align: right;
  margin-bottom: 5px;
  padding-right: 0;
  font-size: 14px;
  color: var(--text-main);
}

#language-switcher label {
  font-weight: bold;
  margin-right: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-selector-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #496578;
}

.language-selector-icon {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#language-selector {
  font-size: 14px;
  height: 34px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid #c4d0da;
  background: #fff;
  color: var(--text-main);
  width: 164px;
}

#reset-page-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 5px;
  z-index: 999;
}

#reset-page-button {
  padding: 5px 10px;
  border: 1px solid #c4d0da;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(28, 45, 62, 0.08);
}

#reset-page-button:hover {
  background: #f3f7fa;
}

@media (max-width: 711px) {
  /* タイトル部刁E*/
  header {
    width: 100%;
    left: 0;
  }

  /* タイトルのフォントサイズを調整 */
  header h1 {
    font-size: 1.2em;
  }

  #mapid,
  .tab-container {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .selected-label-bar,
  #selected-labels{
    margin-left: 0;
    width: 100%;
    border: var(--panel-border);
    box-sizing: border-box;
  }

  .selected-label-bar {
    border: 0;
  }

  #selected-labels.has-image-gallery-slot {
    min-height: var(--selected-image-gallery-slot-height);
  }

  .tab-container {
    margin-top: 10px;
  }

  .search-container,
  .legend {
    margin-left: 0;
    left: 0;
    max-width: 100%;
    width: 100%;
  }

  .search-body {
    gap: 9px;
  }

  .filter-primary-group {
    gap: 7px;
    padding: 9px 8px;
  }

  .select-container {
    --filter-control-height: 32px;
    gap: 6px;
  }

  .select-container select {
    height: 32px;
    font-size: 14px;
    padding: 4px 6px;
  }

  .filter-dropdown-trigger {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .select-mode-toggle {
    --select-mode-option-height: 36px;
  }

  .select-mode-option span {
    min-height: 0;
  }

  .nav-button {
    line-height: 30px;
  }

  .legend {
    margin-left: 0;
    left: 0;
    max-width: 100%;
    width: 100%;
  }

  .search-container {
    top: 0;
    box-shadow: none;
    position: relative;
    transition: max-height 0.18s ease;
    max-height: none;
    overflow: visible;
  }

  .search-body {
    max-height: none !important;      /* 高さ制限を解除 */
    overflow-y: visible;   /* 縦スクロールを無効匁E*/
  }

  .legend {
    position: relative;
    bottom: auto;
    right: auto;
    top: 0;
    margin-bottom: 10px;
    padding: 0;
    max-height: none;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
  }

  .legend.collapsed {
    max-height: var(--legend-collapsed-height);
  }

  #prefecture-chart-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  #prefecture-chart-layout .chart-container-scroll {
    margin: 0;
  }

  .chart-side-legend {
    order: -1;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    max-height: 170px;
    margin: 0;
    padding: 8px 10px;
  }

  .chart-side-legend .chart-legend-list {
    gap: 6px;
  }

  .chart-top-legend {
    margin-bottom: 6px;
  }

  .chart-top-legend .chart-legend-list {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    min-width: 100%;
    padding-bottom: 2px;
  }

  .chart-top-legend .chart-legend-item {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
    padding: 1px 3px;
  }

  .chart-top-legend .chart-legend-label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .chart-container-scroll {
    margin: 12px 0;
  }

  .external-chart-title {
    font-size: 15px;
    margin: 8px 0;
  }

  .chart-divider {
    margin: 28px 0;
  }

  .toggle-button {
    right: 10px;
    top:auto;
    bottom: auto;
    transform: rotate(180deg);
    font-size: 18px;
  }
  .toggle-button.rotate {
    transform: rotate(0deg);
  }

  #mapid {
    height: var(--mobile-map-height);
    width: 100%;
    margin-bottom: 0;
  }

  .maplibregl-popup-content {
    width: min(88vw, 460px);
    min-width: min(280px, calc(100vw - 36px));
  }

  #language-switcher {
    font-size: 12px;
    padding-right: 6px;
  }

  #language-selector {
    font-size: 12px;
    padding: 1px 4px;
    width: 136px;
  }

}

/* ==================== Box Selection (Rectangle) ==================== */
.box-select-buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.box-select-buttons button {
  flex: 1 1 0;
  height: 30px;
  border-radius: 5px;
  border: var(--panel-border);
  background-color: #eee;
  cursor: pointer;
}

#box-select-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28; /* search-container(30)より丁E*/
  display: none;
  pointer-events: none;
}

#box-select-overlay.active {
  display: block;
  pointer-events: auto;
  cursor: crosshair;
}

#box-select-rect {
  position: absolute;
  border: 2px dashed rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.08);
  display: none;
}


@media (hover: none) and (pointer: coarse) {
  .search-body {
    gap: 10px;
  }

  .filter-primary-group {
    gap: 7px;
    padding: 9px 8px;
  }

  .select-container {
    --filter-control-height: 34px;
    gap: 6px;
  }

  .filter-dropdown-trigger {
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 14px;
  }

  .select-mode-toggle {
    --select-mode-option-height: 36px;
  }

  .select-mode-option span {
    min-height: 0;
  }

  .nav-button {
    line-height: 32px;
  }

  #reset-button,
  .box-select-buttons button,
  .filter-dropdown-action-button {
    min-height: 36px;
  }

  .map-filter-container,
  #box-select-buttons {
    display: none;
  }
}


.prefecture-polygon-popup {
  font-size: 13px;
  line-height: 1.45;
}
.prefecture-polygon-popup p {
  margin: 4px 0 6px;
}
.prefecture-polygon-popup ul {
  margin: 0;
  padding-left: 1.2em;
  max-height: 180px;
  overflow: auto;
}
.prefecture-polygon-popup .popup-note {
  color: #555;
  margin-top: 6px;
}

/* JSC Cloudflare additions */
#jsc-home-link-wrapper {
  position: absolute;
  top: 56px;
  left: 170px;
  z-index: 20;
}

#jsc-home-link {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(47, 98, 143, 0.45);
  border-radius: 999px;
  background: #ffffff;
  color: #234f74;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
  box-shadow: none;
}

#jsc-home-link:hover,
#jsc-home-link:focus {
  background: #eef5fb;
  outline: none;
}

.legend-section {
  margin: 10px 10px 0;
  padding: 9px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  flex: 0 0 auto;
}

.legend-section:last-child {
  margin-bottom: 10px;
}

.legend-section + .legend-section {
  margin-top: 6px;
}

.legend-accuracy-section {
  margin-bottom: 10px;
}

.legend-accuracy-section + .choropleth-legend {
  margin-top: 0;
}

.legend-section-title {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.choropleth-legend-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.choropleth-legend-list {
  display: grid;
  gap: 8px;
}

.choropleth-legend--disabled .choropleth-legend-title {
  margin-bottom: 0;
}

.choropleth-legend--disabled {
  padding-top: 8px;
  padding-bottom: 5px;
}

.choropleth-legend--disabled .choropleth-legend-list {
  display: none;
}

.choropleth-legend-group {
  display: grid;
  gap: 4px;
}

.choropleth-legend-group-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: #475569;
}

.choropleth-legend-item {
  display: grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.choropleth-legend-swatch {
  display: inline-block;
  width: 22px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 3px;
}

@media (max-width: 720px) {
  #jsc-home-link-wrapper {
    position: static;
    margin: 8px 0 0;
    text-align: center;
  }
}

/* JSC refinements */
.non-italic {
  font-style: normal;
}

.download-button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

#download-filtered-csv-button,
#download-taxon-csv-button,
#download-author-csv-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-height: 58px;
  max-width: 100%;
  padding: 10px 18px;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}

.download-file-size {
  flex: 0 0 100%;
  color: #607286;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#download-taxon-csv-button::before {
  content: "\2193";
  flex: 0 0 auto;
  font-weight: 700;
}

#download-filtered-csv-button:disabled,
#download-taxon-csv-button:disabled,
#download-author-csv-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .download-button-row {
    grid-template-columns: 1fr;
  }
}

.tab-reference-list {
  list-style: none;
  padding-left: 0;
}

.tab-reference-list li {
  display: flex;
  gap: 0.35em;
  padding-left: 0;
  align-items: start;
}

.tab-reference-list-marker {
  flex: 0 0 auto;
  text-align: left;
  color: #607286;
  font-variant-numeric: tabular-nums;
}

/* JSC prefecture polygon popup refinements */
.prefecture-polygon-popup {
  padding: 12px 16px 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}
.region-summary-popup {
  max-width: 100%;
  max-height: min(320px, calc(100vh - 190px));
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.prefecture-polygon-popup strong {
  display: block;
  margin: 0 30px 6px 0;
  line-height: 1.35;
}
.region-summary-scope-note {
  margin: -2px 0 7px;
  color: #52677b;
  font-size: 11px;
  line-height: 1.35;
}
.prefecture-polygon-popup .prefecture-note-text {
  max-height: 96px;
  overflow: auto;
  padding-right: 4px;
}
.prefecture-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid #9fb5c8;
  border-radius: 999px;
  background: #ffffff;
  color: #1e3a56;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.prefecture-detail-button::after {
  content: "\203A";
  flex: 0 0 auto;
  font-size: 1.1em;
  line-height: 1;
}
.prefecture-detail-button:hover {
  background: #eef5fb;
}

.prefecture-detail-button:focus-visible {
  background: #eef5fb;
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.region-filter-action {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #d8e1ea;
}
.region-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 6px 12px;
  border: 1px solid #5d89ad;
  border-radius: 6px;
  background: #edf6fc;
  color: #163d5d;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.region-filter-button:hover {
  background: #deeffa;
}
.region-filter-button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.prefecture-detail-popup .popup-scroll-container {
  min-width: min(390px, calc(100vw - 46px));
}

/* Lightweight busy indicator */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(1px);
  pointer-events: none;
  opacity: 1;
  transition: opacity 120ms ease;
}
.app-loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.app-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}
.app-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15, 118, 110, 0.22);
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: jsc-spin 0.8s linear infinite;
}
@keyframes jsc-spin {
  to { transform: rotate(360deg); }
}
.chart-svg-host.is-chart-updating {
  opacity: 0.72;
  transition: opacity 120ms ease;
}
.update-history-toolbar {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.update-history-filter-controls {
  display: grid;
  grid-template-columns: auto minmax(180px, 220px) auto minmax(96px, 120px) auto;
  align-items: center;
  gap: 8px 10px;
  margin-left: auto;
  font-size: 13px;
}

.update-history-filter-controls label {
  font-weight: 700;
  color: #34475a;
}

.update-history-filter-controls input,
.update-history-filter-controls select {
  min-height: 32px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #c6d1dc;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.update-history-filter-controls input {
  width: min(220px, 100%);
}

.update-history-filter-controls button {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #9fb5c8;
  border-radius: 999px;
  background: #fff;
  color: #1e3a56;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.update-history-filter-controls button:hover,
.update-history-filter-controls button:focus-visible {
  background: #eef5fb;
  outline: none;
}

.update-history-status {
  margin: 0 0 8px;
  color: #56687a;
  font-size: 13px;
}

.update-history-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.update-history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
}

.update-history-table th,
.update-history-table td {
  border: 1px solid #d5dde7;
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
}

.update-history-table th {
  background: #f4f7fa;
  font-weight: 700;
  white-space: nowrap;
}

.update-history-reference-cell {
  min-width: min(360px, 60vw);
}

.update-history-reference-prose {
  margin-bottom: 7px;
}

.update-history-reference-details {
  min-width: 0;
}

.update-history-reference-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 2px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #496575;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.update-history-reference-summary::-webkit-details-marker {
  display: none;
}

.update-history-reference-summary::before {
  content: "›";
  display: inline-block;
  color: #718795;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.update-history-reference-details[open] > .update-history-reference-summary::before {
  transform: rotate(90deg);
}

.update-history-reference-summary:hover,
.update-history-reference-summary:focus-visible {
  background: #edf4f7;
  color: #294f65;
}

.update-history-reference-summary:focus-visible {
  outline: 2px solid #4d8bab;
  outline-offset: 1px;
}

.update-history-reference-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.update-history-reference-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 5px 8px;
  padding: 7px 8px;
  border: 1px solid #c9d9e5;
  border-radius: 8px;
  background: #f5fafd;
}

.update-history-reference-id {
  padding: 1px 6px;
  border-radius: 999px;
  background: #dceefa;
  color: #1f5e85;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.update-history-reference-citation {
  min-width: 0;
}

.update-history-reference-citation.is-unresolved {
  color: #6c7884;
  font-style: italic;
}

.update-history-reference-entry .reference-url-link {
  grid-column: 2;
  justify-self: start;
  margin-left: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.update-history-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.update-history-sort-button:hover,
.update-history-sort-button:focus-visible {
  color: #1f6ea5;
  outline: none;
}

.update-history-sort-button:active {
  transform: none;
}

.update-history-sort-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.update-history-sort-indicator {
  flex: 0 0 auto;
  width: 1.2em;
  color: #567086;
  font-size: 12px;
  text-align: center;
}

.update-history-column-filter-row th {
  padding: 6px 8px;
  background: #f9fbfd;
}

.update-history-column-filter {
  width: 100%;
  min-width: 80px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid #c6d1dc;
  border-radius: 7px;
  background: #fff;
  color: #22313f;
  font-size: 12px;
  box-sizing: border-box;
}

.update-history-column-filter:focus {
  border-color: #2f78ad;
  outline: 2px solid rgba(47, 120, 173, 0.16);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .update-history-sort-button:active {
    transform: none;
  }
}

.update-history-empty {
  color: #56687a;
  margin: 8px 0 0;
}

.popup-title-text i,
.popup-detail-line i,
.prefecture-detail-popup i {
  font-style: italic;
}

@media (max-width: 720px) {
  .update-history-filter-controls {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .update-history-filter-controls input,
  .update-history-filter-controls select,
  .update-history-filter-controls button {
    width: 100%;
  }

  .update-history-table-wrapper {
    overflow-x: visible;
  }

  .update-history-table,
  .update-history-table tbody,
  .update-history-table tr,
  .update-history-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .update-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .update-history-table tbody {
    display: grid;
    gap: 10px;
  }

  .update-history-table tbody tr {
    overflow: hidden;
    border: 1px solid #d5dde7;
    border-radius: 7px;
    background: #fff;
  }

  .update-history-table tbody td {
    min-width: 0;
    border: 0;
    border-bottom: 1px solid #e2e8ef;
    padding: 7px 9px;
  }

  .update-history-table tbody td:last-child {
    border-bottom: 0;
  }

  .update-history-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #56687a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
  }

  .update-history-reference-cell {
    min-width: 0;
  }
}

/* Final UI refinements */
#jsc-home-link-wrapper {
  left: max(16px, calc((100% - var(--content-width)) / 2));
  top: 56px;
}

#reset-page-button {
  position: absolute;
  top: 10px;
  right: 52px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  height: 32px;
  padding: 5px 12px;
  border: var(--panel-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-main);
  font-weight: 700;
  box-shadow: none;
}

#reset-page-button:hover,
#reset-page-button:focus-visible {
  background: #ffffff;
}

.legend-toggle-button {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: auto;
  height: auto;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #5f6c79;
  line-height: 1;
  transform: rotate(180deg);
}

.legend-toggle-button:hover,
.legend-toggle-button:focus-visible {
  background: transparent;
  border-color: transparent;
}

.legend-toggle-button:active {
  transform: rotate(180deg);
}

.legend {
  max-height: var(--legend-max-height);
  overflow: hidden;
  transition:
    max-height 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.legend:not(.collapsed) {
  max-height: var(--legend-max-height);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.legend:not(.collapsed):has(.legend-count-title:hover),
.legend:not(.collapsed):has(.legend-count-title:focus-visible),
.legend:not(.collapsed):has(.legend-count-title.is-tooltip-visible) {
  overflow: visible;
}

.legend:not(.collapsed) .legend-header {
  position: sticky;
  top: 0;
  z-index: 1;
}

.legend > :not(.legend-header) {
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.legend.collapsed > :not(.legend-header) {
  opacity: 0;
  transform: translateY(-4px);
}

.legend-toggle-button {
  overflow: hidden;
  transition: transform 0.18s ease;
}

.legend-toggle-button::after {
  content: none;
}


.legend .choropleth-legend {
  margin-bottom: 0;
  flex: 0 0 auto;
}

/* UI fixes 2026-06 */

#reset-page-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  font-size: 0;
}

#reset-page-button::before {
  font-size: 17px;
}

.legend-header {
  width: 100%;
}

.legend-toggle-button {
  right: 12px;
  bottom: 10px;
}

.legend-toggle-button.rotate {
  transform: rotate(360deg);
}

.legend-toggle-button.rotate:active {
  transform: rotate(360deg);
}

.map-label-actions {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#map-label-actions .map-action-button {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: var(--panel-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-main);
  font-size: 0;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

#map-label-actions .map-action-button:hover,
#map-label-actions .map-action-button:focus-visible {
  background: #ffffff;
}

.species-image-card {
  position: relative;
}

.species-image-open-button {
  display: grid;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}

.image-modal {
  --image-modal-dialog-width: min(calc(100vw - 48px), 1060px);
  --image-modal-dialog-padding: 14px;
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 32, 0.72);
  overscroll-behavior: contain;
  touch-action: none;
}

.image-modal[hidden] {
  display: none !important;
}

.image-modal-dialog {
  position: relative;
  display: grid;
  box-sizing: border-box;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-areas:
    "counter counter counter"
    "prev image next"
    "caption caption caption";
  align-items: center;
  justify-items: center;
  gap: 10px 12px;
  width: var(--image-modal-dialog-width);
  max-width: var(--image-modal-dialog-width);
  max-height: 92vh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 14px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.image-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(31, 45, 60, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2f3c;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.image-modal-close::before,
.image-modal-close::after {
  position: absolute;
  width: 14px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.image-modal-close::before {
  transform: rotate(45deg);
}

.image-modal-close::after {
  transform: rotate(-45deg);
}

.image-modal-nav {
  position: fixed;
  top: 50%;
  z-index: 2;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 52px;
  border: 1px solid rgba(31, 45, 60, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.88);
  color: #1f4f75;
  font-size: 0;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}

.image-modal-nav::before {
  width: 15px;
  height: 15px;
  border-width: 0 2.4px 2.4px 0;
}

.image-modal-nav:hover,
.image-modal-nav:focus-visible {
  background: #ffffff;
  border-color: #3b78a8;
}

.image-modal-nav:not(:disabled):active {
  transform: translateY(-50%);
  border-color: #8aa8bf;
  background: #dbe7f0;
  color: #244f6d;
  filter: brightness(.94);
  box-shadow: none !important;
}

.image-modal-nav[hidden] {
  display: none !important;
}

.image-modal-nav--prev {
  grid-area: prev;
  left: calc((100vw - var(--image-modal-dialog-width)) / 2 + var(--image-modal-dialog-padding));
}

.image-modal-nav--next {
  grid-area: next;
  right: calc((100vw - var(--image-modal-dialog-width)) / 2 + var(--image-modal-dialog-padding));
}

.image-modal img {
  grid-area: image;
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(92vh - 86px);
  justify-self: center;
  object-fit: contain;
  border-radius: 6px;
  background: #eef3f7;
}

.image-modal img.mirrored {
  transform: scaleX(-1);
}

.image-modal-caption {
  grid-area: caption;
  justify-self: stretch;
  color: #263747;
  font-size: 13px;
  line-height: 1.45;
}

.image-modal-counter {
  grid-area: counter;
  position: static;
  z-index: 1;
  width: 100%;
  justify-self: center;
  padding: 0;
  background: transparent;
  color: #71717a;
  font-size: 12px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
}

.image-modal-counter[hidden] {
  display: none;
}

.image-modal-caption-summary {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.image-modal-caption-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.image-modal-caption-taxon-row {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 5px;
}

.image-modal-caption-taxon-actions {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  white-space: nowrap;
}

.image-modal-caption-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 2px 7px;
  border: 1px solid #c8d5df;
  border-radius: 999px;
  background: #f6fafc;
  color: #245a7b;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.image-modal-caption-link:hover,
.image-modal-caption-link:focus-visible {
  border-color: #3b78a8;
  background: #eef6fb;
}

.image-modal-caption-taxon-actions .image-modal-caption-link {
  display: inline;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1f5f86;
  text-decoration: underline;
}

.image-modal-caption-taxon-actions .image-modal-caption-link:hover,
.image-modal-caption-taxon-actions .image-modal-caption-link:focus-visible {
  background: transparent;
  color: #143c5c;
}

@media (max-width: 520px) {
  .image-modal {
    --image-modal-dialog-width: calc(100vw - 24px);
    --image-modal-dialog-padding: 10px;
    padding: 12px;
  }

  .image-modal-dialog {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(0, auto) auto auto;
    grid-template-areas:
      "counter counter"
      "image image"
      "prev next"
      "caption caption";
    align-items: center;
    gap: 8px 12px;
    width: var(--image-modal-dialog-width);
    max-width: var(--image-modal-dialog-width);
    padding: 44px 10px 12px;
  }

  .image-modal-nav {
    position: static;
    top: auto;
    z-index: 1;
    width: 42px;
    height: 48px;
    transform: none;
  }

  .image-modal-nav:not(:disabled):active {
    transform: none;
  }

  .image-modal-nav--prev {
    justify-self: start;
    left: auto;
  }

  .image-modal-nav--next {
    justify-self: end;
    right: auto;
  }

  .image-modal img {
    width: 100%;
    height: min(58vh, calc(100dvh - 190px));
    max-width: 100%;
    max-height: calc(100dvh - 190px);
  }

  .image-modal-caption {
    height: clamp(72px, 13dvh, 112px);
    overflow: auto;
  }
}

@media (hover: none) and (pointer: coarse), (max-width: 711px) {
  .species-image-strip-frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .species-image-strip {
    grid-column: 1;
  }

  .species-image-strip-button,
  .species-image-strip-actions {
    display: none !important;
  }

  .species-image-strip-button[hidden] {
    display: none !important;
  }
}

.legend-count-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.legend-count-title[data-tooltip]:not([data-tooltip=""])::after {
  content: none;
  display: none;
}

.legend-count-title[data-tooltip]:not([data-tooltip=""]):hover::after,
.legend-count-title[data-tooltip]:not([data-tooltip=""]):focus-visible::after,
.legend-count-title.is-tooltip-visible[data-tooltip]:not([data-tooltip=""])::after {
  display: none;
}

.floating-ui-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6000;
  box-sizing: border-box;
  width: max-content;
  max-width: min(280px, calc(100vw - 40px));
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--tooltip-background);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 8px 18px rgba(20, 34, 47, 0.22);
  transition: opacity 0.12s ease;
}

.floating-ui-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

.tab-header {
  scrollbar-width: none;
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
}

.tab-header::-webkit-scrollbar {
  display: none;
}

#species-list.is-higher-taxonomy-hidden li:not(.species-list-subspecies) {
  margin-left: 0 !important;
}

#species-list.is-higher-taxonomy-hidden .species-list-subspecies {
  margin-left: 1.2em !important;
}

@media (max-width: 711px) {
  .legend,
  .legend:not(.collapsed) {
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    touch-action: pan-y;
  }

  .legend.collapsed {
    max-height: var(--legend-collapsed-height);
    overflow: hidden;
  }
}

.maplibregl-popup,
.mapboxgl-popup {
  max-width: min(360px, calc(100vw - 36px)) !important;
}

.maplibregl-ctrl-compass,
.mapboxgl-ctrl-compass {
  display: none !important;
}

.maplibregl-popup-content,
.mapboxgl-popup-content {
  width: min(100%, 360px, calc(100vw - 36px));
  max-width: min(360px, calc(100vw - 36px));
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.maplibregl-popup-content .popup-wrapper {
  width: min(100%, 360px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  min-width: 0;
}

.maplibregl-popup-content .popup-scroll-container {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.maplibregl-popup-content .popup-scroll-container,
.maplibregl-popup-content .popup-scroll-container *,
.maplibregl-popup-content .popup-title-text,
.maplibregl-popup-content .popup-title-text *,
.maplibregl-popup-content .popup-detail-line,
.maplibregl-popup-content .popup-reference-line {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
}

.maplibregl-popup-content .popup-scroll-container,
.maplibregl-popup-content .popup-detail-line,
.maplibregl-popup-content .popup-reference-line {
  display: block;
  width: 100%;
}

.maplibregl-popup-content .popup-reference-line {
  display: block;
}

.maplibregl-popup-content .popup-nav-button,
.maplibregl-popup-content .popup-nav-counter {
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

.maplibregl-popup-content .popup-nav-fixed {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.maplibregl-popup-content .popup-nav-button {
  display: inline-block;
  min-width: 68px;
}

.maplibregl-popup-content .popup-nav-counter {
  justify-self: center;
  display: inline-block;
  min-width: 78px;
  padding: 2px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .maplibregl-popup,
  .mapboxgl-popup {
    max-width: min(260px, calc(100vw - 28px)) !important;
  }

  .maplibregl-popup-content,
  .mapboxgl-popup-content {
    width: min(100%, 260px, calc(100vw - 28px));
    max-width: min(260px, calc(100vw - 28px));
    min-width: 0;
  }

  .maplibregl-popup-content .popup-wrapper {
    width: min(100%, 260px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }

  .popup-wrapper--below .popup-nav-fixed {
    padding-right: 34px;
  }

  .popup-nav-fixed {
    grid-template-columns: minmax(56px, 1fr) minmax(70px, auto) minmax(56px, 1fr);
    gap: 6px;
    padding-left: 8px;
  }

  .maplibregl-popup-content .popup-nav-button {
    min-width: 56px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .maplibregl-popup-content .popup-nav-counter {
    min-width: 70px;
  }

  .maplibregl-popup-content .popup-scroll-container {
    padding: 10px 12px;
  }
}

.prefecture-chart-single-preview {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(220px, 1fr);
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 340px;
  padding: 18px;
  box-sizing: border-box;
}

.prefecture-chart-single-preview svg {
  max-width: 100%;
  height: auto;
}

.prefecture-chart-single-summary {
  display: grid;
  gap: 8px;
  align-self: center;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.prefecture-chart-single-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.35;
  padding: 2px 4px;
  border-radius: 7px;
  transition: background-color 0.15s ease, opacity 0.15s ease, font-weight 0.15s ease;
}

.prefecture-chart-single-item:focus-visible {
  outline: 2px solid rgba(52, 112, 196, 0.45);
  outline-offset: 1px;
}

.prefecture-chart-single-item.is-active {
  background: rgba(255, 214, 10, 0.18);
  font-weight: 700;
}

.prefecture-chart-single-item.is-dimmed {
  opacity: 0.45;
}

.prefecture-chart-single-swatch {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}

.prefecture-chart-single-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.prefecture-chart-single-value {
  color: var(--text-muted);
  white-space: nowrap;
}

.prefecture-chart-single-more {
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  #jsc-home-link-wrapper {
    position: static;
    margin: 0 0 8px;
    text-align: left;
  }

  .prefecture-chart-single-preview {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 12px;
  }

  .prefecture-chart-single-summary {
    max-height: 220px;
  }
}

.region-summary-popup .prefecture-note-text {
  display: none !important;
}

.tab-content.active {
  content-visibility: auto;
  contain-intrinsic-size: 720px;
}

#tab-species-list.active {
  content-visibility: visible;
  contain-intrinsic-size: auto;
}

@media (max-width: 720px) {
  header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    padding: 10px 12px 8px;
  }

  .map-label-actions {
    position: static;
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: end;
  }

  #jsc-home-link-wrapper {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    margin: 0;
    text-align: left;
  }

  #language-switcher {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    margin: 0;
    padding: 0;
    gap: 4px;
  }

  #language-switcher .language-selector-label {
    width: auto;
    min-width: 0;
    overflow: visible;
    color: #496578;
    white-space: normal;
  }

  .language-selector-icon {
    width: 15px;
    height: 15px;
  }

  #language-selector {
    width: 112px;
    min-width: 0;
  }

  header h1 {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .search-container,
  .search-header,
  .legend,
  .legend-header {
    border-radius: 8px;
  }

  .legend {
    margin-bottom: 14px;
  }

  .legend > .legend-item:last-of-type {
    margin-bottom: 12px;
  }
}

/* Compact, unified page header */
header {
  margin: var(--jsc-scroll-compensation, 0px) 0 14px;
  padding: 0;
}

.catalog-header {
  background: linear-gradient(180deg, #f5fafd 0%, #ebf4f8 100%);
  border-bottom: 1px solid #cbd9e1;
  color: var(--text-main);
  font-family: var(--font-body);
  text-align: left;
}

.catalog-header,
.catalog-header *,
.catalog-header *::before,
.catalog-header *::after {
  box-sizing: border-box;
}

.header-layout {
  display: grid;
  grid-template-areas: "brand navigation utilities";
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  min-height: 66px;
  padding: 9px clamp(14px, 3vw, 34px) 8px;
}

.header-brand {
  grid-area: brand;
  display: grid;
  align-content: center;
  min-width: 0;
}

.header-brand #jsc-home-link-wrapper {
  position: static;
  min-width: 0;
  margin: 0;
  text-align: left;
}

#jsc-home-link {
  width: fit-content;
  min-width: 0;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  color: #285f87;
  font-size: 11px;
  line-height: 1.25;
}

#jsc-home-link .header-control-icon {
  width: 14px;
  height: 14px;
}

#jsc-home-link:hover,
#jsc-home-link:focus-visible {
  background: transparent;
  color: #174665;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#jsc-home-link-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-layout h1 {
  min-width: 0;
  max-width: none;
  margin: 2px 0 0;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.site-title-primary {
  display: block;
  font-size: 1em;
  font-weight: 750;
}

.header-utilities {
  grid-area: utilities;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 6px;
}

.header-control-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-utilities #language-switcher {
  flex: 0 1 auto;
  margin: 0;
  padding: 0 0 0 8px;
  border-left: 1px solid #c9d7df;
  gap: 5px;
}

.header-utilities .map-label-actions {
  position: static;
  z-index: auto;
  flex: 0 0 auto;
}

.header-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #aec2cf;
  border-radius: 4px;
  background: #fff;
  color: #284b5f;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.header-share-button:hover,
.header-share-button:focus-visible {
  background: #f5f9fb;
}

.header-share-status {
  position: fixed;
  z-index: 100;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  max-width: min(calc(100vw - 24px), 420px);
  padding: 8px 12px;
  border: 1px solid #9db5c3;
  border-radius: 4px;
  background: #fff;
  color: #183b4d;
  box-shadow: 0 4px 14px rgba(24, 59, 77, .16);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
}

.header-share-status[hidden] {
  display: none;
}

.header-utilities #reset-page-button {
  position: static;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 4px;
}

.primary-page-nav {
  grid-area: navigation;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 0;
  border: 0;
  background: transparent;
}

.primary-page-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 40px;
  padding: 0 16px;
  color: #536d7d;
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
  transition: background-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.primary-page-link:hover,
.primary-page-link:focus-visible {
  color: #235e87;
  background: #eef5f9;
  outline: none;
}

.primary-page-link:active {
  color: #173f58;
  background: #dceaf3;
  box-shadow: inset 0 2px 5px rgba(20, 34, 47, .2);
}

.primary-page-link.active {
  color: #235e87;
}

.primary-page-link.active::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  background: #397ca9;
  content: "";
}

@media (max-width: 960px) {
  header {
    display: block;
    padding: 0;
  }

  .header-layout {
    grid-template-areas:
      "brand utilities"
      "navigation navigation";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 8px;
    min-height: 0;
    padding: 8px 12px 0;
  }

  .header-utilities {
    gap: 5px;
  }

  .header-layout h1 {
    font-size: 1.1rem;
  }

  .header-utilities #language-switcher {
    position: relative;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    gap: 0;
  }

  .header-share-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
  }

  .header-share-button .header-control-label {
    display: none;
  }

  .header-utilities #language-switcher .language-selector-label {
    display: inline-flex;
    width: 34px;
    height: 34px;
    min-width: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid #aec2cf;
    border-radius: 4px;
    background: #fff;
    pointer-events: none;
  }

  .header-utilities #language-switcher .language-selector-icon,
  .header-utilities #language-switcher .header-control-icon {
    width: 17px;
    height: 17px;
    margin: 0;
  }

  .header-utilities #language-selector {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .header-utilities #language-switcher:focus-within .language-selector-label {
    outline: 2px solid #285f87;
    outline-offset: 2px;
  }

  #jsc-home-link,
  #jsc-home-link-text {
    overflow: visible;
  }

  #jsc-home-link-text {
    line-height: 1.2;
    text-overflow: clip;
    white-space: normal;
  }

  .primary-page-nav {
    width: auto;
    margin: 0 -12px;
    border-top: 1px solid #cbd9e1;
    background: rgba(255, 255, 255, .28);
  }

  .primary-page-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    padding-inline: 8px;
  }

}

@media (max-width: 420px) {
  .header-layout {
    gap-inline: 6px;
  }

  .header-utilities .language-selector-icon,
  .header-utilities #language-switcher .header-control-icon {
    width: 15px;
    height: 15px;
  }
}

/* Responsive chart, panel toggle, and fixed navigation contracts. */
@media (min-width: 712px) {
  .search-body {
    overflow-y: scroll;
    scrollbar-width: thin;
    scrollbar-color: #8fa8b8 #edf3f7;
    -ms-overflow-style: auto;
  }

  .search-body::-webkit-scrollbar {
    width: 10px;
  }

  .search-body::-webkit-scrollbar-track {
    background: #edf3f7;
    border-left: 1px solid #d8e2e9;
  }

  .search-body::-webkit-scrollbar-thumb {
    min-height: 36px;
    border: 2px solid #edf3f7;
    border-radius: 5px;
    background: #8fa8b8;
  }

  .search-body::-webkit-scrollbar-thumb:hover {
    background: #6f8fa3;
  }
}

.record-category-filter {
  min-width: 0;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid #d7e2eb;
  border-radius: 8px;
  background: #fff;
}

.record-category-filter legend {
  padding: 0 4px;
  font-weight: 700;
}

.record-category-filter-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.record-category-filter-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.chart-top-legend {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#classification-radio {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#classification-radio label,
.chart-prefecture-sort-control label {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.year-chart-series-hover {
  transition: opacity 0.15s ease, filter 0.15s ease, stroke-width 0.15s ease;
}

.year-chart-series-hover.is-active {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(32, 48, 64, 0.45));
}

.year-chart-series-hover.is-dimmed {
  opacity: 0.3;
}

#download-filtered-csv-button::before,
#download-taxon-csv-button::before,
#download-author-csv-button::before {
  content: none;
}

.download-button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

#back-to-tabs-button {
  position: fixed;
  left: auto;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 900;
}

.page-scroll-top-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #bccbd7;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #234b67;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
  line-height: 0;
  cursor: pointer;
}

.page-scroll-top-button:hover,
.page-scroll-top-button:focus-visible {
  border-color: #8fafc1;
  background: #eaf3f7;
  color: #173f58;
}

.page-scroll-top-button:focus-visible {
  outline: 2px solid #2d6ca2;
  outline-offset: 2px;
}

.page-scroll-top-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#back-to-tabs-button[hidden] {
  display: none;
}

.maplibregl-canvas.spider-prefecture-polygon-hover {
  cursor: pointer !important;
}

.search-header,
.legend-header {
  padding: 0;
}

.search-container.closed {
  max-height: 44px;
}

.select-box-title,
.legend-header {
  width: 100%;
}

.panel-disclosure-button,
.search-header .panel-disclosure-button,
.legend-header .panel-disclosure-button {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  height: auto;
  padding: 8px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: #263746;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  box-shadow: none;
  transform: none;
  cursor: pointer;
}

.panel-disclosure-button:hover,
.search-header .panel-disclosure-button:hover,
.legend-header .panel-disclosure-button:hover {
  border: 0;
  background: rgba(56, 111, 158, 0.08);
}

.panel-disclosure-button:focus-visible,
.search-header .panel-disclosure-button:focus-visible,
.legend-header .panel-disclosure-button:focus-visible {
  border: 0;
  outline: 2px solid #2d6ca2;
  outline-offset: -2px;
  background: rgba(56, 111, 158, 0.08);
}

.panel-disclosure-button:not(:disabled):active,
.search-header .panel-disclosure-button:not(:disabled):active,
.legend-header .panel-disclosure-button:not(:disabled):active {
  transform: none;
  box-shadow: none !important;
}

.panel-disclosure-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel-disclosure-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-right: 2px;
  border-right: 2px solid #5f6c79;
  border-bottom: 2px solid #5f6c79;
  transform: rotate(45deg) translate(-1px, -1px);
  transform-origin: center;
  transition: transform 0.18s ease;
}

.panel-disclosure-button[aria-expanded="false"] .panel-disclosure-chevron {
  transform: rotate(-45deg);
}

.panelDisclosureChevron {
  flex: 0 0 auto;
  margin: 0;
}

.stv-react-page .imageFilterDisclosure {
  border-bottom: 1px solid #d6dde5;
  border-radius: 0;
  background: linear-gradient(180deg, #f8fbfd 0%, #f1f6f9 100%);
}

.stv-react-page .imageAdvancedDisclosure {
  align-self: stretch;
  margin-top: 2px;
  border: 1px solid #d4dfe6;
  border-radius: 7px;
  background: #fff;
}

.stv-react-page .imageAdvancedDisclosure:hover,
.stv-react-page .imageAdvancedDisclosure:focus-visible {
  border: 1px solid #8fafc1;
}

.stv-react-page .infoDock .imageInfoDisclosure {
  width: max-content;
  min-width: 0;
  max-width: min(240px, calc(100vw - 32px));
  min-height: 44px;
  padding-inline: 6px;
  border: 1px solid #bccbd7;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: #234b67;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}

.stv-react-page .infoDock .imageInfoDisclosure:hover,
.stv-react-page .infoDock .imageInfoDisclosure:focus-visible,
.stv-react-page .infoDock.infoDockOpen .imageInfoDisclosure {
  border-color: #8fafc1;
  background: #eaf3f7;
  color: #173f58;
}

@media (max-width: 640px) {
  #back-to-tabs-button {
    left: auto;
    right: calc(8px + env(safe-area-inset-right));
  }

  .stv-react-page .page-scroll-top-button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px;
  }

  .stv-react-page .infoDock .imageInfoDisclosure {
    width: max-content !important;
    min-width: 44px !important;
    max-width: 58px;
    height: var(--floating-control-shell-height, 44px) !important;
    min-height: var(--floating-control-shell-height, 44px) !important;
    flex: 0 0 auto;
    justify-content: center;
    gap: 0;
    padding: 0 5px;
  }

  .stv-react-page .infoDock .imageInfoDisclosure .infoDockBadgePreview {
    display: inline-flex !important;
  }

}

/* Distribution and image filters share the joined previous / dropdown / next control. */
.select-container[data-select-filter="normal"],
.stv-react-page .toolbarFilterRow .filterStepper {
  --filter-control-height: 26px;
  display: grid;
  grid-template-columns:
    var(--filter-control-height)
    minmax(0, 1fr)
    var(--filter-control-height);
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.select-container[data-select-filter="normal"] > .filter-dropdown {
  grid-column: 2;
  grid-row: 1;
}

.select-container[data-select-filter="normal"] > .filter-navigation-buttons,
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons {
  display: contents;
}

.select-container[data-select-filter="normal"] .nav-button,
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button {
  grid-row: 1;
  margin: 0;
  border: 1px solid #c8d0d8;
  border-radius: 0;
  background: #fff;
  color: #415160;
  box-shadow: none;
}

.select-container[data-select-filter="normal"] .nav-button:first-child,
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button:first-child {
  grid-column: 1;
  border-radius: 7px 0 0 7px;
}

.select-container[data-select-filter="normal"] .nav-button:last-child,
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button:last-child {
  grid-column: 3;
  border-radius: 0 7px 7px 0;
}

.select-container[data-select-filter="normal"] .nav-button:hover:not(:disabled),
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button:hover:not(:disabled) {
  border-color: #9daab3;
  background: #e7edf3;
  color: #18252e;
}

.select-container[data-select-filter="normal"] .nav-button:active:not(:disabled),
.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button:active:not(:disabled) {
  transform: none;
  border-color: #8aa8bf;
  background: #dbe7f0;
  color: #244f6d;
  filter: brightness(.94);
  box-shadow: none;
}

.select-container[data-select-filter="normal"] .filter-dropdown-trigger,
.stv-react-page .toolbarFilterRow .filterStepper .comboDisplay {
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}

.stv-react-page .displayControls {
  --filter-control-height: 26px;
}

.stv-react-page .displayControls #image-density,
.stv-react-page .displayControls .labelChecklist > summary,
.stv-react-page .displayControls .labelDisplayRow select {
  box-sizing: border-box;
  height: var(--filter-control-height) !important;
  min-height: var(--filter-control-height) !important;
  border: 1px solid #cbd6df;
  border-radius: 4px;
  background-color: #fff;
  color: var(--text-main);
  box-shadow: none;
}

.stv-react-page .displayControls #image-density,
.stv-react-page .displayControls .labelDisplayRow select {
  appearance: none;
  -webkit-appearance: none;
  padding: 2px 28px 2px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='5' viewBox='0 0 10 5'%3E%3Cpath d='M0 0h10L5 5z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 10px 5px;
}

.stv-react-page .displayControls .labelChecklist > summary {
  padding: 2px 8px;
}

.stv-react-page .displayControls .labelChecklist > summary .comboCaret {
  width: 0;
  height: 0;
  border: 0;
  border-top: 5px solid #666;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  transform: none;
}

.stv-react-page .displayControls .labelChecklist[open] > summary .comboCaret {
  transform: rotate(180deg);
}

.stv-react-page .toolbarFilterRow {
  container-name: stv-filter-row;
  container-type: inline-size;
}

.stv-react-page .toolbarFilterRow .filterStepper > .field {
  display: block;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
}

.stv-react-page .toolbarFilterRow .filterStepper > .field > span {
  display: none;
}

.stv-react-page .toolbarFilterRow .filterStepper > .field > .comboBox {
  width: 100%;
  min-width: 0;
}

.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button {
  display: grid;
  place-items: center;
  flex: 0 0 var(--filter-control-height) !important;
  width: var(--filter-control-height) !important;
  min-width: var(--filter-control-height) !important;
  height: var(--filter-control-height) !important;
  min-height: var(--filter-control-height) !important;
  padding: 0;
  line-height: calc(var(--filter-control-height) - 2px);
}

.stv-react-page .toolbarFilterRow .filterStepper .stepButtons button svg,
.stv-react-page .toolbarFilterRow .comboDisplayClear svg {
  display: block;
  width: 16px;
  height: 16px;
}

.stv-react-page .toolbarFilterRow .comboDisplay {
  height: var(--filter-control-height) !important;
  min-height: var(--filter-control-height) !important;
  border-color: #cbd6df;
  border-radius: 0;
  background: #fff;
}

.stv-react-page .toolbarFilterRow .comboDisplayWrap:not(.hasSelection) .comboDisplay {
  padding-right: 18px;
}

.stv-react-page .toolbarFilterRow .filterValueText {
  padding-right: 0;
}

.stv-react-page .toolbarFilterRow .comboCaret {
  top: 50%;
  right: 11px;
  width: 0;
  height: 0;
  border: 0;
  border-top: 5px solid #666;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  transform: translateY(-30%);
}

.stv-react-page .toolbarFilterRow .comboDisplay[aria-expanded="true"] .comboCaret {
  transform: translateY(-30%) rotate(180deg);
}

.stv-react-page .toolbarFilterRow .comboDisplayClear {
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #666;
  transform: translateY(-50%);
}

.stv-react-page .toolbarFilterRow .comboDisplayClear:hover {
  background: #e8ecef;
  color: #1f2d36;
}

@media (max-width: 711px) {
  .select-container[data-select-filter="normal"],
  .stv-react-page .toolbarFilterRow .filterStepper,
  .stv-react-page .displayControls {
    --filter-control-height: 32px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .select-container[data-select-filter="normal"],
  .stv-react-page .toolbarFilterRow .filterStepper,
  .stv-react-page .displayControls {
    --filter-control-height: 34px;
  }
}

@media (hover: none) and (pointer: coarse), (max-width: 711px) {
  .select-container[data-select-filter="normal"] .filter-dropdown-trigger {
    padding: 3px 18px 3px 10px;
    font-size: 11px;
  }

  .select-container[data-select-filter="normal"] .filter-dropdown-trigger:not(.is-placeholder) {
    padding-right: 32px;
  }

  .select-container[data-select-filter="normal"] .filter-dropdown-clear {
    top: 50%;
    right: 5px;
    display: grid;
    place-items: center;
    height: 28px;
    border-radius: 50%;
  }

  .select-container[data-select-filter="normal"] .nav-button {
    display: grid;
    place-items: center;
    line-height: 1;
    box-shadow: none;
  }
}

@container stv-filter-row (max-width: 387px) {
  .stv-react-page .toolbarFilterRow .filterStepper {
    width: 100%;
  }
}
