/* 우주야 놀자 놀이터 (pages/space-play.html) — 휴대폰 먼저 */
.sp-head { background: linear-gradient(180deg, #2b2f6b 0%, #4a4290 100%); color: #fff; padding: 44px 0 30px; }
.sp-head .label { color: #ffd43b; }
.sp-head .h2, .sp-head .lead { color: #fff; }
.sp-head .lead { opacity: .92; max-width: 620px; }
.sp-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sp-jump a { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 10px 14px; font-size: 15px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.sp-jump a:hover { background: rgba(255,255,255,.26); }

.sp-sec { scroll-margin-top: 70px; }
.sp-h { margin: 6px 0 10px; }
.sp-sec .sub { margin-bottom: 20px; }

/* 놀이 1 */
.sp-maker { display: grid; gap: 20px; }
.sp-stage-wrap { text-align: center; }
.sp-stage { width: 100%; max-width: 440px; aspect-ratio: 1; border-radius: 22px; touch-action: none; cursor: copy; box-shadow: 0 10px 30px rgba(43,47,107,.25); background: #1e2350; }
.sp-stage.is-pen { cursor: crosshair; }
.sp-count { margin-top: 8px; font-weight: 700; color: #4a4290; min-height: 1.5em; }
.sp-group { margin-bottom: 14px; }
.sp-group h3, .sp-name-label { font-size: 15px; margin: 0 0 8px; display: block; font-weight: 700; }
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-tool { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 2px solid #ddd3f5; background: #fff; font-size: 15px; cursor: pointer; }
.sp-tool[aria-pressed="true"] { border-color: #6c5dd3; background: #efeaff; font-weight: 700; }
.sp-color { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1px #ccc; cursor: pointer; }
.sp-color[aria-pressed="true"] { box-shadow: 0 0 0 3px #6c5dd3; transform: scale(1.08); }
.sp-name { width: 100%; max-width: 280px; min-height: 44px; padding: 8px 12px; border: 2px solid #ddd3f5; border-radius: 12px; font-size: 16px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sp-actions .btn { min-height: 44px; }
.sp-center { justify-content: center; }
.sp-tip { margin-top: 12px; }

/* 놀이 2 */
.sp-orbit { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding: 14px 12px; background: #1e2350; border-radius: 18px; min-height: 96px; }
.sp-sun { font-size: 44px; flex: none; }
.sp-slot { display: flex; flex-direction: column; align-items: center; flex: none; color: #fff; animation: sp-pop .35s ease; }
.sp-slot small { font-size: 12px; margin-top: 2px; }
.sp-msg { text-align: center; font-weight: 700; margin: 14px 0; min-height: 1.5em; color: #4a4290; font-size: 17px; }
.sp-pick, .sp-q-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sp-q-choices { grid-template-columns: repeat(3, 1fr); max-width: 480px; margin: 0 auto; }
.sp-planet { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; border: 2px solid #e6def8; background: #fff; cursor: pointer; font-size: 15px; font-weight: 700; min-height: 44px; }
.sp-planet:hover { border-color: #6c5dd3; }
.sp-planet.is-done { opacity: .35; border-color: #8ce99a; }
.sp-q-choices .sp-planet.is-done { opacity: 1; background: #ebfbee; }
.sp-planet:disabled { cursor: default; }
.sp-planet.is-shake { animation: sp-shake .4s; }
.sp-planet.is-glow { animation: sp-glow 1.2s 2; }

/* 놀이 3 */
.sp-quiz { background: #fff; border-radius: 22px; padding: 22px 16px; box-shadow: 0 6px 20px rgba(74,66,144,.1); max-width: 620px; margin: 0 auto; }
.sp-q-step { text-align: center; color: #888; margin: 0; font-size: 14px; }
.sp-q-hint { text-align: center; font-size: 19px; line-height: 1.6; font-weight: 700; margin: 10px 0 18px; color: #2b2f6b; word-break: keep-all; }

/* 우리 집 모빌 */
.sp-mobile { position: relative; background: #fff; border-radius: 22px; padding: 18px 12px 24px; margin-bottom: 14px; min-height: 160px; }
.sp-bar { height: 8px; border-radius: 4px; background: #c9b8a6; margin: 0 6px; }
.sp-hangs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
.sp-hang { margin: 0; display: flex; flex-direction: column; align-items: center; width: 96px; }
.sp-string { width: 2px; background: #999; display: block; }
.sp-hang img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.sp-hang figcaption { font-size: 13px; font-weight: 700; margin-top: 4px; text-align: center; word-break: keep-all; }
.sp-empty { text-align: center; color: #888; margin: 30px 0 0; }
.sp-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }

@keyframes sp-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sp-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes sp-glow { 50% { box-shadow: 0 0 0 5px #ffd43b; } }
@media (prefers-reduced-motion: reduce) { .sp-slot, .sp-planet.is-shake, .sp-planet.is-glow { animation: none; } }

@media (min-width: 760px) {
  .sp-maker { grid-template-columns: 1fr 1fr; align-items: start; }
  .sp-pick { grid-template-columns: repeat(8, 1fr); }
  .sp-hang { width: 120px; }
  .sp-hang img { width: 120px; height: 120px; }
}

/* 모빌 설계도 인쇄: 모빌 칸만 보여요 */
@media print {
  body.sp-printing * { visibility: hidden; }
  body.sp-printing #sp-mobile, body.sp-printing #sp-mobile .sp-mobile, body.sp-printing #sp-mobile .sp-mobile * , body.sp-printing #sp-mobile h2 { visibility: visible; }
  body.sp-printing #sp-mobile { position: absolute; left: 0; top: 0; width: 100%; background: #fff; }
  body.sp-printing .sp-hang img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 동화 영상 */
.sp-movie { position: relative; width: 100%; max-width: 820px; aspect-ratio: 16 / 9; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #1e2350; box-shadow: 0 10px 30px rgba(43,47,107,.2); }
.sp-movie iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sp-movie-link { text-align: center; margin-top: 10px; }

/* 퀴즈 다음 문제 단추: 답을 고르기 전에는 숨겨요 (.btn 의 display 가 hidden 을 덮지 않게) */
[data-sp-q-next][hidden] { display: none; }
