/* ===== MBTI Test Modal - Premium Commercial UI ===== */
/* BtheK-AI 서비스 - 프리미엄 상업 서비스 수준 UI */

/* CSS Variables for MBTI Type Colors */
:root {
  --mbti-analyst: #88619a;      /* Analyst: INTJ, INTP, ENTJ, ENTP */
  --mbti-diplomat: #33a474;     /* Diplomat: INFJ, INFP, ENFJ, ENFP */
  --mbti-sentinel: #4298b4;     /* Sentinel: ISTJ, ISFJ, ESTJ, ESFJ */
  --mbti-explorer: #e4ae3a;     /* Explorer: ISTP, ISFP, ESTP, ESFP */
  --mbti-gold: linear-gradient(135deg, #ffd700 0%, #ffaa00 50%, #ff8c00 100%);
  --mbti-premium-glow: 0 0 60px rgba(183, 78, 145, 0.3), 0 0 120px rgba(94, 66, 166, 0.2);
}

/* Overlay with enhanced blur */
.mbti-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(49, 36, 80, 0.97) 0%, rgba(20, 15, 35, 0.99) 100%);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  z-index: 99999;
  display: none;
  justify-content: center;
  align-items: center;
  animation: mbti-fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.mbti-modal-overlay::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(183, 78, 145, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(94, 66, 166, 0.1) 0%, transparent 50%);
  animation: mbti-bgFloat 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes mbti-bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, 2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.mbti-modal-overlay.active {
  display: flex;
}

@keyframes mbti-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Container - Glassmorphism Premium */
.mbti-modal {
  width: 92%;
  max-width: 540px;
  max-height: 92vh;
  background: linear-gradient(165deg, 
    rgba(50, 40, 85, 0.95) 0%, 
    rgba(35, 28, 65, 0.98) 50%,
    rgba(25, 20, 50, 0.99) 100%);
  border-radius: 28px;
  border: 1px solid rgba(183, 78, 145, 0.25);
  box-shadow: 
    0 30px 100px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(183, 78, 145, 0.15),
    0 0 40px rgba(94, 66, 166, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
  overflow-y: auto;
  animation: mbti-slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  transform-origin: center center;
}

.mbti-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(183, 78, 145, 0.5) 20%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(183, 78, 145, 0.5) 80%,
    transparent 100%);
}

@keyframes mbti-slideUp {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.92);
  }
  60% {
    transform: translateY(-8px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header - Premium Gradient with Glow */
.mbti-modal-header {
  padding: 32px 32px 24px;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, 
    rgba(183, 78, 145, 0.2) 0%, 
    rgba(94, 66, 166, 0.1) 50%,
    transparent 100%);
}

.mbti-modal-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(183, 78, 145, 0.3), transparent);
}

.mbti-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  padding: 0;
  line-height: 1;
}

.mbti-close-btn:hover {
  background: rgba(183, 78, 145, 0.2);
  color: #fff;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 20px rgba(183, 78, 145, 0.3);
}

.mbti-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #b74e91 0%, #8e44ad 50%, #5e42a6 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 
    0 12px 40px rgba(183, 78, 145, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.2);
  animation: mbti-logoPulse 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.mbti-logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  animation: mbti-logoShine 4s ease-in-out infinite;
}

@keyframes mbti-logoPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 12px 40px rgba(183, 78, 145, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 16px 50px rgba(183, 78, 145, 0.6), 0 6px 16px rgba(0, 0, 0, 0.35);
  }
}

@keyframes mbti-logoShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  30%, 100% { transform: translateX(100%) rotate(45deg); }
}

.mbti-modal-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(183, 78, 145, 0.3);
}

.mbti-modal-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mbti-modal-subtitle .mbti-pulse-dot {
  width: 8px;
  height: 8px;
  background: #b74e91;
  border-radius: 50%;
  animation: mbti-pulseDot 1.5s ease-in-out infinite;
}

@keyframes mbti-pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* Body */
.mbti-modal-body {
  padding: 0 32px 32px;
}

/* Progress Section - Enhanced */
.mbti-progress-section {
  margin-bottom: 28px;
}

.mbti-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mbti-progress-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mbti-progress-label i {
  color: #b74e91;
  font-size: 0.85rem;
}

.mbti-progress-count {
  font-size: 0.9rem;
  background: linear-gradient(90deg, #b74e91, #e4ae3a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mbti-progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mbti-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5e42a6 0%, #b74e91 50%, #e4ae3a 100%);
  border-radius: 12px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 0 20px rgba(183, 78, 145, 0.5);
}

.mbti-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%);
  animation: mbti-shimmer 1.8s ease-in-out infinite;
}

.mbti-progress-fill::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 24px rgba(183, 78, 145, 0.6);
}

@keyframes mbti-shimmer {
  0% { transform: translateX(-200%); }
  100% { transform: translateX(200%); }
}

/* Question Display - Premium Card */
.mbti-question-display {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.06) 0%, 
    rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mbti-question-display::before {
  content: '❓';
  position: absolute;
  top: -20px;
  right: -20px;
  font-size: 100px;
  opacity: 0.03;
  pointer-events: none;
}

.mbti-question-display.animate {
  transform: scale(0.98);
  opacity: 0.8;
}

.mbti-question-number {
  font-size: 0.75rem;
  color: #b74e91;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mbti-question-number::before {
  content: '';
  width: 20px;
  height: 2px;
  background: linear-gradient(90deg, #b74e91, transparent);
  border-radius: 2px;
}

.mbti-question-text {
  font-size: 1.15rem;
  color: #fff;
  line-height: 1.7;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Answer Animation - Premium Scale */
.mbti-answer-animation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mbti-answer-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
}

.mbti-answer-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mbti-answer-dot {
  flex: 1;
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.mbti-answer-dot:nth-child(1),
.mbti-answer-dot:nth-child(7) {
  height: 28px;
  border-radius: 14px;
}

.mbti-answer-dot:nth-child(2),
.mbti-answer-dot:nth-child(6) {
  height: 24px;
  border-radius: 12px;
}

.mbti-answer-dot:nth-child(3),
.mbti-answer-dot:nth-child(5) {
  height: 20px;
  border-radius: 10px;
}

.mbti-answer-dot:nth-child(4) {
  background: rgba(255, 255, 255, 0.15);
}

.mbti-answer-dot.selecting {
  animation: mbti-dotPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mbti-answer-dot.selected {
  background: linear-gradient(135deg, #5e42a6 0%, #b74e91 100%);
  box-shadow: 
    0 4px 16px rgba(183, 78, 145, 0.5),
    0 0 30px rgba(183, 78, 145, 0.3);
  transform: scaleY(1.2);
}

.mbti-answer-dot.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, transparent, rgba(255, 255, 255, 0.3));
  border-radius: inherit;
}

@keyframes mbti-dotPulse {
  0% { transform: scaleY(1); }
  40% { transform: scaleY(2); }
  100% { transform: scaleY(1.2); }
}

/* Status Messages - Enhanced */
.mbti-status {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, 
    rgba(183, 78, 145, 0.08) 0%, 
    rgba(94, 66, 166, 0.05) 100%);
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid rgba(183, 78, 145, 0.1);
}

.mbti-status-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: mbti-bounce 1.2s cubic-bezier(0.36, 0, 0.66, -0.56) infinite;
  display: inline-block;
}

@keyframes mbti-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-5deg); }
  75% { transform: translateY(-12px) rotate(5deg); }
}

.mbti-status-text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  font-weight: 500;
}

.mbti-status-subtext {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mbti-status-subtext .mbti-mini-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #b74e91;
  border-radius: 50%;
  animation: mbti-spin 0.8s linear infinite;
}

/* Result Section - Premium Reveal */
.mbti-result-section {
  display: none;
  text-align: center;
  animation: mbti-resultReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mbti-result-section.active {
  display: block;
}

@keyframes mbti-resultReveal {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  50% {
    opacity: 1;
    transform: scale(1.03) translateY(-5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* Result Badge - Premium Circle */
.mbti-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, #5e42a6 0%, #b74e91 100%);
  border-radius: 50%;
  margin-bottom: 28px;
  box-shadow: 
    0 24px 60px rgba(183, 78, 145, 0.45),
    0 0 0 6px rgba(183, 78, 145, 0.15),
    0 0 0 12px rgba(183, 78, 145, 0.08),
    inset 0 -4px 20px rgba(0, 0, 0, 0.2),
    inset 0 4px 20px rgba(255, 255, 255, 0.15);
  animation: mbti-resultPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.mbti-result-badge::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.15) 60deg,
    transparent 120deg
  );
  animation: mbti-badgeRotate 4s linear infinite;
}

@keyframes mbti-badgeRotate {
  to { transform: rotate(360deg); }
}

@keyframes mbti-resultPop {
  0% { 
    transform: scale(0) rotate(-180deg); 
    opacity: 0;
  }
  60% { 
    transform: scale(1.15) rotate(10deg); 
    opacity: 1;
  }
  80% { 
    transform: scale(0.95) rotate(-5deg); 
  }
  100% { 
    transform: scale(1) rotate(0deg); 
  }
}

.mbti-result-type {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.mbti-result-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.mbti-result-nickname {
  font-size: 1.1rem;
  color: #b74e91;
  margin-bottom: 20px;
  font-weight: 600;
  font-style: italic;
}

.mbti-result-description {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.8;
  margin-bottom: 28px;
  padding: 0 12px;
}

/* Traits Grid - Premium Cards */
.mbti-traits-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.mbti-trait {
  background: linear-gradient(145deg, 
    rgba(255, 255, 255, 0.08) 0%, 
    rgba(255, 255, 255, 0.03) 100%);
  border-radius: 16px;
  padding: 18px 10px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.mbti-trait::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #5e42a6, #b74e91);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mbti-trait:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  border-color: rgba(183, 78, 145, 0.3);
}

.mbti-trait:hover::before {
  opacity: 1;
}

.mbti-trait-letter {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #b74e91 0%, #e4ae3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  text-shadow: none;
}

.mbti-trait-name {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Percentage Bars (Optional Enhancement) */
.mbti-trait-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.mbti-trait-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5e42a6, #b74e91);
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Action Buttons - Premium Style */
.mbti-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  margin-bottom: 8px;
}

.mbti-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.mbti-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent);
  transition: left 0.5s ease;
}

.mbti-btn:hover::before {
  left: 100%;
}

.mbti-btn-primary {
  background: linear-gradient(135deg, #b74e91 0%, #5e42a6 100%);
  color: #fff;
  box-shadow: 
    0 6px 24px rgba(183, 78, 145, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mbti-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 10px 35px rgba(183, 78, 145, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.mbti-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.mbti-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(183, 78, 145, 0.3);
  transform: translateY(-2px);
}

/* Social Share Buttons */
.mbti-share-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.mbti-share-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #fff;
}

.mbti-share-btn.kakao {
  background: #FEE500;
  color: #000;
}

.mbti-share-btn.twitter {
  background: #1DA1F2;
}

.mbti-share-btn.facebook {
  background: #4267B2;
}

.mbti-share-btn.copy {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.mbti-share-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Loading State - Premium */
.mbti-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 24px;
}

.mbti-spinner {
  width: 70px;
  height: 70px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: #b74e91;
  border-right-color: #5e42a6;
  border-radius: 50%;
  animation: mbti-spin 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  margin-bottom: 24px;
  box-shadow: 0 0 30px rgba(183, 78, 145, 0.3);
}

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

/* DNA Helix Loader (Alternative) */
.mbti-dna-loader {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 50px;
}

.mbti-dna-dot {
  width: 12px;
  height: 12px;
  background: #b74e91;
  border-radius: 50%;
  animation: mbti-dna 1.2s ease-in-out infinite;
}

.mbti-dna-dot:nth-child(2) { animation-delay: 0.2s; background: #8e44ad; }
.mbti-dna-dot:nth-child(3) { animation-delay: 0.4s; background: #5e42a6; }
.mbti-dna-dot:nth-child(4) { animation-delay: 0.6s; background: #8e44ad; }
.mbti-dna-dot:nth-child(5) { animation-delay: 0.8s; background: #b74e91; }

@keyframes mbti-dna {
  0%, 100% { transform: translateY(-20px) scale(0.8); opacity: 0.5; }
  50% { transform: translateY(20px) scale(1.2); opacity: 1; }
}

/* Error State - Friendly */
.mbti-error-state {
  text-align: center;
  padding: 36px 24px;
}

.mbti-error-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: inline-block;
  animation: mbti-errorShake 0.5s ease-in-out;
}

@keyframes mbti-errorShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.mbti-error-title {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 10px;
  font-weight: 600;
}

.mbti-error-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Confetti Animation - Enhanced */
.mbti-confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}

.mbti-confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  animation: mbti-confettiFall 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.mbti-confetti-piece:nth-child(odd) {
  border-radius: 50%;
}

.mbti-confetti-piece:nth-child(even) {
  border-radius: 2px;
  transform: rotate(45deg);
}

@keyframes mbti-confettiFall {
  0% {
    transform: translateY(-100%) rotate(0deg) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(-80%) rotate(90deg) scale(1);
  }
  100% {
    transform: translateY(120vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* Firework Particles */
.mbti-firework {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: mbti-fireworkBurst 1s ease-out forwards;
}

@keyframes mbti-fireworkBurst {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(3) translateY(-100px);
    opacity: 0;
  }
}

/* Footer - Premium */
.mbti-modal-footer {
  padding: 18px 32px 26px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.1));
}

.mbti-footer-text {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mbti-footer-link {
  color: #b74e91;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mbti-footer-link:hover {
  color: #e4ae3a;
  text-shadow: 0 0 10px rgba(228, 174, 58, 0.5);
}

/* Type Color Themes */
.mbti-modal[data-type-group="analyst"] .mbti-result-badge {
  background: linear-gradient(135deg, #88619a 0%, #5e42a6 100%);
}

.mbti-modal[data-type-group="diplomat"] .mbti-result-badge {
  background: linear-gradient(135deg, #33a474 0%, #2c7a5e 100%);
}

.mbti-modal[data-type-group="sentinel"] .mbti-result-badge {
  background: linear-gradient(135deg, #4298b4 0%, #2d6a8a 100%);
}

.mbti-modal[data-type-group="explorer"] .mbti-result-badge {
  background: linear-gradient(135deg, #e4ae3a 0%, #c9962e 100%);
}

/* Mobile Responsive - Enhanced for Single Screen View */
@media (max-width: 520px) {
  .mbti-modal-overlay {
    overflow-y: auto;  /* ✅ 스크롤 허용 */
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;  /* ✅ 상단 정렬 */
    padding: 10px 0;
  }
  
  .mbti-modal {
    width: 94%;
    max-width: 100%;
    height: auto;
    max-height: none;  /* ✅ 높이 제한 해제 */
    border-radius: 20px;
    margin: 10px auto 20px;  /* ✅ 하단 여백 추가 */
    box-sizing: border-box;
    overflow: visible;  /* ✅ 오버플로우 해제 */
    display: flex;
    flex-direction: column;
  }
  
  .mbti-modal-header {
    padding: 14px 16px 10px;
    flex-shrink: 0;
  }
  
  .mbti-modal-body {
    padding: 0 16px 14px;
    overflow: visible;  /* ✅ 오버플로우 해제 */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;  /* ✅ 상단 정렬 */
  }
  
  .mbti-modal-title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }
  
  .mbti-modal-subtitle {
    font-size: 0.8rem;
  }
  
  .mbti-logo {
    width: 50px;
    height: 50px;
    font-size: 24px;
    border-radius: 14px;
    margin-bottom: 10px;
  }
  
  .mbti-close-btn {
    width: 26px;
    height: 26px;
    top: 10px;
    right: 10px;
    font-size: 14px;
  }
  
  /* 진행 중 화면 컴팩트화 */
  .mbti-progress-section {
    margin-bottom: 12px;
  }
  
  .mbti-question-display {
    padding: 12px;
    min-height: 60px;
    border-radius: 12px;
    margin-bottom: 12px;
  }
  
  .mbti-question-number {
    font-size: 0.65rem;
    margin-bottom: 6px;
  }
  
  .mbti-question-text {
    font-size: 0.9rem;
    line-height: 1.4;
  }
  
  .mbti-answer-animation {
    padding: 8px 10px;
    gap: 3px;
    margin-bottom: 12px;
  }
  
  .mbti-answer-dot:nth-child(1),
  .mbti-answer-dot:nth-child(7) {
    height: 18px;
  }
  
  .mbti-answer-dot:nth-child(2),
  .mbti-answer-dot:nth-child(6) {
    height: 14px;
  }
  
  .mbti-answer-dot:nth-child(3),
  .mbti-answer-dot:nth-child(5) {
    height: 12px;
  }
  
  .mbti-answer-dot:nth-child(4) {
    height: 10px;
  }
  
  .mbti-status {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .mbti-status-icon {
    font-size: 32px;
    margin-bottom: 8px;
  }
  
  .mbti-status-text {
    font-size: 0.85rem;
  }
  
  .mbti-status-subtext {
    font-size: 0.75rem;
    margin-top: 6px;
  }
  
  /* 결과 화면 - 한 화면에 모두 표시 */
  .mbti-result-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
  }
  
  .mbti-result-badge {
    width: 90px;
    height: 90px;
    margin-bottom: 10px;
  }
  
  .mbti-result-type {
    font-size: 1.6rem;
  }
  
  .mbti-result-name {
    font-size: 1.1rem;
    margin-bottom: 2px;
  }
  
  .mbti-result-nickname {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }
  
  .mbti-result-description {
    font-size: 0.8rem;
    margin-bottom: 12px;
    padding: 0 4px;
    line-height: 1.5;
  }
  
  /* 4개 특성 한 줄로 컴팩트하게 */
  .mbti-traits-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
  }
  
  .mbti-trait {
    padding: 8px 2px;
    border-radius: 10px;
  }
  
  .mbti-trait-letter {
    font-size: 1.2rem;
    margin-bottom: 2px;
  }
  
  .mbti-trait-name {
    font-size: 0.55rem;
    letter-spacing: 0;
  }
  
  /* 유명인 섹션 컴팩트 */
  .mbti-famous {
    margin-bottom: 10px;
  }
  
  .mbti-famous-title {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }
  
  .mbti-famous-list {
    gap: 4px;
  }
  
  .mbti-famous-person {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
  
  /* 버튼 가로 배치 - 더 컴팩트 */
  .mbti-actions {
    flex-direction: row;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 10px;  /* ✅ 하단 여백 추가 */
    width: 100%;
    padding-bottom: 10px;  /* ✅ 패딩 추가 */
  }
  
  .mbti-btn {
    padding: 12px 16px;  /* ✅ 패딩 증가 */
    font-size: 0.95rem;
    border-radius: 10px;
    min-height: 44px;  /* ✅ 최소 높이 보장 */
  }
  
  .mbti-share-buttons {
    display: none;  /* 모바일에서 공유 버튼 숨김 - 공간 절약 */
  }
  
  .mbti-modal-footer {
    padding: 12px 16px 16px;  /* ✅ 하단 패딩 증가 */
    flex-shrink: 0;
  }
  
  .mbti-footer-text {
    font-size: 0.65rem;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .mbti-modal {
    width: 96%;
    max-height: none;  /* ✅ 높이 제한 해제 */
  }
  
  .mbti-modal-header {
    padding: 12px 12px 8px;
  }
  
  .mbti-modal-body {
    padding: 0 12px 12px;
  }
  
  .mbti-modal-title {
    font-size: 1.1rem;
  }
  
  .mbti-logo {
    width: 44px;
    height: 44px;
    font-size: 20px;
    margin-bottom: 8px;
  }
  
  .mbti-result-badge {
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
  }
  
  .mbti-result-type {
    font-size: 1.4rem;
  }
  
  .mbti-result-name {
    font-size: 1rem;
  }
  
  .mbti-result-nickname {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
  
  .mbti-result-description {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }
  
  .mbti-traits-grid {
    gap: 4px;
    margin-bottom: 10px;
  }
  
  .mbti-trait {
    padding: 6px 2px;
  }
  
  .mbti-trait-letter {
    font-size: 1rem;
  }
  
  .mbti-trait-name {
    font-size: 0.5rem;
  }
  
  .mbti-btn {
    font-size: 0.85rem;
    padding: 10px 12px;  /* ✅ 패딩 증가 */
    gap: 4px;
    min-height: 40px;  /* ✅ 최소 높이 보장 */
  }
  
  .mbti-modal-footer {
    padding: 10px 12px 14px;  /* ✅ 하단 패딩 증가 */
  }
  
  .mbti-footer-text {
    font-size: 0.6rem;
  }
}

/* Landscape orientation */
@media (max-height: 600px) and (orientation: landscape) {
  .mbti-modal {
    max-height: 98vh;
  }
  
  .mbti-modal-header {
    padding: 16px 28px 12px;
  }
  
  .mbti-logo {
    width: 50px;
    height: 50px;
    font-size: 22px;
    margin-bottom: 10px;
  }
  
  .mbti-modal-title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }
  
  .mbti-modal-subtitle {
    font-size: 0.8rem;
  }
  
  .mbti-result-badge {
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
  }
}

/* Dark scrollbar - Premium */
.mbti-modal::-webkit-scrollbar {
  width: 8px;
}

.mbti-modal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.mbti-modal::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(183, 78, 145, 0.4), rgba(94, 66, 166, 0.4));
  border-radius: 4px;
  border: 2px solid transparent;
}

.mbti-modal::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(183, 78, 145, 0.6), rgba(94, 66, 166, 0.6));
}

/* Sound Wave Animation */
.mbti-sound-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
}

.mbti-sound-bar {
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #b74e91, #5e42a6);
  border-radius: 4px;
  animation: mbti-soundWave 0.8s ease-in-out infinite;
}

.mbti-sound-bar:nth-child(1) { animation-delay: 0s; }
.mbti-sound-bar:nth-child(2) { animation-delay: 0.1s; }
.mbti-sound-bar:nth-child(3) { animation-delay: 0.2s; }
.mbti-sound-bar:nth-child(4) { animation-delay: 0.3s; }
.mbti-sound-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes mbti-soundWave {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* Pulsing Glow Effect */
.mbti-glow-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(183, 78, 145, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: mbti-glowPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes mbti-glowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.8; }
}

/* Success Check Animation */
.mbti-success-check {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #33a474 0%, #2c7a5e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: mbti-successPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mbti-success-check svg {
  width: 32px;
  height: 32px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mbti-success-check svg path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: mbti-checkDraw 0.4s 0.3s ease forwards;
}

@keyframes mbti-successPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes mbti-checkDraw {
  to { stroke-dashoffset: 0; }
}

/* Typing Indicator */
.mbti-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  width: fit-content;
}

.mbti-typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: mbti-typingBounce 1.4s infinite ease-in-out;
}

.mbti-typing-dot:nth-child(1) { animation-delay: 0s; }
.mbti-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mbti-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes mbti-typingBounce {
  0%, 80%, 100% { transform: scale(0); background: rgba(255, 255, 255, 0.3); }
  40% { transform: scale(1); background: #b74e91; }
}

/* Print Styles */
@media print {
  .mbti-modal-overlay {
    position: static;
    background: #fff;
  }
  
  .mbti-modal {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
  }
  
  .mbti-close-btn,
  .mbti-actions,
  .mbti-share-buttons {
    display: none;
  }
}

/* ===== 큰 화면 모바일 (S24 Ultra 등 6.5인치 이상) ===== */
/* 화면 높이가 높은 대형 모바일에서 모달이 한 화면에 잘 들어가도록 */
@media (max-width: 520px) and (min-height: 800px) {
  .mbti-modal {
    max-height: 90vh;
    overflow: hidden;  /* 모달 자체는 overflow hidden */
    display: flex;
    flex-direction: column;
  }
  
  .mbti-modal-header {
    padding: 10px 16px 6px;
    flex-shrink: 0;
  }
  
  .mbti-modal-body {
    flex: 1;
    overflow-y: auto;  /* 바디만 스크롤 */
    padding: 0 16px 8px;
    -webkit-overflow-scrolling: touch;
  }
  
  .mbti-logo {
    width: 44px;
    height: 44px;
    font-size: 20px;
    margin-bottom: 6px;
  }
  
  .mbti-modal-title {
    font-size: 1.1rem;
    margin-bottom: 2px;
  }
  
  .mbti-modal-subtitle {
    font-size: 0.7rem;
  }
  
  .mbti-result-badge {
    width: 70px;
    height: 70px;
    margin-bottom: 6px;
  }
  
  .mbti-result-type {
    font-size: 1.3rem;
  }
  
  .mbti-result-name {
    font-size: 0.95rem;
    margin-bottom: 1px;
  }
  
  .mbti-result-nickname {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
  
  .mbti-result-description {
    font-size: 0.72rem;
    margin-bottom: 8px;
    line-height: 1.35;
  }
  
  .mbti-traits-grid {
    gap: 4px;
    margin-bottom: 8px;
  }
  
  .mbti-trait {
    padding: 6px 2px;
  }
  
  .mbti-trait-letter {
    font-size: 1rem;
  }
  
  .mbti-trait-name {
    font-size: 0.5rem;
  }
  
  /* 유명인 섹션 - 더 컴팩트하게 */
  .mbti-famous {
    margin-bottom: 6px;
  }
  
  .mbti-famous-title {
    font-size: 0.6rem;
    margin-bottom: 4px;
  }
  
  .mbti-famous-list {
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .mbti-famous-person {
    font-size: 0.6rem;
    padding: 2px 6px;
    white-space: nowrap;
  }
  
  /* ✅ 버튼 영역 - 하단 고정, 항상 보이게 */
  .mbti-actions {
    margin-top: 6px;
    margin-bottom: 0;
    gap: 6px;
    padding: 0;
    flex-shrink: 0;
  }
  
  .mbti-btn {
    padding: 10px 10px;
    font-size: 0.82rem;
    flex: 1;
    min-width: 0;
    border-radius: 10px;
  }
  
  .mbti-modal-footer {
    padding: 6px 16px;
    flex-shrink: 0;
  }
  
  .mbti-footer-text {
    font-size: 0.55rem;
  }
}

/* ===== 매우 긴 화면 (S24 Ultra 등) - 높이 900px 이상 ===== */
@media (max-width: 520px) and (min-height: 900px) {
  .mbti-modal {
    max-height: 88vh;
  }
  
  .mbti-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
  }
  
  .mbti-result-badge {
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
  }
  
  .mbti-result-type {
    font-size: 1.4rem;
  }
  
  .mbti-result-name {
    font-size: 1rem;
  }
  
  .mbti-result-description {
    margin-bottom: 10px;
  }
  
  .mbti-traits-grid {
    margin-bottom: 10px;
  }
  
  .mbti-famous {
    margin-bottom: 8px;
  }
  
  .mbti-actions {
    margin-top: 8px;
  }
  
  .mbti-btn {
    padding: 11px 12px;
    font-size: 0.85rem;
  }
}

/* ===== Safe Area 대응 (노치/홀펀치 디스플레이) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 520px) {
    .mbti-modal {
      padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .mbti-modal-footer {
      padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    }
  }
}