
/* ============== 모달 컨테이너 (라이트/다크 자동 추종) ==============
   색상은 전부 테마 토큰(--accent-primary / --accent-primary-rgb / --bg-* / --text-* / --border-dark)로 구동.
   → 라이트: 흰 배경 + 그린(#1ea459), 다크: 어두운 배경 + 틸(#14b8a6). 하드코딩 색 제거. */
.lotto-modal-content {
    position: relative;
    width: 92%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 26px 26px;
    text-align: center;
    border-radius: 20px;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(var(--accent-primary-rgb),0.10), transparent 55%),
        var(--bg-primary);
    border: 1px solid rgba(var(--accent-primary-rgb),0.28);
    box-shadow:
        0 24px 60px rgba(0,0,0,0.28),
        inset 0 1px 0 rgba(var(--accent-primary-rgb),0.12);
    animation: lottoModalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* 다크 모드에선 깊이감 있는 그라디언트 + 강한 그림자 */
[data-theme="dark"] .lotto-modal-content {
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(20,184,166,0.14), transparent 55%),
        linear-gradient(180deg, #0c1a1f 0%, #0a1419 100%);
    box-shadow:
        0 24px 60px rgba(0,0,0,0.65),
        inset 0 1px 0 rgba(20,184,166,0.18);
}
@keyframes lottoModalIn {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.lotto-modal-content::-webkit-scrollbar { width: 4px; }
.lotto-modal-content::-webkit-scrollbar-thumb { background: rgba(var(--accent-primary-rgb),0.2); border-radius: 2px; }

/* 다크 모드: 전역 catch-all 규칙 [data-theme="dark"] [class$="-header"]/[class$="-list"]/[class$="-wrap"] 가
   모달 안 .lotto-header(-header)·.lvi-list(-list)·.lotto-ticket-wrap(-wrap) 에 글래스 배경(#0f1419)을 입혀
   라이트 모드엔 없는 '검은 박스'가 생김 → 모달 안에서만 투명으로 되돌려 라이트 모드와 동일하게 함 (라이트 모드·전역 규칙 불변). */
[data-theme="dark"] #lotto-modal .lotto-header,
[data-theme="dark"] #lotto-modal .lvi-list,
[data-theme="dark"] #lotto-modal .lotto-ticket-wrap {
    background: transparent;
    border-color: transparent;
}

/* ============== 닫기 버튼 ============== */
.lotto-close-btn {
    position: absolute;
    top: 14px; right: 16px;
    width: 32px; height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
}
.lotto-close-btn:hover {
    color: var(--accent-primary);
    border-color: rgba(var(--accent-primary-rgb),0.4);
    transform: rotate(90deg);
}

/* ============== 헤더 ============== */
.lotto-header { margin-bottom: 22px; }
.lotto-eyebrow {
    font-size: 10px; font-weight: 600;
    letter-spacing: 4px;
    color: rgba(var(--accent-primary-rgb),0.7);
    margin-bottom: 6px;
}
.lotto-title {
    font-size: 26px; font-weight: 900;
    letter-spacing: 4px;
    color: var(--accent-primary);
    text-shadow: 0 0 24px rgba(var(--accent-primary-rgb),0.35);
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}
.lotto-divider {
    width: 64px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    margin: 10px auto 0;
}

/* ============== 업체 이용권 경품 안내 ============== */
.lotto-voucher-info {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid rgba(var(--accent-primary-rgb), 0.25);
    border-radius: 12px;
    background: rgba(var(--accent-primary-rgb), 0.06);
    text-align: center;
}
.lvi-title {
    font-size: 14px; font-weight: 700; color: var(--accent-primary);
    letter-spacing: 0.5px; margin-bottom: 10px;
}
.lvi-list {
    list-style: none; margin: 0 0 10px; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.lvi-list li {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.lvi-note {
    margin: 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.7;
}
.lotto-reward-intro {
    text-align: center; margin: -2px 0 16px;
    font-size: 13px; color: var(--text-muted); line-height: 1.6;
}
.lotto-reward-intro strong { color: var(--accent-primary); font-weight: 700; }

/* ============== 조건 (게이지 형태) ============== */
.lotto-conditions { margin-bottom: 20px; }
.lotto-cond-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.3s;
}
.lotto-cond-item .cond-icon {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 12px; font-weight: 700;
    background: var(--bg-hover);
    color: var(--text-muted);
    flex-shrink: 0;
}
.lotto-cond-item .cond-text { flex: 1; text-align: left; }
.lotto-cond-item .cond-progress {
    width: 70px; height: 5px;
    background: var(--bg-hover);
    border-radius: 3px; overflow: hidden;
    flex-shrink: 0;
}
.lotto-cond-item .cond-progress-bar {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.lotto-cond-item.done {
    background: rgba(var(--accent-primary-rgb),0.08);
    border-color: rgba(var(--accent-primary-rgb),0.28);
    color: var(--accent-primary);
}
.lotto-cond-item.done .cond-icon {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    color: #ffffff;
}
.lotto-cond-item.fail .cond-icon {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
}

/* ============== 복권 카드 ============== */
.lotto-ticket-wrap { margin: 18px auto 12px; }
.lotto-ticket {
    position: relative;
    width: 300px; height: 180px;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--accent-primary);
    background:
        radial-gradient(circle at 20% 20%, rgba(var(--accent-primary-rgb),0.12), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(var(--accent-primary-rgb),0.10), transparent 45%),
        var(--bg-secondary);
    box-shadow:
        0 10px 30px rgba(0,0,0,0.25),
        inset 0 0 30px rgba(var(--accent-primary-rgb),0.08),
        inset 0 1px 0 rgba(var(--accent-primary-rgb),0.25);
}
/* 다크 모드 티켓은 원래의 깊은 카드 그라디언트 유지 */
[data-theme="dark"] .lotto-ticket {
    background:
        radial-gradient(circle at 20% 20%, rgba(20,184,166,0.12), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(20,184,166,0.1), transparent 45%),
        linear-gradient(135deg, #1a2833 0%, #0f1a1f 100%);
    box-shadow:
        0 10px 30px rgba(0,0,0,0.5),
        inset 0 0 30px rgba(20,184,166,0.08),
        inset 0 1px 0 rgba(20,184,166,0.25);
}
.lotto-ticket::before {
    content: 'DOPAMINE';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: rgba(var(--accent-primary-rgb),0.06);
    font-size: 38px; font-weight: 900;
    letter-spacing: 8px;
    pointer-events: none;
    z-index: 0;
}
.lotto-ticket::after {
    content: ''; position: absolute;
    top: 8px; right: 12px;
    width: 8px; height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(var(--accent-primary-rgb),0.6);
    animation: ticketDot 2s ease-in-out infinite;
}
@keyframes ticketDot {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
#lotto-canvas {
    position: absolute; top: 0; left: 0;
    cursor: pointer; z-index: 2;
    border-radius: 12px;
}
.lotto-result {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 6px; z-index: 1;
}
.lotto-result .result-emoji { font-size: 42px; line-height: 1; }
.lotto-result .result-name {
    font-size: 18px; font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: 1px;
}
.lotto-result .result-amount {
    font-size: 12px;
    color: var(--text-muted);
}
.lotto-result.lose .result-name { color: var(--text-muted); }

.lotto-hint {
    font-size: 12px;
    color: rgba(var(--accent-primary-rgb),0.6);
    margin-top: 12px;
    letter-spacing: 1px;
    animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

/* ============== 뽑기 버튼 (메탈릭) ============== */
.lotto-play-btn {
    position: relative;
    display: inline-block;
    padding: 14px 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-secondary) 50%, var(--accent-primary) 100%);
    color: #ffffff;
    font-size: 14px; font-weight: 900;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.25s;
    margin-top: 8px;
    box-shadow:
        0 4px 20px rgba(var(--accent-primary-rgb),0.35),
        inset 0 1px 0 rgba(255,255,255,0.4);
    overflow: hidden;
}
.lotto-play-btn::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}
.lotto-play-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 30px rgba(var(--accent-primary-rgb),0.55),
        inset 0 1px 0 rgba(255,255,255,0.5);
}
.lotto-play-btn:hover::before { left: 100%; }
.lotto-play-btn:active { transform: translateY(0); }
.lotto-play-btn:disabled {
    opacity: 0.5; cursor: not-allowed; transform: none;
    box-shadow: none;
}

/* ============== 결과 영역 ============== */
.lotto-result-area {
    margin-top: 18px;
    padding: 18px 16px;
    border-radius: 12px;
}
.lotto-result-area.win {
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(var(--accent-primary-rgb),0.18), transparent 60%),
        rgba(var(--accent-primary-rgb),0.07);
    border: 1px solid rgba(var(--accent-primary-rgb),0.4);
    animation: winGlow 2s ease-in-out infinite alternate;
}
@keyframes winGlow {
    from { box-shadow: 0 0 20px rgba(var(--accent-primary-rgb),0.18); }
    to { box-shadow: 0 0 40px rgba(var(--accent-primary-rgb),0.45); }
}
.lotto-result-area.lose {
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
}

/* "오늘의 결과" 박스 */
.lotto-already {
    text-align: center;
}
.lotto-already .already-label {
    font-size: 10px; font-weight: 600;
    letter-spacing: 3px;
    color: rgba(var(--accent-primary-rgb),0.6);
    margin-bottom: 6px;
}
.lotto-result-area.win .already-result {
    font-size: 20px; font-weight: 900;
    color: var(--accent-primary);
    text-shadow: 0 0 20px rgba(var(--accent-primary-rgb),0.4);
    letter-spacing: 1px;
}
.lotto-result-area.lose .already-result {
    font-size: 18px; font-weight: 700;
    color: var(--text-muted);
}

/* ============== 당첨자 ============== */
.lotto-winners {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(var(--accent-primary-rgb),0.14);
    text-align: left;
}
.lotto-winners h4 {
    font-size: 10px; font-weight: 600;
    letter-spacing: 3px;
    color: rgba(var(--accent-primary-rgb),0.55);
    margin: 0 0 10px;
    text-align: center;
}
.lotto-winner-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.2s;
}
.lotto-winner-item:hover {
    background: rgba(var(--accent-primary-rgb),0.06);
    border-color: rgba(var(--accent-primary-rgb),0.2);
}
.lotto-winner-item .win-reward {
    color: var(--accent-primary); font-weight: 700;
}

/* ============== 컨페티 (당첨 시) ============== */
.lotto-confetti {
    position: absolute;
    width: 8px; height: 8px;
    pointer-events: none;
    animation: confettiFall 1.4s ease-out forwards;
}
@keyframes confettiFall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(160px) rotate(540deg); opacity: 0; }
}

/* ============== 모바일 대응 ============== */
@media (max-width: 480px) {
    .lotto-modal-content { padding: 28px 20px 22px; }
    .lotto-title { font-size: 22px; letter-spacing: 3px; }
    .lotto-ticket { width: 100%; max-width: 280px; height: 168px; }
    #lotto-canvas { width: 100%; }
}
