/* 룰렛 이벤트 모달 ---------------------------------------------------------- */

.roulette-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    letter-spacing: -0.07em;
    word-break: keep-all;
}

.roulette-modal[hidden],
.roulette-modal [hidden] {
    display: none;
}

.roulette-modal *,
.roulette-modal *::before,
.roulette-modal *::after {
    box-sizing: border-box;
}

:where(.roulette-modal) button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.roulette-modal__dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.roulette-modal__content {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 40px 30px 30px;
    border: 1px solid #E5E5E5;
    border-radius: 16px;
    background: #fff;
    color: #1F2420;
}

.roulette-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.roulette-modal__view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 상단 안내 --------------------------------------------------------------- */

.roulette-modal__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.roulette-modal__badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #E7F3E5;
    color: #238B4B;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.roulette-modal__title {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
}

.roulette-modal__desc {
    margin: 0;
    color: #8A8A8A;
    font-size: 14px;
    line-height: 1.5;
}

/* 사전 지급 혜택 안내 ------------------------------------------------------ */

.roulette-modal__given {
    align-self: stretch;
    margin: 8px 0 0;
    padding: 14px 16px;
    border: 2px solid #FFD84D;
    border-radius: 12px;
    background: #FFF6C9;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
}

.roulette-modal__given strong {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(transparent 58%, #FFD84D 58%);
}

.roulette-modal__given span {
    display: block;
    margin-top: 4px;
    color: #6B5300;
    font-size: 13px;
    font-weight: 600;
}

/* 룰렛 판 ---------------------------------------------------------------- */

.roulette-wheel {
    position: relative;
    width: min(100%, 290px);
    aspect-ratio: 1 / 1;
    margin: 18px auto 4px;
}

/* 바깥 테두리 및 전구 */
.roulette-wheel::before,
.roulette-wheel::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.roulette-wheel::before {
    background-color: #1F2420;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20200%20200%27%3E%3Ccircle%20cx%3D%27124.38%27%20cy%3D%279.01%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3Ccircle%20cx%3D%27190.99%27%20cy%3D%2775.62%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3Ccircle%20cx%3D%27166.61%27%20cy%3D%27166.61%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3Ccircle%20cx%3D%2775.62%27%20cy%3D%27190.99%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3Ccircle%20cx%3D%279.01%27%20cy%3D%27124.38%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3Ccircle%20cx%3D%2733.39%27%20cy%3D%2733.39%27%20r%3D%272.5%27%20fill%3D%27%23FFD84D%27%2F%3E%3C%2Fsvg%3E");
    box-shadow: 0 10px 22px rgba(31, 36, 32, 0.22);
}

.roulette-wheel::after {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20200%20200%27%3E%3Ccircle%20cx%3D%27166.61%27%20cy%3D%2733.39%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3Ccircle%20cx%3D%27190.99%27%20cy%3D%27124.38%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3Ccircle%20cx%3D%27124.38%27%20cy%3D%27190.99%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3Ccircle%20cx%3D%2733.39%27%20cy%3D%27166.61%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3Ccircle%20cx%3D%279.01%27%20cy%3D%2775.62%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3Ccircle%20cx%3D%2775.62%27%20cy%3D%279.01%27%20r%3D%272.5%27%20fill%3D%27%23FFFFFF%27%2F%3E%3C%2Fsvg%3E");
    animation: roulette-light 1.2s steps(1) infinite;
    pointer-events: none;
}

@keyframes roulette-light {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* 룰렛 바늘 */
.roulette-wheel__pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    z-index: 3;
    width: 34px;
    height: 47px;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%20-5%2036%2049%27%3E%3Cpath%20d%3D%27M18%2041.5%20L5.2%2019.6%20A14.6%2014.6%200%201%201%2030.8%2019.6%20Z%27%20fill%3D%27%23E64646%27%20stroke%3D%27%231F2420%27%20stroke-width%3D%273%27%20stroke-linejoin%3D%27round%27%2F%3E%3Ccircle%20cx%3D%2718%27%20cy%3D%2714.5%27%20r%3D%275%27%20fill%3D%27%23fff%27%2F%3E%3C%2Fsvg%3E") no-repeat center / contain;
    filter: drop-shadow(0 2px 2px rgba(31, 36, 32, 0.25));
    transform: translateX(-50%);
    transform-origin: 50% 30%;
}

/* 회전 중 바늘 애니메이션 */
.roulette-modal__view--spin:has(.roulette-modal__confirm:disabled) .roulette-wheel__pointer {
    animation: roulette-tick 0.16s ease-in-out 26 alternate;
}

@keyframes roulette-tick {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(-14deg); }
}

/* 룰렛 6칸 (12시 방향부터 시계 방향, 마지막 칸은 1등) */
.roulette-wheel__board {
    position: absolute;
    inset: 5.6%;
    z-index: 1;
    margin: 0;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: conic-gradient(
        #F4FAF1 0deg 60deg,
        #C4EAD2 60deg 120deg,
        #F4FAF1 120deg 180deg,
        #C4EAD2 180deg 240deg,
        #F4FAF1 240deg 300deg,
        #FFD84D 300deg 360deg
    );
    list-style: none;
    overflow: hidden;
    transition: transform 4.6s cubic-bezier(.12, .72, .1, 1);
}

/* 칸 구분선 및 가장자리 음영 */
.roulette-wheel__board::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle, transparent 62%, rgba(31, 36, 32, 0.07) 100%),
        repeating-conic-gradient(from -0.6deg, #fff 0deg 1.2deg, transparent 1.2deg 60deg);
}

.roulette-wheel__item {
    position: absolute;
    top: 0;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 90px;
    height: 50%;
    margin-left: -45px;
    padding-top: 17px;
    line-height: 1.2;
    letter-spacing: -0.03em;
    transform-origin: 50% 100%;
    transform: rotate(calc(var(--i) * 60deg + 30deg));
}

.roulette-wheel__item span {
    color: #4F5852;
    font-size: 12px;
    font-weight: 600;
}

.roulette-wheel__item strong {
    font-size: 17px;
    font-weight: 700;
}

/* 1등 칸 */
.roulette-wheel__item:last-child span {
    color: #6B5300;
}

/* 룰렛 중앙 블토기 */
.roulette-wheel__hub {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 25%;
    filter: drop-shadow(0 3px 5px rgba(31, 36, 32, 0.28));
    transform: translate(-50%, -50%);
}

.roulette-wheel__hub img {
    display: block;
    width: 100%;
}

/* 당첨 결과 --------------------------------------------------------------- */

.roulette-win__art {
    display: block;
    width: 140px;
    margin: 0 auto;
}

.roulette-win__box {
    padding: 16px;
    border-radius: 12px;
    background: #F8F8F8;
}

.roulette-win__box-title {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

.roulette-win__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.roulette-win__list li {
    position: relative;
    padding-left: 10px;
    color: #6B6E6B;
    font-size: 13px;
    line-height: 1.5;
}

.roulette-win__list li::before {
    content: "·";
    position: absolute;
    left: 0;
}

.roulette-win__expire {
    margin: 0;
    color: #E64646;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

/* 하단 버튼 --------------------------------------------------------------- */

.roulette-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.roulette-modal__confirm,
.roulette-modal__cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: inherit;
}

.roulette-modal__confirm {
    border: 1px solid #42BC74;
    background: #42BC74;
    color: #fff;
}

.roulette-modal__confirm:hover {
    background: #3DAE6A;
}

.roulette-modal__confirm:disabled {
    border-color: #E5E5E5;
    background: #F2F2F2;
    color: #A0A398;
    cursor: default;
}

.roulette-modal__cancel {
    border: 1px solid #E5E5E5;
    background: #fff;
    color: #1F2420;
}

.roulette-modal__cancel:hover {
    background: #F5F5F5;
}

.roulette-modal__note {
    margin: 0;
    color: #8A8A8A;
    font-size: 12px;
    text-align: center;
}

/* 모바일 ----------------------------------------------------------------- */

@media (max-width: 480px) {
    .roulette-modal { padding: 16px; }
    .roulette-modal__content { padding: 36px 20px 20px; }
    .roulette-modal__view { gap: 16px; }
    .roulette-modal__title { font-size: 18px; }
    .roulette-wheel { width: min(100%, 260px); }
    .roulette-wheel__item { padding-top: 14px; }
    .roulette-wheel__item span { font-size: 11px; }
    .roulette-wheel__item strong { font-size: 15px; }
}

/* 움직임 줄이기 설정 대응 */
@media (prefers-reduced-motion: reduce) {
    .roulette-wheel__board { transition-duration: .6s; }

    .roulette-wheel::after,
    .roulette-wheel__pointer {
        animation: none !important;
    }
}