* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    margin: 0;
    padding: 2rem 1rem;
}

.container {
    text-align: center;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 560px;
    border: 1px solid rgba(255,255,255,0.1);
}

h1 {
    color: #fff;
    font-size: 2rem;
    margin: 0 0 1.5rem;
    letter-spacing: 1px;
}

h2 {
    color: #fff;
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem;
}

/* ── 탭 ── */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 5px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    background: transparent;
    color: rgba(255,255,255,0.5);
    transition: all 0.2s;
}

.tab.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── 버튼 ── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-green {
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: #fff;
    box-shadow: 0 4px 15px rgba(76,175,80,0.4);
}

.btn-green:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76,175,80,0.5);
}

.btn-gray {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-gray:hover { background: rgba(255,255,255,0.2); }

.btn-draw {
    background: linear-gradient(135deg, #e040fb, #7b1fa2);
    color: #fff;
    font-size: 1.1rem;
    padding: 14px 32px;
    box-shadow: 0 4px 20px rgba(224,64,251,0.4);
}

.btn-draw:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(224,64,251,0.5);
}

.action-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.manual-btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1rem;
}

/* ── 번호 그리드 ── */
.hint {
    color: rgba(255,255,255,0.7);
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 0.5rem;
}

.grid-num {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.grid-num:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.grid-num.selected {
    background: var(--c);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 10px var(--c);
    transform: scale(1.1);
}

/* ── 로또 공 ── */
.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--c) 80%, white), var(--c));
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 2px 3px rgba(255,255,255,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.ball.winning {
    width: 54px;
    height: 54px;
    font-size: 1.2rem;
    box-shadow: 0 0 20px var(--c), 0 4px 10px rgba(0,0,0,0.3);
}

.ball.bonus {
    width: 54px;
    height: 54px;
    font-size: 1.2rem;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.ball.match {
    box-shadow: 0 0 14px var(--c), 0 4px 10px rgba(0,0,0,0.3);
    transform: scale(1.1);
}

.ball.dim {
    opacity: 0.35;
    filter: grayscale(60%);
}

/* ── 게임 세트 목록 ── */
.game-sets-section { margin-top: 1.5rem; }

.game-set {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    animation: slideIn 0.25s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.set-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.set-index {
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
}

.set-type {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}

.set-balls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: center;
}

.set-balls .ball { width: 40px; height: 40px; font-size: 0.95rem; }

.remove-btn {
    background: rgba(255,80,80,0.2);
    border: none;
    color: rgba(255,120,120,0.9);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.remove-btn:hover { background: rgba(255,80,80,0.4); }

/* ── 추첨 결과 ── */
.draw-result {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.winning-display {
    margin-bottom: 0.5rem;
}

.winning-balls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.plus-bonus {
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    font-weight: 700;
}

.bonus-label {
    color: rgba(255,255,255,0.4);
    font-size: 0.75rem;
    margin-top: 6px;
}

.results-list { margin-top: 1.5rem; }

.result-item {
    background: rgba(255,255,255,0.05);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    animation: slideIn 0.3s ease;
}

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

.prize-label {
    font-weight: 800;
    font-size: 1rem;
    padding: 4px 12px;
    border-radius: 20px;
}

.prize-1 .prize-label { background: linear-gradient(135deg, #FFD700, #FFA000); color: #000; }
.prize-2 .prize-label { background: linear-gradient(135deg, #C0C0C0, #9E9E9E); color: #000; }
.prize-3 .prize-label { background: linear-gradient(135deg, #CD7F32, #8D4E08); color: #fff; }
.prize-4 .prize-label { background: linear-gradient(135deg, #69c8f2, #1976D2); color: #fff; }
.prize-5 .prize-label { background: linear-gradient(135deg, #b0d840, #558B2F); color: #fff; }
.no-prize .prize-label { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); }

.result-balls {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-balls .ball { width: 42px; height: 42px; font-size: 1rem; }

.match-info {
    margin-top: 8px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
}

.prize-1, .prize-2 { border-color: rgba(255,215,0,0.3); }
.prize-3 { border-color: rgba(205,127,50,0.3); }

/* ── 캐릭터 섹션 ── */
.character-section {
    margin-top: 2rem;
    animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.character-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* 말풍선 */
.speech-bubble {
    position: relative;
    background: white;
    border-radius: 18px;
    padding: 14px 20px;
    max-width: 280px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    z-index: 2;
    animation: bubblePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: -8px;
}

@keyframes bubblePop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: white;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.1));
}

.speech-bubble p {
    margin: 0;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
}

.speech-bubble strong {
    color: #c940f0;
    font-size: 1.05rem;
}

/* 캐릭터 SVG */
#charSvg {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 8px 20px rgba(201,64,240,0.3));
    animation: charFloat 3s ease-in-out infinite;
}

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

/* 입 열고 닫기 */
#charMouthGroup .mouth-open { display: none; }
#charMouthGroup.open .mouth-open  { display: block; }
#charMouthGroup.open .mouth-closed { display: none; }

/* 반짝이 애니메이션 */
.sparkle { transform-origin: center; }

.sparkle-1 { animation: sparklePulse 1.6s ease-in-out infinite; }
.sparkle-2 { animation: sparklePulse 2.1s ease-in-out infinite 0.3s; }
.sparkle-3 { animation: sparkleFade 1.8s ease-in-out infinite 0.6s; }
.sparkle-4 { animation: sparkleFade 2.3s ease-in-out infinite 1s; }

@keyframes sparklePulse {
    0%, 100% { opacity: 0.9; transform: scale(1) rotate(0deg); }
    50%       { opacity: 0.4; transform: scale(0.6) rotate(20deg); }
}

@keyframes sparkleFade {
    0%, 100% { opacity: 0.8; }
    50%       { opacity: 0.1; }
}

/* ── 룰렛 추첨 애니메이션 ── */
.roulette-section {
    margin-top: 2rem;
    padding: 1.5rem 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.3s ease;
}

.roulette-section h2 {
    margin: 0 0 1.2rem;
    font-size: 1.2rem;
}

.roulette-slots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    min-height: 70px;
}

/* 스피닝 상태 */
@keyframes roulette-spin {
    0%   { transform: rotateY(0deg) scale(1); }
    50%  { transform: rotateY(180deg) scale(1.05); }
    100% { transform: rotateY(360deg) scale(1); }
}

/* 착지 애니메이션 */
@keyframes ball-land {
    0%   { transform: scale(1.6) translateY(-8px); box-shadow: 0 0 40px var(--c); }
    50%  { transform: scale(0.88) translateY(4px); }
    75%  { transform: scale(1.08) translateY(-2px); }
    100% { transform: scale(1) translateY(0); }
}

@keyframes bonus-land {
    0%   { transform: scale(1.8) translateY(-10px); box-shadow: 0 0 60px #fff; }
    50%  { transform: scale(0.85) translateY(5px); }
    75%  { transform: scale(1.1) translateY(-3px); }
    100% { transform: scale(1) translateY(0); }
}

.roulette-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--c) 80%, white), var(--c));
    box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 2px 3px rgba(255,255,255,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    transition: background 0.05s;
}

.roulette-ball.spinning {
    animation: roulette-spin 0.3s linear infinite;
    opacity: 0.85;
    filter: blur(0.5px);
}

.roulette-ball.bonus-pending {
    border: 2px dashed rgba(255,255,255,0.4);
}

.roulette-ball.landed {
    animation: ball-land 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    box-shadow: 0 0 18px var(--c), 0 4px 14px rgba(0,0,0,0.4);
}

.roulette-ball.bonus-ball {
    animation: bonus-land 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 30px rgba(255,255,255,0.5), 0 0 18px var(--c);
    width: 64px;
    height: 64px;
    font-size: 1.3rem;
}

.roulette-bonus-label {
    margin-top: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 0.78rem;
    text-align: right;
    padding-right: 8px;
    animation: fadeIn 0.4s ease;
}
