/* fourstick.css - 윷가락 던지기 전용 스타일 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #D4A574 0%, #8B5E3C 100%);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* 뒤로가기 버튼 */
.back-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(93, 58, 26, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    text-decoration: none;
    z-index: 20;
}

.back-btn:hover {
    background: #5D3A1A;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(93, 58, 26, 0.4);
}

h1 {
    color: #FFF8E7;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 던지기 영역 */
#throw-area {
    border: 3px solid rgba(255, 248, 231, 0.3);
    border-radius: 20px;
    padding: 30px 40px;
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

#throw-area.charging {
    border-color: #DAA520;
}

#throw-area.reveal {
    border-color: #FFD700;
}

/* 윷가락 */
.stick-container {
    perspective: 800px;
    width: 55px;
    height: 180px;
}

.stick {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stick.throwing {
    transition: transform 1s ease-in-out;
}

.stick-container.bouncing {
    animation: stickBounce 1.2s ease-out;
}

@keyframes stickBounce {
    0% { transform: translateY(0); }
    15% { transform: translateY(-100px) scale(0.95); }
    30% { transform: translateY(-70px); }
    50% { transform: translateY(-25px); }
    70% { transform: translateY(-8px); }
    85% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

.stick-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stick-white {
    background: linear-gradient(180deg, #FFF8E7 0%, #F5E6C8 50%, #EDD9B5 100%);
    border: 2px solid #D4C5A0;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.05);
}

.stick-brown {
    background: linear-gradient(
        90deg,
        #6B3A1B 0%, #8B5A2B 20%, #A0703C 40%,
        #B8863C 50%,
        #A0703C 60%, #8B5A2B 80%, #6B3A1B 100%
    );
    transform: rotateX(180deg);
    border: 2px solid #5D3A1A;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.stick-brown::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 30%;
    width: 40%;
    height: 80%;
    border-radius: 20px;
    background: repeating-linear-gradient(
        180deg,
        transparent,
        transparent 8px,
        rgba(0, 0, 0, 0.08) 8px,
        rgba(0, 0, 0, 0.08) 9px
    );
}

.stick-white .mark {
    width: 14px;
    height: 14px;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

#hint {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 248, 231, 0.5);
    font-size: 0.85rem;
    transition: opacity 0.3s;
    white-space: nowrap;
}

/* 캔버스 & 플래시 */
canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFF8E7;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.15s;
}

/* 결과 표시 */
.result-wrap {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-display {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 248, 231, 0.3);
    border-radius: 15px;
    width: 160px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.result-display.show {
    opacity: 1;
    transform: scale(1);
}

.result-display.impact {
    animation: impactPulse 0.8s cubic-bezier(0.17, 0.67, 0.29, 1.2);
}

@keyframes impactPulse {
    0% {
        transform: scale(0.3) rotate(-10deg);
        box-shadow: 0 0 0 0 rgba(218, 165, 32, 0.9);
        filter: brightness(2);
    }
    20% {
        transform: scale(1.4) rotate(3deg);
        box-shadow: 0 0 60px 30px rgba(218, 165, 32, 0.6);
        filter: brightness(1.5);
    }
    40% {
        transform: scale(0.9) rotate(-2deg);
        filter: brightness(1.1);
    }
    60% {
        transform: scale(1.1) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 10px 30px rgba(218, 165, 32, 0.3);
        filter: brightness(1);
    }
}

.result-name {
    font-size: 2.5rem;
    font-weight: 900;
    color: #FFF8E7;
}

.result-desc {
    font-size: 0.85rem;
    color: rgba(255, 248, 231, 0.6);
    margin-top: 2px;
}

.result-display.yut .result-name,
.result-display.mo .result-name {
    color: #FFD700;
}

.result-display.backdo .result-name {
    color: #ff6b6b;
}

/* 컨페티 & 이펙트 */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    top: -10px;
    animation: confettiFall 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) translateX(0) rotateZ(0deg) scale(1); opacity: 1; }
    25% { transform: translateY(25vh) translateX(20px) rotateZ(180deg) scale(1.1); opacity: 1; }
    50% { transform: translateY(50vh) translateX(-15px) rotateZ(360deg) scale(0.9); opacity: 0.9; }
    75% { transform: translateY(75vh) translateX(10px) rotateZ(540deg) scale(0.7); opacity: 0.5; }
    100% { transform: translateY(105vh) translateX(-5px) rotateZ(720deg) scale(0.3); opacity: 0; }
}

.shockwave {
    position: absolute;
    border-radius: 50%;
    border: 3px solid rgba(218, 165, 32, 0.6);
    animation: shockwaveExpand 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes shockwaveExpand {
    0% { width: 20px; height: 20px; opacity: 1; border-width: 4px; }
    100% { width: 250px; height: 250px; opacity: 0; border-width: 1px; }
}

.star-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: starBurst 0.6s ease-out forwards;
}

@keyframes starBurst {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0); }
}