.hisrec-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, 280px);
  gap: 16px;
  margin: 1em 0;
  justify-content: center;
}

.hisrec-card {
  display: flex;
  flex-direction: column;
  width: 280px;
  height: 360px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 2px solid #9A6D04;
  background-color: #fff;
  overflow: hidden;
}

/* #content h4 の見た目をカードタイトル用に移植 */
#content .hisrec-card__name {
  flex: 0 0 3em;
  margin: 0;
  padding: 2px 12px 5px;
  height: calc(2.7em + 10px);
  max-height: calc(2.7em + 10px);
  box-sizing: border-box;
  border-left: 7px solid #9a6d04;
  font-size: 2em;
  font-weight: bold;
  line-height: 1.35;
  color: #333;
  background-color: #F0ECDD;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hisrec-card__photo {
  flex: 0 0 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  padding: 4px;
  box-sizing: border-box;
}

.hisrec-card__photo a {
  display: block;
  line-height: 0;
}

.hisrec-card__photo img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 88px;
  object-fit: contain;
}

.hisrec-card__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hisrec-card__id {
  flex: 0 0 auto;
  margin: 0 0 1px !important;
  font-size: 0.8em;
  line-height: 1.2;
  color: #666;
}

.hisrec-card__meta {
  flex: 1 1 auto;
  margin: 0;
  display: grid;
  grid-template-columns: 10em 1fr;
  grid-template-rows: repeat(3, 1fr);
  font-size: 0.85em;
  line-height: 1.3;
  border-top: 1px solid #9A6D04;
  overflow: hidden;
}

.hisrec-card__meta dt,
.hisrec-card__meta dd {
  margin: 0;
  padding: 2px 4px;
  border-bottom: 1px solid #9A6D04;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 0;
}

.hisrec-card__meta dt {
  justify-content: center;
  background-color: #F0ECDD;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
}

.hisrec-card__meta dd {
  padding: 2px 5px;
  background-color: #fff;
  word-break: break-all;
  line-height: 1.25;
}

.hisrec-card__meta dt:nth-last-of-type(1),
.hisrec-card__meta dd:nth-last-of-type(1) {
  border-bottom: none;
}

.hisrec-cards__heading {
  margin: 0 0 0.5em;
  font-size: 1.1em;
  font-weight: bold;
}

.search-panel {
  position: relative;
  margin: 1.5em 0 2em;
  z-index: 20;
}

.search-bar {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border: 1px solid #d0d0d0;
  border-radius: 9999px;
  background-color: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

.search-bar:focus-within {
  border-color: #9a6d04;
  box-shadow: 0 0 0 2px rgba(154, 109, 4, 0.18);
}

.search-bar__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 4px 0 18px;
  color: #888;
  pointer-events: none;
}

.search-bar__icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.search-bar__input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 14px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.4;
  color: #333;
}

.search-bar__input:focus {
  border: none;
  background: transparent;
}

.search-bar__input::placeholder {
  color: #999;
}

.search-bar__filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin: 5px;
  padding: 10px 18px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #333;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.search-bar__filters:hover,
.search-bar__filters.is-active {
  background-color: #f0ecdd;
}

.search-bar__filters-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.search-bar__hint {
  max-width: 960px;
  margin: 0.5em auto 0;
  padding: 0 0.5em;
  font-size: 0.9em;
}

.filters-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: transparent;
}

.filters-backdrop[hidden] {
  display: none;
}

.filters-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: max(0px, calc((100% - 960px) / 2));
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 24px));
  max-height: min(72vh, 680px);
  margin: 0;
  padding: 0;
  border: 1px solid #e3e3e3;
  border-radius: 16px;
  background-color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  overflow: hidden;
}

.filters-panel[hidden] {
  display: none;
}

.filters-panel__body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.1em 1.15em 0.75em;
}

.filters-panel__section + .filters-panel__section {
  margin-top: 1.15em;
  padding-top: 1.15em;
  border-top: 1px solid #ececec;
}

.filters-panel__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 0.65em;
}

.filters-panel__heading {
  margin: 0;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #777;
}

.filters-panel__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  border-top: 1px solid #ececec;
  background: #fff;
}

.filters-panel__clear {
  margin: 0;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #222;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.filters-panel__clear:hover {
  color: #9a6d04;
}

.filters-panel__done {
  margin: 0;
  padding: 10px 18px;
  border: none;
  border-radius: 9999px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.filters-panel__done:hover {
  background: #333;
}

.search-panel__detail {
  margin-top: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background-color: transparent;
  overflow: visible;
}

.filters-panel .search-panel__detail ul.checkList02,
.filters-panel .search-panel__detail ul.checkList01 {
  display: flex;
  flex-wrap: wrap;
  float: none;
  gap: 8px;
  margin: 0;
  width: auto;
}

.filters-panel .search-panel__detail ul.checkList02 li,
.filters-panel .search-panel__detail ul.checkList01 li {
  position: relative;
  float: none;
  clear: none;
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
}

.filters-panel .search-panel__detail ul.checkList02 li input,
.filters-panel .search-panel__detail ul.checkList01 li input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
  float: none;
}

.filters-panel .search-panel__detail ul.checkList02 li label,
.filters-panel .search-panel__detail ul.checkList01 li label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid #d8d8d8;
  border-radius: 9999px;
  background: #fff;
  color: #222;
  font-size: 0.92em;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.filters-panel .search-panel__detail ul.checkList02 li input:checked + label,
.filters-panel .search-panel__detail ul.checkList01 li input:checked + label {
  border-color: #9a6d04;
  background: #f0ecdd;
  color: #333;
}

.filters-panel .search-panel__detail ul.checkList02 li label:hover,
.filters-panel .search-panel__detail ul.checkList01 li label:hover {
  border-color: #b0b0b0;
}

.filters-panel .search-panel__detail ul.checkList01 li label span {
  padding: 0;
  background: none !important;
}

.filters-panel .search-panel__detail .color03,
.filters-panel .search-panel__detail .color04 {
  margin-top: 0.85em !important;
  margin-bottom: 0.5em !important;
  font-size: 0.92em !important;
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.image-overlay[hidden] {
  display: none;
}

.image-overlay__img {
  display: block;
  max-width: min(100%, 960px);
  max-height: calc(100vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.image-overlay__close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.image-overlay__close:hover {
  background: #fff;
}

@media (max-width: 640px) {
  .search-bar__filters-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .search-bar__filters {
    padding: 10px 14px;
  }

  .filters-backdrop {
    background: rgba(0, 0, 0, 0.45);
  }

  .filters-panel {
    position: fixed;
    top: 80px;
    right: 0;
    left: auto;
    bottom: 0;
    width: min(100vw - 40px, 420px);
    max-width: none;
    height: auto;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.22);
  }

  .filters-panel__body {
    padding: 1.4em 1.2em 1em;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .filters-panel__footer {
    justify-content: space-between;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }

  .filters-panel__done {
    min-width: 96px;
    padding: 12px 22px;
  }

  body.filters-open {
    overflow: hidden;
  }

  .hisrec-cards {
    grid-template-columns: 280px;
    justify-content: center;
  }
}
