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

:root {
  /* 토스 상단 구역(상태바 + ⋯/✕ 버튼). 토스 안에서만 main.js가 값을 채운다. */
  --top-zone: 0px;
  --header-h: calc(52px + var(--top-zone));
  --nav-h:    46px;
  --blue-dark:  #0277bd;
  --blue-mid:   #29b6f6;
  --blue-light: #81d4fa;
  --bg:         #e1f5fe;
  --gold:       #ffd54f;
  --text:       #1a2a3a;
}

body {
  background: var(--bg);
  font-family: "Pretendard Variable", Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ── 헤더 ── */
header {
  height: var(--header-h);
  background: var(--blue-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--top-zone) 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

#title { font-size: 1.1rem; font-weight: 700; }

#count-display {
  background: rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── 네비 ── */
nav {
  height: var(--nav-h);
  display: flex;
  background: var(--blue-dark);
  border-top: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: var(--header-h);
  z-index: 99;
}

.nav-btn {
  flex: 1;
  border: none;
  background: none;
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
  font-weight: 700;
}

/* ── 뷰 ── */
.view { display: none; flex-direction: column; }
.view.active { display: flex; }

#pond-view {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

#pond-view::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

#pond-area {
  position: relative;
  width: 100%;
  aspect-ratio: 459 / 1024; /* Preserve the background image ratio perfectly */
  background: #7fb27a;
  cursor: grab;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y; /* Allow smooth native vertical scrolling on mobile */
  flex-shrink: 0; /* Block vertical squeezing and stretching inside flex viewports */
}

/* 배경 레이어 — 맵마다 필터만 바꿔 같은 일러스트를 시간/계절로 변주한다.
   #pond-area에 직접 filter를 걸면 오리까지 물들기 때문에 별도 레이어로 분리했다. */
#pond-area::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url('../background.jpeg');
  background-size: cover; /* Prevent stretching and squash distortions */
  background-position: center top; /* Render beautifully from the top surface */
  background-repeat: no-repeat;
  filter: var(--map-filter, none);
  transition: filter 0.45s ease;
  pointer-events: none;
}

#pond-area.map-sunset { --map-filter: sepia(0.55) saturate(1.7) hue-rotate(-18deg) contrast(1.05); }
#pond-area.map-night  { --map-filter: brightness(0.42) saturate(0.7) contrast(1.15) hue-rotate(12deg); }
#pond-area.map-snow   { --map-filter: grayscale(0.5) brightness(1.2) saturate(0.55) contrast(0.95); }

/* 맵 분위기 오버레이 + 파티클 */
#map-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  transition: background 0.45s ease;
}

#map-fx.fx-sunset { background: linear-gradient(180deg, rgba(255,160,60,0.22), rgba(255,110,80,0.12) 55%, rgba(120,60,110,0.2)); }
#map-fx.fx-night  { background: linear-gradient(180deg, rgba(10,20,60,0.42), rgba(20,30,75,0.34)); }
#map-fx.fx-snow   { background: linear-gradient(180deg, rgba(220,238,255,0.34), rgba(200,225,250,0.28)); }

#map-fx::before {
  content: '';
  position: absolute;
  inset: -10% -10% 0 -10%;
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* 눈꽃연못 — 흩날리는 눈 */
#map-fx.fx-snow::before {
  opacity: 1;
  background-image:
    radial-gradient(2.5px 2.5px at 18% 12%, #fff, transparent),
    radial-gradient(2px 2px at 72% 36%, #fff, transparent),
    radial-gradient(3px 3px at 45% 68%, #fff, transparent),
    radial-gradient(2px 2px at 88% 82%, #fff, transparent);
  background-size: 150px 150px, 220px 220px, 190px 190px, 260px 260px;
  animation: snowfall 14s linear infinite;
}

@keyframes snowfall {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: 30px 150px, -40px 220px, 20px 190px, -25px 260px; }
}

/* 달빛연못 — 깜빡이는 별빛 */
#map-fx.fx-night::before {
  opacity: 1;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 8%, rgba(255,255,255,0.95), transparent),
    radial-gradient(1.5px 1.5px at 64% 18%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 34% 44%, rgba(255,247,200,0.9), transparent),
    radial-gradient(1.5px 1.5px at 84% 62%, rgba(255,255,255,0.85), transparent);
  background-size: 180px 180px, 240px 240px, 300px 300px, 210px 210px;
  animation: twinkle 4.5s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* 노을연못 — 은은하게 번지는 노을빛 */
#map-fx.fx-sunset::before {
  opacity: 1;
  background: radial-gradient(60% 34% at 50% 6%, rgba(255,196,110,0.5), transparent 70%);
  animation: sunglow 7s ease-in-out infinite;
}

@keyframes sunglow {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ── 맵 선택 바 ── */
#map-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(2, 119, 189, 0.92);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

#map-bar::-webkit-scrollbar { display: none; }

.map-chip {
  flex: 0 0 auto;
  border: none;
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.14);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.map-chip.active {
  background: #fff;
  color: var(--blue-dark);
  font-weight: 700;
}

.map-chip.locked {
  color: rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.18);
  cursor: default;
}

/* 상단 반사광 효과만 유지 */

/* 물결 shimmer (대각선 빛 반사) */
#pond-area::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    112deg,
    transparent 0px,
    transparent 55px,
    rgba(255,255,255,0.04) 55px,
    rgba(255,255,255,0.07) 63px,
    rgba(255,255,255,0.04) 71px,
    transparent 71px,
    transparent 126px
  );
  animation: shimmer 9s linear infinite;
  pointer-events: none;
}

@keyframes shimmer {
  from { transform: translateX(-126px); }
  to   { transform: translateX(0); }
}

#pond-ducks { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

#pond-empty {
  position: absolute;
  top: 26%;
  width: 100%;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  text-align: center;
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 5;
}

.pond-duck {
  position: absolute;
  width: 40px;
  height: 40px;
  animation: gentle-float var(--duration, 8s) ease-in-out infinite;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.25));
  transform: translateX(-50%) translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none; /* Prevent scrolling while dragging on touch devices */
  pointer-events: auto; /* Enable mouse/touch events despite parent's pointer-events: none */
  transition: left 6s ease-in-out, top 6s ease-in-out; /* 오리 산책 (main.js WANDER_MOVE_MS) */
}

.pond-duck.dragging {
  animation: none !important;
  transform: translateX(-50%) translateY(-50%) scale(1.15) !important;
  cursor: grabbing;
  z-index: 1000 !important;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.35)) !important;
  transition: transform 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes gentle-float {
  0% {
    transform: translateX(-50%) translateY(-50%) rotate(-5deg);
  }
  25% {
    transform: translateX(calc(-50% + 2px)) translateY(calc(-50% - 3px)) rotate(-1.5deg);
  }
  50% {
    transform: translateX(-50%) translateY(calc(-50% - 6px)) rotate(5deg);
  }
  75% {
    transform: translateX(calc(-50% - 2px)) translateY(calc(-50% - 3px)) rotate(1.5deg);
  }
  100% {
    transform: translateX(-50%) translateY(-50%) rotate(-5deg);
  }
}

/* 리플 */
.ripple {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-anim 0.7s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-anim {
  to { transform: translate(-50%, -50%) scale(3.5); opacity: 0; }
}

/* 연못 하단 잔디밭 제거 및 하단 투명화 */
#pond-footer {
  text-align: center;
  padding: 30px 0 40px;
  font-size: 1.4rem;
  letter-spacing: 3px;
  position: relative;
  overflow: hidden;
  z-index: 4;
}

#reeds {
  position: relative;
  z-index: 1;
}

/* ── 도감 ── */
#collection-view {
  padding: 16px;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

#collection-header h2   { font-size: 1.1rem; font-weight: 700; }
#collection-subtitle    { font-size: 0.8rem; color: #555; margin-top: 2px; }

#duck-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.duck-card {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  padding: 4px 2px;
  gap: 2px;
}

.duck-card:hover          { transform: scale(1.07); }
.duck-card.locked         { background: #cfd8dc; }
.duck-card.collected      { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

.duck-card.rarity-uncommon.collected  { border-color: #4caf50; }
.duck-card.rarity-rare.collected      { border-color: #2196f3; }
.duck-card.rarity-legendary.collected { border-color: var(--gold); box-shadow: 0 2px 10px rgba(255,213,79,0.5); }

.card-emoji            { font-size: clamp(1.2rem, 3.5vw, 1.7rem); line-height: 1; }
.card-emoji.silhouette { filter: brightness(0) opacity(0.2); }

.card-sprite {
  width: 68%;
  aspect-ratio: 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
.card-sprite.silhouette { filter: brightness(0) opacity(0.18); }
.card-name {
  font-size: clamp(0.45rem, 1.4vw, 0.6rem);
  text-align: center;
  font-weight: 600;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  padding: 0 1px;
}
.duck-card.locked .card-name { color: #999; }

/* 흔들기 */
@keyframes shake {
  0%, 100% { transform: translateX(0) scale(1.07); }
  25%       { transform: translateX(-5px) scale(1.07); }
  75%       { transform: translateX(5px) scale(1.07); }
}
.shake { animation: shake 0.35s ease; }

/* ── 알림 ── */
#notification {
  position: fixed;
  top: calc(var(--header-h) + var(--nav-h) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--blue-dark);
  color: #fff;
  border-radius: 16px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  z-index: 500;
}

#notification.show   { transform: translateX(-50%) translateY(0); }
#notif-emoji {
  font-size: 2rem;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
#notif-label         { font-size: 0.7rem; opacity: 0.75; }
#notif-name          { font-size: 1rem; font-weight: 700; }

/* ── 모달 ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 600;
}

#modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 24px;
  z-index: 601;
  text-align: center;
  width: min(320px, 88vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
}

#modal-emoji {
  font-size: 4rem;
  margin: 0 auto 6px;
  width: 90px;
  height: 90px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-name  { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
#modal-desc  { font-size: 0.88rem; color: #555; line-height: 1.6; margin-bottom: 12px; }

.rarity-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.rarity-badge.rarity-common    { background: #eceff1; color: #546e7a; }
.rarity-badge.rarity-uncommon  { background: #e8f5e9; color: #2e7d32; }
.rarity-badge.rarity-rare      { background: #e3f2fd; color: #1565c0; }
.rarity-badge.rarity-legendary { background: #fff8e1; color: #e65100; }

#modal-share-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
}
#modal-share-btn:active { transform: scale(0.97); }

.modal-condition-container {
  background: #f1f8ff;
  border: 1px solid #c8e1ff;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 0.82rem;
  color: #0366d6;
  text-align: left;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.condition-label {
  font-weight: 700;
  font-size: 0.8rem;
  color: #0056b3;
}

#modal-emoji.silhouette {
  filter: brightness(0) opacity(0.15) !important;
}

/* ── 미션 화면 ── */
#missions-view {
  padding: 16px;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

#missions-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

#missions-subtitle {
  font-size: 0.8rem;
  color: #555;
  margin-top: 2px;
}

#ad-reward-btn {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: var(--gold);
  color: #4a3400;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
}
#ad-reward-btn:active { transform: scale(0.97); }

#missions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  border: 2px solid transparent;
  transition: transform 0.15s;
}

.mission-item:hover {
  transform: translateY(-1px);
}

.mission-item.cleared {
  border-color: #c3e6cb;
  background: #f4faf6;
}

.mission-item.locked {
  border-color: #ffeeba;
  background: #fffdf5;
}

.mission-sprite {
  width: 44px;
  height: 44px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
}

.mission-sprite.silhouette {
  filter: brightness(0) opacity(0.15);
}

.mission-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mission-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #333;
}

.mission-item.locked .mission-title {
  color: #888;
}

.mission-desc {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.4;
}

.mission-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}

.mission-status.cleared {
  background: #d4edda;
  color: #155724;
}

.mission-status.locked {
  background: #fff3cd;
  color: #856404;
}

/* ── 밤 연못 모드 ── */
#night-toggle-btn {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2c3e50;
  color: #fff;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

#night-toggle-btn:active {
  transform: scale(0.9);
}

#pond-area.night-mode {
  /* 컨셉 바이블(초록걸음) 기준: 밤은 파랑으로 돌리지 않고 green-600(최암부) 쪽으로만 어둡게 */
  filter: brightness(0.55) saturate(0.9);
}

#pond-area.night-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2px 2px at 20% 25%, #FAF7EC, transparent),
    radial-gradient(2px 2px at 60% 12%, #FAF7EC, transparent),
    radial-gradient(1.5px 1.5px at 80% 35%, #FAF7EC, transparent),
    radial-gradient(1.5px 1.5px at 35% 55%, #FAF7EC, transparent),
    radial-gradient(2px 2px at 90% 18%, #FAF7EC, transparent),
    radial-gradient(1.5px 1.5px at 12% 75%, #FAF7EC, transparent),
    radial-gradient(1.5px 1.5px at 50% 45%, #FAF7EC, transparent);
  opacity: 0.7;
  pointer-events: none;
  z-index: 1;
  animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.35; }
  to   { opacity: 0.85; }
}

/* ── 모바일 가상 키보드 ── */
#keyboard-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

#keyboard-fab:active {
  transform: scale(0.9);
}

#keyboard-pad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 700;
}

#keyboard-pad {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: min(480px, 100vw);
  background: #2b394a;
  border-radius: 24px 24px 0 0;
  padding: 20px 24px 30px;
  z-index: 701;
  color: #fff;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

#keyboard-pad.show {
  transform: translateX(-50%) translateY(0);
}

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

.kpad-header h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.kpad-close {
  background: none;
  border: none;
  color: #a0aec0;
  font-size: 1.2rem;
  cursor: pointer;
}

.kpad-subtitle {
  font-size: 0.78rem;
  color: #a0aec0;
  margin-bottom: 18px;
}

.kpad-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kcap {
  aspect-ratio: 1;
  background: #f7fafc;
  color: #2d3748;
  border: none;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 4px 0 #cbd5e0, 0 8px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.05s, box-shadow 0.05s, background 0.05s;
}

.kcap:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 transparent, 0 4px 6px rgba(0,0,0,0.1);
  background: #e2e8f0;
}

/* Key color varieties for premium game look */
.kcap:nth-child(1), .kcap:nth-child(5) { background: #fffff0; }
.kcap:nth-child(2), .kcap:nth-child(6) { background: #e6fffa; color: #008080; }
.kcap:nth-child(3), .kcap:nth-child(7) { background: #ebf8ff; color: #2b6cb0; }
.kcap:nth-child(4), .kcap:nth-child(8) { background: #fff5f5; color: #c53030; }

.kpad-dpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    ".    up   .     b"
    "left down right a";
  gap: 10px;
  margin-bottom: 16px;
}
.dpad-up    { grid-area: up; }
.dpad-left  { grid-area: left; }
.dpad-right { grid-area: right; }
.dpad-down  { grid-area: down; }
.dpad-b     { grid-area: b; }
.dpad-a     { grid-area: a; }

.kpad-stats {
  font-size: 0.85rem;
  text-align: center;
  color: #a0aec0;
}

#kpad-count {
  color: #3182ce;
  font-weight: 700;
}

/* Floating particles */
.kcap-particle {
  position: fixed;
  font-size: 1rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 1000;
  color: #63b3ed;
  animation: float-up 0.8s ease-out forwards;
}

@keyframes float-up {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -150px) scale(1.4); opacity: 0; }
}

.hidden { display: none !important; }

/* ── 종료 확인 모달 ── */
#exit-modal-overlay,
#settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 900;
}

#exit-modal,
#settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 30px 24px 24px;
  z-index: 901;
  text-align: center;
  width: min(340px, 90vw);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.exit-modal-content h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #1a202c;
}

.exit-modal-content p {
  font-size: 0.92rem;
  color: #4a5568;
  line-height: 1.6;
  margin-bottom: 24px;
}

.exit-modal-buttons {
  display: flex;
  gap: 12px;
}

.exit-modal-buttons button {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

#btn-exit-cancel {
  background: #edf2f7;
  color: #4a5568;
}

#btn-exit-cancel:active {
  transform: scale(0.97);
  background: #e2e8f0;
}

#btn-exit-confirm {
  background: #ff5a5f;
  color: #ffffff;
}

#btn-exit-confirm:active {
  transform: scale(0.97);
  background: #e14d52;
}

#duck-size-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: -12px 0 20px;
}

.size-option {
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #edf2f7;
  color: #4a5568;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.size-option.active {
  background: #0277bd;
  border-color: #0277bd;
  color: #ffffff;
}

#btn-settings-close {
  background: #edf2f7;
  color: #4a5568;
}

/* ── 헤더 컨트롤 및 사운드 토글 버튼 ── */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s, background 0.15s;
}

.header-icon-btn:active {
  transform: scale(0.9);
  background: #f7fafc;
}

/* ── UI 아이콘 (index.html SVG symbol) ── */
.icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
}
.header-icon-btn { color: #4a3b22; }
.header-icon-btn .icon { width: 18px; height: 18px; }
.nav-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }
#keyboard-fab .icon { width: 26px; height: 26px; }
#notif-emoji .icon { width: 30px; height: 30px; }
#reeds { display: block; width: 70%; max-width: 300px; height: auto; margin: 0 auto; }

/* ── 타이틀 ── */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 850;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(14, 52, 38, 0.15) 0%, rgba(14, 52, 38, 0.55) 70%, rgba(14, 52, 38, 0.8) 100%),
    url('../background.jpeg') center / cover no-repeat, #5b8a52;
  color: #fff;
  text-align: center;
  padding: 24px;
}
.title-content { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.title-logo {
  width: 132px;
  height: 132px;
  border-radius: 32px;
  border: 4px solid #fff8e6;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: title-bob 3.2s ease-in-out infinite;
}
@keyframes title-bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
.title-name {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff8e6;
  text-shadow: 0 3px 0 #6b4a1f, 0 6px 18px rgba(0,0,0,0.4);
}
.title-tagline { font-size: 1rem; line-height: 1.6; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.title-progress { font-size: 0.85rem; min-height: 1.2em; opacity: 0.9; text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
#title-start {
  margin-top: 10px;
  min-width: 200px;
  padding: 15px 28px;
  border: none;
  border-radius: 999px;
  background: #f6c945;
  color: #4a3400;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 5px 0 #b8892a, 0 10px 24px rgba(0,0,0,0.3);
  cursor: pointer;
}
#title-start:active { transform: translateY(3px); box-shadow: 0 2px 0 #b8892a; }
#title-start:disabled { background: #e8e1cc; color: #7d7462; box-shadow: none; }
.title-version { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); font-size: 0.75rem; opacity: 0.7; }

/* ── 공용 창 (안내·출석·정보·완주) ── */
#panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 920;
}
#panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 921;
  width: min(340px, 90vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #fffaf0;
  border: 3px solid #e9d8b4;
  border-radius: 24px;
  padding: 26px 22px 20px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  color: #3d3020;
}
#panel.wide { width: min(420px, 94vw); }
#panel h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 8px; }
#panel p { font-size: 0.9rem; line-height: 1.6; color: #5e5038; margin-bottom: 14px; word-break: keep-all; }
.panel-sprite { width: 80px; height: 80px; margin: 0 auto 8px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.panel-icon { color: #c9822b; margin-bottom: 4px; }
.panel-icon .icon { width: 44px; height: 44px; }
.panel-primary, .panel-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}
.panel-primary { background: var(--blue-dark); color: #fff; }
.panel-secondary { background: #f1e6cd; color: #5e4a25; }
.panel-primary:active, .panel-secondary:active { transform: scale(0.97); }
.step-dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; }
.step-dots i { width: 8px; height: 8px; border-radius: 50%; background: #e3d5b5; }
.step-dots i.on { background: var(--blue-dark); width: 20px; border-radius: 4px; }

/* 출석 칸 (창·미션 탭 공용) */
.att-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 4px 0 6px; }
.att-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border-radius: 10px;
  background: #f3ead6;
  color: #8a7a5c;
  font-size: 0.7rem;
}
.att-day b { font-size: 0.72rem; }
.att-day small { font-size: 0.68rem; }
.att-day.done { background: #f6c945; color: #4a3400; }
.att-day.big { outline: 2px dashed #e0a43a; outline-offset: -2px; }
.att-day.today { animation: att-pop 0.5s ease-out; }
@keyframes att-pop { 50% { transform: scale(1.25); } }

/* 정보 */
.about-logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 6px; }
#panel .about-version { margin-bottom: 10px; font-size: 0.8rem; }
.about-credits { text-align: left; font-size: 0.8rem; margin-bottom: 12px; }
.about-credits dt { font-weight: 800; color: #5e4a25; margin-top: 6px; }
.about-credits dd { color: #6e6148; line-height: 1.45; }
#panel .about-contact { font-size: 0.85rem; margin-bottom: 4px; }
.about-contact a { color: var(--blue-dark); font-weight: 700; }
.privacy-frame { width: 100%; height: 62vh; border: 1px solid #e9d8b4; border-radius: 12px; background: #fff; }

/* 완주 */
.ending-title { font-size: 1.6rem !important; color: #b3741c; }
.ending-parade { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 4px 0 12px; }
.ending-parade span { width: 30px; height: 30px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.ending-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.ending-stats div { background: #f3ead6; border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; }
.ending-stats small { font-size: 0.72rem; color: #8a7a5c; }
.ending-stats b { font-size: 1rem; }
#ending-replay-btn {
  margin-top: 8px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: #f6c945;
  color: #4a3400;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ── 설정 ── */
.setting-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.setting-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f7fafc;
  font-size: 0.92rem;
  font-weight: 700;
  color: #2d3748;
  cursor: pointer;
}
.setting-toggle .switch { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: #e2e8f0; color: #718096; }
.setting-toggle.on .switch { background: var(--blue-dark); color: #fff; }
#settings-modal .setting-label { margin-bottom: 20px; font-weight: 700; }
.setting-links { display: flex; gap: 8px; margin-bottom: 14px; }
.setting-links button {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4a5568;
  cursor: pointer;
}

/* ── 미션: 돋보기·출석·오늘의 오리·힌트 ── */
#missions-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff3cd;
  color: #7a5b00;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}
#attendance-strip { background: #fff; border-radius: 14px; padding: 10px 12px 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.att-title { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 800; color: #5e4a25; margin-bottom: 4px; }
.att-title span { margin-left: auto; color: #8a7a5c; font-weight: 700; }
#daily-duck-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff6d6, #ffe9b8);
  border: 2px solid #f6c945;
}
#daily-duck-card:empty { display: none; }
#daily-duck-card.done { background: #f4faf6; border-color: #c3e6cb; }
.daily-sprite { width: 48px; height: 48px; flex-shrink: 0; background-size: contain; background-repeat: no-repeat; background-position: center; }
.daily-sprite.silhouette { filter: brightness(0) opacity(0.25); }
.daily-info { flex: 1; min-width: 0; }
.daily-title { font-size: 0.9rem; font-weight: 800; color: #5e4a25; }
.daily-hint { font-size: 0.78rem; color: #6e6148; line-height: 1.4; }
.daily-reward { font-size: 0.75rem; font-weight: 800; color: #b3741c; white-space: nowrap; }
#ad-reward-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }
.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  background: #fff3cd;
  color: #7a5b00;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.hint-btn:active { transform: scale(0.95); }

/* ── 발견 축하 ── */
#notification.legendary { background: linear-gradient(135deg, #b3741c, #f6c945); }
#celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 550; overflow: hidden; }
.confetti {
  position: absolute;
  top: calc(var(--header-h) + var(--nav-h) + 30px);
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confetti-fall 1.3s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}
@keyframes confetti-fall {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* ── 짧은 안내 ── */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(360px, 88vw);
  padding: 11px 18px;
  border-radius: 14px;
  background: rgba(30, 36, 44, 0.92);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  z-index: 960;
}
