<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🎰 로또 번호 추천기</title>
<style>
*{
margin:0;
padding:0;
box-sizing:border-box;
font-family:"Pretendard","맑은 고딕",sans-serif;
}
body{
background:linear-gradient(135deg,#667eea,#764ba2);
display:flex;
justify-content:center;
align-items:center;
height:100vh;
}
.container{
background:#fff;
width:500px;
padding:40px;
border-radius:20px;
text-align:center;
box-shadow:0 15px 40px rgba(0,0,0,.25);
}
h1{
margin-bottom:15px;
color:#333;
}
p{
color:#777;
margin-bottom:30px;
}
button{
background:#5B5FEF;
color:white;
border:none;
padding:15px 35px;
font-size:18px;
border-radius:10px;
cursor:pointer;
transition:.3s;
}
button:hover{
background:#4549d9;
transform:scale(1.05);
}
.numbers{
margin-top:35px;
display:flex;
justify-content:center;
flex-wrap:wrap;
gap:12px;
}
.ball{
width:60px;
height:60px;
border-radius:50%;
color:white;
font-size:22px;
font-weight:bold;
display:flex;
justify-content:center;
align-items:center;
box-shadow:0 5px 10px rgba(0,0,0,.2);
}
.yellow{background:#f4b400;}
.blue{background:#4285f4;}
.red{background:#ea4335;}
.gray{background:#777;}
.green{background:#34a853;}
footer{
margin-top:30px;
color:#999;
font-size:13px;
}
</style>
</head>
<body>
<div class="container">
<h1>🎰 로또 번호 추천기</h1>
<p>버튼을 눌러 오늘의 행운 번호를 받아보세요.</p>
<button onclick="generateLotto()">
번호 추천받기
</button>
<div class="numbers" id="numbers"></div>
<footer>
행운은 준비된 사람에게 찾아옵니다 🍀
</footer>
</div>
<script>
function getColor(num){
if(num<=10) return "yellow";
if(num<=20) return "blue";
if(num<=30) return "red";
if(num<=40) return "gray";
return "green";
}
function generateLotto(){
let numbers=[];
while(numbers.length<6){
let n=Math.floor(Math.random()*45)+1;
if(!numbers.includes(n)){
numbers.push(n);
}
}
numbers.sort((a,b)=>a-b);
const result=document.getElementById("numbers");
result.innerHTML="";
numbers.forEach(num=>{
const ball=document.createElement("div");
ball.className="ball "+getColor(num);
ball.textContent=num;
result.appendChild(ball);
});
}
</script>
</body>
</html>