/* ==========================================================
   어딜까용 — 조아용 테마
   공식 조아용 색상 기준: 초록 #70C493 · 노랑 #FAF4A6
   ========================================================== */
:root {
  --g900: #163121;
  --g700: #2E6043;
  --g500: #479E6C;
  --g300: #70C493;
  --g100: #D4EDDE;
  --g050: #F1F9F4;
  --y600: #C9A227;
  --y500: #F0D84B;
  --y400: #F5E97E;
  --y100: #FAF4A6; /* 조아용 공식 이미지의 배경색과 동일 — 사진이 그대로 녹아듦 */
  --ink: #1F2A1F;
  --ink-sub: #4E5D4E;
  --white: #FFFFFF;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(22, 49, 33, 0.12);
  --font-head: 'Jua', 'Pretendard Variable', sans-serif;
  --font-body: 'Pretendard Variable', Pretendard, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--g050);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

h1, h2, h3, .brand-name, .btn, .game-round, .game-score {
  font-family: var(--font-head);
  font-weight: 400;
}

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1050; /* Leaflet 컨트롤(z-index 1000)보다 위 */
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--g700);
  color: var(--white);
  box-shadow: 0 2px 12px rgba(22, 49, 33, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}

.brand-mascot { width: 40px; height: 40px; }

/* 마스코트 이미지 공통: 조아용 공식 사진(노란 배경 원본)을
   가공 없이 그대로 써도 자연스럽도록 원형 프레임 처리 */
.brand-mascot, .loading-mascot, .bubble-mascot, .final-mascot,
.hero-mascot img, .dex-empty img, .answer-pin img {
  border-radius: 50%;
  background: var(--y100);
  object-fit: cover; /* 원본 830x552의 중앙 정사각 크롭 — 모든 포즈가 이 범위 안에 있음 */
  aspect-ratio: 1 / 1;
}

.brand-name {
  font-size: 1.5rem;
  color: var(--y400);
  letter-spacing: 0.02em;
}

.site-nav { display: flex; gap: 4px; margin-left: auto; }

.site-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); }

.site-nav a.active { background: var(--y400); color: var(--g900); }

.key-chip {
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--white);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.key-chip:hover { background: rgba(255, 255, 255, 0.12); }

.key-chip.ok { border-color: var(--y400); color: var(--y400); }

/* ---------- 레이아웃 ---------- */
#app, .site-footer-container { width: 100%; max-width: 1100px; margin: 0 auto; padding-inline: 20px; }
#app { flex: 1; padding-block: 32px 64px; }



.page-head { text-align: center; margin-bottom: 32px; }
.page-head h1 { font-size: 2.2rem; color: var(--g700); margin-bottom: 8px; }
.page-head p { color: var(--ink-sub); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--y500);
  color: var(--g900);
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.35);
}

.btn-primary:hover { background: var(--y400); box-shadow: 0 6px 18px rgba(201, 162, 39, 0.45); }

.btn-primary:disabled {
  background: #D8D8D0;
  color: #8B8B84;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--g700);
  border: 2px solid var(--g300);
}

.btn-ghost:hover { background: var(--g100); }

.btn-lg { padding: 15px 32px; font-size: 1.15rem; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ---------- 홈 ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 32px;
  background: linear-gradient(135deg, var(--g700) 0%, var(--g500) 100%);
  border-radius: 28px;
  padding: 56px 48px;
  color: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-eyebrow {
  display: inline-block;
  background: rgba(245, 233, 126, 0.2);
  color: var(--y400);
  border: 1px solid rgba(245, 233, 126, 0.5);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.hero-title { font-size: 3.2rem; line-height: 1.15; margin-bottom: 18px; }

.hero-title em { font-style: normal; color: var(--y400); }

.hero-sub { font-size: 1.05rem; line-height: 1.7; color: rgba(255, 255, 255, 0.9); margin-bottom: 28px; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero .btn-ghost { color: var(--white); border-color: rgba(255, 255, 255, 0.5); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.hero-mascot { position: relative; text-align: center; }

.hero-mascot img {
  width: 220px;
  max-width: 100%;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.25));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.hero-bubble {
  position: absolute;
  top: -14px;
  right: 0;
  background: var(--white);
  color: var(--g900);
  font-family: var(--font-head);
  padding: 12px 18px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  line-height: 1.4;
  animation: float 3s ease-in-out infinite reverse;
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--y500);
}

.feature-icon { font-size: 2rem; margin-bottom: 10px; }

.feature-card h3 { color: var(--g700); margin-bottom: 8px; font-size: 1.1rem; }

.feature-card p { font-size: 0.88rem; color: var(--ink-sub); line-height: 1.6; }

.home-cta {
  text-align: center;
  margin-top: 48px;
  padding: 40px;
  background: var(--y100);
  border-radius: 28px;
}

.home-cta h2 { color: var(--g700); font-size: 1.6rem; margin-bottom: 18px; }

/* ---------- 게임 공통 패널 ---------- */
.play-panel {
  text-align: center;
  background: var(--white);
  border-radius: 28px;
  padding: 64px 32px;
  box-shadow: var(--shadow);
  max-width: 560px;
  margin: 40px auto;
}

.play-panel h2 { color: var(--g700); margin-bottom: 12px; }

.play-panel p { color: var(--ink-sub); line-height: 1.7; margin-bottom: 20px; }

.loading-mascot { width: 110px; margin-bottom: 16px; animation: float 2s ease-in-out infinite; }

.loading-mascot.sad { filter: none; }

.loading-bar {
  width: 220px;
  height: 10px;
  background: var(--g100);
  border-radius: 999px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-bar-fill {
  width: 40%;
  height: 100%;
  background: var(--y500);
  border-radius: 999px;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

/* ---------- 게임 화면 ---------- */
.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.game-round {
  font-size: 1.4rem;
  color: var(--g700);
}

.game-round small { color: var(--ink-sub); font-size: 0.9rem; }

.game-score {
  font-size: 1.2rem;
  color: var(--g900);
  background: var(--y400);
  border-radius: 999px;
  padding: 8px 20px;
  box-shadow: 0 3px 10px rgba(201, 162, 39, 0.3);
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
  align-items: start;
}

.photo-panel { display: flex; flex-direction: column; gap: 12px; }

.photo-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--g900);
  aspect-ratio: 4 / 3;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(22, 49, 33, 0.85);
  color: var(--y400);
  font-family: var(--font-head);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.calm-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--y400);
  color: var(--g900);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.hint-text {
  background: var(--y100);
  border-left: 4px solid var(--y500);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
  color: var(--ink);
}

.map-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#game-map { height: 440px; width: 100%; }

.map-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.pin-guide { font-size: 0.92rem; color: var(--ink-sub); }

/* 지도 마커 */
.guess-pin { font-size: 30px; line-height: 30px; text-align: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }

.answer-pin img { width: 44px; height: 44px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }

/* ---------- 오버레이 / 결과 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 38, 26, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1100; /* Leaflet 컨트롤·헤더보다 위 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.result-card, .modal-card {
  background: var(--white);
  border-radius: 24px;
  padding: 28px;
  max-width: 620px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: pop 0.25s ease-out;
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

#result-emoji { font-size: 2.4rem; }

.result-head h2 { color: var(--g700); font-size: 1.4rem; }

.result-head p { color: var(--ink-sub); font-size: 0.9rem; }

.result-score { margin-left: auto; text-align: right; }

.result-score span {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--y600);
}

.result-score small { display: block; color: var(--g500); font-weight: 700; font-size: 0.78rem; }

.joayong-bubble {
  display: flex;
  gap: 12px;
  background: var(--g050);
  border: 2px solid var(--g100);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}

.bubble-mascot { width: 52px; height: 52px; flex-shrink: 0; }

.bubble-name { font-family: var(--font-head); color: var(--g700); display: block; margin-bottom: 6px; }

.bubble-body p { font-size: 0.95rem; line-height: 1.7; color: var(--ink); white-space: pre-line; }

.result-gallery { margin-bottom: 16px; }

.gallery-label { font-size: 0.85rem; font-weight: 700; color: var(--ink-sub); margin-bottom: 8px; }

.gallery-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.gallery-strip img {
  height: 90px;
  border-radius: 10px;
  flex-shrink: 0;
}

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.result-card.final { text-align: center; }

.final-mascot { width: 120px; animation: float 2.5s ease-in-out infinite; }

.final-score-label { color: var(--ink-sub); margin-top: 8px; }

.final-score {
  font-family: var(--font-head);
  font-size: 3.6rem;
  color: var(--y600);
  line-height: 1.2;
}

.final-grade { font-family: var(--font-head); font-size: 1.4rem; color: var(--g700); margin-bottom: 8px; }

.final-note { color: var(--ink-sub); font-size: 0.92rem; margin-bottom: 20px; line-height: 1.6; }

/* ---------- 모달 ---------- */
.modal-card h2 { color: var(--g700); margin-bottom: 12px; }

.modal-card > p { color: var(--ink-sub); font-size: 0.92rem; line-height: 1.7; margin-bottom: 16px; }

#key-input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--g100);
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: monospace;
  margin-bottom: 10px;
}

#key-input:focus { outline: none; border-color: var(--g300); }

.modal-hint { font-size: 0.8rem; color: var(--ink-sub); margin-bottom: 16px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 도감 ---------- */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.dex-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
  border: none;
  text-align: left;
  padding: 0;
  font-family: var(--font-body);
}

.dex-card:hover { transform: translateY(-4px); }

.dex-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--g100); }

.dex-card-body { padding: 14px 16px; }

.dex-card-body h3 { font-size: 1rem; color: var(--g900); margin-bottom: 4px; font-family: var(--font-body); font-weight: 700; }

.dex-card-body p { font-size: 0.8rem; color: var(--ink-sub); }

.dex-card-score {
  display: inline-block;
  margin-top: 8px;
  background: var(--y100);
  color: var(--y600);
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 3px 10px;
}

.dex-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-sub);
  line-height: 1.8;
}

.dex-empty img { width: 100px; opacity: 0.75; margin-bottom: 12px; }

.dex-empty .btn { margin-top: 16px; }

.dex-detail img { width: 100%; height: 240px; object-fit: cover; border-radius: 14px; margin-bottom: 16px; background: var(--g100); }

.dex-detail h2 { margin-bottom: 4px; }

.dex-detail-addr { color: var(--ink-sub); font-size: 0.88rem; margin-bottom: 14px; }

#dex-detail-overview { font-size: 0.95rem; line-height: 1.75; color: var(--ink); margin-bottom: 18px; }

/* ---------- 소개 ---------- */
.about-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-bottom: 20px;
}

.about-card h2 {
  color: var(--g700);
  font-size: 1.3rem;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--y400);
  display: inline-block;
}

.about-card p { line-height: 1.8; color: var(--ink); }

.api-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }

.api-list li {
  background: var(--g050);
  border-left: 5px solid var(--g500);
  border-radius: 10px;
  padding: 16px 18px;
}

.api-list strong { display: block; color: var(--g900); margin-bottom: 6px; }

.api-list span { display: block; font-size: 0.92rem; color: var(--ink-sub); line-height: 1.65; margin-bottom: 8px; }

.api-list code {
  font-size: 0.8rem;
  background: var(--g100);
  color: var(--g700);
  border-radius: 6px;
  padding: 3px 8px;
}

.plain-list { list-style: none; display: flex; flex-direction: column; gap: 10px; line-height: 1.7; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--g900);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 1200;
  animation: pop 0.2s ease-out;
}

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .game-grid { grid-template-columns: 1fr; }
  #game-map { height: 360px; }
  .hero { grid-template-columns: 1fr; padding: 40px 28px; text-align: center; }
  .hero-actions { justify-content: center; }
  .hero-mascot img { width: 160px; }
  .hero-bubble { right: 10%; }
  .hero-title { font-size: 2.4rem; }
}

@media (max-width: 560px) {
  .site-header { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .site-nav { order: 3; width: 100%; justify-content: center; margin-left: 0; }
  .key-chip { margin-left: auto; }
  #app, .site-footer-container { padding-inline: 12px; }
  #app { padding-block: 20px 48px; }
  .features { grid-template-columns: 1fr; }
  .map-actions { flex-direction: column; align-items: stretch; text-align: center; }
}

.site-footer-container { --zerossin-footer-muted: var(--ink-sub); --zerossin-footer-line: var(--g100); --zerossin-footer-ink: var(--ink); }
