:root {
  --max-width: 980px;
  --accent: #2d8cff;
  --navy: #1a3a6b;
  --sky-top: #c8e8f8;
  --sky-bottom: #e8f4fd;
}

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

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, 'Noto Sans KR', sans-serif;
  color: #111;
}

/* ── 랜딩 페이지 ── */
body.landing {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg,
    #0b1e4a 0%,
    #1a4a8a 18%,
    #2d7ecf 38%,
    #5ab2ea 58%,
    #a8d8f4 76%,
    #d4eef8 90%,
    #e8f4fd 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── 하늘 씬 ── */
.sky-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* 태양 */
.sun {
  position: absolute;
  top: 6%;
  right: 12%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,240,160,0.9) 0%, rgba(255,210,80,0.5) 40%, transparent 70%);
  filter: blur(6px);
  animation: sun-pulse 6s ease-in-out infinite;
}
@keyframes sun-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* ── 구름 ── */
.cloud {
  position: absolute;
  background: rgba(255,255,255,0.88);
  border-radius: 100px;
}
.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
}

.cloud-sm { width: 120px; height: 36px; }
.cloud-sm::before { width: 60px; height: 52px; top: -26px; left: 18px; }
.cloud-sm::after  { width: 44px; height: 40px; top: -20px; left: 60px; }

.cloud-md { width: 200px; height: 54px; }
.cloud-md::before { width: 90px; height: 74px; top: -38px; left: 30px; }
.cloud-md::after  { width: 68px; height: 58px; top: -30px; left: 110px; }

.cloud-lg { width: 280px; height: 70px; }
.cloud-lg::before { width: 120px; height: 96px; top: -48px; left: 44px; }
.cloud-lg::after  { width: 90px; height: 76px; top: -38px; left: 160px; }

.cloud-xl { width: 380px; height: 90px; opacity: 0.6; filter: blur(2px); }
.cloud-xl::before { width: 160px; height: 120px; top: -62px; left: 60px; }
.cloud-xl::after  { width: 120px; height: 96px; top: -50px; left: 220px; }

@keyframes drift {
  from { transform: translateX(-520px); }
  to   { transform: translateX(calc(100vw + 520px)); }
}
@keyframes drift-zoom {
  from { transform: translateX(-520px) scale(0.85); opacity: 0; }
  8%   { opacity: 0.85; }
  92%  { opacity: 0.85; }
  to   { transform: translateX(calc(100vw + 520px)) scale(1.15); opacity: 0; }
}

.c1 { top: 8%;  animation: drift      80s -10s linear infinite; opacity: 0.55; }
.c2 { top: 18%; animation: drift      65s -30s linear infinite; opacity: 0.6;  }
.c3 { top: 30%; animation: drift      50s -5s  linear infinite; opacity: 0.75; }
.c4 { top: 42%; animation: drift      42s -20s linear infinite; opacity: 0.8;  }
.c5 { top: 55%; animation: drift-zoom 30s -8s  linear infinite; }
.c6 { top: 62%; animation: drift-zoom 24s -18s linear infinite; }
.c7 { top: 72%; animation: drift-zoom 18s -3s  linear infinite; }


/* ── 랜딩 콘텐츠 ── */
.landing-main {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 20px 32px;
  animation: fade-up 0.8s ease both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 날아다니는 새 ── */
.bird {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: bird-fly linear infinite;
  pointer-events: none;
}
@keyframes bird-fly {
  from { transform: translateX(-220px); opacity: 0; }
  6%   { opacity: 1; }
  92%  { opacity: 1; }
  to   { transform: translateX(calc(100vw + 220px)); opacity: 0; }
}
.bird-emoji {
  display: block;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}
.bird-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(10,30,80,0.3);
  backdrop-filter: blur(4px);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.3);
}

/* 매 — 화면 상단 */
.b-mae .bird-emoji  { font-size: 2.8rem; }
.b-mae.b1           { top: 7%;  animation-duration: 13s; animation-delay: -1s; }
.b-mae.b2           { top: 13%; animation-duration: 13s; animation-delay: -7s; }

/* 참새 — 중상단 */
.b-cham .bird-emoji { font-size: 1.9rem; }
.b-cham.b1          { top: 24%; animation-duration: 26s; animation-delay: -4s; }
.b-cham.b2          { top: 30%; animation-duration: 26s; animation-delay: -14s; }

/* 모기 — 중단 (카드 위 여백) */
.b-moki .bird-emoji { font-size: 1.5rem; }
.b-moki.b1          { top: 42%; animation-duration: 60s; animation-delay: -8s; }
.b-moki.b2          { top: 48%; animation-duration: 60s; animation-delay: -35s; }

/* 동물 쇼케이스 */
.animals-showcase {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
  max-width: 420px;
}

.animal-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 18px 10px 14px;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 4px 16px rgba(10,30,80,0.1);
}

.animal-emoji {
  font-size: 3rem;
  line-height: 1;
}

.animal-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.animal-speed {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.88);
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 콘텐츠 카드 */
.landing-card {
  background: rgba(255,255,255,0.38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 28px;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(10,30,80,0.14), inset 0 1px 0 rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.55);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.landing-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 20px;
  filter: drop-shadow(0 4px 12px rgba(10,30,80,0.15));
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.landing-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.landing-slogan {
  font-size: 0.85rem;
  color: #4a6fa5;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.landing-desc {
  font-size: 0.88rem;
  color: #5a7aaa;
  line-height: 1.5;
  margin-top: 4px;
  font-weight: 500;
}

.btn-primary {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 15px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  margin-top: 10px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 16px rgba(26,58,107,0.3);
}
.btn-primary:hover { background: #2d5aaa; transform: translateY(-1px); }

.landing-note {
  font-size: 0.78rem;
  color: #4a6fa5;
  text-align: center;
  margin-top: 4px;
  font-weight: 500;
}

/* 모바일 */
@media (max-width: 480px) {
  .landing-logo { width: 90%; max-width: 260px; }
  .landing-main { padding: 16px 16px 20px; }
}

/* ── 앱 페이지 ── */
body.app {
  height: 100vh;
  background: var(--sky-bottom);
  overflow: hidden;
}

/* 플로팅 카드 */
.float-card {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 560px;
  z-index: 20;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  border: 1px solid rgba(255,255,255,0.85);
  overflow: visible;
}

.float-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid #eef3fa;
}

.float-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.float-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 6px;
}

.float-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--navy);
}

.float-hint {
  flex: 1;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
}

.btn-home {
  text-decoration: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--navy);
  border-radius: 20px;
  padding: 5px 13px;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-home:hover { background: #2d5aaa; }

/* 검색 바 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  position: relative;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f9ff;
  border: 1.5px solid #d0e4f8;
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.15s;
}
.search-field:focus-within {
  border-color: var(--accent);
  background: #fff;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-start { background: #e74c3c; }
.dot-end   { background: var(--accent); }

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 0;
  font-size: 0.9rem;
  outline: none;
  color: #222;
}
.search-input-wrap input::placeholder { color: #aab; }

.suggest-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: -20px;
  right: -12px;
  background: #fff;
  border: 1px solid #d0e4f8;
  border-radius: 10px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  overflow: hidden;
}
.suggest-list.open { display: block; }

.suggest-list li {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.suggest-list li:hover { background: #f0f6ff; }
.suggest-list li strong { font-size: 0.9rem; color: #222; font-weight: 600; }
.suggest-list li span   { font-size: 0.78rem; color: #888; }

.search-arrow {
  color: #aac;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.reset-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid #d0e4f8;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  color: #555;
  transition: background 0.15s;
}
.reset-btn:hover { background: #f0f6ff; }


/* 지도 */
.map-wrap {
  position: fixed;
  inset: 0;
}

#map {
  width: 100%;
  height: 100%;
}

/* 결과 오버레이 (지도 위 카드) */
.result-overlay {
  background: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  min-width: 170px;
  border: 1px solid #e0eef8;
}

.result-dist {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 3px 0;
  font-size: 0.85rem;
}
.result-row .animal { color: #555; }
.result-row .time   { font-weight: 700; color: var(--navy); }

/* FAB 버튼 그룹 */
.fab-group {
  position: absolute;
  bottom: 24px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}

.fab-share {
  background: var(--accent);
  color: #fff;
}

.fab-bgm {
  background: #fff;
  color: var(--navy);
}
.fab-bgm.playing {
  background: var(--navy);
  color: #fff;
}

.fab-loc {
  background: #fff;
  color: var(--navy);
}

/* 반응형 */
@media (max-width: 600px) {
  .float-card { top: 8px; width: calc(100% - 16px); }
  .search-bar { flex-wrap: wrap; gap: 6px; }
  .search-field { flex: 1 1 calc(50% - 30px); }
  .search-arrow { display: none; }
  .float-hint { display: none; }
}

@media (max-width: 420px) {
  .landing-card { padding: 32px 20px 28px; }
  .landing-logo { width: 96px; height: 96px; }
}
