/* Refined 2026 guide experience */
.modal-backdrop {
  background: rgba(7, 12, 24, .72);
  backdrop-filter: blur(14px) saturate(120%);
}

.guide-modal {
  --world-accent: #4f46e5;
  width: min(1000px, 100%);
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 26px;
  box-shadow: 0 38px 120px rgba(2, 6, 23, .42);
  overflow: hidden;
}

.modal-topline {
  align-items: center;
  min-height: 78px;
  padding: 18px 82px 18px 32px;
  background: linear-gradient(90deg, #fff 0%, #f8fafc 100%);
  border-bottom: 1px solid #edf0f4;
}

.modal-world {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--world-accent) 10%, white);
  color: var(--world-accent);
  font-family: "Noto Sans KR", sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.modal-world::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--world-accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--world-accent) 14%, transparent);
}

.step-count {
  padding: 6px 10px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  letter-spacing: .14em;
}

.modal-x {
  top: 19px;
  right: 23px;
  width: 40px;
  height: 40px;
  background: #eef1f5;
  color: #334155;
  transition: transform .2s ease, background .2s ease;
}

.modal-x:hover { transform: rotate(8deg); background: #e2e7ee; }
.step-viewport { padding: 34px 38px 4px; }
.guide-step { grid-template-columns: 1.05fr .95fr; gap: 42px; }

.guide-visual {
  height: 344px;
  border: 1px solid #e7ecf2;
  border-radius: 20px;
  background: linear-gradient(145deg, #f7faff, #edf4f8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.guide-copy .eyebrow { margin-bottom: 13px; color: var(--world-accent); }
.guide-copy h2 { font-size: 34px; line-height: 1.22; letter-spacing: -.055em; }
.guide-copy > p:not(.eyebrow) { color: #667085; line-height: 1.75; }
.guide-copy strong { color: #344054; border-top-color: #e7eaf0; font-weight: 700; }
.phone, .mini-screen, .keys kbd, .mouse i { border-color: #27364a; box-shadow: 0 12px 28px rgba(51, 65, 85, .12); }
.rotate-arrow, .swipe { color: var(--world-accent); }
.joystick, .touch-dot { border-color: #27364a; }
.mouse i::after { border-color: var(--world-accent); }
.keyboard-visual { background: linear-gradient(145deg, #f8fafc, #eef2f7); }

.enter-visual {
  position: relative;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--world-accent) 22%, white), #eef2ff 42%, #dbe5ff 100%);
}

.metaverse-scene { position: relative; width: 100%; height: 100%; overflow: hidden; perspective: 700px; }

.gateway {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  width: 132px;
  height: 190px;
  transform: translate(-50%, -50%);
  border-radius: 70px 70px 18px 18px;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--world-accent) 20%, white) 46%, var(--world-accent) 100%);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, .72), 0 0 0 9px color-mix(in srgb, var(--world-accent) 58%, transparent), 0 0 55px color-mix(in srgb, var(--world-accent) 65%, transparent);
  animation: gatewayFloat 3.6s ease-in-out infinite;
}

.gateway::before {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: 55px 55px 12px 12px;
  background: radial-gradient(circle at 50% 34%, #fff 0 8%, color-mix(in srgb, var(--world-accent) 20%, white) 25%, color-mix(in srgb, var(--world-accent) 72%, #111827) 100%);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, .58);
}

.gateway span {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 34px;
  width: 17px;
  height: 17px;
  transform: translateX(-50%);
  border-radius: 50% 50% 45% 45%;
  background: #fff;
  box-shadow: 0 18px 0 -4px #fff, 0 31px 0 -6px #fff;
  animation: avatarGlow 1.8s ease-in-out infinite;
}

.gateway i {
  position: absolute;
  inset: -18px;
  border: 1px solid color-mix(in srgb, var(--world-accent) 55%, transparent);
  border-radius: 82px 82px 26px 26px;
  animation: gatewayPulse 2.8s ease-out infinite;
}

.gateway i:nth-child(2) { animation-delay: .9s; }
.gateway i:nth-child(3) { animation-delay: 1.8s; }

.scene-path {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -26px;
  width: 190px;
  height: 180px;
  transform: translateX(-50%) rotateX(64deg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--world-accent) 56%, transparent), transparent 72%);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  filter: blur(1px);
}

.scene-orbit {
  position: absolute;
  left: 50%;
  top: 47%;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(66deg);
  animation: orbitSpin 9s linear infinite;
}

.orbit-one { width: 340px; height: 150px; }
.orbit-two { width: 440px; height: 210px; animation-duration: 14s; animation-direction: reverse; }
.scene-spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 14px 4px #fff; animation: sparkDrift 3s ease-in-out infinite; }
.spark-one { left: 20%; top: 29%; }
.spark-two { right: 18%; top: 42%; animation-delay: 1.1s; }
.spark-three { left: 28%; bottom: 18%; animation-delay: 2.1s; }

.modal-footer { margin-top: 32px; padding: 22px 38px 28px; background: #fbfcfe; border-top-color: #edf0f4; }
.progress button { height: 6px; background: #d9dee7; }
.progress button.is-active { background: var(--world-accent); }
.modal-actions button, .enter-button { min-width: 128px; padding: 14px 22px; border-radius: 12px; }
.close-button { background: #eef1f5; color: #475467; }

.next-button, .enter-button {
  background: var(--world-accent);
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--world-accent) 30%, transparent);
  transition: transform .2s ease, box-shadow .2s ease;
}

.next-button:hover, .enter-button:hover { transform: translateY(-2px); box-shadow: 0 14px 30px color-mix(in srgb, var(--world-accent) 38%, transparent); }
.enter-button[aria-disabled=true] { background: #c7cbd4; color: #666; box-shadow: none; }

@keyframes gatewayFloat { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, -54%); } }
@keyframes gatewayPulse { 0% { transform: scale(.9); opacity: .8; } 80%, 100% { transform: scale(1.22); opacity: 0; } }
@keyframes avatarGlow { 50% { filter: drop-shadow(0 0 10px #fff); transform: translateX(-50%) scale(1.08); } }
@keyframes orbitSpin { to { transform: translate(-50%, -50%) rotateX(66deg) rotateZ(360deg); } }
@keyframes sparkDrift { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-16px); opacity: 1; } }

@media (max-width: 820px) {
  .guide-modal { border-radius: 22px; }
  .guide-step { gap: 26px; }
  .guide-visual { height: 265px; }
  .step-viewport { padding: 26px 28px 2px; }
  .modal-footer { padding: 20px 28px 24px; }
  .gateway { width: 105px; height: 150px; }
}

@media (max-width: 560px) {
  .modal-backdrop {
    align-items: stretch;
    padding: 0;
    background: #fff;
  }

  .guide-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    max-height: none;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .modal-topline {
    flex: 0 0 auto;
    min-height: 66px;
    padding: max(12px, env(safe-area-inset-top)) 66px 12px 18px;
  }

  .modal-world { font-size: 15px; padding: 8px 13px; }

  .modal-x {
    top: max(13px, env(safe-area-inset-top));
    right: 16px;
    width: 42px;
    height: 42px;
  }

  .step-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 16px 18px 24px;
  }

  .guide-step.is-active {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .guide-visual {
    flex: 0 0 auto;
    width: 100%;
    height: clamp(168px, 29dvh, 218px);
    border-radius: 16px;
  }

  .guide-copy .eyebrow { margin-bottom: 7px; }
  .guide-copy h2 { margin-bottom: 10px; font-size: 24px; line-height: 1.28; }
  .guide-copy > p:not(.eyebrow) { margin-bottom: 13px; font-size: 14px; line-height: 1.65; }
  .guide-copy strong { padding-top: 12px; font-size: 12px; }

  .modal-footer {
    position: relative;
    z-index: 4;
    flex: 0 0 auto;
    display: grid;
    align-items: stretch;
    justify-content: stretch;
    gap: 12px;
    margin-top: 0;
    padding: 12px 18px max(14px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid #e8ecf2;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, .08);
    backdrop-filter: blur(14px);
  }

  .progress { width: 100%; justify-content: center; }
  .progress button { width: 24px; height: 6px; }
  .progress button.is-active { width: 42px; }
  .modal-actions { width: 100%; }
  .modal-actions button, .enter-button {
    width: 100%;
    min-height: 50px;
    border-radius: 13px;
  }

  .gateway { width: 88px; height: 128px; }
  .orbit-one { width: 245px; }
  .orbit-two { width: 320px; }
}

@media (max-width: 560px) and (max-height: 700px) {
  .modal-topline { min-height: 58px; }
  .step-viewport { padding-top: 12px; }
  .guide-step.is-active { gap: 12px; }
  .guide-visual { height: 154px; }
  .guide-copy h2 { font-size: 22px; }
  .guide-copy > p:not(.eyebrow) { line-height: 1.5; }
  .modal-footer { gap: 9px; padding-top: 9px; }
}

@media (max-width: 560px) {
  body.modal-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gateway, .gateway i, .gateway span, .scene-orbit, .scene-spark { animation: none !important; }
}
