* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: Arial, "Malgun Gothic", sans-serif;
  color: #172033;
  background: #f4f6f8;
}

button,
input,
select {
  font: inherit;
}

.orientation-lock-message {
  display: none;
}

.toast-message {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  background: rgba(23, 32, 51, 0.96);
  box-shadow: 0 10px 28px rgba(17, 27, 45, 0.28);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.initial-loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(244, 246, 248, 0.76);
  backdrop-filter: blur(3px);
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.initial-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.initial-loading-box {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(320px, 100%);
  border: 1px solid rgba(216, 222, 231, 0.9);
  border-radius: 8px;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 40px rgba(17, 27, 45, 0.22);
  text-align: center;
}

.initial-loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #d8dee7;
  border-top-color: #1769e0;
  border-radius: 50%;
  animation: loading-spin 0.85s linear infinite;
}

.initial-loading strong {
  color: #172033;
  font-size: 17px;
  line-height: 1.35;
}

.initial-loading p {
  margin: 0;
  color: #637083;
  font-size: 13px;
  line-height: 1.45;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  min-height: 640px;
}

.app-shell.has-detail {
  grid-template-columns: 304px 352px minmax(0, 1fr);
}

.map-panel {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
}

.app-shell.has-detail .map-panel {
  grid-column: 3;
}

.map {
  width: 100%;
  height: 100%;
  background: #d9e0e7;
}

.search-here-btn {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  color: #ffffff;
  background: #172033;
  box-shadow: 0 6px 18px rgba(17, 27, 45, 0.28);
  cursor: pointer;
  font-weight: 700;
}

.search-here-btn:hover {
  background: #1769e0;
}

.side-panel {
  grid-column: 1;
  grid-row: 1;
  overflow: auto;
  border-right: 1px solid #d8dee7;
  background: #ffffff;
}

.global-actions {
  position: fixed;
  top: 16px;
  right: 72px;
  z-index: 18;
  display: flex;
  gap: 6px;
}

.detail-drawer {
  grid-column: 2;
  grid-row: 1;
  overflow: auto;
  border-right: 1px solid #d8dee7;
  background: #ffffff;
}

.detail-drawer[hidden] {
  display: none;
}

.detail-drawer-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid #e7ebf0;
  background: #ffffff;
}

.detail-drawer-header h2 {
  margin: 4px 0 0;
  font-size: 19px;
  line-height: 1.35;
}

.drawer-kicker {
  color: #1769e0;
  font-size: 12px;
  font-weight: 700;
}

#closeDetailBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d8dee7;
  border-radius: 6px;
  color: #445064;
  background: #ffffff;
  cursor: pointer;
}

#closeDetailBtn:hover {
  color: #172033;
  background: #f4f6f8;
}

.detail-content {
  padding: 18px 20px 24px;
}

.detail-summary {
  padding-bottom: 16px;
  border-bottom: 1px solid #e7ebf0;
}

.detail-summary p {
  margin: 0 0 12px;
  color: #536176;
  font-size: 14px;
  line-height: 1.5;
}

.naver-map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border-radius: 7px;
  color: #ffffff;
  background: #03c75a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.naver-map-link:hover {
  background: #02b351;
}

.csv-info-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 13px;
}

.csv-info-table tr {
  border-bottom: 1px solid #edf1f5;
}

.csv-info-table th,
.csv-info-table td {
  padding: 10px 0;
  vertical-align: top;
  line-height: 1.45;
}

.csv-info-table th {
  width: 128px;
  padding-right: 14px;
  color: #637083;
  font-weight: 700;
  text-align: left;
}

.csv-info-table td {
  color: #172033;
  word-break: break-word;
}

.panel-header {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid #e7ebf0;
}

.mobile-panel-toggle {
  display: none;
}

.panel-header-content {
  display: grid;
  gap: 14px;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #172033;
  text-decoration: none;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #ffffff;
  background: #172033;
  font-size: 16px;
}

.visitor-stats {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 8px;
  color: #637083;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.visitor-stats strong {
  color: #172033;
  font-weight: 800;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  border: 1px solid #d8dee7;
  border-radius: 6px;
  padding: 6px 8px;
  color: #445064;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.header-action-btn:hover {
  color: #1769e0;
  border-color: #1769e0;
  background: #f4f8ff;
}

.header-action-btn .material-symbols-outlined {
  font-size: 17px;
}

.panel-header h1 {
  margin: 0 0 6px;
  font-size: 21px;
  line-height: 1.25;
}

.panel-header p {
  margin: 0;
  color: #637083;
  font-size: 13px;
  line-height: 1.45;
}

#locateBtn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  color: #ffffff;
  background: #1769e0;
  cursor: pointer;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e7ebf0;
}

.controls label {
  display: grid;
  gap: 6px;
  color: #445064;
  font-size: 12px;
  font-weight: 700;
}

.controls input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd3df;
  border-radius: 6px;
  padding: 8px 10px;
  background: #ffffff;
  color: #172033;
}

.controls button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  background: #172033;
  cursor: pointer;
  font-weight: 700;
}

.controls button:hover {
  background: #1769e0;
}

.filter-section {
  padding: 14px 20px 16px;
  border-bottom: 1px solid #e7ebf0;
}

.filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #445064;
  font-size: 13px;
}

.filter-title button {
  border: 0;
  padding: 4px 0;
  color: #1769e0;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.filter-title > button {
  display: none;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-actions-extra {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.filter-actions button {
  border: 1px solid #d8dee7;
  border-radius: 999px;
  padding: 6px 10px;
  color: #445064;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.filter-actions button:hover {
  color: #1769e0;
  border-color: #1769e0;
  background: #f4f8ff;
}

.filter-actions button[hidden] {
  display: none;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.filter-section.is-expanded .chip-scroll {
  flex-wrap: wrap;
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}

.filter-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  border: 1px solid #d8dee7;
  border-radius: 999px;
  padding: 7px 10px;
  color: #445064;
  background: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip:hover,
.filter-chip.is-active {
  border-color: #1769e0;
  color: #1769e0;
  background: #f4f8ff;
}

.filter-chip em {
  color: #7a8798;
  font-size: 11px;
  font-style: normal;
}

.chip-icon {
  font-size: 16px;
  line-height: 1;
}

.detail-panel {
  margin: 16px 20px;
  padding: 16px;
  border: 1px solid #dfe5ed;
  border-radius: 8px;
  background: #f9fbfd;
}

.detail-panel h2 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
}

.detail-panel p {
  margin: 4px 0;
  color: #536176;
  font-size: 13px;
  line-height: 1.5;
}

.detail-panel .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 9px 4px 7px;
  background: #eaf1ff;
  color: #1f5fbf;
  font-size: 12px;
  line-height: 1.2;
}

.badge-accent {
  background: #e8f8f3;
  color: #087a5a;
}

.badge-current {
  background: #fff4e5;
  color: #9a5a00;
}

.badge-icon {
  font-size: 16px;
  line-height: 1;
}

.list-title {
  display: flex;
  justify-content: space-between;
  padding: 4px 20px 10px;
  color: #445064;
  font-size: 13px;
}

.place-list {
  list-style: none;
  margin: 0;
  padding: 0 20px 20px;
}

.place-item {
  width: 100%;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 12px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.place-item:hover,
.place-item.is-active {
  border-color: #1769e0;
  background: #f4f8ff;
}

.place-name {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
  line-height: 1.35;
}

.place-address {
  display: block;
  color: #637083;
  font-size: 13px;
  line-height: 1.45;
}

.place-distance {
  display: block;
  margin-top: 8px;
  color: #1769e0;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  .app-shell.has-detail {
    display: block;
  }

  .map-panel,
  .app-shell.has-detail .map-panel {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
  }

  .search-here-btn {
    position: fixed;
    top: auto;
    bottom: 88px;
    left: 50%;
    z-index: 24;
  }

  .side-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    height: 78px;
    overflow: hidden;
    border-right: 0;
    border-top: 1px solid #d8dee7;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(17, 27, 45, 0.2);
    transition: height 0.22s ease;
  }

  .global-actions {
    top: 242px;
    right: 9px;
    z-index: 12;
    flex-direction: column;
    gap: 8px;
  }

  .toast-message {
    right: 16px;
    bottom: 92px;
    left: 16px;
    max-width: none;
    text-align: center;
  }

  .app-shell.mobile-panel-open .side-panel {
    height: 52vh;
    overflow: auto;
  }

  .app-shell.mobile-panel-open .search-here-btn {
    bottom: calc(52vh + 10px);
  }

  .panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 104px;
    padding: 22px 20px 14px;
    background: #ffffff;
    cursor: pointer;
    touch-action: manipulation;
  }

  .brand-row {
    align-items: center;
  }

  .brand-logo {
    font-size: 17px;
  }

  .header-action-btn {
    justify-content: center;
    width: 38px;
    min-height: 38px;
    padding: 6px;
  }

  .header-action-btn span:not(.material-symbols-outlined) {
    display: none;
  }

  .header-action-btn .material-symbols-outlined {
    font-size: 20px;
  }

  .panel-title-row {
    align-items: flex-start;
  }

  .mobile-panel-toggle {
    position: absolute;
    top: 0;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    width: 96px;
    height: 28px;
    transform: translateX(-50%);
    border: 0;
    border-radius: 999px;
    color: #7a8798;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .mobile-panel-toggle::before {
    content: "";
    position: absolute;
    top: 7px;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #c7d0dc;
  }

  .mobile-panel-toggle .material-symbols-outlined {
    position: relative;
    top: 7px;
    font-size: 20px;
  }

  .app-shell.mobile-panel-open .mobile-panel-toggle .material-symbols-outlined {
    transform: rotate(180deg);
  }

  .detail-drawer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    height: 52vh;
    overflow: auto;
    border-right: 0;
    border-top: 1px solid #d8dee7;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 32px rgba(17, 27, 45, 0.24);
  }

  .detail-drawer-header {
    padding-top: 18px;
  }

  .controls {
    grid-template-columns: minmax(0, 1fr) 64px;
    padding: 14px 16px;
  }

  .filter-section,
  .place-list {
    padding-right: 16px;
    padding-left: 16px;
  }

  .filter-actions-extra {
    position: sticky;
    top: 104px;
    z-index: 1;
    margin-right: -16px;
    margin-left: -16px;
    padding: 0 16px 10px;
    background: #ffffff;
  }

  .filter-section.is-expanded .chip-scroll {
    max-height: 180px;
  }

  .list-title {
    padding-right: 16px;
    padding-left: 16px;
  }

}

@media (max-width: 900px) and (orientation: landscape) {
  .app-shell,
  .global-actions {
    display: none;
  }

  .orientation-lock-message {
    display: flex;
    min-height: 100vh;
    padding: 28px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #172033;
    background: #ffffff;
    text-align: center;
  }

  .orientation-lock-message .material-symbols-outlined {
    color: #1769e0;
    font-size: 42px;
  }

  .orientation-lock-message strong {
    font-size: 20px;
  }

  .orientation-lock-message p {
    max-width: 320px;
    margin: 0;
    color: #637083;
    font-size: 14px;
    line-height: 1.5;
  }
}


.ad-box{
  width:100%;
  height:auto;
  overflow:hidden;
  min-height: 200px;
  box-sizing: border-box;
  padding:10px;
}

#ad-close-btn{
  background-color: #222;
  box-sizing: border-box;
  width:100%;
  text-align: center;
  padding:10px 0;
  color: #fff;
  cursor: pointer;
}