:root {
  --white: #ffffff;
  --gray: #000000;
  --font: "Gothic A1", sans-serif;
  --mono: "Gothic A1", sans-serif;
}

* {
  box-sizing: border-box;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  filter: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border: 0 !important;
  outline: none;
  font-family: var(--font);
  font-weight: 500;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--white);
  color: var(--gray);
  font-family: var(--font);
  font-weight: 500;
}

button,
input,
dialog {
  border-radius: 0;
  box-shadow: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  background: var(--white);
  border-bottom: 0;
  flex-shrink: 0;
}

.header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: #000;
  pointer-events: none;
}

.header__title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--gray);
  line-height: 1.2;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.header__count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  line-height: 1.2;
  white-space: nowrap;
}

.nav,
.view-toggle {
  display: flex;
  align-items: center;
  border: 0 !important;
  overflow: visible;
}

.nav__link,
.filter-toggle,
.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  color: var(--gray);
  text-decoration: none;
  background: transparent;
  border: 0 !important;
  cursor: pointer;
}

.nav__link:hover,
.nav__link.is-active,
.filter-toggle:hover,
.filter-toggle.is-active,
.toggle-btn:hover,
.toggle-btn.is-active {
  background: transparent;
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.app--main .main--map {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.map-wrap--full {
  position: relative;
  inset: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-wrap--full .map {
  flex: 1;
  min-height: 0;
  border: 0;
  border-top: 0;
}

.map-wrap--full .map-note {
  padding: 8px 16px;
  border-top: 0;
  position: relative;
  z-index: 2;
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 1300;
  background: transparent;
  pointer-events: none;
}

.scroll-progress--app {
  position: fixed;
  z-index: 2000;
}

.scroll-progress--app::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: #000;
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: #000;
  transform-origin: left center;
  transition: width 0.2s ease;
}

.sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  z-index: 1200;
  width: 46vw;
  max-width: none;
  max-height: none;
  background: #fff;
  border: 0;
  color: #000;
  transform: translateX(105%);
  pointer-events: none;
  opacity: 0;
}

.sheet::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #000;
  pointer-events: none;
  z-index: 3;
}

.sheet.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.sheet__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #000;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
}

.sheet__inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
}

.sheet__img {
  width: 100%;
  height: auto;
  max-height: min(62vh, 640px);
  object-fit: contain;
  object-position: center top;
  background: #fff;
  border: 0;
  display: block;
  flex: 0 0 auto;
}

.sheet__body {
  padding: 28px 44px 20px 16px;
  overflow: auto;
  flex: 1 1 auto;
}

.sheet__code {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 16px;
  color: #000;
}

.sheet__fields {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5em 1fr;
  column-gap: 0;
  row-gap: 0;
  font-size: 12px;
}

.sheet__fields dt,
.sheet__fields dd {
  margin: 0;
  padding: 14px 0;
  color: #000;
  word-break: break-word;
  border-bottom: 1px solid #000 !important;
}

.sheet__fields dt {
  padding-right: 12px;
  white-space: nowrap;
  word-break: keep-all;
}

.sheet__fields dt:last-of-type,
.sheet__fields dd:last-of-type {
  border-bottom: 0 !important;
}

@media (max-width: 640px) {
  .sheet {
    width: 46vw;
    min-width: 200px;
  }
  .sheet__img {
    max-height: min(48vh, 420px);
  }
  .sheet__body {
    padding: 22px 40px 16px 14px;
  }
}

.map-nav,
.map-hud,
.map-mode-btn {
  z-index: 1000;
}

.map-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 120px;
  border: 0;
  background: transparent;
  color: var(--gray);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.map-nav--prev { left: 12px; }
.map-nav--next { right: 12px; }

.map-nav:hover {
  background: transparent;
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

.map-mode-btn {
  position: absolute;
  right: 12px;
  bottom: 52px;
  z-index: 1000;
  border: 1px solid var(--gray);
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray);
  font: inherit;
  font-size: 12px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
}

.map-mode-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.map-wrap.is-all-mode .map-nav {
  display: none;
}

.map-wrap--full:not(.is-all-mode) .leaflet-container {
  touch-action: none;
  cursor: grab;
}

.view3d {
  position: absolute;
  inset: 0 0 36px 0;
  z-index: 1;
  background: #fff;
  min-height: 0;
  pointer-events: auto;
}

.view3d canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  pointer-events: auto;
}

.map-wrap.is-tour-mode #map {
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.map-wrap.is-tour-mode .view3d {
  z-index: 5;
  pointer-events: auto;
}

.map-wrap.is-all-mode .view3d {
  display: none !important;
}

.map-wrap.is-tour-mode .leaflet-control-attribution {
  display: none;
}

.map-pin {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.map-pin__photo {
  background: transparent;
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  flex: 0 0 auto;
}

.map-pin__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0 !important;
  pointer-events: none;
}

.map-pin__dot {
  width: 8px;
  height: 8px;
  border-radius: 50% !important;
  background: var(--gray);
  border: 0;
  flex: 0 0 auto;
}

.map-pin--sm {
  gap: 6px;
}

.map-pin--sm .map-pin__dot {
  background: #fff;
  box-shadow: inset 0 0 0 1.5px #000;
}

@media (max-width: 640px) {
  .map-nav {
    width: 36px;
    height: 96px;
    font-size: 24px;
  }
  .map-nav--prev { left: 6px; }
  .map-nav--next { right: 6px; }
  .map-mode-btn {
    right: 8px;
    bottom: 48px;
    padding: 8px 10px;
    font-size: 11px;
  }
  .map-pin {
    gap: 8px;
  }
  .map-pin__dot {
    width: 7px;
    height: 7px;
  }
}

.view-toggle {
  display: flex;
  align-items: center;
  border: 0 !important;
  overflow: visible;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

.filter-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.7);
}

.sidebar {
  width: min(300px, 92vw);
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--gray);
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
}

.sidebar.is-open {
  display: flex;
}

.sidebar__block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray);
}

.sidebar__block--grow {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.sidebar__label {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
}

.search {
  width: 100%;
  border: 1px solid var(--gray);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  background: var(--white);
  color: var(--gray);
}

.search::placeholder {
  color: var(--gray);
  opacity: 0.7;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip,
.filter-item {
  appearance: none;
  border: 1px solid var(--gray);
  background: transparent;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  color: var(--gray);
  cursor: pointer;
  text-decoration: none;
}

.chip:hover,
.filter-item:hover,
.chip.is-active,
.filter-item.is-active {
  background: transparent;
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
}

.filter-item__count {
  color: var(--gray);
  font-family: var(--mono);
  font-size: 11px;
}

.main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 12px;
  position: relative;
  background: var(--white);
}

.loading,
.error,
.empty {
  margin: 48px auto;
  text-align: center;
  color: var(--gray);
  max-width: 420px;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.card {
  border: 1px solid var(--gray);
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--gray);
}

.card:hover {
  border-color: var(--gray);
}

.card__img-wrap {
  aspect-ratio: 1;
  background: var(--white);
  border-bottom: 1px solid var(--gray);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
}

.card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  display: block;
}

.card__body {
  padding: 6px 0 0;
  margin: 0;
  text-align: left;
}

.card__code {
  font-family: var(--mono);
  font-size: 12px;
  margin: 0;
  padding: 0;
  color: var(--gray);
  text-align: left;
}

.card__meta {
  margin: 2px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--gray);
  line-height: 1.35;
  text-align: left;
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin: 4px 0 0;
  padding: 0;
}

.badge,
.badge--포함,
.badge--책,
.badge--제외 {
  font-size: 10px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--gray);
}

.map-wrap {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.map-wrap--full {
  position: relative;
  inset: auto;
  flex: 1;
  min-height: 0;
}

.map {
  flex: 1;
  min-height: 420px;
  border: 1px solid var(--gray);
  background: var(--white);
  position: relative;
  z-index: 0;
}

.map.leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
  background: var(--white);
}

.map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85);
  color: #666;
  font-size: 10px;
  border: 0;
}

.map .leaflet-control-attribution a {
  color: #666;
}

.map-region-label {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--gray);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding: 0 !important;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.map-region-label--sm {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
}

.map-region-label::before {
  display: none !important;
}

.map .leaflet-tooltip {
  background: var(--white);
  border: 1px solid var(--gray);
  color: var(--gray);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 6px;
}

.map .leaflet-tooltip::before {
  border-top-color: var(--gray);
}

.map-wrap--full .map {
  min-height: 0;
  border: 0;
}

.map-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--gray);
  background: var(--white);
}

.map-hud__btn {
  border: 0;
  border-bottom: 1px solid var(--gray);
  background: var(--white);
  color: var(--gray);
  width: 36px;
  height: 32px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.map-hud__btn:last-child {
  border-bottom: 0;
}

.map-hud__btn:hover {
  background: transparent;
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.map-note {
  margin: 0;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--gray);
  border-top: 0;
  background: var(--white);
  position: relative;
}

.map-note::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: #000;
  pointer-events: none;
}

.detail {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  padding: 0;
  width: 46vw;
  max-width: none;
  height: 100%;
  max-height: none;
  border: 0;
  background: var(--white);
  color: #000;
  transform: translateX(105%);
}

.detail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #000;
  pointer-events: none;
  z-index: 3;
}

.detail::backdrop {
  background: transparent;
  opacity: 1;
}

.detail__inner {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  position: relative;
}

.detail__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  border: 0;
  background: transparent;
  width: 32px;
  height: 32px;
  font-size: 18px;
  color: #000;
  cursor: pointer;
  padding: 0;
}

.detail__img {
  width: 100%;
  height: auto;
  max-height: min(62vh, 640px);
  min-height: 0;
  object-fit: contain;
  object-position: center top;
  background: var(--white);
  border: 0;
  display: block;
  flex: 0 0 auto;
}

.detail__body {
  padding: 28px 44px 20px 16px;
  overflow: auto;
  flex: 1 1 auto;
}

.detail__code {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 16px;
  color: #000;
}

.detail__fields {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5em 1fr;
  column-gap: 0;
  row-gap: 0;
  font-size: 12px;
}

.detail__fields dt,
.detail__fields dd {
  margin: 0;
  padding: 14px 0;
  color: #000;
  word-break: break-word;
  border-bottom: 1px solid #000 !important;
}

.detail__fields dt {
  padding-right: 12px;
  white-space: nowrap;
  word-break: keep-all;
}

.detail__fields dt:last-of-type,
.detail__fields dd:last-of-type {
  border-bottom: 0 !important;
}

@media (max-width: 860px) {
  .header {
    padding: 5px 10px;
    gap: 8px;
  }

  .header__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .header__right {
    gap: 6px;
    flex-shrink: 0;
  }

  .header__count {
    display: none;
  }

  .filter-toggle,
  .toggle-btn,
  .nav__link {
    padding: 4px 8px;
  }

  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    max-height: min(70vh, 520px);
    bottom: auto;
    border-right: 0;
    border-bottom: 1px solid var(--gray);
  }

  .detail {
    width: 46vw;
    min-width: 200px;
  }

  .detail__img {
    max-height: min(48vh, 420px);
  }

  .detail__body {
    padding: 22px 40px 16px 14px;
  }
}
