:root {
    --bg-color: #fff0f5; /* Lavender Blush */
    --card-bg: #ffffff;
    --primary-color: #ff69b4; /* Hot Pink */
    --secondary-color: #ffb6c1; /* Light Pink */
    --tertiary-color: #db7093; /* Pale Violet Red */
    --text-color: #5d4a4a;
    --border-color: #ffc0cb; /* Pink */
    --accent-color: #ffd700;
}

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

body {
    background-color: var(--bg-color);
    font-family: 'Gowun Dodum', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-image: radial-gradient(#ffc0cb 0.5px, transparent 0.5px);
    background-size: 20px 20px; /* 잔잔한 도트 패턴 */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

header {
    margin-bottom: 30px;
}

header h1 {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 4rem;
    color: var(--primary-color);
    text-shadow: 3px 3px 0px rgba(255, 182, 193, 0.3);
    margin-bottom: 5px;
}

header p {
    font-size: 1.1rem;
    color: var(--tertiary-color);
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px; /* 더 둥글게 */
    padding: 25px;
    box-shadow: 0 8px 15px rgba(255, 182, 193, 0.2);
}

h2 {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 2.5rem;
    margin-bottom: 20px;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 10px;
    color: var(--tertiary-color);
}

.input-group {
    margin-bottom: 20px;
}

label {
    font-weight: bold;
    margin-right: 10px;
}

input[type="number"] {
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    width: 80px;
    text-align: center;
    font-size: 1rem;
    color: var(--text-color);
    outline: none;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
}

.prize-row {
    margin: 12px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.button-group {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

button {
    padding: 12px 28px;
    border: none;
    border-radius: 50px; /* 알약 모양 */
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    font-family: 'Gowun Dodum', sans-serif;
    transition: all 0.3s;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 0 #e05599;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #e05599;
}

.primary-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #e05599;
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: #fff;
    box-shadow: 0 4px 0 #ff9fb0;
}

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

.tertiary-btn {
    background-color: #f8bbd0;
    color: #ad1457;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 15px;
}

.persistence-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

#info-text {
    margin-top: 20px;
    color: var(--tertiary-color);
    font-size: 0.95rem;
}

#info-text span {
    color: var(--primary-color);
    font-weight: bold;
}

/* 뽑기판 스타일 */
.board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 12px;
    margin-top: 20px;
    padding: 15px;
    background: #fff5f7;
    border: 3px solid #ffdae0;
    border-radius: 15px;
}

.lottery-item {
    aspect-ratio: 1 / 1;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    user-select: none;
    position: relative;
}

.lottery-item:hover {
    transform: scale(1.1) rotate(2deg);
    z-index: 10;
}

.lottery-item.revealed {
    cursor: default;
    transform: rotateY(180deg);
}

.lottery-item .front, .lottery-item .back {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 2px 2px 5px rgba(255, 182, 193, 0.3);
}

.lottery-item .front {
    background: #ffffff;
    border: 2px solid #ffdae0;
    color: var(--primary-color);
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1.5rem;
}

.lottery-item .back {
    background: #fff;
    transform: rotateY(180deg);
    font-size: 1.1rem;
    font-family: 'Nanum Pen Script', cursive;
    border: 2px solid var(--primary-color);
}

.prize-rank-1 .back { background-color: #fff9c4; color: #f57f17; border-color: #fbc02d; }
.prize-rank-2 .back { background-color: #f3e5f5; color: #7b1fa2; border-color: #9c27b0; }
.prize-rank-3 .back { background-color: #e1f5fe; color: #0288d1; border-color: #03a9f4; }
.prize-blank .back { background-color: #f5f5f5; color: #bdbdbd; border-color: #e0e0e0; }

.hidden {
    display: none !important;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats {
    background: white;
    padding: 10px 20px;
    border-radius: 30px;
    border: 2px solid var(--border-color);
    color: var(--tertiary-color);
    font-weight: bold;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 192, 203, 0.6); /* 좀 더 진한 핑크빛 반투명 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(255, 105, 180, 0.3);
    border: 5px solid var(--secondary-color);
    max-width: 550px;
    width: 100%;
    max-height: 90vh; /* 화면 높이의 90%로 제한 */
    overflow-y: auto; /* 내용이 많으면 내부 스크롤 생성 */
    position: relative;
}

.modal-content h2 {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 4rem;
    margin-bottom: 20px;
    border-bottom: none;
    color: var(--primary-color);
}

.help-btn {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 5px 15px;
    font-size: 0.9rem;
    margin-top: 10px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.help-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.help-content {
    max-width: 500px;
    width: 90%;
    padding: 30px !important;
}

.help-body {
    text-align: left;
    margin: 20px 0;
}

.help-item {
    margin-bottom: 20px;
}

.help-item h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.help-item p {
    font-size: 0.95rem;
    color: var(--text-color);
}

#close-help {
    width: 100%;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .board {
        grid-template-columns: repeat(4, 1fr);
    }
    header h1 {
        font-size: 3rem;
    }
}

/* 캐릭터 및 음원 설정 스타일 */
.mascot-container {
    font-size: 5rem;
    margin-bottom: -10px;
    animation: bounce 2s infinite;
}

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

.modal-mascot {
    font-size: 6rem;
    margin-bottom: 10px;
    animation: celebrate 0.5s infinite alternate;
}

@keyframes celebrate {
    from { transform: scale(1) rotate(-10deg); }
    to { transform: scale(1.2) rotate(10deg); }
}

.rank-label {
    min-width: 40px;
    font-weight: bold;
}

.audio-upload-label {
    background-color: #fce4ec;
    color: #f06292;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid #f8bbd0;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 5px;
}

.audio-upload-label:hover {
    background-color: #f8bbd0;
}

.prize-audio {
    display: none;
}

.remove-prize-btn {
    background-color: #ffcdd2;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 5px;
    padding: 0;
    line-height: 1;
}

.remove-prize-btn:hover {
    background-color: #ef9a9a;
    color: white;
}

.warning {
    color: #d32f2f;
    font-weight: bold;
    margin-top: 15px;
    font-size: 0.95rem;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ffcdd2;
}
