/* Slate Dark Theme & Modern Mobile UI Stylesheet */

html,
body {
    background-color: #0f172a !important;
    color: #f1f5f9;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    margin: 0;
    padding: 0;

    /* 스크롤바는 숨기되 위아래 스크롤 동작 허용 */
    overflow-y: auto;
    overflow-x: hidden;
    -ms-overflow-style: none;
    /* IE, Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Chrome, Safari, Opera 스크롤바 숨김 */
body::-webkit-scrollbar,
html::-webkit-scrollbar {
    display: none;
}

* {
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 상단 기준 정렬로 스크롤 가능 구역 확보 */
    min-height: 100vh;
    padding: 16px;
}

.container {
    background-color: #1e293b;
    padding: 1.8rem 1.2rem;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

/* Header & Emoji */
h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 0.3rem 0;
    color: #38bdf8;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 .emoji {
    -webkit-text-fill-color: initial;
    background: none;
}

.today-line {
    font-size: 0.85rem;
    color: #38bdf8;
    margin-bottom: 1.2rem;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.today-line:empty::before {
    content: "오늘의 행운 한 줄을 불러오는 중...";
    color: #64748b;
}

/* D-Day Timer */
.dday-timer {
    background-color: #0f172a;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 1.2rem;
    border: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.dday-title {
    color: #94a3b8;
    font-weight: 500;
}

.dday-clock {
    color: #f59e0b;
    font-weight: bold;
    font-family: ui-monospace, monospace;
    text-align: right;
}

/* Info Card */
.info-card {
    background-color: #0f172a;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.2rem;
    text-align: left;
    border: 1px solid #334155;
}

.info-card h3 {
    font-size: 0.95rem;
    color: #38bdf8;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-card p {
    font-size: 0.825rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0 0 0.6rem 0;
}

.explain-link {
    color: #38bdf8;
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 1.2rem;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    background-color: #0f172a;
    border: 1px solid #334155;
    color: #94a3b8;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background-color: #0284c7;
    color: white;
    border-color: #38bdf8;
}

/* Game List & Balls */
.game-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 1.5rem 0;
}

.game-row {
    background-color: #0f172a;
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #334155;
}

.game-label {
    font-weight: bold;
    color: #38bdf8;
    font-size: 0.95rem;
    width: 32px;
    text-align: center;
    margin-right: 4px;
}

.ball-container {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex-grow: 1;
    gap: 6px;
}

/* 공 초기 상태: 보이지 않도록 오파시티 0 설정 */
.ball {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: #ffffff;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0);
}

/* 하나씩 등장하는 Pop 애니메이션 */
@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.ball.placeholder {
    opacity: 1;
    transform: scale(1);
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.55;
    }

    50% {
        opacity: 1;
    }
}

/* Buttons & Rows */
.action-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn {
    background-color: #0284c7;
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn:hover {
    background-color: #0369a1;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background-color: #334155;
    color: #f8fafc;
    border: none;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #475569;
}

#soundToggleBtn {
    border-radius: 9999px;
    border: 1px solid #334155;
    background: rgba(30, 41, 59, 0.85);
    color: #94a3b8;
    font-weight: 600;
}

/* Log Box */
.log-box {
    margin-top: 1.2rem;
    background-color: #0f172a;
    padding: 0.8rem;
    border-radius: 10px;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: #38bdf8;
    max-height: 90px;
    overflow-y: auto;
    border: 1px solid #1e293b;
    line-height: 1.4;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.88);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #1e293b;
    padding: 1.5rem;
    border-radius: 18px;
    max-width: 440px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid #334155;
    text-align: left;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-top: 0;
    color: #38bdf8;
    font-size: 1.1rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 8px;
}

.explain-item {
    margin-bottom: 1rem;
}

.explain-item h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    color: #f1f5f9;
}

.explain-item p {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
}

.close-btn {
    width: 100%;
    padding: 10px;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

/* Media Queries */
@media (max-width: 400px) {
    .ball {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .game-row {
        padding: 8px 8px;
    }
}

.mobile-br {
    display: none;
}

@media (max-width: 480px) {
    .mobile-br {
        display: block;
    }
}