:root {
    --bg-dark: #070714;
    --neon-blue: #00f3ff;
    --neon-purple: #9d00ff;
    --neon-pink: #ff00ea;
    --text-main: #ffffff;
    --text-muted: #a0a0b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow: hidden; /* 진정한 SPA 느낌, 스크롤 방지 */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Particles */
#particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, #130b29 0%, var(--bg-dark) 100%);
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.3;
    pointer-events: none;
    animation: floatUp infinite linear;
}

@keyframes floatUp {
    from {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    to {
        transform: translateY(-10vh) scale(1.5);
        opacity: 0;
    }
}

/* App Container */
#app {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    position: relative;
    padding: 2rem;
}

/* Top Right Controls Container */
.top-right-controls {
    position: absolute;
    top: 2.5rem;
    right: 10%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-end;
    z-index: 100;
}

/* Reset Button */
.reset-btn {
    background: rgba(255, 0, 234, 0.1); /* 약간의 네온 핑크 배경 */
    color: var(--text-main); /* 흰색 텍스트로 또렷하게 */
    border: 2px solid var(--neon-pink); /* 핑크색 네온 테두리 */
    box-shadow: 0 0 15px rgba(255, 0, 234, 0.3), inset 0 0 10px rgba(255, 0, 234, 0.1); /* 은은한 발광 효과 */
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(8px);
    letter-spacing: 1px;
}

.reset-btn:hover {
    background: var(--neon-pink);
    color: var(--bg-dark);
    box-shadow: 0 0 25px rgba(255, 0, 234, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px) scale(1.05);
}

.reset-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Global Auto Button */
.global-auto-btn {
    background: rgba(0, 243, 255, 0.1);
    color: var(--text-main);
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3), inset 0 0 10px rgba(0, 243, 255, 0.1);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(8px);
    letter-spacing: 1px;
    display: none; /* hidden by default */
}

.global-auto-btn:hover {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px) scale(1.05);
}

.global-auto-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Number Slots */
.number-slots-container {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    z-index: 100;
}

.slot {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
}

.slot.filled {
    border-color: rgba(0, 243, 255, 0.6);
    background: rgba(0, 243, 255, 0.1);
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3), inset 0 0 15px rgba(0, 243, 255, 0.2);
    transform: scale(1.1) translateY(-5px);
    animation: floatingUI 3s ease-in-out infinite alternate;
}

/* 숫자 1~10 (노랑) */
.slot.filled.c-10 {
    border-color: rgba(251, 196, 0, 0.8);
    background: rgba(251, 196, 0, 0.1);
    text-shadow: 0 0 10px rgba(251, 196, 0, 0.8);
    box-shadow: 0 0 20px rgba(251, 196, 0, 0.4), inset 0 0 15px rgba(251, 196, 0, 0.2);
}
/* 숫자 11~20 (파랑) */
.slot.filled.c-20 {
    border-color: rgba(0, 243, 255, 0.8);
    background: rgba(0, 243, 255, 0.1);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4), inset 0 0 15px rgba(0, 243, 255, 0.2);
}
/* 숫자 21~30 (빨강) */
.slot.filled.c-30 {
    border-color: rgba(255, 114, 114, 0.8);
    background: rgba(255, 114, 114, 0.1);
    text-shadow: 0 0 10px rgba(255, 114, 114, 0.8);
    box-shadow: 0 0 20px rgba(255, 114, 114, 0.4), inset 0 0 15px rgba(255, 114, 114, 0.2);
}
/* 숫자 31~40 (회색) */
.slot.filled.c-40 {
    border-color: rgba(170, 170, 170, 0.8);
    background: rgba(170, 170, 170, 0.1);
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.8);
    box-shadow: 0 0 20px rgba(170, 170, 170, 0.4), inset 0 0 15px rgba(170, 170, 170, 0.2);
}
/* 숫자 41~45 (초록) */
.slot.filled.c-50 {
    border-color: rgba(176, 216, 64, 0.8);
    background: rgba(176, 216, 64, 0.1);
    text-shadow: 0 0 10px rgba(176, 216, 64, 0.8);
    box-shadow: 0 0 20px rgba(176, 216, 64, 0.4), inset 0 0 15px rgba(176, 216, 64, 0.2);
}

/* Copy Button */
.copy-btn {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    color: var(--text-main);
    border: none;
    padding: 0 1.5rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    align-items: center;
    justify-content: center;
}

.copy-btn.show {
    display: flex !important;
    animation: popNumber 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.copy-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 20px rgba(157, 0, 255, 0.6);
}

.copy-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Screen Transitions */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 10;
}

.screen.active:has(.tooltip-wrapper:hover) {
    z-index: 9999;
}

/* Main Screen Layout */
header {
    text-align: center;
    margin-bottom: 4rem;
    animation: floatingUI 6s ease-in-out infinite;
}

.logo {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

.logo span {
    font-weight: 300;
    color: var(--text-main);
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: unset;
    text-shadow: none;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-top: 1rem;
    font-weight: 300;
}

/* Cards */
.card-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.game-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem 2rem;
    width: 300px;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: floatingUI 4s ease-in-out infinite;
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
    transition: transform 0.3s ease;
}

.game-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.game-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.neon-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Hover Effects */
.game-card:hover {
    transform: translateY(-20px) scale(1.05) !important;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 243, 255, 0.4);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 243, 255, 0.1);
}

.game-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.game-card:hover .neon-line {
    opacity: 1;
}

.game-card:nth-child(2):hover {
    border-color: rgba(157, 0, 255, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), 0 0 20px rgba(157, 0, 255, 0.2), inset 0 0 20px rgba(157, 0, 255, 0.1);
}
.game-card:nth-child(2) .neon-line {
    background: linear-gradient(90deg, transparent, var(--neon-purple), transparent);
}

.game-card:nth-child(3):hover {
    border-color: rgba(255, 0, 234, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5), 0 0 20px rgba(255, 0, 234, 0.2), inset 0 0 20px rgba(255, 0, 234, 0.1);
}
.game-card:nth-child(3) .neon-line {
    background: linear-gradient(90deg, transparent, var(--neon-pink), transparent);
}


/* Scroll Arrows */
.scroll-arrow {
    font-size: 1.8rem;
    color: var(--neon-blue);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
    display: none; /* Only show on mobile when needed */
}

.scroll-arrow.top-arrow {
    top: 7rem;
    animation: bounceTop 2s infinite;
}

.scroll-arrow.bottom-arrow {
    bottom: 5rem;
    animation: bounceBottom 2s infinite;
}

.scroll-arrow.visible {
    opacity: 1;
}

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

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

/* Game Screens */
nav {
    position: absolute;
    top: 2rem;
    left: 2rem;
    animation: floatingUI 5s ease-in-out infinite reverse;
}

.back-btn {
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid rgba(0, 243, 255, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.back-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transform: translateX(-5px);
}

.game-content {
    text-align: center;
    animation: floatingUI 6s ease-in-out infinite;
}

.game-content h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.placeholder-dome, .placeholder-target, .placeholder-spinner {
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    border: 2px dashed var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.02);
}

/* Floating Animation Keyframes */
@keyframes floatingUI {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

/* --- Game 1 Styles --- */

/* Dome Container */
.dome-container {
    width: 300px;
    height: 300px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 60%, transparent);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1),
                inset 10px 0 40px rgba(0, 243, 255, 0.2),
                inset -10px 0 40px rgba(157, 0, 255, 0.2),
                0 0 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Canvas styling inside dome */
.dome-container canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

/* Draw Button & Group */
.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    z-index: 100;
    position: relative;
}

.draw-btn {
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
    color: var(--text-main);
    border: none;
    padding: 1rem 3rem;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 100;
}

.draw-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.draw-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(157, 0, 255, 0.6);
}

.draw-btn:hover::before {
    left: 100%;
}

.draw-btn:active {
    transform: translateY(2px) scale(0.98);
}

.draw-btn:disabled {
    background: var(--glass-border);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.draw-btn:disabled::before {
    display: none;
}

/* Auto Button Override */
.auto-btn {
    background: linear-gradient(90deg, #10ac84, #1dd1a1);
    box-shadow: 0 0 15px rgba(29, 209, 161, 0.4);
}

.auto-btn:hover {
    box-shadow: 0 10px 25px rgba(29, 209, 161, 0.6);
}

/* Zoom ball effect */
.zoom-ball {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 1), 0 0 6px rgba(0, 0, 0, 0.8), 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.5);
    opacity: 0;
    pointer-events: none;
}

/* Light burst animation */
.zoom-ball.animate {
    animation: zoomBurst 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoomBurst {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
        filter: brightness(1) blur(10px);
    }
    40% {
        transform: translate(-50%, -50%) scale(5);
        opacity: 1;
        filter: brightness(2) blur(0px);
        box-shadow: 0 0 100px var(--neon-pink), inset 0 0 30px #fff;
    }
    80% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 1;
        filter: brightness(1.5) blur(0px);
    }
    100% {
        transform: translate(-50%, 40vh) scale(0.5); /* drops down towards slot */
        opacity: 0;
        filter: brightness(1) blur(5px);
    }
}

/* --- Game 2 Styles --- */

.target-game-container {
    position: relative;
    width: 300px;
    height: 400px; /* 하단 공간 확보 */
    margin: 0 auto 2rem;
}

#target-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    z-index: 5;
    animation: floatingUI 5s ease-in-out infinite;
}

#target-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.3), inset 0 0 20px rgba(0, 243, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.1);
    /* transform은 js에서 직접 제어합니다 */
}

.target-game-container.shake #target-wrapper {
    animation: shakeTarget 0.4s ease-in-out;
}
.target-game-container.shake #target-canvas {
    box-shadow: 0 0 40px rgba(255, 0, 85, 0.6);
    border-color: rgba(255, 0, 85, 0.5);
}

@keyframes shakeTarget {
    0% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-10px) rotate(-5deg); }
    40% { transform: translateX(10px) rotate(5deg); }
    60% { transform: translateX(-10px) rotate(-5deg); }
    80% { transform: translateX(10px) rotate(5deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

.arrow-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.arrow {
    position: absolute;
    bottom: -60px; /* 초기 화면 밖에서 대기 */
    left: 50%;
    width: 4px;
    height: 40px;
    background: linear-gradient(to top, rgba(200, 150, 100, 1), #fff);
    transform: translateX(-50%);
    transition: bottom 0.5s cubic-bezier(0.2, 0.8, 0.4, 1);
    z-index: 10;
}

/* 화살촉 모형 */
.arrow::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -6px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid var(--neon-blue);
    filter: drop-shadow(0 0 5px var(--neon-blue));
}

/* 전통 화살 깃 모양 */
.arrow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -4px;
    width: 12px;
    height: 15px;
    background: repeating-linear-gradient(45deg, transparent, transparent 2px, #ddd 2px, #ddd 4px);
    box-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.arrow.shoot {
    bottom: 70px; /* 발사 시 과녁 하단 끝자락(반지름 언저리) 도달 */
}

@keyframes arrowBounce {
    0% { bottom: 70px; transform: translateX(-50%) rotate(0deg); }
    30% { bottom: 120px; transform: translateX(-50%) rotate(-45deg); opacity: 1; }
    100% { bottom: -100px; transform: translateX(-150px) rotate(-120deg); opacity: 0; }
}

.arrow.bounce {
    animation: arrowBounce 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.notification-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: var(--neon-pink);
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 0, 234, 0.8);
    background: rgba(0, 0, 0, 0.8);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    border: 2px solid var(--neon-pink);
    z-index: 20;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    text-align: center;
    line-height: 1.4;
    pointer-events: none;
}

.notification-text.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* --- Game 3 Styles --- */

.spinner-game-container {
    width: 300px;
    height: 300px;
    margin: 0 auto 2rem;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-game-container::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 250px; height: 150px;
    background: repeating-linear-gradient(transparent, transparent 2px, rgba(0, 243, 255, 0.1) 3px, rgba(0, 243, 255, 0.1) 4px);
    pointer-events: none;
    border-radius: 20px;
    z-index: 2;
}

.digital-number {
    font-size: 8rem;
    font-weight: 900;
    font-family: 'Courier New', Courier, monospace;
    color: var(--neon-blue);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.8), 0 0 40px rgba(0, 243, 255, 0.5), 0 0 80px rgba(157, 0, 255, 0.5);
    background: -webkit-linear-gradient(#fff, var(--neon-blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: filter 0.1s ease, transform 0.1s ease;
    z-index: 5;
    position: relative;
}

/* Rolling Motion Blur Effect */
.digital-number.rolling {
    filter: blur(4px);
    transform: scaleY(1.3);
    text-shadow: 0 15px 20px rgba(0, 243, 255, 0.8), 0 -15px 20px rgba(0, 243, 255, 0.8);
}

/* Easing out Motion Blur */
.digital-number.slowing {
    filter: blur(2px);
    transform: scaleY(1.1);
    text-shadow: 0 5px 10px rgba(0, 243, 255, 0.8), 0 -5px 10px rgba(0, 243, 255, 0.8);
}

/* Stop Flash & Pop Effect */
.spinner-game-container.flash::before {
    content: '';
    position: fixed;
    top: 50%; left: 50%; 
    width: 200vw; height: 200vh;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(0, 243, 255, 0.5) 20%, transparent 60%);
    pointer-events: none;
    z-index: 9999;
    animation: flashBurst 0.8s ease-out forwards;
}

.digital-number.pop {
    animation: popNumber 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    color: var(--neon-pink);
    text-shadow: 0 0 30px rgba(255, 0, 234, 1), 0 0 60px rgba(255, 0, 234, 0.8);
    background: -webkit-linear-gradient(#fff, var(--neon-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes flashBurst {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

@keyframes popNumber {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* --- 숫자 확정 시 파티클 폭죽 애니메이션 --- */
.burst-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    /* random 변수를 받아 퍼지는 방향 결정 */
    animation: explode 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
        box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    }
    100% {
        transform: scale(0) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

/* --- Jackpot Finale Overlay --- */
.jackpot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex; /* 자바스크립트에서 flex로 변경하여 나타나게 함 */
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 10000;
}

.jackpot-text {
    font-size: 8rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px #ff00ea,
        0 0 20px #ff00ea,
        0 0 40px #ff00ea,
        0 0 80px #ffd700;
    opacity: 0;
    transform: scale(0.2);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.jackpot-text.show {
    opacity: 1;
    transform: scale(1) rotate(-5deg);
    animation: pulseColor 1.5s infinite alternate;
}

@keyframes pulseColor {
    0% {
        text-shadow: 0 0 10px #ff00ea, 0 0 20px #ff00ea, 0 0 40px #ff00ea, 0 0 80px #ffd700;
        transform: scale(1) rotate(-5deg);
    }
    100% {
        text-shadow: 0 0 15px #00f3ff, 0 0 30px #00f3ff, 0 0 60px #00f3ff, 0 0 100px #ffd700;
        transform: scale(1.05) rotate(5deg);
    }
}

/* Custom Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: var(--glass-bg);
    border: 1px solid var(--neon-pink);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 0, 234, 0.3), inset 0 0 20px rgba(255, 0, 234, 0.1);
    transform: scale(0.8) translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-overlay.show .custom-modal {
    transform: scale(1) translateY(0);
}

.custom-modal p {
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 2rem;
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.modal-btn {
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.modal-btn.confirm {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    color: white;
    box-shadow: 0 0 15px rgba(255, 0, 234, 0.4);
}

.modal-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 0, 234, 0.7);
}

.modal-btn.cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Scroll Arrow Styles */
.scroll-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--neon-blue);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    z-index: 10;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.scroll-arrow.visible {
    opacity: 1;
    animation: bounce 1.5s infinite ease-in-out;
}

.scroll-arrow.top-arrow {
    top: 9rem;
}

.scroll-arrow.bottom-arrow {
    bottom: 2rem; /* just above the number slots if they overlap, or maybe we just put bottom: 2rem */
}

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

/* =========================================
   Responsive Design (Media Queries)
   ========================================= */

/* 태블릿 (Tablet) - 1024px 이하 */
@media screen and (max-width: 1024px) {
    .card-container {
        gap: 1.5rem;
    }
    .game-card {
        width: 280px;
        padding: 2.5rem 1.5rem;
    }
}

/* 모바일 (Mobile) - 768px 이하 */
@media screen and (max-width: 768px) {
    #app {
        padding: 1rem;
    }
    header {
        margin-bottom: 2.5rem;
        margin-top: 3.5rem;
    }
    .logo {
        font-size: 3rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    
    .reset-btn {
        top: 1rem;
        right: 1rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .card-container {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 1.2rem;
        
        /* 세로로 길어진 카드들을 스크롤해서 볼 수 있도록 수정 */
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        padding-top: 3rem; /* Push cards down so the first one is clearly visible */
        padding-bottom: 140px; /* 숫자 슬롯(고정)에 마지막 화면이 가려지지 않게 여유 공간 */
        
        /* SPA 느낌을 위해 스크롤바 숨김 처리 */
        -ms-overflow-style: none; /* IE, Edge */
        scrollbar-width: none; /* Firefox */
    }
    .card-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .scroll-arrow.bottom-arrow {
        bottom: 150px; /* Number slots above offset */
    }
    
    .game-card {
        width: 90%;
        max-width: 350px;
        padding: 2rem 1.5rem;
        flex-shrink: 0; /* 카드가 세로로 찌그러져 텍스트가 가려지는 현상 방지 */
    }

    nav {
        top: 1rem;
        left: 1rem;
    }
    .back-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .game-content h2 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    /* 번호 슬롯 반응형 조정 */
    .number-slots-container {
        bottom: 1rem;
        gap: 0.5rem;
        flex-wrap: wrap;
        width: 100%;
        max-width: 350px;
        justify-content: center;
    }
    .slot {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    /* Copy 버튼 별도 줄 위치 */
    .copy-btn {
        margin-top: 0.5rem;
        width: 100%;
        max-width: 180px;
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
    }

    .jackpot-text {
        font-size: 5rem;
    }

    .scroll-arrow {
        display: block; /* enable for mobile */
    }
}

/* 소형 모바일 (Small Mobile) - 480px 이하 */
@media screen and (max-width: 480px) {
    header {
        margin-top: 3rem;
    }
    .logo {
        font-size: 2.3rem;
    }
    .subtitle {
        font-size: 0.85rem;
    }
    
    /* Game 컨테이너들을 CSS 변환으로 축소하여 UI 깨짐 방지 */
    .dome-container, 
    .target-game-container, 
    .spinner-game-container {
        transform: scale(0.8);
        transform-origin: center top;
        margin-bottom: -50px; /* scale로 인해 남는 시각적 여백 보정 */
    }

    /* 숫자 슬롯 더 작게 */
    .number-slots-container {
        max-width: 300px;
        gap: 0.3rem;
    }
    .slot {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-width: 1px;
    }

    .jackpot-text {
        font-size: 3.5rem;
    }
}

/* Premium Toggle Engine */
.main-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
}

.premium-toggle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(45, 52, 54, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.premium-toggle-wrapper.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.2);
}

.premium-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    margin-bottom: 0.3rem;
}

.premium-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.premium-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.premium-slider:before {
    position: absolute;
    content: "🔮";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

input:checked + .premium-slider {
    background-color: rgba(255, 215, 0, 0.3);
    border-color: gold;
}

input:checked + .premium-slider:before {
    transform: translateX(28px);
    content: "👑";
    box-shadow: 0 0 15px gold;
}

.premium-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
    transition: color 0.3s;
}

.premium-toggle-wrapper.active .premium-label {
    color: gold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

.premium-status {
    position: absolute;
    bottom: -18px;
    font-size: 0.7rem;
    white-space: nowrap;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* Tooltip styles */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    cursor: help;
}

.info-icon {
    font-size: 0.9rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
    transition: all 0.3s ease;
}

.tooltip-wrapper:hover .info-icon {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 150%;
    top: auto;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: rgba(10, 10, 25, 0.95);
    border: 1px solid var(--neon-blue);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 300;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 243, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: var(--neon-blue) transparent transparent transparent;
}

.tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip-content h4 {
    color: var(--neon-pink);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 5px rgba(255, 0, 234, 0.5);
}

.tooltip-content strong {
    color: gold;
    font-weight: 700;
}
