/* ====== Global & Base ====== */
body {
  background: #e0e7ef;
  min-height: 100vh;
  margin: 0;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}
.iqtest-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding-top: 30px;
}

/* ====== 테스트 컨테이너 ====== */
.iqtest-container {
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 8px 44px #7dd3fc22, 0 1.5px 8px #6366f122;
  padding: 38px 28px 28px 28px;
  max-width: 500px;
  width: 96vw;
  margin: 0 auto 20px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@media (max-width:650px) {
  .question-meta-wrap { height: 90%;}
  .iqtest-container {
    max-width: 86vw;
    max-height: 125vw;
    border-radius: 18px;
    padding: 10vw 5vw 5vw 5vw;
    min-width: 0;
  }
  .iqtest-container .iqtest-progress-bottom {padding-bottom: 50px; }
}

@media (max-width:400px) {
  .iqtest-container {
    max-width: 86vw;
    max-height: 155vw;
    border-radius: 18px;
    padding: 10vw 5vw 5vw 5vw;
    min-width: 0;
  }
  .iqtest-container .iqtest-progress-bottom {padding-bottom: 50px; }
}

/* ====== 헤더 (로고, 타이머 등) ====== */
.iqtest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.iqtest-logo {
  font-weight: bold;
  font-size: 1.26rem;
  color: #6366f1;
  letter-spacing: 1.2px;
}
.iqtest-timer {
  font-size: 1.1rem;
  font-weight: 700;
  color: #dc2626;
  background: #f1f5ff;
  border-radius: 8px;
  padding: 5px 18px 5px 14px;
  box-shadow: 0 2px 8px #60a5fa19;
  letter-spacing: 1.2px;
}

/* 메타(난이도, 힌트) */
#meta-zone,
.question-meta-wrap {
  width: 100%;
  margin: 0 auto 2px auto;
}
.meta-flex-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 5px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.question-difficulty {
  font-size: 1.03rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.hint-sticker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.hint-sticker {
  background: linear-gradient(90deg,#facc15 60%,#fdba74 100%);
  color: #312e81;
  font-weight: 700;
  border-radius: 16px;
  font-size: 0.97rem;
  padding: 3px 13px;
  margin-left: 7px;
  cursor: pointer;
  transition: background 0.17s;
}
.hint-sticker.hint-opened {
  background: #e0e7ef;
  color: #64748b;
}
.hint-tooltipbox {
  display: none;
  position: absolute;
  left: 100%;      /* 스티커 우측 */
  top: 50%;
  transform: translateY(-50%);
  min-width: 120px;
  max-width: 350px;
  font-size: 0.97rem;
  z-index: 50;
  box-shadow: 0 2px 7px #0001;
}
@media (max-width: 650px) {
  .hint-tooltipbox {
    left: 0;
    top: 110%;
    transform: none;
    min-width: 95vw;
    max-width: 98vw;
    white-space: pre-line;
  }
}



/* ====== 문제 진행 ====== */
.iqtest-progress {
  font-size: 1.05rem;
  color: #64748b;
  font-weight: 500;
  min-width: 118px;
  text-align: right;
  margin: 0 0 6px 0;
}

.iqtest-progress-bar-bg {
  background: #e5e7eb;
  border-radius: 7px;
  height: 11px;
  width: 100%;
  overflow: hidden;
  margin-bottom: 4px;
}
.iqtest-progress-bar-fill {
  background: linear-gradient(90deg, #6366f1 60%, #60a5fa 100%);
  height: 100%;
  width: 2%;
  border-radius: 7px;
  transition: width 0.22s cubic-bezier(.35,1.8,.52,1);
}

.iqtest-question-box {
  background: #f3f4f6;
  border-radius: 16px;
  padding: 24px 13px 22px 13px;
  font-size: 1.33rem;
  min-height: 88px;
  color: #334155;
  margin-bottom: 5px;
  box-shadow: 0 1.5px 7px #6366f11a;
  position: relative;
}
.iqtest-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3열 */
  grid-template-rows: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 24px;
  justify-items: stretch;
  align-items: stretch;
  min-height: 128px;
}
.choice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.17rem;
  font-weight: 700;
  background: #fff;
  border: 2px solid #d1d5db;
  border-radius: 15px;
  min-height: 46px;
  cursor: pointer;
  box-shadow: 0 2px 7px #0001;
  transition: border 0.14s, background 0.14s, box-shadow 0.14s;
  text-align: center;
  padding: 0;
  height: 52px;
}
.choice-btn.selected,
.choice-btn:focus,
.choice-btn:hover {
  border: 2.5px solid #6366f1;
  background: #eef2ff;
  z-index: 1;
}

@media (max-width:600px) {
  .iqtest-choices { gap: 8px; min-height: 84px; }
  .iqtest-choice-btn { font-size: 0.98rem; height: 36px; border-radius: 8px; }
}


/* 내비게이션 버튼 */
.iqtest-nav-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 10px 0 12px 0;
}
.iqtest-nav-btns button {
  flex: 1 1 30%;
  min-width: 85px;
  padding: 13px 0;
  border-radius: 9px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: border 0.15s, background 0.15s, transform 0.12s;
}
.iqtest-nav-btns button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}


/* ====== 메인 페이지 ====== */

.main-container {
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 8px 44px #7dd3fc22, 0 1.5px 8px #6366f122;
  padding: 40px 32px 32px 32px;
  max-width: 530px;
  width: 98vw;
  margin: 0 auto;
  text-align: center;
}

.title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #4f46e5;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.subtitle {
  font-size: 1.13rem;
  color: #64748b;
  margin-bottom: 30px;
}

.puzzle-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 390px;
  max-width: 98vw;
  margin: 10px auto 10px auto;
  aspect-ratio: 1/1;
  gap: 0;
  perspective: 900px;
  position: relative;
  background: #e0e7ef;
  border-radius: 27px;
  box-shadow: 0 6px 26px #38bdf81a, 0 1.5px 8px #6366f122;
}
.puzzle-card {
  position: relative;
  min-width: 0; min-height: 0;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 11px #0001;
  border-radius: 17px;
  z-index: 1;
  transition: 
    box-shadow 0.19s,
    filter 0.17s,
    z-index 0.17s,
    transform 0.38s cubic-bezier(.18,1.3,.49,1.02);
}
.puzzle-bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  background-image: url('../img/main2.jpg');
  background-size: 200% 200%;
  background-repeat: no-repeat;
  background-position: center center;
  z-index: 1;
  filter: brightness(0.96) saturate(1.04);
  transition: filter 0.23s, transform 0.18s;
}
/* 4조각 영역별로 이미지 위치 다르게 */
.piece-tl .puzzle-bg { background-position: left top; }
.piece-tr .puzzle-bg { background-position: right top; }
.piece-bl .puzzle-bg { background-position: left bottom; }
.piece-br .puzzle-bg { background-position: right bottom; }

/* 퍼즐 카드 hover/터치: 3D로 위로 들림, 그림자 강조 */
.puzzle-card:hover, .puzzle-card:focus-visible, .puzzle-card.touch {
  z-index: 10;
  box-shadow: 0 20px 58px #6366f177, 0 2px 12px #38bdf833;
  filter: brightness(1.09) contrast(1.11);
  transform: perspective(650px) rotateX(-14deg) scale(1.04);
}
.puzzle-card:hover .puzzle-bg,
.puzzle-card.touch .puzzle-bg {
  filter: brightness(1.10) blur(0.08px);
  transform: scale(1.06) rotate(-0.7deg);
}

/* 카드 내용(기본: 슬라이드 다운 숨김) */
.puzzle-content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  background: linear-gradient(0deg, #fffbeeb8 85%, #f4f8ff00 100%);
  padding: 18px 10px 12px 10px;
  border-radius: 0 0 16px 16px;
  font-size: 1.09rem;
  box-shadow: 0 6px 32px #6366f122;
  transform: translateY(92%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: 
    opacity 0.34s cubic-bezier(.31,1.7,.53,1),
    transform 0.36s cubic-bezier(.34,1.6,.48,1);
  will-change: opacity, transform;
}
.puzzle-card:hover .puzzle-content,
.puzzle-card:focus .puzzle-content,
.puzzle-card:focus-visible .puzzle-content,
.puzzle-card.touch .puzzle-content {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1.04);
  transition-delay: 0.05s;
}

/* 타이틀/설명/시간: 기본 모두 안보임 */
.puzzle-content .card-title,
.puzzle-content .card-desc,
.puzzle-content .card-time {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.42s cubic-bezier(.34,1.6,.48,1),
    transform 0.41s cubic-bezier(.34,1.6,.48,1);
}

/* PC는 한번에 등장 */
.puzzle-card:hover .card-title,
.puzzle-card:hover .card-desc,
.puzzle-card:hover .card-time,
.puzzle-card:focus .card-title,
.puzzle-card:focus .card-desc,
.puzzle-card:focus .card-time {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

/* 모바일: 카드에 .touch 붙으면 순차로 나타남 */
@media (hover:none) and (pointer:coarse), (max-width:600px) {
  .puzzle-card .card-title,
  .puzzle-card .card-desc,
  .puzzle-card .card-time {
    opacity: 0;
    transform: translateY(22px);
    transition:
      opacity 0.42s cubic-bezier(.34,1.6,.48,1),
      transform 0.41s cubic-bezier(.34,1.6,.48,1);
  }
  .puzzle-card.touch .card-title {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.12s;
  }
  .puzzle-card.touch .card-desc {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.40s;
  }
  .puzzle-card.touch .card-time {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.60s;
  }
  /* 타이틀-카드 여백 넉넉히 */
  .title { margin-bottom: 5vw !important; }
}

/* 텍스트 스타일 */
.card-title {
  font-weight: 800;
  font-size: 1.17rem;
  color: #312e81;
  margin-bottom: 7px;
  text-shadow: 0 2px 7px #fff3;
}
.card-desc {
  font-size: 1.01rem;
  color: #475569;
  line-height: 1.43;
  font-weight: 500;
}
.card-time {
  font-size: 0.93rem;
  color: #0ea5e9;
  margin-left: 6px;
  font-weight: 700;
}

/* 파티클 효과 (모바일에서만) */
.puzzle-content .particle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  background: #a5b4fc;
  box-shadow: 0 0 7px #fff8;
  opacity: 0.9;
  transition: transform 0.75s cubic-bezier(.32,1.6,.59,1), opacity 0.7s;
  will-change: transform, opacity;
}

/* 반응형 */
@media (max-width:650px) {
  .iqtest-wrap { padding: 20px 15px 0px 10px;}
  .main-container { padding: 10px 3vw 10px 3vw; max-width: 89vw;}
  .puzzle-cards-grid { width: 89vw; }
  .main-container .title {padding-top: 30px;}

}
@media (max-width:400px) {
  .iqtest-wrap { padding: 20px 15px 0px 10px;}
  .main-container { padding: 10px 3vw 10px 3vw; max-width: 89vw;}
  .puzzle-cards-grid { border-radius: 18px;}
}

/* ====== 결과 ====== */
.iqtest-wrap .result-container {
  max-width: 500px;
  margin: 5px auto 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 6px 28px #0002;
  text-align: center;
  padding: 15px 14px 12px 14px;
}
.iqtest-wrap .result-title {
  font-size: 1.7rem;
  font-weight: bold;
  color: #6366f1;
  margin-bottom: 7px;
}
.iqtest-wrap .desc {
  font-size: 1.12rem;
  color: #858585;
  margin-bottom: 18px;
}
.iqtest-wrap .name-form-wrap {
  margin-bottom: 18px;
}
.iqtest-wrap .name-label {
  font-size: 1.04rem;
  color: #64748b;
  font-weight: 600;
  margin-right: 7px;
}
.iqtest-wrap .name-input {
  padding: 7px 12px;
  font-size: 1.05rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  width: 150px;
}
.iqtest-wrap .brain-img-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
  width: 300px;
  background: #f0f9ff;
  border-radius: 19px;
  box-shadow: 0 4px 14px #60a5fa22;
  padding-top: 28px;
  padding-bottom: 65px;
  overflow: visible;
}
.iqtest-wrap .brain-img-wrap img {
  width: 280px;
  height: auto;
  border-radius: 19px;
  background: #f0f9ff;
  display: block;
  margin: 0 auto;
  z-index: 1;
}
.iqtest-wrap .score-label {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: bold;
  color: #ffea00;
  text-shadow: 0 2px 8px #fff8, 0 1px 8px #60a5fa22;
  letter-spacing: 2px;
  white-space: nowrap;
  user-select: none;
  animation: popIn 1.1s cubic-bezier(0.4, 2, 0.3, 1) 0.25s both;
  z-index: 2;
}
@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-20deg); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.12) rotate(3deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
.iqtest-wrap .badge-label {
  position: absolute;
  top: 8px;
  right: 15px;
  font-size: 1.13rem;
  background: linear-gradient(90deg,#60a5fa,#6366f1);
  color: #fff;
  font-weight: bold;
  border-radius: 11px;
  padding: 7px 17px 7px 14px;
  box-shadow: 0 2px 7px #6366f133;
  letter-spacing: 0.7px;
  animation: badgePop .95s cubic-bezier(.6,2,.35,1) 0.18s both;
  user-select: none;
  z-index: 3;
}
@keyframes badgePop {
  0% { transform: scale(0.4) rotate(-16deg); opacity: 0;}
  60% { transform: scale(1.18) rotate(2deg); opacity: 1;}
  100% { transform: scale(1) rotate(0deg);}
}
.iqtest-wrap .name-label-img {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  font-size: 1.13rem;
  color: #000000;
  font-weight: 700;
  background: #f0f9ffcc;
  border-radius: 8px;
  padding: 4px 18px 4px 18px;
  letter-spacing: 0.6px;
  user-select: none;
  box-shadow: 0 2px 12px #6366f111;
  max-width: 92%;
  min-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2;
  pointer-events: none;
  text-align: center;
  border: 1px solid #a5b4fc33;
}
.iqtest-wrap .site-address {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: 96%;
  text-align: center;
  font-size: 0.96rem;
  color: #94a3b8;
  font-weight: 500;
  user-select: none;
  letter-spacing: 1px;
  background: #e0f2fe88;
  border-radius: 5px;
  z-index: 2;
  text-decoration: none;
}
.iqtest-wrap .download-btn {
  background: linear-gradient(90deg,#60a5fa,#6366f1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.09rem;
  font-weight: 600;
  padding: 10px 0;
  width: 45%;
  cursor: pointer;
  margin-top: 5px;
  margin-bottom: 5px;
  box-shadow: 0 4px 12px #6366f122;
  transition: background 0.15s, transform 0.13s;
}
.iqtest-wrap .download-btn:hover { background: linear-gradient(90deg,#38bdf8,#6366f1);}
.iqtest-wrap .result-msg {
  color: #0ea5e9;
  font-size: 1.04rem;
  margin-top: 5px;
  margin-bottom: 5px;
}
.iqtest-wrap .social-wrap {
  display: flex;
  justify-content: center;
  gap: 11px;
  margin-top: 10px;
  margin-bottom: 5px;
}
.iqtest-wrap .social-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 8px #0001;
  transition: background .17s, box-shadow .16s;
}
.iqtest-wrap .social-btn:hover {
  background: #bae6fd;
  box-shadow: 0 4px 16px #6366f122;
}
.iqtest-wrap .social-btn svg { vertical-align: middle; }
