/* ============================================
   PHAMO AR — Kids-Friendly Stylesheet 🎨
   นักสืบท้องถิ่นดิจิทัล: ผามออีแดง
   ============================================ */

:root {
  /* สีสดใสเหมาะกับเด็ก */
  --c-primary: #4dabf7;       /* ฟ้าสดใส */
  --c-primary-dark: #1c7ed6;
  --c-yellow: #ffd43b;        /* เหลืองสว่าง */
  --c-orange: #ff922b;        /* ส้ม */
  --c-pink: #ff8cc6;          /* ชมพูหวาน */
  --c-green: #69db7c;         /* เขียวมิ้นต์ */
  --c-purple: #b197fc;        /* ม่วงน่ารัก */
  --c-coral: #ff6b6b;         /* แดงคอรัล */

  --c-bg: #fff9e6;            /* พื้นครีมสว่าง */
  --c-bg-cloud: #e7f5ff;      /* ฟ้าอ่อนเมฆ */
  --c-bg-soft: #fff3bf;
  --c-text: #1a3a52;
  --c-text-soft: #5a7d96;
  --c-white: #ffffff;
  --c-border: #fff3bf;

  --shadow-cute: 0 6px 0 rgba(28, 126, 214, 0.25);
  --shadow-pop: 0 8px 20px rgba(255, 146, 43, 0.3);
  --shadow-soft: 0 4px 14px rgba(77, 171, 247, 0.18);
  --shadow-deep: 0 10px 30px rgba(28, 126, 214, 0.25);

  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;

  --font-th: "Mali", "Itim", "Noto Sans Thai", "Sarabun", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-th);
  color: var(--c-text);
  background:
    radial-gradient(circle at 10% 10%, #ffe8a3 0, transparent 35%),
    radial-gradient(circle at 90% 20%, #ffc9e6 0, transparent 30%),
    radial-gradient(circle at 50% 100%, #c2f0d1 0, transparent 40%),
    var(--c-bg);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--c-primary-dark);
  text-decoration: none;
}

/* ============================================
   Floating shapes (decoration)
   ============================================ */
.shape {
  position: absolute;
  pointer-events: none;
  opacity: 0.7;
  z-index: 1;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(8deg); }
}

@keyframes bounce-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@keyframes pop-in {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   Header / Navigation
   ============================================ */
.site-header {
  background: var(--c-white);
  border-radius: 0 0 28px 28px;
  box-shadow: 0 4px 0 rgba(28, 126, 214, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 8px;
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--c-primary-dark);
  font-size: 20px;
}

.nav-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--c-yellow), var(--c-orange));
  display: grid;
  place-items: center;
  color: var(--c-white);
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 4px 0 rgba(255, 146, 43, 0.4);
  transform: rotate(-6deg);
  transition: transform .2s;
}
.nav-brand:hover .nav-brand-icon { transform: rotate(6deg) scale(1.05); }

.nav-links {
  display: flex;
  gap: 10px;
  list-style: none;
  font-size: 15px;
}

.nav-links a {
  color: var(--c-text);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--c-bg-cloud);
  transition: all .2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--c-yellow);
  color: var(--c-text);
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .nav-links { display: none; }
}

/* ============================================
   Hero
   ============================================ */
.hero {
  background:
    linear-gradient(135deg, #74c0fc 0%, #b197fc 50%, #ff8cc6 100%);
  color: var(--c-white);
  padding: 60px 16px 90px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin: 16px 8px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep);
}

/* เมฆลอย */
.hero::before {
  content: "☁️";
  position: absolute;
  font-size: 60px;
  top: 20px; left: 8%;
  animation: float 6s ease-in-out infinite;
  opacity: 0.85;
}

.hero::after {
  content: "🌈";
  position: absolute;
  font-size: 70px;
  top: 40px; right: 10%;
  animation: float 7s ease-in-out infinite;
  animation-delay: -2s;
}

.hero-emojis {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-emojis span {
  position: absolute;
  font-size: 36px;
  animation: float 5s ease-in-out infinite;
}
.hero-emojis span:nth-child(1) { bottom: 30%; left: 5%; animation-delay: -1s; }
.hero-emojis span:nth-child(2) { top: 30%; right: 5%; animation-delay: -3s; }
.hero-emojis span:nth-child(3) { bottom: 15%; right: 20%; animation-delay: -4s; }
.hero-emojis span:nth-child(4) { top: 60%; left: 15%; animation-delay: -2s; }

.hero-content { position: relative; z-index: 2; }

.hero-badge {
  display: inline-block;
  background: var(--c-white);
  color: var(--c-orange);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 22px;
  box-shadow: 0 4px 0 rgba(255, 146, 43, 0.4);
}

.hero h1 {
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.25;
  margin-bottom: 16px;
  font-weight: 700;
  text-shadow: 0 3px 0 rgba(28, 126, 214, 0.25);
}

.hero h1 .highlight {
  color: var(--c-yellow);
  display: inline-block;
  animation: wiggle 3s ease-in-out infinite;
}

.hero p {
  max-width: 620px;
  margin: 0 auto 30px;
  font-size: clamp(15px, 2.2vw, 18px);
  text-shadow: 0 2px 0 rgba(28, 126, 214, 0.15);
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* คลื่นล่าง hero */
.hero-wave {
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 50px;
  background: var(--c-bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

/* ============================================
   Buttons (chunky, kid-friendly)
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  font-family: inherit;
  position: relative;
  text-decoration: none;
}

.btn:active { transform: translateY(2px); }

.btn-primary {
  background: var(--c-yellow);
  color: var(--c-text);
  box-shadow: 0 5px 0 var(--c-orange);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--c-orange);
}

.btn-secondary {
  background: var(--c-white);
  color: var(--c-primary-dark);
  box-shadow: 0 5px 0 var(--c-primary);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--c-primary);
}

.btn-outline {
  background: var(--c-white);
  color: var(--c-primary-dark);
  box-shadow: 0 4px 0 var(--c-bg-cloud);
  border: 2px solid var(--c-bg-cloud);
}
.btn-outline:hover {
  background: var(--c-bg-cloud);
  transform: translateY(-2px);
}

.btn-pink {
  background: var(--c-pink);
  color: var(--c-white);
  box-shadow: 0 5px 0 #d96cad;
}

.btn-green {
  background: var(--c-green);
  color: var(--c-text);
  box-shadow: 0 5px 0 #40a35a;
}

/* ============================================
   Sections
   ============================================ */
.section {
  padding: 60px 16px;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.section-title {
  text-align: center;
  font-size: clamp(24px, 4vw, 34px);
  color: var(--c-primary-dark);
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
  width: 100%;
}

.section-title::after {
  content: "";
  display: block;
  width: 80px;
  height: 6px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, var(--c-yellow), var(--c-orange));
  border-radius: 3px;
}

.section-subtitle {
  text-align: center;
  color: var(--c-text-soft);
  margin-bottom: 36px;
  font-size: 15px;
}

/* ============================================
   AR Gallery Cards
   ============================================ */
.ar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 26px;
}

.ar-card {
  background: var(--c-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(28, 126, 214, 0.15);
  transition: transform .25s cubic-bezier(.5,1.7,.5,1), box-shadow .25s;
  display: flex;
  flex-direction: column;
  border: 3px solid transparent;
  animation: pop-in .5s ease both;
}

.ar-card:nth-child(1) { animation-delay: 0s; border-color: var(--c-yellow); }
.ar-card:nth-child(2) { animation-delay: .1s; border-color: var(--c-pink); }
.ar-card:nth-child(3) { animation-delay: .2s; border-color: var(--c-green); }
.ar-card:nth-child(4) { animation-delay: .3s; border-color: var(--c-purple); }
.ar-card:nth-child(5) { animation-delay: .4s; border-color: var(--c-orange); }

.ar-card:hover {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: 0 12px 0 rgba(28, 126, 214, 0.2);
}

.ar-card-thumb {
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--c-white);
  font-size: 80px;
}

.ar-card:nth-child(1) .ar-card-thumb { background: linear-gradient(135deg, #4dabf7, #74c0fc); }
.ar-card:nth-child(2) .ar-card-thumb { background: linear-gradient(135deg, #ff8cc6, #ffa8d8); }
.ar-card:nth-child(3) .ar-card-thumb { background: linear-gradient(135deg, #69db7c, #8ce99a); }
.ar-card:nth-child(4) .ar-card-thumb { background: linear-gradient(135deg, #b197fc, #d0bfff); }
.ar-card:nth-child(5) .ar-card-thumb { background: linear-gradient(135deg, #ff922b, #ffc078); }

.ar-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ar-card-thumb .big-emoji {
  animation: bounce-soft 2.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.ar-card-number {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--c-white);
  color: var(--c-primary-dark);
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 3px 0 rgba(0,0,0,0.1);
}

.ar-card-stars {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 16px;
  z-index: 2;
}

.ar-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  background: var(--c-white);
}

.ar-card-tag {
  display: inline-block;
  background: var(--c-bg-cloud);
  color: var(--c-primary-dark);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  align-self: flex-start;
}

.ar-card h3 {
  font-size: 19px;
  color: var(--c-text);
  line-height: 1.3;
  font-weight: 700;
}

.ar-card-desc {
  color: var(--c-text-soft);
  font-size: 14px;
  flex: 1;
}

.ar-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.ar-card-actions .btn {
  padding: 11px 16px;
  font-size: 14px;
  flex: 1;
  justify-content: center;
}

/* ============================================
   How-to-Scan
   ============================================ */
.howto {
  background: var(--c-white);
  border-radius: var(--radius);
  margin: 0 8px;
  max-width: none;
  position: relative;
  overflow: hidden;
}

.howto::before {
  content: "✨";
  position: absolute;
  top: 30px; left: 5%;
  font-size: 40px;
  animation: float 4s ease-in-out infinite;
}

.howto::after {
  content: "⭐";
  position: absolute;
  top: 40px; right: 8%;
  font-size: 36px;
  animation: float 5s ease-in-out infinite;
  animation-delay: -1s;
}

.howto-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 36px;
}

.howto-step {
  background: linear-gradient(180deg, var(--c-bg-cloud), var(--c-white));
  padding: 28px 22px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 5px 0 rgba(28, 126, 214, 0.12);
  transition: transform .2s;
  border: 3px dashed var(--c-primary);
}

.howto-step:hover { transform: translateY(-4px) scale(1.02); }

.howto-step:nth-child(2) {
  background: linear-gradient(180deg, #fff3bf, var(--c-white));
  border-color: var(--c-orange);
}
.howto-step:nth-child(3) {
  background: linear-gradient(180deg, #d3f9d8, var(--c-white));
  border-color: var(--c-green);
}

.howto-step-num {
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-yellow), var(--c-orange));
  color: var(--c-white);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 5px 0 rgba(255, 146, 43, 0.4);
  animation: bounce-soft 3s ease-in-out infinite;
}

.howto-step:nth-child(2) .howto-step-num {
  background: linear-gradient(135deg, var(--c-pink), var(--c-coral));
  box-shadow: 0 5px 0 #d96cad;
  animation-delay: -.5s;
}
.howto-step:nth-child(3) .howto-step-num {
  background: linear-gradient(135deg, var(--c-green), #40a35a);
  box-shadow: 0 5px 0 #40a35a;
  animation-delay: -1s;
}

.howto-step h4 {
  color: var(--c-primary-dark);
  margin-bottom: 8px;
  font-size: 17px;
}

.howto-step p {
  color: var(--c-text-soft);
  font-size: 14px;
}

/* ============================================
   AR Page (full-screen viewer)
   ============================================ */
.ar-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 20%, #74c0fc 0, transparent 40%),
    radial-gradient(circle at 80% 80%, #b197fc 0, transparent 40%),
    #1a3a52;
  color: var(--c-white);
}

.ar-page-header {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(14px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.ar-page-back {
  color: var(--c-white);
  background: var(--c-yellow);
  color: var(--c-text);
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 0 var(--c-orange);
}

.ar-page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-white);
}

.ar-stage {
  flex: 1;
  position: relative;
  background: linear-gradient(180deg, #74c0fc 0%, #b197fc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
}

.ar-info-panel {
  background: var(--c-white);
  color: var(--c-text);
  padding: 24px 18px;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
  position: relative;
}

.ar-info-panel::before {
  content: "";
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 50px; height: 5px;
  background: var(--c-bg-cloud);
  border-radius: 3px;
}

.ar-info-panel h2 {
  color: var(--c-primary-dark);
  margin-bottom: 10px;
  font-size: 20px;
}

.ar-info-panel p {
  color: var(--c-text-soft);
  font-size: 15px;
  margin-bottom: 16px;
}

.ar-info-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================
   MindAR Container
   ============================================ */
.mindar-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.mindar-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 30;
  pointer-events: none;
}

.mindar-hint {
  background: var(--c-white);
  color: var(--c-text);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
  pointer-events: auto;
  box-shadow: 0 5px 0 rgba(28, 126, 214, 0.2);
}

.mindar-hint strong { color: var(--c-orange); }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: linear-gradient(135deg, var(--c-primary-dark), #5f3dc4);
  color: rgba(255, 255, 255, 0.95);
  padding: 40px 16px 24px;
  text-align: center;
  font-size: 14px;
  margin: 24px 8px 8px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: "🌟 ⭐ ✨";
  position: absolute;
  top: 10px;
  width: 100%;
  font-size: 18px;
  opacity: 0.6;
  letter-spacing: 30px;
}

.site-footer a { color: var(--c-yellow); font-weight: 600; }

.footer-grid {
  max-width: 1000px;
  margin: 30px auto 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  text-align: left;
}

.footer-grid h4 {
  color: var(--c-yellow);
  margin-bottom: 12px;
  font-size: 16px;
}

.footer-copy {
  border-top: 2px dashed rgba(255, 255, 255, 0.25);
  padding-top: 18px;
  font-size: 13px;
  opacity: 0.95;
}

/* ============================================
   QR Modal
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 126, 214, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 0 rgba(255, 146, 43, 0.4);
  border: 4px solid var(--c-yellow);
  animation: pop-in .3s cubic-bezier(.5,1.8,.5,1);
}

.modal h3 {
  color: var(--c-primary-dark);
  margin-bottom: 8px;
  font-size: 20px;
}

.modal p {
  color: var(--c-text-soft);
  margin-bottom: 18px;
  font-size: 14px;
}

.modal-qr {
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  padding: 18px;
  background: var(--c-bg-cloud);
  border-radius: var(--radius-sm);
  border: 3px dashed var(--c-primary);
}

.modal-close {
  background: var(--c-pink);
  color: var(--c-white);
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  font-weight: 700;
  box-shadow: 0 4px 0 #d96cad;
}

.modal-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #d96cad;
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.mt-4 { margin-top: 24px; }
.muted { color: var(--c-text-soft); }

/* น่ารัก-เม้าส์เคอร์เซอร์ */
button, a, .ar-card { cursor: pointer; }

/* ============================================
   Map preview grid (home)
   ============================================ */
.map-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.place-mini-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--c-white);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 0 rgba(28,126,214,.12);
  border: 2px solid transparent;
  transition: all .2s;
  text-decoration: none;
  color: var(--c-text);
}
.place-mini-card:hover {
  transform: translateY(-3px);
  border-color: var(--c-yellow);
  box-shadow: 0 7px 0 rgba(28,126,214,.18);
}
.place-mini-thumb {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  display: grid; place-items: center;
  font-size: 26px;
  flex-shrink: 0;
}
.place-mini-card strong {
  display: block; color: var(--c-primary-dark);
  font-size: 14px; line-height: 1.3;
}
.place-mini-card small {
  color: var(--c-text-soft); font-size: 12px;
}

/* ============================================
   Map page (MapLibre)
   ============================================ */
.map-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 76px);
  margin: 0 8px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  background: var(--c-white);
}
@media (max-width: 768px) {
  .map-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
}
.map-sidebar {
  background: var(--c-bg-cloud);
  overflow-y: auto;
  padding: 18px;
  border-right: 3px solid var(--c-white);
}
@media (max-width: 768px) {
  .map-sidebar { max-height: 40vh; }
}
.map-sidebar h2 {
  color: var(--c-primary-dark);
  font-size: 19px;
  margin-bottom: 6px;
}
.map-sidebar .lead {
  color: var(--c-text-soft);
  font-size: 13px; margin-bottom: 14px;
}
.map-filter {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.map-filter button {
  background: var(--c-white);
  border: 2px solid var(--c-bg-cloud);
  color: var(--c-text-soft);
  font-family: inherit;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.map-filter button.active {
  background: var(--c-yellow);
  border-color: var(--c-orange);
  color: var(--c-text);
}
.map-place-list { display: flex; flex-direction: column; gap: 10px; }
.map-place-item {
  background: var(--c-white);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 5px solid var(--c-yellow);
  cursor: pointer;
  transition: all .15s;
}
.map-place-item:hover {
  transform: translateX(4px);
  box-shadow: 0 3px 0 rgba(28,126,214,.15);
}
.map-place-item.active {
  background: var(--c-bg-soft);
  border-left-color: var(--c-orange);
}
.map-place-item strong {
  display: block; color: var(--c-primary-dark);
  font-size: 14px;
}
.map-place-item small {
  color: var(--c-text-soft); font-size: 12px;
}
.map-canvas {
  position: relative;
  background: #c2e6ff;
  overflow: hidden; /* clip panel slide-in */
}
#map { width: 100%; height: 100%; }

/* =============================================
   Place info panel (bottom slide-up, replaces popup)
   ============================================= */
.place-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 32px rgba(28,126,214,.22);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px 20px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.34,1.12,.64,1);
  min-height: 110px;
}
.place-panel.open { transform: translateY(0); }

/* Drag handle */
.place-panel::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 4px;
  background: #dee2e6;
  border-radius: 99px;
}

/* Close button */
.panel-close {
  position: absolute;
  top: 10px; right: 12px;
  background: #f1f3f5;
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  display: grid; place-items: center;
  color: #555;
  line-height: 1;
}
.panel-close:hover { background: #ffe3e3; color: #c92a2a; }

/* Image on the left */
.panel-img-wrap {
  flex-shrink: 0;
  width: 90px; height: 90px;
  border-radius: 14px;
  overflow: hidden;
  background: #e9ecef;
  position: relative;
}
.panel-img-skel {
  width: 100%; height: 100%;
  background: linear-gradient(90deg,#e9ecef 25%,#f8f9fa 50%,#e9ecef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.panel-img {
  width: 100%; height: 100%;
  object-fit: cover; display: none;
}

/* Text area */
.panel-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.panel-text h3 {
  font-size: 15px;
  color: var(--c-primary-dark);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-en {
  font-size: 12px; color: #5a7d96;
  margin: 0 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.panel-era  { font-size: 11px; color: #888; margin: 0; }

/* Action buttons */
.panel-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-btn {
  display: inline-block;
  background: var(--c-yellow);
  color: var(--c-text);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-th);
}
.panel-btn--ar { background: #ff8cc6; }
.panel-btn:hover { opacity: .88; }

/* Mobile: stack vertically, full-width image */
@media (max-width: 640px) {
  .place-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 16px 28px;
    gap: 12px;
    max-height: 55vh;
    overflow-y: auto;
  }
  .panel-img-wrap {
    width: 100%; height: 140px;
  }
  .panel-text h3 {
    font-size: 17px;
    white-space: normal;
  }
  .panel-btns { justify-content: flex-start; }
}

.map-controls {
  position: absolute;
  top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10;
}
.map-controls button {
  width: 42px; height: 42px;
  background: var(--c-white);
  border: none;
  border-radius: 12px;
  font-size: 18px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(28,126,214,.18);
  font-family: inherit;
}
.map-controls button:hover { background: var(--c-yellow); }

.maplibregl-popup-content {
  border-radius: 14px !important;
  padding: 14px 16px !important;
  box-shadow: 0 8px 24px rgba(28,126,214,.25) !important;
  font-family: var(--font-th) !important;
}
.maplibregl-popup-content h4 {
  color: var(--c-primary-dark);
  margin-bottom: 4px; font-size: 15px;
}
.maplibregl-popup-content .pop-tag {
  display: inline-block;
  background: var(--c-bg-cloud);
  color: var(--c-primary-dark);
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px; margin: 4px 0;
}
.maplibregl-popup-content .pop-actions {
  margin-top: 8px;
}
.maplibregl-popup-content .pop-actions a {
  display: inline-block;
  background: var(--c-yellow);
  color: var(--c-text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.maplibregl-popup-content .pop-era {
  font-size: 11px; color: #888; margin: 3px 0 4px;
}
/* ============================================================
   Photo-circle map pin  (.pin-img wrapper / .pin-dot wrapper)
   MapLibre sets CSS transform on the ROOT element — so we must
   NEVER put transition/transform on the root class.
   All animations live on .pin-circle (the inner child).
   ============================================================ */

/* Root wrapper — MapLibre owns its transform, we only set layout */
[class^="pin-"] { position: relative; }

/* Inner circle — safe to animate */
.pin-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid;          /* color set via inline style */
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  margin: 0 auto;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s;
}
.pin-circle img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.pin-emoji {
  display: grid; place-items: center;
  height: 100%; font-size: 22px;
}
.pin-tip {
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 11px solid;     /* color set via inline style */
  margin: -1px auto 0;
}

/* Popup image */
.pop-img-wrap {
  width: 100%; margin-bottom: 10px;
  border-radius: 10px; overflow: hidden;
  min-height: 0; transition: min-height .3s;
}
.pop-img-skeleton {
  width: 100%; height: 140px;
  background: linear-gradient(90deg,#e9ecef 25%,#f1f3f5 50%,#e9ecef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.pop-img {
  width: 100%; max-height: 160px;
  object-fit: cover; display: block;
  border-radius: 10px;
}
/* Sidebar thumbnail */
.map-place-item { position: relative; overflow: hidden; }
.side-thumb {
  width: 100%; height: 80px;
  object-fit: cover; display: block;
  border-radius: 8px; margin-bottom: 8px;
  transition: transform .3s;
}
.map-place-item:hover .side-thumb { transform: scale(1.05); }

/* Place detail page */
.place-detail {
  max-width: 920px;
  margin: 24px auto;
  background: var(--c-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(28,126,214,.15);
}
.place-detail .hero-img {
  height: 280px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  display: grid; place-items: center;
  color: var(--c-white);
  font-size: 90px;
  position: relative;
}
.place-detail .hero-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.place-detail-body { padding: 26px 22px; }
.place-detail-body h1 {
  color: var(--c-primary-dark);
  font-size: 26px;
  margin-bottom: 4px;
}
.place-detail-body .meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 18px;
}
.place-detail-body .meta span {
  background: var(--c-bg-cloud);
  color: var(--c-primary-dark);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.place-mini-map {
  height: 280px;
  background: var(--c-bg-cloud);
  border-radius: var(--radius);
  margin: 18px 0;
  overflow: hidden;
}

/* Admin */
.admin-shell {
  max-width: 1000px;
  margin: 30px auto;
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 6px 0 rgba(28,126,214,.15);
}
.admin-shell h1 { color: var(--c-primary-dark); margin-bottom: 18px; }
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-bg-cloud);
}
.admin-table th {
  background: var(--c-bg-cloud);
  color: var(--c-primary-dark);
  font-weight: 700;
}
.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.admin-form .full { grid-column: 1 / -1; }
.admin-form label {
  display: block;
  font-weight: 600;
  color: var(--c-primary-dark);
  font-size: 13px;
  margin-bottom: 4px;
}
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--c-bg-cloud);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}
.admin-form textarea { min-height: 90px; resize: vertical; }
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--c-primary);
}
.admin-actions { display: flex; gap: 10px; margin-top: 16px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.success { background: #d3f9d8; color: #2b8a3e; border-left: 4px solid #40c057; }
.flash.error   { background: #ffe3e3; color: #c92a2a; border-left: 4px solid #fa5252; }
