
* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f1e7;
  --text: #22311f;
  --muted: #5c6a55;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

.page {
  min-height: 100vh;
  padding: 16px 10px 28px;
}

.intro {
  max-width: 760px;
  margin: 0 auto 12px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: #7f9852;
}

.intro h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.intro p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.map-card {
  width: min(100%, 980px);
  margin: 0 auto;
}

.map-wrap {
  position: relative;
  width: 100%;
  background: #d6e6c0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(36, 49, 31, 0.18);
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
}

/*
  Invisible tap areas.
  The red labels are already baked into the map image, so these buttons do NOT draw new labels.
*/
.map-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}

/* Brief visual feedback only when pressing/tapping */
.map-hotspot:active {
  background: rgba(255, 255, 255, 0.18);
}

/* Keyboard accessibility for desktop testing */
.map-hotspot:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.95);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.legend {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  padding: 0 2px;
  text-align: center;
}

.legend-count {
  font-weight: 700;
  font-size: 14px;
}

.legend-note {
  font-size: 13px;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(0, 0, 0, 0.96);
  color: #fff;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.lightbox.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  z-index: 120;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 34px;
  line-height: 40px;
  cursor: pointer;
}

.photo-content {
  width: 100%;
  max-width: 960px;
  text-align: center;
}

.photo-content h2 {
  margin: 0 56px 14px;
  font-size: 25px;
  font-weight: 700;
}

.photo-content img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 16px;
}

.photo-content p {
  margin: 14px auto 0;
  max-width: 660px;
  font-size: 16px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

@media (max-width: 600px) {
  .page {
    padding: 12px 8px 20px;
  }

  .intro h1 {
    font-size: 21px;
  }

  .intro p {
    font-size: 14px;
  }

  .map-wrap {
    border-radius: 18px;
  }

  .photo-content h2 {
    font-size: 22px;
  }

  .photo-content img {
    max-height: 72vh;
    border-radius: 12px;
  }

  .photo-content p {
    font-size: 15px;
  }
}

/* Hotspot editor mode */
body.editor-mode .map-hotspot {
  background: rgba(255, 255, 255, 0.25);
  border: 2px dashed rgba(255, 255, 255, 0.95);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  z-index: 5;
}

body.editor-mode .map-hotspot span {
  pointer-events: none;
}

body.editor-mode .map-hotspot.selected {
  background: rgba(182, 201, 120, 0.42);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(182, 201, 120, 0.75), 0 8px 22px rgba(0,0,0,.25);
  z-index: 10;
}

.editor-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  width: min(390px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
  display: none;
  background: rgba(35, 49, 31, 0.96);
  color: white;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  font-size: 13px;
}

.editor-panel.open {
  display: block;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.editor-header strong {
  font-size: 16px;
}

.editor-header button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.editor-help {
  margin: 0 0 10px;
  color: rgba(255,255,255,.78);
  line-height: 1.35;
}

.editor-current {
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.editor-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.editor-controls button,
.editor-list button,
.copy-btn {
  border: 0;
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(255,255,255,.12);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.editor-controls button:hover,
.editor-list button:hover,
.copy-btn:hover {
  background: rgba(255,255,255,.22);
}

.editor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.editor-list button {
  text-align: left;
  font-size: 12px;
  line-height: 1.15;
}

.editor-list button.selected {
  background: #b6c978;
  color: #22311f;
}

.copy-btn {
  width: 100%;
  background: #b6c978;
  color: #22311f;
  margin-bottom: 8px;
}

#editorOutput {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 0;
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.95);
  color: #1f2a1d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .editor-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 48vh;
  }
}
.photo-content {
  position: relative;
}

.photo-counter {
  margin: -8px 0 12px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  opacity: 0.9;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;

  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: none;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 48px;
  line-height: 1;
  cursor: pointer;

  transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-nav:hover {
  background: rgba(0, 0, 0, 0.78);
  transform: translateY(-50%) scale(1.06);
}

.gallery-nav.prev {
  left: 18px;
}

.gallery-nav.next {
  right: 18px;
}

@media (max-width: 640px) {
  .gallery-nav {
    width: 42px;
    height: 42px;
    font-size: 34px;
  }

  .gallery-nav.prev {
    left: 8px;
  }

  .gallery-nav.next {
    right: 8px;
  }

  .photo-counter {
    font-size: 13px;
    margin-bottom: 10px;
  }
}
.title-th {
  display: block;
  font-size: 1.18em;
  font-weight: 800;
}

.title-en {
  display: block;
  margin-top: 4px;
  font-size: 0.72em;
  font-weight: 600;
  opacity: 0.78;
}

.desc-th {
  display: block;
  font-size: 1.05em;
  font-weight: 600;
}

.desc-en {
  display: block;
  margin-top: 6px;
  font-size: 0.86em;
  opacity: 0.75;
}
.map-hotspot.hint-pulse {
  background: rgba(182, 201, 120, 0.22);
  box-shadow: 0 0 0 0 rgba(182, 201, 120, 0.6);
  animation: softPulse 4.5s ease-in-out infinite;
}

.map-hotspot.hint-pulse {
  background: rgba(255, 198, 92, 0.28);
  box-shadow: 0 0 0 0 rgba(255, 198, 92, 0.65);
  animation: softPulse 4.5s ease-in-out infinite;
}

.map-hotspot.hint-pulse::after {
  content: "✨ แตะเพื่อดูรูป";
  position: absolute;
  left: 50%;
  top: -38px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 235, 0.96);
  color: #24372f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(36, 49, 31, 0.22);
}

@keyframes softPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(255, 198, 92, 0.6);
  }

  45% {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 0 0 16px rgba(255, 198, 92, 0);
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(255, 198, 92, 0);
  }
}