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

body {
  margin: 0;
  padding: 0;
  background: #f4f6f9;
  color: #1f2933;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.4;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px;
}

h1 {
  margin: 0;
  font-size: 1.2rem;
  text-align: left;
}

/* 제목은 왼쪽 위, 관광지 등록 버튼은 오른쪽 위 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 10px;
}

.panel-title { margin: 0 0 10px; font-size: 0.95rem; }

.rank-head { margin: 14px 0 8px; }

h2 {
  margin: 0;
  font-size: 1rem;
}

.panel {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(20, 33, 48, 0.08);
}

.status { margin: 4px 0 12px; font-size: 0.85rem; color: #5c6773; }
.status.ok { color: #1d7a46; }
.status.error { color: #c92a2a; }

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  background: #2b6cb0;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { background: #b6c0ca; cursor: default; }

button.secondary { background: #0f766e; }

button.ghost {
  background: #eef2f7;
  color: #33414f;
  font-weight: 600;
}

button.small { padding: 7px 12px; font-size: 0.82rem; }

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

/* 인기도 목록: 한 줄에 3개, 스크롤 */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

.rank-card {
  border: 1px solid #e1e6ec;
  border-radius: 10px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  background: #fbfcfe;
}

.rank-no { font-size: 0.68rem; color: #8a94a0; }
.r-name { font-size: 0.82rem; font-weight: 700; word-break: keep-all; }
.r-road, .r-city { font-size: 0.7rem; color: #5c6773; word-break: keep-all; }
.r-like { font-size: 0.75rem; font-weight: 700; color: #c2410c; margin-top: 2px; }

/* 인기도 목록에서 이름을 눌러 고른 사람이 하트를 누른 곳: 노랗게 표시 */
.rank-card.from-nick {
  border-color: #e8c65a;
  background: #fffaea;
}

.rank-card.from-nick .r-like { color: #a16207; }

.rank-nick-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid #f0d98a;
  border-radius: 9px;
  background: #fff8dd;
  color: #7a5a00;
  font-size: 0.72rem;
  font-weight: 700;
}

.r-pressers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.r-presser {
  padding: 2px 6px;
  border: 1px solid #dbe3ec;
  border-radius: 999px;
  background: #eef2f7;
  color: #33414f;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-all;
  cursor: pointer;
}

.r-presser.on {
  border-color: #e0b73a;
  background: #ffe9a8;
  color: #7a5a00;
}

.r-pressers-empty { font-size: 0.64rem; color: #96a2af; }

/* 대한민국 지도 */
.map-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: #5c6773;
}

.map-wrap {
  position: relative;
  overflow: hidden;
  background: #e8f2fb;
  border-radius: 12px;
  padding: 4px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.map-wrap *,
.map-wrap svg,
.map-wrap text {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

#korea-map {
  display: block;
  width: 100%;
  height: auto;
  max-height: 58vh;
  touch-action: none;
  cursor: grab;
}

#korea-map.dragging { cursor: grabbing; }

.map-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.map-tool {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #cdd8e3;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2933;
  font-size: 0.9rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(20, 33, 48, 0.12);
}

.map-tool:active { background: #e3edf8; }

.zoom-level {
  padding: 2px 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #33414f;
  font-size: 0.66rem;
  font-weight: 700;
}

.map-land {
  fill: #ffffff;
  stroke: #b3c3d3;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.marker { cursor: pointer; }

.marker-dot {
  fill: #ffffff;
  stroke: #2b6cb0;
  stroke-width: 1.6;
}

.marker:hover .marker-dot,
.marker:focus-visible .marker-dot {
  fill: #fde8d7;
  stroke-width: 2.4;
}

.marker.on .marker-dot {
  fill: #ffd9b3;
  stroke: #c2410c;
  stroke-width: 2.6;
}

.marker-emoji {
  font-size: 11px;
  text-anchor: middle;
  pointer-events: none;
}

.marker-count {
  font-size: 8px;
  font-weight: 700;
  fill: #c2410c;
  text-anchor: middle;
  pointer-events: none;
}

/* 밀려난 표시와 실제 좌표 자리를 잇는 점선과 '원래 있던 위치' 안내 */
.marker-base { pointer-events: none; }

.marker-line {
  stroke: #9db2c6;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.marker-base-dot {
  fill: #ffffff;
  stroke: #9db2c6;
  stroke-width: 1.2;
}

.marker-base-label {
  font-size: 8px;
  font-weight: 700;
  fill: #6b7c8f;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 2.5;
  opacity: 0;
}

.marker-base.show .marker-base-label { opacity: 1; }

.map-detail {
  margin-top: 10px;
  border: 1px solid #e1e6ec;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.8rem;
  color: #5c6773;
}

.map-detail button {
  display: block;
  width: 100%;
  margin-top: 8px;
}

/* 오늘 이미 하트를 준 장소: 회색으로 바뀌고 눌리지 않습니다. */
.map-detail button:disabled {
  background: #c3ccd5;
  color: #ffffff;
  cursor: default;
  pointer-events: none;
}

.d-name { font-size: 0.95rem; font-weight: 800; color: #1f2933; }
.d-where { margin-top: 2px; font-size: 0.74rem; word-break: keep-all; }
.d-like { margin-top: 4px; font-size: 0.82rem; font-weight: 700; color: #c2410c; }
.d-state { margin: 6px 0 0; font-size: 0.74rem; }

/* 하트를 누른 사람 */
.d-pressers {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dfe6ee;
}

.d-pressers-title { font-size: 0.76rem; font-weight: 700; color: #33414f; }
.d-presser-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.d-presser {
  padding: 3px 8px;
  border-radius: 999px;
  background: #fdece2;
  color: #9a3412;
  font-size: 0.72rem;
  font-weight: 700;
  word-break: break-all;
}

.d-pressers-empty { margin: 5px 0 0; font-size: 0.74rem; color: #7a8694; }
.d-pressers-empty.error { color: #c92a2a; }

/* 관광지 등록 */
.register-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.register-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #33414f;
}

.register-form input,
.register-form select {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  padding: 9px 10px;
  border: 1px solid #d3dbe4;
  border-radius: 9px;
  background: #fff;
  color: #1f2933;
}

.register-form button { align-self: flex-start; }

@media (max-width: 380px) {
  .app { padding: 8px; }
  .rank-grid { gap: 5px; }
  .rank-card { padding: 5px; }
  .r-name { font-size: 0.76rem; }
  .r-road, .r-city { font-size: 0.66rem; }
  .marker-emoji { font-size: 10px; }
}
