@font-face {
    font-family: "Pretendard";
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/Pretendard-Regular.woff2") format("woff2");
}
@font-face {
    font-family: "Pretendard";
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/Pretendard-SemiBold.woff2") format("woff2");
}
@font-face {
    font-family: "Pretendard";
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/Pretendard-Bold.woff2") format("woff2");
}

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

body {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
    background: #f4f5f7;
    color: #222;
    line-height: 1.5;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 96px;
}

h1 { font-size: 1.4rem; margin: 12px 0 4px; }
.sub { color: #777; font-size: 0.9rem; margin-bottom: 16px; }

/* 카드 */
.card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
    -webkit-tap-highlight-color: transparent;
}
.card.selected { border-color: #2563eb; background: #eff6ff; }
.card .set-badge {
    font-size: 0.9rem;
    color: #666;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px 6px;
    white-space: nowrap;
}
.card.selected .set-badge { background: #dbeafe; color: #1d4ed8; }
.card .check { margin-left: auto; font-size: 1.2rem; color: #cbd5e1; }
.card.selected .check { color: #2563eb; }

.set-divider {
    font-size: 1rem;
    color: #888;
    margin: 18px 0 8px;
    font-weight: 600;
}

/* 당첨번호 모달 */
.win-title {
    font-size: 1rem;
    color: #333;
    font-weight: 700;
    margin: 20px 0 8px;
}
.win-card { flex-wrap: wrap; row-gap: 8px; }
.win-card .win-balls { flex-wrap: nowrap; }
.bonus-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding: 3px 6px;
    border: 2px solid #c7d2fe;
    border-radius: 14px;
    background: #fff;
}
.bonus-box .bonus-label {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 5px;
    font-size: 0.9rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .5px;
    color: #4f46e5;
    white-space: nowrap;
}

/* 번호 볼 */
.balls { display: flex; gap: 5px; flex-wrap: wrap; }
.pension-num { font-weight: 700; letter-spacing: 1px; }
.deposit-amount { color: #111; font-weight: 700; font-size: 1.2rem; margin-left: auto; }
.round-select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #ddd; font-size: 1rem; background: #fff; }
.ball {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}
.ball.z1 { background: #fbc400; }   /* 1-10 */
.ball.z2 { background: #69c8f2; }   /* 11-20 */
.ball.z3 { background: #ff7272; }   /* 21-30 */
.ball.z4 { background: #aaaaaa; }   /* 31-40 */
.ball.z5 { background: #b0d840; }   /* 41-45 */
.ball.bonus { background: #555; }

/* 하단 고정 버튼 */
.bottom-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.96);
    border-top: 1px solid #e5e7eb;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}
.bottom-bar .inner { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}
.btn:disabled { background: #cbd5e1; cursor: default; }
.btn.secondary { background: #f1f5f9; color: #334155; margin-top: 8px; }
.btn.danger { background: #ef4444; color: #fff; }

/* 상태/안내 페이지 */
.notice {
    background: #fff;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    margin-top: 40px;
}
.notice .emoji { font-size: 2.4rem; margin-bottom: 12px; }
.notice h2 { font-size: 1.2rem; margin-bottom: 8px; }
.notice p { color: #666; font-size: 0.95rem; }
.notice .balls { justify-content: center; margin-top: 16px; }

/* 모달 (확인/진행/결과 공용) */
.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 0 10px;
}
.overlay.show { display: flex; }
.modal-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px;
    text-align: center;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 16px 48px rgba(0,0,0,.3);
    animation: modal-pop .18s ease-out;
}
@keyframes modal-pop {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.modal-emoji {
    width: 64px; height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #f1f5f9;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}
.modal-card h2 { font-size: 1.25rem; margin-bottom: 8px; }
.modal-card p { color: #555; font-size: 0.95rem; line-height: 1.6; white-space: pre-line; }
/* 모달 내 조합 행: 공 6개 + 상태배지를 한 줄에 (좁은 폭 삐짐 방지) */
.modal-card .card { gap: 8px; }
.modal-card .card .balls { flex-wrap: nowrap; gap: 4px; }
.modal-card .ball { width: 28px; height: 28px; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; }
.modal-actions .btn { margin: 0; }
.spinner {
    width: 44px; height: 44px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 이력 테이블 */
.history-item {
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}
.history-item .round { font-weight: 700; }
.history-item .meta { color: #888; font-size: 0.9rem; }
.tag {
    font-size: 0.9rem;
    border-radius: 6px;
    padding: 3px 8px;
    font-weight: 600;
}
.tag.win  { background: #dcfce7; color: #15803d; }   /* 당첨 - 초록 */
.tag.lose { background: #e5e7eb; color: #4b5563; }   /* 낙첨 - 회색 */
.tag.wait { background: #dbeafe; color: #1d4ed8; }   /* 대기 - 파랑 */
.tag.fail { background: #fee2e2; color: #b91c1c; }   /* 실패 - 빨강 */
.history-item.clickable { cursor: pointer; }
.history-item.clickable:active { background: #f8fafc; }

/* 설정 폼 */
.form-group { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.form-group label.title { display: block; font-weight: 700; font-size: 1.1rem; margin-bottom: 12px; }
.form-group .sub-label { font-weight: 700; font-size: 1rem; color: #333; margin-bottom: 10px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row input { display: none; }
.chip-row label.chip {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    background: #fff;
}
.chip-row input:checked + label.chip { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.95rem; }
.field-desc { color: #888; font-size: 0.9rem; margin-top: 10px; line-height: 1.5; }
.warn-banner {
    background: #fef3c7; color: #92400e;
    border-radius: 10px; padding: 10px 14px;
    font-size: 0.9rem; margin-bottom: 14px; font-weight: 600;
}
.nav-links { display: flex; gap: 8px; margin-bottom: 16px; }
.nav-links a {
    flex: 1; text-align: center;
    background: #fff; border-radius: 10px;
    padding: 10px; font-size: 0.9rem;
    color: #334155; text-decoration: none; font-weight: 600;
}
.nav-links a.active { background: #2563eb; color: #fff; }
.nav-links.admin-row { margin-top: -8px; }

/* 게임 선택 탭 (통계): 작은 알약, 선택 시 파랑 */
.game-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.game-tabs a {
    font-size: 0.9rem; font-weight: 600;
    border-radius: 999px; padding: 6px 14px;
    background: #e5e5e5; color: #334155;   /* 미선택 */
    text-decoration: none;
}
.game-tabs a.active { background: #dbeafe; color: #334155; }  /* 선택 */

/* 랜딩 페이지 */
.landing {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.landing-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 28px;
    text-align: center;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.landing-balls {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
}
.landing-title {
    font-size: 1.7rem;
    margin: 0 0 6px;
}
.landing-tagline {
    color: #2563eb;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 18px;
}
.landing-desc {
    color: #555;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 22px;
}
.landing-features {
    list-style: none;
    text-align: left;
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    color: #334155;
}
.landing-features li { padding: 5px 0; }
.landing-btn {
    margin-bottom: 18px;
}
.landing-note {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}
.landing-note strong { color: #b45309; }
.landing-footer {
    color: #b0b6bf;
    font-size: 0.9rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
}

/* 관리자: 요약 배지 */
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.badge {
    font-size: 0.9rem; font-weight: 600;
    border-radius: 999px; padding: 5px 12px;
    background: #f1f5f9; color: #475569;
}
.badge.blue   { background: #dbeafe; color: #1d4ed8; }
.badge.amber  { background: #fef3c7; color: #92400e; }
.badge.red    { background: #fee2e2; color: #b91c1c; }
.badge.green  { background: #dcfce7; color: #15803d; }
.badge.violet { background: #ede9fe; color: #6d28d9; }   /* 수동 */
.badge.teal   { background: #ccfbf1; color: #0f766e; }   /* 자동 */

/* 관리자: 키-값 정렬 목록 */
.kv { font-size: 0.9rem; }
.kv > div { display: flex; gap: 10px; padding: 3px 0; }
.kv .k { color: #9aa0a6; flex: 0 0 104px; }
.kv .v { color: #333; font-weight: 500; }

/* 관리자: 회원 행 */
.member { align-items: flex-start; }
.member .info { flex: 1; min-width: 0; }
.member .name { font-weight: 700; margin-bottom: 6px; }

/* 하단 돌아가기 버튼 */
.btn.back { background: #475569; color: #fff; }
