/* 기본 초기화 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Jua', sans-serif;
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: #475569;
  position: relative;
  overflow-x: hidden;
  padding: 40px 0;
}

.font-nanum {
  font-family: 'Nanum Pen Script', cursive;
}

/* 반짝이 파티클 배경 */
.particles {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.particle {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.6;
  animation: float 5s infinite ease-in-out alternate;
}
.p1 { top: 10%; left: 20%; animation-duration: 4s; }
.p2 { top: 30%; left: 80%; animation-duration: 6s; }
.p3 { top: 60%; left: 15%; animation-duration: 5s; }
.p4 { top: 80%; left: 75%; animation-duration: 7s; }
.p5 { top: 40%; left: 50%; animation-duration: 4.5s; }

@keyframes float {
  0% { transform: translateY(0) scale(1); opacity: 0.4; }
  100% { transform: translateY(-20px) scale(1.2); opacity: 0.8; }
}

/* 앱 컨테이너 */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 헤더 */
.app-header {
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  padding: 15px 30px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  border: 2px solid rgba(255,255,255,0.8);
}
.app-header h1 {
  font-family: 'Nanum Pen Script', cursive;
  font-size: 3.5rem;
  color: #a21caf;
  text-shadow: 2px 2px 0px #fff;
  margin-bottom: 5px;
}
.app-header p {
  font-size: 1.2rem;
  color: #64748b;
}

/* 메인 레이아웃 */
.main-card {
  display: flex;
  gap: 20px;
}

@media (max-width: 768px) {
  .main-card {
    flex-direction: column;
  }
}

/* 동화책 느낌의 패널 */
.storybook-page {
  flex: 1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  border-radius: 30px;
  padding: 25px;
  box-shadow: 
    inset 0 0 20px rgba(255,255,255,0.5),
    0 15px 35px rgba(0,0,0,0.1),
    0 5px 15px rgba(0,0,0,0.05);
  border: 3px solid rgba(255,255,255,0.8);
}

/* 탭 네비게이션 */
.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 25px;
  background: rgba(241, 245, 249, 0.8);
  padding: 8px;
  border-radius: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 5px;
  border: none;
  background: transparent;
  font-family: 'Jua', sans-serif;
  font-size: 1rem;
  color: #64748b;
  cursor: pointer;
  border-radius: 15px;
  transition: all 0.3s ease;
}
.tab-btn:hover {
  background: rgba(255,255,255,0.5);
}
.tab-btn.active {
  background: #fff;
  color: #d946ef;
  box-shadow: 0 4px 10px rgba(217, 70, 239, 0.2);
  transform: translateY(-2px);
}

/* 폼 요소 */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.input-group.hidden {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.label-row label {
  font-size: 1.1rem;
  color: #334155;
}
.label-row span {
  font-size: 0.9rem;
  color: #94a3b8;
}

/* 뱃지 */
.val-badge {
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: bold;
  color: #475569;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.highlight-blue { background: #e0f2fe; color: #0284c7; }
.highlight-pink { background: #fce7f3; color: #db2777; }
.highlight-purple { background: #fae8ff; color: #c026d3; }
.highlight-green { background: #dcfce7; color: #16a34a; }

/* 성별 선택 버튼 */
.gender-selector {
  display: flex;
  gap: 10px;
}
.gender-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 15px;
  font-family: 'Jua', sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #64748b;
}
.gender-btn.active[data-gender="female"] {
  border-color: #f472b6;
  background: #fdf2f8;
  color: #db2777;
}
.gender-btn.active[data-gender="male"] {
  border-color: #38bdf8;
  background: #f0f9ff;
  color: #0284c7;
}

/* 색상 선택 버튼 */
.color-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.color-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.color-btn:hover {
  transform: scale(1.1);
}
.color-btn.active {
  border-color: #475569;
  transform: scale(1.15);
}

/* 슬라이더 커스텀 */
.fairy-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 10px;
  background: #e2e8f0;
  outline: none;
}
.fairy-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #cbd5e1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}
.fairy-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.slider-blue::-webkit-slider-thumb { background: #38bdf8; }
.slider-pink::-webkit-slider-thumb { background: #f472b6; }
.slider-purple::-webkit-slider-thumb { background: #d946ef; }
.slider-green::-webkit-slider-thumb { background: #4ade80; }

/* 드롭다운 */
.fairy-select, .fairy-input {
  padding: 12px;
  border-radius: 15px;
  border: 2px solid #e2e8f0;
  font-family: 'Jua', sans-serif;
  font-size: 1.1rem;
  color: #475569;
  background: #fff;
  outline: none;
}

/* 젤리몬 스테이지 */
.jellymon-stage {
  position: relative;
  height: 220px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}
.jellymon-svg {
  width: 200px;
  height: 200px;
  z-index: 2;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.jellymon-svg.bounce {
  animation: jellyBounce 0.5s;
}
@keyframes jellyBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1, 0.9); }
}

.jelly-shadow {
  position: absolute;
  bottom: 10px;
  width: 120px;
  height: 20px;
  background: rgba(0,0,0,0.1);
  border-radius: 50%;
  z-index: 1;
  filter: blur(4px);
  transition: all 0.3s;
}
.speech-bubble {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #fff;
  padding: 10px 15px;
  border-radius: 20px;
  border-bottom-left-radius: 0;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  font-size: 1rem;
  color: #a21caf;
  z-index: 3;
  animation: float-bubble 3s infinite;
}
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* 결과 카드 */
.result-card {
  text-align: center;
  background: #fff;
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 1.1rem;
  color: #94a3b8;
  margin-bottom: 5px;
}
.result-main-row {
  margin-bottom: 10px;
}
.result-number {
  font-size: 3rem;
  font-weight: bold;
  color: #a21caf;
}
.result-unit {
  font-size: 1.5rem;
  color: #d946ef;
}
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 15px;
  background: #fdf4ff;
  color: #d946ef;
  border-radius: 20px;
  font-size: 1.1rem;
  border: 1px solid #f5d0fe;
}
.fairy-advice {
  background: #f8fafc;
  padding: 15px;
  border-radius: 15px;
  font-size: 0.95rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.fairy-advice i {
  color: #fbbf24;
}

/* 2단계: 버튼 및 확장 섹션 */
.btn-share-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fbbf24;
  color: #78350f;
  border: none;
  padding: 5px 15px;
  border-radius: 20px;
  font-family: 'Jua', sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(251, 191, 36, 0.3);
}
.btn-share-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(251, 191, 36, 0.4);
}
.btn-share-badge i {
  width: 16px;
  height: 16px;
}

.bottom-extension-card {
  width: 100%;
}
.extension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.share-counter {
  background: #f1f5f9;
  padding: 5px 15px;
  border-radius: 20px;
  color: #475569;
  font-size: 0.9rem;
}

.extension-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .extension-grid {
    grid-template-columns: 1fr;
  }
}

/* 스킨 섹션 */
.secret-skins-section h3, .diary-section h3 {
  font-size: 1.2rem;
  color: #334155;
  margin-bottom: 15px;
}
.skins-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skin-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255,255,255,0.6);
  padding: 10px 15px;
  border-radius: 15px;
  transition: all 0.3s ease;
  cursor: pointer;
}
.skin-item.locked {
  opacity: 0.5;
  filter: grayscale(100%);
  cursor: not-allowed;
}
.skin-item.unlocked {
  border: 2px solid #a21caf;
  box-shadow: 0 4px 10px rgba(162, 28, 175, 0.15);
}
.skin-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
}
.skin-info {
  display: flex;
  flex-direction: column;
}
.skin-info span {
  font-size: 1.1rem;
  color: #1e293b;
}
.skin-info small {
  color: #64748b;
  font-size: 0.8rem;
}

/* 다이어리 섹션 */
.chart-wrapper {
  background: #fff;
  border-radius: 20px;
  padding: 10px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
  margin-bottom: 15px;
  height: 200px;
}
.diary-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}
.diary-input-row .fairy-input {
  flex: 1;
  padding: 10px;
}
.btn-primary, .btn-secondary {
  padding: 10px 15px;
  border: none;
  border-radius: 15px;
  font-family: 'Jua', sans-serif;
  cursor: pointer;
  transition: 0.2s;
}
.btn-primary {
  background: #ec4899;
  color: #fff;
}
.btn-primary:hover { background: #db2777; }
.btn-secondary {
  background: #cbd5e1;
  color: #475569;
}
.btn-secondary:hover { background: #94a3b8; color: #fff; }

.diary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 5px;
}
.diary-list li {
  background: rgba(255,255,255,0.7);
  padding: 10px 15px;
  border-radius: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.diary-list li .diary-date {
  font-size: 0.8rem;
  color: #94a3b8;
}
.diary-list li .diary-stats {
  font-size: 1rem;
  color: #ec4899;
  font-weight: bold;
}
.diary-list li .diary-memo {
  font-size: 0.95rem;
  color: #334155;
  flex: 1;
  margin: 0 10px;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-card {
  width: 90%;
  max-width: 400px;
  position: relative;
  text-align: center;
  transform: translateY(0);
  transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal-card {
  transform: translateY(50px);
}
.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
}
.share-card-preview {
  background: linear-gradient(135deg, #fdf4ff, #fae8ff);
  border: 2px solid #f0abfc;
  border-radius: 20px;
  padding: 20px;
  margin: 15px 0;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.preview-mascot {
  height: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}
.preview-mascot svg {
  width: 120px;
  height: 120px;
}
.preview-badge {
  display: inline-block;
  background: #d946ef;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 5px;
}
.preview-stats h3 {
  color: #86198f;
  margin-bottom: 5px;
}
.preview-stats p {
  color: #94a3b8;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
}
.btn-share-action {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 15px;
  font-family: 'Jua', sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.2s;
}
.btn-share-action:hover {
  filter: brightness(0.95);
}

/* SEO 콘텐츠 영역 */
.seo-article {
  margin-top: 20px;
  line-height: 1.6;
}
.seo-article details summary {
  list-style: none;
  cursor: pointer;
}
.seo-article details summary::-webkit-details-marker {
  display: none;
}
.seo-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.seo-summary h2 {
  font-family: 'Jua', sans-serif;
  color: #a21caf;
  font-size: 1.8rem;
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.seo-toggle-icon {
  font-size: 1.2rem;
  color: #a21caf;
  transition: transform 0.3s;
}
.seo-article details[open] .seo-toggle-icon {
  transform: rotate(180deg);
}
.seo-content-inner {
  margin-top: 15px;
  border-top: 2px dashed #f5d0fe;
  padding-top: 15px;
}
.seo-article h3 {
  font-size: 1.3rem;
  color: #db2777;
  margin-top: 20px;
  margin-bottom: 10px;
}
.seo-article p {
  color: #475569;
  margin-bottom: 15px;
  font-size: 1rem;
}
.seo-article ul {
  margin-left: 20px;
  margin-bottom: 15px;
  color: #475569;
}
.seo-article li {
  margin-bottom: 5px;
}
.seo-article strong {
  color: #1e293b;
}
