@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nanum Gothic', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

/* 별 배경 */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--d) ease-in-out infinite alternate;
  opacity: 0;
}

@keyframes twinkle {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 0.8; transform: scale(1.2); }
}

/* 카드 컨테이너 */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 36px 32px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.05) inset;
}

/* 헤더 */
.header {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  font-size: 52px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 16px rgba(255,200,0,0.6));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px rgba(255,255,255,0.3);
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.3px;
}

/* 티켓 */
.ticket {
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.ticket::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,200,0,0.12), transparent 70%);
  pointer-events: none;
}

.ticket-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.ticket-round {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.ticket-date {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* 번호 영역 */
.lotto-numbers {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 60px;
  align-items: center;
  margin-bottom: 18px;
}

/* 빈 슬롯 */
.empty-slot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.03);
}

/* 번호 볼 */
.number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  position: relative;
  cursor: default;
  animation: dropIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  box-shadow:
    0 6px 16px rgba(0,0,0,0.35),
    0 2px 4px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.35);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.number::after {
  content: '';
  position: absolute;
  top: 8px; left: 12px;
  width: 14px; height: 6px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  filter: blur(2px);
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 번호 색상 (실제 로또 규칙 반영) */
.num-yellow  { background: radial-gradient(circle at 40% 35%, #ffe259, #ffa751); }
.num-blue    { background: radial-gradient(circle at 40% 35%, #4facfe, #00a0ff); }
.num-red     { background: radial-gradient(circle at 40% 35%, #ff6b6b, #e03a3a); }
.num-gray    { background: radial-gradient(circle at 40% 35%, #b0b0b0, #787878); }
.num-green   { background: radial-gradient(circle at 40% 35%, #43e97b, #38b26a); }

.ticket-footer {
  text-align: center;
}

.ticket-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* 버튼 */
.generate-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7971e, #ffd200);
  color: #1a1a1a;
  font-family: 'Nanum Gothic', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow:
    0 4px 20px rgba(247,151,30,0.45),
    0 1px 0 rgba(255,255,255,0.3) inset;
  letter-spacing: 0.3px;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(247,151,30,0.55),
    0 1px 0 rgba(255,255,255,0.3) inset;
}

.generate-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(247,151,30,0.35);
}

.generate-btn.spinning .btn-icon {
  display: inline-block;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-icon { font-size: 18px; }

/* 기록 섹션 */
.history-section {
  margin-top: 24px;
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeSlideIn 0.3s ease both;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.history-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.history-time {
  margin-left: auto;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* 반응형 */
@media (max-width: 380px) {
  .container { padding: 28px 20px; }
  .number, .empty-slot { width: 46px; height: 46px; font-size: 16px; }
  .lotto-numbers { gap: 7px; }
}
