@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
  --pink: #ff6b9d;
  --pink-light: #ff8fb8;
  --purple: #c471ed;
  --lavender: #b8a9f0;
  --mint: #7ee8c7;
  --yellow: #ffe066;
  --peach: #ffb5a7;
  --sky: #89c4f4;
  --bg-start: #fce4ec;
  --bg-mid: #f3e5f5;
  --bg-end: #e8eaf6;
}

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

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: linear-gradient(160deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  min-height: 100vh;
  color: #4a4a4a;
  overflow-x: hidden;
}

/* Floating decorations */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--pink) 0%, transparent 70%);
  opacity: 0.2;
  top: -60px;
  right: -60px;
  animation: floatA 10s ease-in-out infinite;
}
body::after {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--lavender) 0%, transparent 70%);
  opacity: 0.2;
  bottom: -40px;
  left: -40px;
  animation: floatB 12s ease-in-out infinite;
}

@keyframes floatA {
  0% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-40px, 30px) scale(1.1); }
  50% { transform: translate(-20px, 60px) scale(0.95); }
  75% { transform: translate(20px, 20px) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes floatB {
  0% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.08); }
  50% { transform: translate(50px, -20px) scale(0.92); }
  75% { transform: translate(10px, -50px) scale(1.1); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Extra floating circles */
.bg-deco {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.bg-deco-1 {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--mint) 0%, transparent 70%);
  opacity: 0.15;
  top: 40%;
  left: -30px;
  animation: floatC 14s ease-in-out infinite;
}
.bg-deco-2 {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--yellow) 0%, transparent 70%);
  opacity: 0.15;
  top: 20%;
  right: -20px;
  animation: floatA 16s ease-in-out infinite reverse;
}
.bg-deco-3 {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--peach) 0%, transparent 70%);
  opacity: 0.12;
  bottom: 30%;
  right: 10%;
  animation: floatB 11s ease-in-out infinite;
}

@keyframes floatC {
  0% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(40px, -30px) rotate(10deg); }
  66% { transform: translate(-20px, 40px) rotate(-5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 36px 28px;
  width: 100%;
  box-shadow:
    0 8px 32px rgba(255, 107, 157, 0.12),
    0 2px 8px rgba(196, 113, 237, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  text-align: center;
  letter-spacing: -0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.45);
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #555;
  border: 1.5px solid #ccc;
  font-weight: 700;
}

.btn-secondary:hover {
  background: white;
  border-color: var(--pink-light);
  color: var(--pink);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ========== Progress Bar ========== */
.progress-container {
  width: 100%;
  margin-bottom: 28px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: linear-gradient(90deg, #fce4ec, #f3e5f5, #e8eaf6);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--lavender));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: white;
  border: 3px solid var(--purple);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(196, 113, 237, 0.3);
}

.progress-text {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  color: #888;
  font-weight: 600;
}

/* ========== Slide Scale (Range Slider) ========== */
.scale-container {
  margin: 28px 0;
  padding: 0 4px;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.scale-option {
  flex: 1;
  padding: 14px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.scale-option.option-a {
  background: linear-gradient(135deg, #fff0f5, #ffe0ec);
  color: #c04070;
  border: 2px solid transparent;
}

.scale-option.option-b {
  background: linear-gradient(135deg, #f0f0ff, #e8e0ff);
  color: #5b4a9e;
  border: 2px solid transparent;
}

.slider-track {
  position: relative;
  padding: 20px 0;
}

.custom-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pink-light), #e8d5f5, var(--lavender));
  cursor: pointer;
}

.custom-track-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  transition: width 0.15s ease;
  pointer-events: none;
}

.custom-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--purple);
  box-shadow: 0 3px 12px rgba(196, 113, 237, 0.3);
  cursor: grab;
  user-select: none;
  transition: left 0.15s ease, box-shadow 0.2s ease;
  z-index: 2;
}

.custom-thumb:hover {
  box-shadow: 0 4px 20px rgba(196, 113, 237, 0.45);
}

.custom-thumb:active {
  cursor: grabbing;
  box-shadow: 0 6px 24px rgba(196, 113, 237, 0.5);
}

.slider-dots {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: -14px;
  pointer-events: none;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(196, 113, 237, 0.2);
}

.slider-dot.center {
  background: rgba(196, 113, 237, 0.5);
  width: 10px;
  height: 10px;
}

.slider-emoji {
  text-align: center;
  font-size: 32px;
  margin-top: 8px;
  transition: all 0.3s ease;
}

/* ========== Question Slide Animation ========== */
.question-slide {
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.6;
  color: #4a4a4a;
  padding: 0 8px;
}

/* ========== Result Page ========== */
.result-type {
  font-size: 56px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #555;
}

.result-summary {
  text-align: center;
  font-size: 14px;
  color: #aaa;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Dimension Bars */
.dimension-bar {
  margin-bottom: 14px;
}

.dimension-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #999;
}

.dimension-labels .active {
  color: var(--pink);
  font-weight: 700;
}

.bar-track {
  height: 12px;
  background: linear-gradient(90deg, #fce4ec, #f3e5f5, #e8eaf6);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.bar-fill-left {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--pink-light));
  border-radius: 8px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-fill-right {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #c4a7e8, var(--lavender));
  border-radius: 8px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Sections */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px dashed #f0e0f0;
  color: #777;
}

.section-content {
  font-size: 14px;
  line-height: 1.9;
  color: #666;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 14px;
  background: linear-gradient(135deg, #fff0f5, #fce4ec);
  color: var(--pink);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 107, 157, 0.15);
}

.tag-weak {
  background: linear-gradient(135deg, #fff8e1, #fff3e0) !important;
  color: #e8a040 !important;
  border: 1px solid rgba(232, 160, 64, 0.15) !important;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== Stats ========== */
.stat-bar-container {
  margin-bottom: 12px;
}

.stat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
  color: #888;
}

.stat-bar-label strong {
  color: #666;
}

.stat-bar-track {
  height: 20px;
  background: linear-gradient(90deg, #fce4ec, #f3e5f5);
  border-radius: 10px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  border-radius: 10px;
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 3px;
}

/* ========== Loading ========== */
.loading {
  text-align: center;
  padding: 60px 0;
  color: #c471ed;
  font-size: 16px;
  font-weight: 500;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #f3e5f5;
  border-top-color: var(--pink);
  border-right-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Navigation */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.nav-buttons .btn {
  flex: 1;
}

/* ========== Home: Mobile Fullscreen ========== */
@media (max-width: 600px) {
  .container-home {
    max-width: 100%;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .card-home {
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.75);
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    padding: calc(env(safe-area-inset-top, 0px) + 48px) 24px
             calc(env(safe-area-inset-bottom, 0px) + 32px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ========== Home Decorations ========== */
.character-wrap {
  margin-bottom: 12px;
  animation: heartBounce 2.5s ease-in-out infinite;
}

@keyframes heartBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-8px) scale(1.05); }
  60% { transform: translateY(-3px) scale(0.98); }
}

.home-title {
  font-size: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.home-subtitle {
  color: #888;
  margin-bottom: 28px;
  line-height: 1.7;
  font-size: 15px;
}

.home-counter {
  margin-top: 18px;
  font-size: 14px;
  color: #999;
}

.home-counter strong {
  color: var(--pink);
}

/* ========== MBTI Type Grid (Detail Page) ========== */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.type-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff0f5, #f3e5f5);
  color: #888;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.type-chip:hover {
  background: linear-gradient(135deg, #ffe0ec, #e8d5f5);
  color: #666;
  transform: translateY(-2px);
}

.type-chip.active {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(255, 107, 157, 0.3);
}

/* ========== MBTI Type Card Grid (List Page) ========== */
.type-card-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.type-card-item {
  display: block;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border-left: 4px solid #ccc;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
}

.type-card-item:hover {
  background: white;
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.type-card-code {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 2px;
}

.type-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #555;
  margin-bottom: 4px;
}

.type-card-summary {
  font-size: 13px;
  color: #999;
  line-height: 1.5;
}

/* ========== Sparkle decoration ========== */
.sparkles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--pink-light);
  border-radius: 50%;
  animation: sparkle 3s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 0.8; transform: scale(1); }
}
