/* 스윙 — 하늘 위 줄타기 */
.stage.sw { touch-action: none; overscroll-behavior: none; background: #8fcbff; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sw-cv { position: absolute; left: 0; top: 0; display: block; touch-action: none; cursor: pointer; }

/* 일시정지 단추 */
.sw-pause { position: absolute; left: 10px; top: 10px; z-index: 4; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(20, 21, 42, 0.55); display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; }
.sw-pause[hidden] { display: none; }
.sw-pause i { display: block; width: 5px; height: 15px; border-radius: 2px; background: #fff; }
.sw-pause:hover { background: rgba(20, 21, 42, 0.75); }
@media (min-width: 700px) and (min-height: 500px) { .sw-pause { width: 46px; height: 46px; } }

/* 단계 이름 띠 · 새 장치 안내 */
.sw-banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; white-space: nowrap;
  padding: 8px 24px 6px; border-radius: 16px; background: rgba(20, 21, 42, 0.78); color: #fff; font-family: var(--title); font-size: 26px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.sw-banner[hidden] { display: none; }
.sw-banner.bad { background: linear-gradient(135deg, rgba(255, 107, 90, 0.95), rgba(210, 70, 80, 0.95)); }
.sw-banner.show { animation: sw-banner 1.6s ease-out both; }
@keyframes sw-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  22% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%); }
}
.sw-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; pointer-events: none; width: max-content; max-width: calc(100% - 24px); text-align: center;
  padding: 9px 18px 8px; border-radius: 16px; background: linear-gradient(135deg, rgba(255, 200, 61, 0.97), rgba(255, 150, 70, 0.96)); color: #2a1a00; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3), 0 0 0 2px #fff; }
.sw-toast[hidden] { display: none; }
.sw-toast b { display: block; font-family: var(--title); font-weight: 400; font-size: 15px; letter-spacing: 0.05em; color: #7a3a00; }
.sw-toast span { display: block; font-family: var(--title); font-size: 19px; line-height: 1.25; }
.sw-toast.show { animation: sw-toast 5.2s ease-out both; }
@keyframes sw-toast { 0% { opacity: 0; transform: translate(-50%, 14px); } 6% { opacity: 1; transform: translate(-50%, 0); } 92% { opacity: 1; } 100% { opacity: 0; } }

/* 판(시작 · 일시정지 · 단계 끝 · 끝) */
.sw .overlay { background: rgba(12, 14, 40, 0.5); backdrop-filter: blur(2px); }
.sw .overlay.sw-menu, .sw .overlay.sw-select { background: linear-gradient(180deg, rgba(12, 14, 40, 0.1), rgba(12, 14, 40, 0.45)); backdrop-filter: none; }
.sw .panel { background: linear-gradient(180deg, rgba(37, 42, 96, 0.97), rgba(27, 31, 72, 0.97)); color: #fff; border: 1px solid rgba(120, 132, 255, 0.45); touch-action: pan-y;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(100, 112, 255, 0.2); }
.sw .panel.wide { width: min(620px, 100%); padding: 18px 18px 20px; }
.sw .panel h2 { color: #fff; }
.sw .panel p, .sw .panel ul { color: #cfd3ff; }
.sw .panel ul { font-size: 14.5px; line-height: 1.5; margin-bottom: 10px; }
.sw .panel li::marker { color: #ffc83d; }
.sw .panel .stats div { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(143, 150, 255, 0.18); }
.sw .panel .stats b { color: #ffd23f; font-size: 24px; }
.sw .panel .stats span { color: #a9afd6; }
.sw .panel .newbest { color: #ffd23f; margin: -4px 0 8px; }
.sw .panel .newbest[hidden], .sw .panel [hidden] { display: none; }
.sw .big-btn { background: linear-gradient(135deg, #6c78ff, #4450dc); box-shadow: 0 8px 22px rgba(100, 112, 255, 0.45); cursor: pointer; }
.sw .big-btn:hover { filter: brightness(1.08); }
.sw .sub-btn { background: rgba(255, 255, 255, 0.06); border-color: rgba(143, 150, 255, 0.25); color: #dfe2ff; text-decoration: none; cursor: pointer; font-family: inherit; }
.sw .sub-btn:hover { background: rgba(255, 255, 255, 0.11); }
.sw-row { display: flex; gap: 8px; }
.sw-row .sub-btn { flex: 1; min-width: 0; }
.sw-robot { display: block; width: 220px; height: auto; margin: -8px auto -4px; filter: drop-shadow(0 6px 14px rgba(100, 112, 255, 0.35)); }
.sw .panel .sw-keys { font-size: 12.5px; color: #a9afd6; margin-bottom: 8px; }
.sw .panel .sw-total { margin: 10px 0 0; font-size: 14px; color: #ffd23f; }
.sw .panel .sw-total:empty { display: none; }
@media (pointer: coarse) { .sw .panel .sw-keys { display: none; } }

/* 단계 선택 */
.sw-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sw-head h2 { flex: 1; margin: 0; text-align: left; font-size: 28px; }
.sw-head b { font-family: var(--title); font-weight: 400; font-size: 18px; color: #ffd23f; }
.sw-x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(143, 150, 255, 0.35); background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 20px; cursor: pointer; flex: none; }
.sw-worlds { max-height: calc(100vh - 220px); overflow: auto; }
.sw-world { margin-top: 10px; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); }
.sw-world h3 { margin: 0 0 8px; font-family: var(--title); font-weight: 400; font-size: 19px; text-align: left; color: #fff; }
.sw-world.w0 h3::before { content: '☁ '; } .sw-world.w1 h3::before { content: '🌄 '; } .sw-world.w2 h3::before { content: '✦ '; } .sw-world.w3 h3::before { content: '❄ '; }
.sw-world.w0 { background: linear-gradient(135deg, rgba(79, 157, 255, 0.28), rgba(255, 255, 255, 0.04)); }
.sw-world.w1 { background: linear-gradient(135deg, rgba(239, 111, 122, 0.28), rgba(255, 207, 143, 0.06)); }
.sw-world.w2 { background: linear-gradient(135deg, rgba(45, 51, 136, 0.5), rgba(120, 240, 255, 0.06)); }
.sw-world.w3 { background: linear-gradient(135deg, rgba(31, 124, 154, 0.35), rgba(90, 255, 190, 0.07)); }
.sw-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
@media (max-width: 520px) { .sw-grid { grid-template-columns: repeat(4, 1fr); } }
.sw-lv { aspect-ratio: 1 / 1.05; border-radius: 12px; border: 1px solid rgba(143, 150, 255, 0.35); background: rgba(20, 22, 60, 0.7); color: #fff; cursor: pointer; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-family: inherit; }
.sw-lv b { font-family: var(--title); font-weight: 400; font-size: 22px; line-height: 1; }
.sw-lv span { display: flex; gap: 1px; }
.sw-lv span i { width: 10px; height: 10px; background: rgba(255, 255, 255, 0.2); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.sw-lv span i.on { background: #ffd23f; }
.sw-lv:hover:not(.lock) { border-color: #ffd23f; transform: translateY(-1px); }
.sw-lv.done { background: rgba(68, 80, 220, 0.55); }
.sw-lv.lock { opacity: 0.45; cursor: default; }
.sw-lv.lock b { font-size: 16px; }

/* 단계 끝: 별 */
.sw .panel .sw-lvname { margin: 0; font-family: var(--title); font-size: 16px; color: #a9afd6; }
.sw .panel .sw-ctitle { margin: 0 0 4px; }
.sw-stars { display: flex; justify-content: center; gap: 10px; margin: 4px 0 8px; }
.sw-stars i { width: 54px; height: 54px; background: rgba(255, 255, 255, 0.14); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transform: scale(0.85); }
.sw-stars i:nth-child(2) { width: 64px; height: 64px; margin-top: -8px; }
.sw-stars i.on { background: linear-gradient(180deg, #ffe680, #ffb21f); animation: sw-star 0.45s cubic-bezier(0.2, 1.8, 0.4, 1) both; filter: drop-shadow(0 0 10px rgba(255, 210, 63, 0.8)); }
.sw-stars i.off { animation: sw-star-off 0.3s ease-out both; }
@keyframes sw-star { 0% { transform: scale(2.2) rotate(-40deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes sw-star-off { 0% { transform: scale(0.6); } 100% { transform: scale(0.85); } }
.sw .panel .sw-goals { list-style: none; padding: 0; margin: 0 auto 6px; display: inline-block; text-align: left; font-size: 14px; }
.sw .panel .sw-goals li { padding-left: 22px; position: relative; color: #8f95c9; }
.sw .panel .sw-goals li::before { content: '☆'; position: absolute; left: 0; color: #8f95c9; }
.sw .panel .sw-goals li.ok { color: #fff; }
.sw .panel .sw-goals li.ok::before { content: '★'; color: #ffd23f; }
.sw .panel .stats { margin: 8px 0 12px; }
.sw .panel .sw-alldone { color: #ffd23f; font-size: 14.5px; }

@media (max-height: 700px) {
  .sw-robot { width: 160px; margin: -12px auto -6px; }
  .sw .panel { padding: 16px 18px; }
  .sw .panel h2 { font-size: 28px; margin: 0 0 4px; }
  .sw .panel p { margin-bottom: 8px; font-size: 14.5px; }
  .sw .panel ul { font-size: 13px; line-height: 1.4; margin-bottom: 8px; }
  .sw .big-btn { padding: 11px; font-size: 22px; }
  .sw-stars i { width: 44px; height: 44px; } .sw-stars i:nth-child(2) { width: 52px; height: 52px; }
}
@media (max-height: 480px) {
  .sw .panel { width: min(640px, 100%); padding: 10px 16px; }
  .sw .panel.wide { width: min(760px, 100%); }
  .sw-robot, .sw .sw-menu ul { display: none; }
  .sw .panel h2 { font-size: 24px; margin: 0 0 2px; }
  .sw .panel p { font-size: 13.5px; margin-bottom: 6px; }
  .sw .panel .stats { margin: 4px 0 6px; }
  .sw .panel .stats b { font-size: 20px; }
  .sw .panel .stats div { padding: 5px 4px; }
  .sw .big-btn { padding: 8px; font-size: 20px; }
  .sw .sub-btn { padding: 7px; margin-top: 6px; }
  .sw-stars { margin: 0 0 2px; } .sw-stars i { width: 36px; height: 36px; } .sw-stars i:nth-child(2) { width: 42px; height: 42px; margin-top: -4px; }
  .sw .panel .sw-goals { font-size: 12.5px; }
  .sw-worlds { max-height: calc(100vh - 120px); }
  .sw-grid { grid-template-columns: repeat(8, 1fr); }
  .sw-banner { top: 30%; font-size: 22px; }
  .sw-toast { bottom: 8px; padding: 6px 14px; } .sw-toast span { font-size: 16px; }
}
