.leaseholder-back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 20;
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid #555;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: #222;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.leaseholder-back-to-top:hover,
.leaseholder-back-to-top:focus {
  background: #fff0a8;
  color: #111;
  outline: 2px solid #222;
  outline-offset: 2px;
}

.leaseholder-map {
  margin: 0 0 1.5rem;
}

.leaseholder-district-intro {
  font-size: 0.88em;
}

.leaseholder-map h2 {
  margin-bottom: 0.35rem;
  color: #222;
  font-size: 1.15em;
  font-style: normal;
  text-align: left;
}

.leaseholder-map > p {
  margin: 0 0 0.7rem;
  color: #555;
  font-size: 0.82em;
}

.leaseholder-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0 0 0.7rem;
  padding: 0;
  list-style: none;
  font-size: 0.76em;
}

.leaseholder-map-legend li {
  padding: 0;
  white-space: nowrap;
}

.leaseholder-map-legend a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.24rem;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
}

.leaseholder-map-legend a.district-active,
.leaseholder-map-legend a:focus {
  background: #e8edf1;
  outline: 1px solid #7d8c98;
  outline-offset: 1px;
}

.map-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid #555;
  border-radius: 2px;
}

.map-swatch-dejima { background: #dc955d; }
.map-swatch-umegasaki { background: #d5c85c; }
.map-swatch-oura { background: #69b5a1; }
.map-swatch-sagarimatsu { background: #6d9fce; }
.map-swatch-higashiyamate { background: #ae86c7; }
.map-swatch-minamiyamate { background: #d17d96; }

.leaseholder-map-object {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1991 / 1383;
  border: 1px solid #d2d2d2;
  background: #fff;
}

.leaseholder-map > .leaseholder-map-note {
  margin-top: 0.35rem;
  font-size: 0.7em;
}

.leaseholder-filters {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) minmax(10rem, 1fr) 7rem 7rem auto;
  align-items: end;
  gap: 0.8rem;
  margin-top: 0.8rem;
  padding: 1rem;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.leaseholder-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.82em;
  font-weight: 700;
}

.leaseholder-field input,
.leaseholder-field select,
.leaseholder-reset {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 0.85em;
}

.leaseholder-reset {
  width: auto;
  cursor: pointer;
  font-weight: 700;
}

.leaseholder-filter-note {
  margin-top: 0.45rem;
  color: #666;
  font-size: 0.78em;
}

.lot-browser {
  margin: 1.5rem 0;
}

.lot-browser h2 {
  margin-bottom: 0.6rem;
  color: #222;
  font-size: 1.05em;
  font-style: normal;
  text-align: left;
}

.lot-browser .district-lot-section {
  border-top: 1px solid #ddd;
  padding: 0.7rem 0;
  scroll-margin-top: 0.75rem;
}

.lot-browser .district-lot-section h3 {
  margin: 0 0 0.35rem;
  font-size: 1em;
}

.district-description {
  margin: 0 0 0.55rem;
  color: #444;
  font-size: 0.82em;
  line-height: 1.5;
}

.lot-browser details {
  padding: 0.1rem 0 0;
}

.lot-browser summary {
  cursor: pointer;
  font-weight: 700;
}

.lot-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0 0.25rem 1.2rem;
}

.lot-link-list a {
  display: inline-block;
  padding: 0.22rem 0.48rem;
  border: 1px solid #c9d4de;
  border-radius: 3px;
  font-size: 0.78em;
  font-weight: 600;
}

.leaseholder-count {
  margin: 1rem 0 0.5rem;
  font-size: 0.88em;
  font-weight: 700;
}

.leaseholder-table-wrap {
  overflow-x: auto;
}

.leaseholder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78em;
  line-height: 1.45;
}

.leaseholder-table th,
.leaseholder-table td {
  padding: 0.65rem;
  border: 1px solid #d8d8d8;
  text-align: left;
  vertical-align: top;
}

.leaseholder-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf1f4;
}

.leaseholder-table tbody .leaseholder-record-even {
  background: #fafafa;
}

.leaseholder-table thead th:first-child,
.leaseholder-location,
.leaseholder-date-line {
  width: 1%;
  white-space: nowrap;
}

.leaseholder-location span,
.leaseholder-location a {
  display: block;
  white-space: nowrap;
}

.leaseholder-location-district {
  font-weight: 700;
}

.leaseholder-location-japanese {
  font-weight: 400;
}

.leaseholder-location-lot {
  margin-top: 0.15rem;
}

.leaseholder-mobile-location-row {
  display: none;
}

.leaseholder-date-line {
  min-width: 8rem;
}

.leaseholder-table tbody .leaseholder-line > td {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  border-top: 0;
  border-bottom: 0;
}

.leaseholder-table tbody .leaseholder-record-start > td,
.leaseholder-table tbody .leaseholder-record-start > th {
  padding-top: 0.65rem;
  border-top: 1px solid #d8d8d8;
}

.leaseholder-table tbody .leaseholder-record-end > td {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #d8d8d8;
}

.leaseholder-location {
  padding-top: 0.65rem;
  border-bottom: 1px solid #d8d8d8;
  vertical-align: top;
}

.leaseholder-bio-link {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.16em;
}

.leaseholder-highlight > th,
.leaseholder-highlight > td {
  animation: leaseholder-highlight 2.2s ease-out;
}

@keyframes leaseholder-highlight {
  from { background: #fff0a8; }
  to { background: transparent; }
}

.leaseholder-empty {
  padding: 1.5rem;
  border: 1px solid #ddd;
  text-align: center;
}

.leaseholder-source-note {
  margin: 1.5rem 0 0;
  color: #777;
  font-size: 0.7em;
  line-height: 1.45;
}

.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;
}

body.night-mode .leaseholder-filters {
  background: #2a2a2a;
  border-color: #444;
}

body.night-mode .leaseholder-map h2 {
  color: #ddd;
}

body.night-mode .leaseholder-map > p {
  color: #aaa;
}

body.night-mode .leaseholder-map-legend a.district-active,
body.night-mode .leaseholder-map-legend a:focus {
  background: #39434b;
  outline-color: #a9bac8;
}

body.night-mode .leaseholder-map-object {
  border-color: #555;
}

body.night-mode .leaseholder-back-to-top {
  border-color: #aaa;
  background: rgba(38, 38, 38, 0.94);
  color: #eee;
}

body.night-mode .leaseholder-back-to-top:hover,
body.night-mode .leaseholder-back-to-top:focus {
  background: #665d2e;
  color: #fff;
  outline-color: #eee;
}

body.night-mode .leaseholder-field input,
body.night-mode .leaseholder-field select,
body.night-mode .leaseholder-reset {
  background: #222;
  border-color: #666;
  color: #ddd;
}

body.night-mode .leaseholder-filter-note {
  color: #aaa;
}

body.night-mode .lot-browser h2 {
  color: #ddd;
}

body.night-mode .lot-browser .district-lot-section,
body.night-mode .leaseholder-table th,
body.night-mode .leaseholder-table td,
body.night-mode .leaseholder-empty {
  border-color: #444;
}

body.night-mode .district-description,
body.night-mode .leaseholder-source-note {
  color: #aaa;
}

body.night-mode .leaseholder-table thead th {
  background: #30363b;
}

body.night-mode .leaseholder-mobile-location {
  border-color: #555;
  background: #30363b;
}

body.night-mode .leaseholder-table tbody .leaseholder-record-even {
  background: #262626;
}

@media (max-width: 600px) {
  .leaseholder-back-to-top {
    right: 0.7rem;
    bottom: 0.7rem;
  }

  .leaseholder-filters {
    grid-template-columns: 1fr 1fr;
  }

  .leaseholder-search-field,
  .leaseholder-filters .leaseholder-field:nth-child(2) {
    grid-column: 1 / -1;
  }

  .leaseholder-reset {
    grid-column: 1 / -1;
    width: 100%;
  }

  .leaseholder-table {
    width: 100%;
    table-layout: fixed;
    font-size: 0.62em;
    line-height: 1.3;
  }

  .leaseholder-table-wrap {
    width: 100%;
    overflow-x: visible;
  }

  .leaseholder-table th,
  .leaseholder-table td {
    min-width: 0;
    padding: 0.3rem 0.24rem;
    overflow-wrap: anywhere;
  }

  .leaseholder-table thead th:first-child,
  .leaseholder-location {
    display: none;
  }

  .leaseholder-table thead th:nth-child(2) {
    width: 75%;
  }

  .leaseholder-table thead th:nth-child(3) {
    width: 25%;
  }

  .leaseholder-mobile-location-row {
    display: table-row;
  }

  .leaseholder-mobile-location {
    padding: 0.42rem 0.3rem;
    border-top: 1px solid #bfc9d1;
    border-bottom: 1px solid #d8d8d8;
    background: #edf1f4;
    font-weight: 700;
    white-space: nowrap;
  }

  .leaseholder-mobile-location a {
    white-space: nowrap;
  }

  .leaseholder-table thead th:first-child,
  .leaseholder-location,
  .leaseholder-date-line,
  .leaseholder-location span,
  .leaseholder-location a {
    width: auto;
    min-width: 0;
    white-space: normal;
  }

  .leaseholder-date-line {
    min-width: 0;
  }

  .leaseholder-record-start {
    scroll-margin-top: 2.5rem;
  }

  .leaseholder-mobile-location-row {
    scroll-margin-top: 2.5rem;
  }
}
