/* ── 오버레이 배경 ── */
.round-result-overlay {
    width: calc(100% - 500px);
    height: 100%;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9999999;
    display: none;
}
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ── 팝업 ── */
.results-popup {
    background: linear-gradient(145deg, #2a2a3e 0%, #1e1e2f 100%);
    border-radius: 20px;
    padding: 30px 24px 24px;
    width: 460px;
    max-width: 92vw;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    animation: popupEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 닫기 버튼 ── */
.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: background 0.2s, transform 0.2s;
}
.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ── 반짝이 ── */
.sparkle {
    position: absolute;
    color: #ffd700;
    font-size: 12px;
    animation: sparkleAnim 2s linear infinite;
    pointer-events: none;
}
.sparkle:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.sparkle:nth-child(2) { top: 20%; right: 20%; animation-delay: 0.5s; }
.sparkle:nth-child(3) { bottom: 15%; left: 25%; animation-delay: 1s; }
.sparkle:nth-child(4) { bottom: 25%; right: 15%; animation-delay: 1.5s; }

/* ── 헤더 ── */
.popup-header {
    text-align: center;
    margin-bottom: 20px;
}
.round-pop-title {
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}
.round-pop-title span {
    -webkit-text-fill-color: initial;
}
.subtitle {
    color: #a0a0b0;
    font-size: 13px;
}

/* ── 결과 리스트 (가로 배치) ── */
.results-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 16px;
}
.round-result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}
.round-result-item.first {
    border-color: rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.05);
}

/* ── 순위 아이콘 ── */
.rank-number {
    font-size: 22px;
    text-align: center;
}

/* ── 볼 ── */
.result-ball {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 -2px 6px rgba(0, 0, 0, 0.3), inset 0 2px 6px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transform: translateX(-500px);
    opacity: 0;
}
.result-ball img { width: 100%; }
.result-ball::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 25%;
    height: 25%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    border-radius: 50%;
}
.result-ball.fly-in {
    animation: flyIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ── 프로그레스 바 ── */
.progress-container {
    width: 100%;
    height: 26px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 13px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.progress-bar {
    height: 100%;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.round-result-item.first  .progress-bar { background: linear-gradient(90deg, #e72121, #870909); box-shadow: 0 0 20px rgba(255, 0, 0, 0.4); }
.round-result-item.second .progress-bar { background: linear-gradient(90deg, #007bff85, #0064cf85); }
.round-result-item.third  .progress-bar { background: linear-gradient(90deg, #cd7f32ad, #d98027ad); }

/* ── 배팅 결과 섹션 ── */
.my-bet-result {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.my-bet-result.visible {
    opacity: 1;
    transform: translateY(0);
}
.bet-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: rgba(255, 215, 0, 0.35);
}
.bet-divider::before,
.bet-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
}
.bet-divider-star { font-size: 12px; color: rgba(255, 215, 0, 0.5); }

.bet-result-msg {
    text-align: center;
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}
.bet-result-msg.win {
    color: #ffd700;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.55);
    animation: betMsgPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bet-result-msg.lose { color: #666; }

.bet-stats-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 13px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.bet-stat-col { flex: 1; text-align: center; }
.bet-stat-lbl {
    font-size: 12px;
    color: #fff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 7px;
}
.bet-stat-val {
    font-size: 20px;
    font-weight: 900;
    color: #ccc;
    font-variant-numeric: tabular-nums;
}
.bet-stat-vline {
    width: 1px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}
.win-col .bet-stat-val { color: #4ade80; text-shadow: 0 0 12px rgba(74, 222, 128, 0.45); }
.lose-col .bet-stat-val { color: #555; }

.bet-net-row {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 0;
    border-radius: 10px;
}
.bet-net-row.win {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.25);
    animation: netGlow 1.8s ease-in-out infinite;
}
.bet-net-row.lose {
    color: #e78b8b;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.net-sign { font-size: 16px; margin-right: 2px; }

/* ── 애니메이션 ── */
@keyframes popupEnter {
    from { transform: scale(0.7) translateY(50px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes popupExit {
    from { transform: scale(1) translateY(0); opacity: 1; }
    to   { transform: scale(0.8) translateY(30px); opacity: 0; }
}
@keyframes flyIn {
    0%   { transform: translateX(-500px); opacity: 0; }
    70%  { transform: translateX(10px); opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes titleGlow {
    from { filter: brightness(1); }
    to   { filter: brightness(1.2); }
}
@keyframes sparkleAnim {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50%       { opacity: 1; transform: scale(1) rotate(180deg); }
}
@keyframes betMsgPop {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@keyframes netGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
    50%       { box-shadow: 0 0 14px rgba(74, 222, 128, 0.25); }
}

/* ── 반응형 ── */
@media (max-width: 1500px) {
    .round-result-overlay { width: 500px; left: calc((100% - 500px) / 2); }
}
@media (max-width: 600px), (max-height: 720px) {
    .results-popup { padding: 20px 12px 16px; }
    .popup-header  { margin-bottom: 14px; }
    .round-pop-title { font-size: 20px; }
    .result-ball   { width: 44px; height: 44px; }
    .progress-bar  { font-size: 11px; }
    .bet-stat-val  { font-size: 17px; }
    .bet-net-row   { font-size: 13px; }
}

.my-bet-result {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.my-bet-result.visible {
    opacity: 1;
    transform: translateY(0);
}

.bet-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 16px;
    color: rgba(255,215,0,0.35);
    font-size: 11px;
}
.bet-divider::before,
.bet-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.3), transparent);
}
.bet-divider-star { color: rgba(255,215,0,0.5); font-size: 12px; }

.bet-result-msg {
    text-align: center;
    font-size: 17px;
    font-weight: 900;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}
.bet-result-msg.win {
    color: #ffd700;
    text-shadow: 0 0 18px rgba(255,215,0,0.55);
    animation: betMsgPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.bet-result-msg.lose {
    color: #666;
}

@keyframes betMsgPop {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.bet-stats-row {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(255,255,255,0.07);
    gap: 10px;
}
.bet-stat-col {
    flex: 1;
    text-align: center;
}
.bet-stat-lbl {
    font-size: 12px;
    color: #fff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.bet-stat-val {
    font-size: 20px;
    font-weight: 900;
    color: #ccc;
    font-variant-numeric: tabular-nums;
}
.bet-stat-vline {
    width: 1px;
    height: 44px;
    background: rgba(255,255,255,0.12);
    flex-shrink: 0;
}

.win-col .bet-stat-val {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74,222,128,0.45);
}
.lose-col .bet-stat-val { color: #555; }

.bet-net-row {
    margin-top: 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    padding: 10px 0;
    border-radius: 10px;
}
.bet-net-row.win {
    color: #4ade80;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.25);
    animation: netGlow 1.8s ease-in-out infinite;
}
.bet-net-row.lose {
    color: #e78b8b;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
}
.net-sign {
    font-size: 17px;
    margin-right: 2px;
}

@keyframes netGlow {
    0%,100% { box-shadow: 0 0 0 rgba(74,222,128,0); }
    50%      { box-shadow: 0 0 14px rgba(74,222,128,0.25); }
}
