/* ==========================================================================
   왕립 마법 동물 농장 (Royal Pet Farm) - Farm & Pet Core CSS
   ========================================================================== */

/* 메인 농장 컨테이너 */
.farm-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 농장 뷰포트 (동물이 서 있는 목장 테마 배경) */
.farm-field {
  position: relative;
  height: 270px;
  background: radial-gradient(circle at 50% 20%, #fef9c3 0%, #bbf7d0 50%, #86efac 100%);
  border-radius: 24px;
  border: 3px solid #fbcfe8;
  box-shadow: inset 0 -12px 24px rgba(22, 101, 52, 0.12), 0 8px 20px rgba(244, 114, 182, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 24px;
  overflow: hidden;
}

/* 하늘 구름 데코 */
.field-decor-cloud {
  position: absolute;
  top: 14px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  filter: blur(0.5px);
  animation: cloudFloat 16s ease-in-out infinite alternate;
}

.cloud-1 {
  width: 70px;
  height: 22px;
  left: 20px;
}
.cloud-2 {
  width: 90px;
  height: 26px;
  right: 25px;
  animation-duration: 22s;
  animation-delay: -6s;
}

@keyframes cloudFloat {
  0% { transform: translateX(0); }
  100% { transform: translateX(18px); }
}

/* 바닥 잔디 언덕 데코 */
.field-hill {
  position: absolute;
  bottom: 0;
  left: -20px;
  right: -20px;
  height: 80px;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  border-radius: 50% 50% 0 0;
  opacity: 0.85;
}

/* 농장 필드 전용 우체통 오브젝트 (상단 우측) */
.field-mailbox-post {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #38bdf8;
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25), 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 15;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: var(--font-body);
}

.field-mailbox-post:hover {
  transform: translateY(-2px) scale(1.05);
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.field-mailbox-post:active {
  transform: translateY(0) scale(0.95);
}

.field-mailbox-post .mailbox-post-body {
  font-size: 20px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.field-mailbox-post.has-unread .mailbox-post-body {
  animation: mailboxJiggle 2.4s ease-in-out infinite;
}

.field-mailbox-label {
  font-size: 12px;
  font-weight: 800;
  color: #0284c7;
}

.mailbox-field-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: badgePulse 1.6s ease-in-out infinite;
}

@keyframes mailboxJiggle {
  0%, 80%, 100% { transform: rotate(0deg); }
  85% { transform: rotate(-12deg) scale(1.15); }
  90% { transform: rotate(12deg) scale(1.15); }
  95% { transform: rotate(-6deg) scale(1.08); }
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 동물 상단 정보 (이름, 단계, 속성) */
.pet-header-tag {
  position: absolute;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #fbcfe8;
  z-index: 2;
}

.pet-element-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.pet-display-name {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.pet-stage-pill {
  font-size: 11px;
  font-weight: 700;
  color: #db2777;
  background: #fdf2f8;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #f472b6;
}

/* 동물 그래픽 아바타 박스 (5단계: 농장 랜덤 배회) */
.pet-avatar-wrapper {
  position: absolute;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  transition: left 3.2s cubic-bezier(0.4, 0, 0.2, 1), top 3.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
}

.pet-avatar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: petBounce 2.6s ease-in-out infinite;
  transition: transform 0.35s ease;
}

.pet-avatar-inner.walking {
  animation: petWalkWobble 0.55s ease-in-out infinite alternate;
}

.pet-avatar-wrapper:active .pet-avatar-inner {
  transform: scale(0.92);
}

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

@keyframes petWalkWobble {
  0% { transform: translateY(-3px) rotate(-3deg); }
  100% { transform: translateY(-10px) rotate(3deg); }
}

.pet-shadow {
  position: absolute;
  left: 50%;
  top: 76%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 16px;
  background: rgba(20, 83, 45, 0.25);
  border-radius: 50%;
  z-index: 5;
  transition: left 3.2s cubic-bezier(0.4, 0, 0.2, 1), top 3.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* 4대 스탯 패널 */
.stats-panel {
  background: var(--panel-bg);
  border-radius: 24px;
  border: 2px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #fbcfe8;
  padding-bottom: 8px;
}

.stats-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: #db2777;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-decay-info {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 스탯 리스트 */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-val {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.stat-val .curr {
  font-size: 14px;
}

.stat-val .max {
  font-size: 11px;
  color: #94a3b8;
}

/* 게이지 바 */
.stat-bar-track {
  height: 14px;
  background: #f1f5f9;
  border-radius: 999px;
  position: relative;
  overflow: visible;
  border: 1px solid #e2e8f0;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease-out;
  position: relative;
}

/* 성장 기준 눈금선 (100: 33.3%, 200: 66.6%) */
.stat-milestone-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: rgba(100, 116, 139, 0.4);
  z-index: 2;
  pointer-events: none;
}

.stat-milestone-marker::after {
  content: attr(data-label);
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 800;
  color: #94a3b8;
}

.marker-100 { left: 33.33%; }
.marker-200 { left: 66.66%; }

/* 스탯별 색상 설정 */
.stat-item[data-stat="love"] .stat-label { color: var(--stat-love); }
.stat-item[data-stat="love"] .stat-bar-fill {
  background: linear-gradient(90deg, #f472b6, #ec4899);
}

.stat-item[data-stat="charm"] .stat-label { color: var(--stat-charm); }
.stat-item[data-stat="charm"] .stat-bar-fill {
  background: linear-gradient(90deg, #c084fc, #a855f7);
}

.stat-item[data-stat="knowledge"] .stat-label { color: var(--stat-knowledge); }
.stat-item[data-stat="knowledge"] .stat-bar-fill {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.stat-item[data-stat="health"] .stat-label { color: var(--stat-health); }
.stat-item[data-stat="health"] .stat-bar-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

/* 엔딩 버튼 영역 */
.ending-action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-ending {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  border-radius: 16px;
}

.btn-ending.ready {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
  animation: endingGlow 1.8s infinite alternate;
  cursor: pointer;
}

@keyframes endingGlow {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px #fde047); }
  100% { transform: scale(1.02); filter: drop-shadow(0 0 14px #f59e0b); }
}

.ending-hint {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* 입양 모달 내부 스타일 */
.adoption-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.adopt-species-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.adopt-species-card:hover {
  background: #fdf2f8;
  border-color: #f472b6;
  transform: translateY(-2px);
}

.adopt-species-card.selected {
  background: #fdf2f8;
  border-color: #ec4899;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.25);
}

.adopt-thumb {
  width: 70px;
  height: 70px;
}

.adopt-species-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.adopt-species-elem {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

/* 선택 동물 디테일 프리뷰 */
.adopt-detail-box {
  background: #fff1f2;
  border-radius: 16px;
  border: 1px solid #fecdd3;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adopt-detail-title {
  font-weight: 800;
  font-size: 13px;
  color: #be123c;
}

.adopt-detail-story {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

/* 이름 입력 폼 */
.adopt-name-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.adopt-name-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.adopt-name-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.adopt-name-input:focus {
  border-color: #ec4899;
}

/* 성장 축하 모달 내부 */
.growth-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.growth-sparkle-icon {
  font-size: 40px;
  animation: pulse 1s infinite alternate;
}

.growth-pet-preview {
  width: 140px;
  height: 140px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.growth-celebration-title {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: #db2777;
  text-align: center;
}

.growth-celebration-text {
  font-size: 14px;
  color: #475569;
  text-align: center;
  line-height: 1.5;
}

/* ==========================================================================
   5단계: 농장 꾸미기 & 동물 배회 & 상태창 CSS
   ========================================================================== */

/* 동물 머리 위 동적 말풍선 */
.pet-speech-bubble-farm {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -100%);
  z-index: 25;
  pointer-events: none;
  transition: left 3.2s cubic-bezier(0.4, 0, 0.2, 1), top 3.2s cubic-bezier(0.4, 0, 0.2, 1);
  animation: speechPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speech-content {
  background: rgba(255, 255, 255, 0.98);
  color: #1e293b;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  border: 2px solid #fbcfe8;
  position: relative;
  white-space: nowrap;
  max-width: 240px;
  text-align: center;
}

.speech-content::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 6px 0 6px;
  border-style: solid;
  border-color: #fbcfe8 transparent transparent transparent;
}

@keyframes speechPopIn {
  from { opacity: 0; transform: translate(-50%, -80%) scale(0.7); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* 농장 퀵 액션 버튼 그룹 (좌측: 탐험 & 친구 / 우측: 꾸미기 & 가방) */
.farm-action-buttons {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.farm-action-group {
  position: absolute;
  bottom: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.farm-action-left {
  left: 16px;
  right: auto;
}

.farm-action-right {
  right: 16px;
  left: auto;
}

.farm-field.deco-mode .farm-action-group,
.farm-field.deco-mode .farm-action-buttons,
.farm-field.deco-mode .field-mailbox-post {
  display: none !important;
}

.btn-toggle-deco {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #a855f7;
  color: #7e22ce;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-toggle-deco:hover {
  background: #faf5ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.3);
}

.btn-toggle-deco.active {
  background: #a855f7;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.35);
}

/* 꾸미기 모드 상단 툴바 */
.farm-field.deco-mode {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.35), inset 0 0 30px rgba(168, 85, 247, 0.15);
}

.deco-mode-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid #c084fc;
  border-radius: 999px;
  padding: 6px 12px 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 18px rgba(147, 51, 234, 0.2);
  z-index: 30;
  animation: slideDown 0.25s ease-out;
}

.deco-topbar-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b21a8;
}

.btn-done-deco {
  padding: 5px 14px;
  font-size: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  border: none;
  box-shadow: 0 2px 6px rgba(126, 34, 206, 0.3);
}

/* 꾸미기 모드 하단 트레이 */
.deco-tray-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-top: 2px solid #d8b4fe;
  border-radius: 20px 20px 0 0;
  padding: 10px 14px 14px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
  z-index: 30;
  animation: slideUp 0.25s ease-out;
}

.deco-tray-header {
  font-size: 11px;
  font-weight: 800;
  color: #7e22ce;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deco-tray-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.deco-tray-item {
  flex-shrink: 0;
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fdf4ff;
  border: 1.5px solid #e9d5ff;
  border-radius: 14px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.deco-tray-item:hover {
  transform: translateY(-3px);
  border-color: #a855f7;
  background: #f5d0fe;
}

.deco-tray-item:active {
  transform: scale(0.95);
}

.deco-tray-icon {
  font-size: 28px;
  line-height: 1;
}

.deco-tray-name {
  font-size: 10px;
  font-weight: 700;
  color: #581c87;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.deco-tray-qty {
  font-size: 9px;
  font-weight: 800;
  color: #a855f7;
  background: #ffffff;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #d8b4fe;
}

.deco-tray-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 12px 0;
  text-align: center;
  width: 100%;
}

/* 농장 장식 배치 레이어 & 장식 아이템 */
.farm-deco-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.farm-field.deco-mode .farm-deco-layer {
  pointer-events: auto;
}

.farm-deco-item {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.15s ease;
}

.farm-deco-icon {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.farm-field.deco-mode .farm-deco-item {
  cursor: grab;
}

.farm-field.deco-mode .farm-deco-item:active,
.farm-deco-item.dragging {
  cursor: grabbing;
  z-index: 35 !important;
}

.farm-deco-item.selected .farm-deco-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.8));
}

.farm-deco-recall-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #ef4444;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
  z-index: 5;
}

.farm-deco-recall-btn:hover {
  transform: scale(1.2);
  background: #dc2626;
}

/* 동물 상세 상태창 모달 카드 */
.pet-status-modal-card {
  max-width: 380px;
  padding: 20px;
}

.pet-status-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px dashed #fbcfe8;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.pet-status-avatar-mini {
  width: 72px;
  height: 72px;
  background: radial-gradient(circle, #fef9c3 0%, #bbf7d0 100%);
  border-radius: 18px;
  border: 2px solid #fbcfe8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pet-status-avatar-mini svg {
  width: 58px;
  height: 58px;
}

.pet-status-info-text {
  flex: 1;
}

.pet-status-name {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.pet-status-mood {
  font-size: 12px;
  font-weight: 700;
  color: #db2777;
  margin-top: 2px;
}

.pet-status-meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.status-meter-box {
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 14px;
  padding: 8px 10px;
}

.status-meter-title {
  font-size: 11px;
  font-weight: 700;
  color: #831843;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.status-meter-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.status-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.pet-status-story-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
}

/* ==========================================================================
   6단계 & 7단계: 동굴 탐험 & 가상 커뮤니티 & 우편함 CSS
   ========================================================================== */

/* 상단/하단 퀵 액션 공통 버튼 */
.btn-farm-action {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.btn-farm-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.btn-farm-action.btn-explore {
  border-color: #6366f1;
  color: #4338ca;
  background: #eef2ff;
}

.btn-farm-action.btn-explore:hover {
  background: #e0e7ff;
}

.btn-farm-action.btn-friends {
  border-color: #ec4899;
  color: #be185d;
  background: #fdf2f8;
}

.btn-farm-action.btn-friends:hover {
  background: #fce7f3;
}

/* 하단 탭 알림 뱃지 */
.nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
  animation: pulse 1.2s infinite alternate;
}

/* --- 6단계: 동굴 탐험 모달 --- */
.explore-modal-card {
  max-width: 420px;
  background: radial-gradient(circle at 50% 0%, #ede9fe 0%, #ffffff 60%);
  border: 2px solid #c7d2fe;
}

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

.explore-cooldown-bar {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.explore-pet-synergy-banner {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 14px;
}

.explore-input-group {
  margin-bottom: 14px;
}

.explore-input-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #312e81;
  margin-bottom: 6px;
}

.explore-spell-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #818cf8;
  font-size: 15px;
  font-weight: 700;
  outline: none;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.explore-spell-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.explore-spellbook-box {
  background: #faf5ff;
  border: 1.5px dashed #c084fc;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.explore-spell-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.spell-chip {
  background: #ffffff;
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #6b21a8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s;
}

.spell-chip:hover {
  background: #f3e8ff;
  border-color: #a855f7;
  transform: translateY(-1px);
}

.explore-result-view {
  margin-top: 14px;
  border-top: 1px dashed #c7d2fe;
  padding-top: 14px;
  animation: popIn 0.3s ease-out;
}

.explore-resonance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.explore-resonance-badge.super {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.explore-resonance-badge.normal {
  background: #e2e8f0;
  color: #334155;
}

/* --- 7단계: 친구 목록 & 친구 농장 방문 뷰 --- */
.friends-modal-card {
  max-width: 420px;
}

.friends-list-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-card {
  background: #ffffff;
  border: 1.5px solid #fbcfe8;
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s;
}

.friend-card:hover {
  transform: translateY(-2px);
  border-color: #ec4899;
}

.friend-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.friend-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fdf2f8;
  border: 2px solid #f472b6;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-farm-modal-card {
  max-width: 440px;
  padding: 16px;
}

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

.friend-field {
  height: 250px;
  margin-bottom: 14px;
}

.friend-interaction-bar {
  display: flex;
  gap: 8px;
}

/* --- 7단계: 우편함 모달 --- */
.mailbox-modal-card {
  max-width: 440px;
  width: 95%;
  max-height: 85vh;
  padding: 20px;
  border-radius: 24px;
}

.mailbox-header-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #bae6fd;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.mailbox-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.mailbox-card,
.mail-item-card {
  background: #ffffff;
  border: 1.5px solid #e0f2fe;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
}

.mailbox-card.claimed,
.mail-item-card.claimed {
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.75;
}

.mailbox-card-header,
.mail-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.mailbox-sender-badge,
.mail-sender-tag {
  font-size: 11px;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}

.mailbox-date,
.mail-date {
  font-size: 10px;
  color: #94a3b8;
}

.mailbox-card-title,
.mail-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 4px;
}

.mailbox-status-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.mailbox-status-tag.new {
  background: #fef08a;
  color: #854d0e;
}

.mailbox-status-tag.claimed {
  background: #e2e8f0;
  color: #64748b;
}

.mailbox-card-message,
.mail-content {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
}

.mailbox-card-footer,
.mail-reward-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.mailbox-reward-chip,
.mail-reward-info {
  font-size: 12px;
  font-weight: 700;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}

.btn-claim-mail {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: #10b981;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.btn-claim-mail:hover {
  transform: scale(1.05);
  background: #059669;
}

.btn-claim-mail.done,
.btn-claim-mail.btn-disabled {
  background: #cbd5e1 !important;
  color: #94a3b8 !important;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   모바일 화면 대응 (폭 360px ~ 420px 이하) 레이아웃 최적화
   기능 변경 없이 360px 화면에서 깨지거나 넘치는 레이아웃을 완벽하게 수정합니다.
   ========================================================================== */
@media (max-width: 420px) {
  /* 1. 상단 바 & 뱃지 360px 한 줄 수납 */
  .top-bar {
    padding: 8px 8px;
    gap: 4px;
  }

  .top-bar-left {
    gap: 4px;
  }

  .brand-badge {
    padding: 3px 6px;
    font-size: 11px;
    gap: 3px;
  }

  .rank-badge {
    padding: 3px 6px;
    font-size: 11px;
  }

  .currency-badge {
    padding: 3px 6px;
    font-size: 11px;
    gap: 2px;
  }

  /* 2. 메인 컨테이너 패딩 축소 (내부 가로 공간 확보) */
  .farm-container {
    padding: 8px;
    gap: 10px;
  }

  /* 3. 농장 필드 및 내부 요소 */
  .farm-field {
    height: 250px;
    border-radius: 18px;
    padding-bottom: 16px;
  }

  .pet-header-tag {
    top: 8px;
    padding: 4px 8px;
    gap: 4px;
    max-width: 90%;
  }

  .pet-display-name {
    font-size: 16px;
  }

  .pet-element-badge,
  .pet-stage-pill {
    font-size: 10px;
    padding: 1px 5px;
  }

  .pet-avatar-wrapper {
    width: 120px;
    height: 120px;
  }

  /* 4. 농장 액션 버튼 그룹 (좌측: 탐험 & 친구 / 우측: 꾸미기 & 가방) */
  .farm-action-group {
    bottom: 8px;
    gap: 4px;
  }

  .farm-action-left {
    left: 8px;
    right: auto;
  }

  .farm-action-right {
    right: 8px;
    left: auto;
  }

  .farm-action-buttons {
    bottom: 8px;
    right: 8px;
    left: auto;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 260px;
  }

  .btn-farm-action,
  .btn-toggle-deco,
  .btn-quick-bag {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 999px;
  }

  /* 5. 4대 수치 패널 */
  .stats-panel {
    padding: 12px 10px;
    border-radius: 18px;
    gap: 8px;
  }

  .stats-title {
    font-size: 17px;
  }

  .stats-decay-info {
    font-size: 10px;
  }

  .stat-item-header {
    font-size: 12px;
  }

  .stat-bar-track {
    height: 12px;
  }

  .btn-ending {
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 12px;
  }

  /* 6. 하단 5개 탭 바 (360px 한 줄 수납) */
  .bottom-nav {
    padding: 6px 4px 10px;
  }

  .nav-item {
    padding: 2px 3px;
    font-size: 10px;
    gap: 1px;
  }

  .nav-item .icon {
    font-size: 18px;
  }

  /* 7. 모달 카드 패딩 최적화 */
  .modal-card {
    padding: 16px 12px;
    border-radius: 20px;
    max-height: 94vh;
  }

  .modal-title {
    font-size: 22px;
  }

  /* 8. 상점 모달 360px 최적화 */
  .shop-modal-card {
    padding: 14px 10px;
  }

  .shop-header-box {
    flex-direction: row;
    gap: 6px;
    align-items: center;
  }

  .shop-main-title {
    font-size: 20px;
  }

  .shop-points-badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .shop-tab-bar {
    gap: 3px;
    padding: 3px;
  }

  .shop-tab-btn {
    padding: 6px 6px;
    font-size: 11px;
  }

  .shop-item-grid {
    gap: 6px;
    padding: 2px 2px 8px;
  }

  .shop-item-card {
    padding: 8px 6px;
    border-radius: 14px;
  }

  .shop-item-icon {
    font-size: 24px;
    width: 34px;
    height: 34px;
  }

  .shop-item-name {
    font-size: 12px;
  }

  .shop-item-desc {
    font-size: 10px;
    margin: 4px 0 6px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .shop-item-price {
    font-size: 11px;
  }

  .btn-buy {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* 9. 입양 모달 그리드 */
  .adoption-grid {
    gap: 6px;
    margin-bottom: 10px;
  }

  .adopt-species-card {
    padding: 6px;
    border-radius: 12px;
  }

  .adopt-thumb {
    width: 52px;
    height: 52px;
  }

  .adopt-species-name {
    font-size: 12px;
  }

  /* 10. 우편함 & 탐험 모달 */
  .mailbox-modal-card,
  .explore-modal-card,
  .friends-modal-card {
    padding: 14px 10px;
  }

  .mailbox-header-box {
    flex-wrap: wrap;
    gap: 6px;
  }

  .explore-spell-chips {
    gap: 4px;
  }

  .explore-spell-chip {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* 11. 친구 카드 & 커뮤니티 */
  .friend-card {
    padding: 10px;
    gap: 8px;
  }

  .friend-card-avatar {
    font-size: 30px;
    width: 44px;
    height: 44px;
  }

  /* 12. 미니게임 상태 바 */
  .mg-status-bar {
    gap: 4px;
    flex-wrap: wrap;
  }

  .mg-status-chip {
    padding: 4px 8px;
    font-size: 11px;
  }
}


