/**
 * 社務所 - 御神籤抽籤樣式
 * 從 shrine-office.css 分離出來
 */

/* ========================================
   籤棒飛出動畫
   ======================================== */

.flying-stick {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 100;
    pointer-events: none;
}

.flying-stick img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 金色籤棒特效 */
.flying-stick.golden {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8))
            drop-shadow(0 0 40px rgba(255, 193, 7, 0.6))
            drop-shadow(0 0 60px rgba(255, 152, 0, 0.4));
    animation: golden-glow 0.15s ease-in-out infinite alternate;
}

.flying-stick.golden img {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1))
            drop-shadow(0 0 30px rgba(255, 193, 7, 0.8));
}

@keyframes golden-glow {
    0% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 193, 7, 0.6))
                drop-shadow(0 0 60px rgba(255, 152, 0, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 35px rgba(255, 215, 0, 1))
                drop-shadow(0 0 60px rgba(255, 193, 7, 0.9))
                drop-shadow(0 0 100px rgba(255, 152, 0, 0.7));
    }
}

/* ========================================
   抽籤 Modal
   ======================================== */

.draw-content {
    text-align: center;
    min-height: 400px;
    min-width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.draw-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.draw-phase {
    animation: phase-appear 0.3s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.draw-title {
    font-family: 'Yuji Syuku', serif;
    font-size: 2.2rem;
    color: #1c1917;
    margin-bottom: 0.75rem;
}

.draw-cost {
    font-size: 1rem;
    color: #78716c;
    margin-bottom: 1.5rem;
}

.draw-subtitle {
    font-size: 1.2rem;
    color: #78716c;
    margin-bottom: 2rem;
}

/* ========================================
   抽籤選項按鈕
   ======================================== */

.draw-options {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.draw-option-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    background: linear-gradient(180deg, #fdfbf7, #f5f0e6);
    border: 2px solid #d6d3d1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    outline: none;
}

.draw-option-btn:hover {
    border-color: #cd7f32;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: linear-gradient(180deg, #fdfbf7, #f5f0e6);
    outline: none;
}

.draw-option-btn:focus,
.draw-option-btn:active {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.draw-option-btn.selected {
    border-color: #991b1b;
    border-width: 3px;
    background: linear-gradient(180deg, #fef2f2, #fecaca);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(153, 27, 27, 0.2);
}

.draw-option-btn img {
    width: 56px;
    height: 56px;
}

.draw-option-btn .option-name {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.3rem;
    font-weight: bold;
    color: #1c1917;
}

.draw-option-btn .option-cost {
    font-size: 1rem;
    color: #78716c;
}

/* 黃金籤特殊樣式 */
.draw-option-gold {
    border-color: rgba(250, 204, 21, 0.5);
    background: linear-gradient(180deg, #fffbeb, #fef3c7);
}

.draw-option-gold:hover {
    border-color: #fbbf24;
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.3);
}

.draw-option-gold.selected {
    border-color: #d97706;
    border-width: 3px;
    background: linear-gradient(180deg, #fef3c7, #fde68a);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.3);
}

.draw-option-gold .option-name {
    color: #b45309;
}

/* ========================================
   抽籤按鈕區
   ======================================== */

.draw-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.draw-actions .modal-btn {
    width: 100%;
}

.draw-actions .modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.draw-actions .modal-btn-secondary {
    width: 100%;
}

/* ========================================
   搖籤動畫
   ======================================== */

.shaking-cylinder {
    width: 80px;
    margin: 0 auto 1rem;
    animation: shake 0.3s ease-in-out infinite;
}

.shaking-cylinder img {
    width: 100%;
}

@keyframes shake {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

.draw-hint {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.2rem;
    color: #78716c;
}

/* ========================================
   結果展示 - 籤紙
   ======================================== */

.draw-phase-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* 籤紙容器 */
.fortune-result {
    position: relative;
    width: 420px;
    height: 680px;
}

.fortune-paper-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.fortune-paper-content {
    position: absolute;
    top: 8%;
    left: 12%;
    right: 12%;
    bottom: 12%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0.5rem;
    text-align: center;
    color: #3e2723;
}

/* 頂部：稀有度 */
.fortune-rank {
    font-family: 'Hina Mincho', 'Yuji Syuku', serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.fortune-rank.fortune-lucky { color: #b91c1c; }
.fortune-rank.fortune-normal { color: #3e2723; }

/* 中：道具圖示 + 光暈 */
.fortune-item-wrapper {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fortune-item-glow {
    position: absolute;
    inset: -10px;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.fortune-item-wrapper img {
    position: relative;
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 1;
}

/* 道具名稱 */
.fortune-item-name {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid rgba(62, 39, 35, 0.2);
    width: 80%;
}

/* 底部：運勢文案 + 功能說明 */
.fortune-text-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: rgba(255, 248, 225, 0.92);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(141, 110, 99, 0.25);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.fortune-text {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.1rem;
    color: #5d4037;
    line-height: 1.6;
    margin: 0 0 0.5rem 0;
    font-style: italic;
}

.fortune-divider {
    width: 40px;
    height: 2px;
    background: rgba(62, 39, 35, 0.3);
    margin-bottom: 0.5rem;
}

.fortune-desc {
    font-size: 1rem;
    font-weight: bold;
    color: #b91c1c;
    margin: 0;
    line-height: 1.5;
}

/* 按鈕獨立在籤紙外面 */
.fortune-accept-btn {
    background: #3e2723;
    color: #fff8e1;
    padding: 0.75rem 3rem;
    border: 2px solid #d7ccc8;
    border-radius: 2rem;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.fortune-accept-btn:hover {
    transform: scale(1.05);
    background: #5d4037;
}

/* 獎勵顯示（備用） */
.fortune-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 8px;
    border: 1px solid #22c55e;
}

.fortune-reward img {
    width: 32px;
    height: 32px;
}

.fortune-reward span {
    font-weight: 600;
    color: #15803d;
}

/* ========================================
   響應式
   ======================================== */

@media (max-width: 768px) {
    .draw-title {
        font-size: 1.5rem;
    }
    
    .fortune-rank {
        font-size: 2.5rem;
    }
    
    .fortune-result {
        width: 300px;
        height: 480px;
    }
    
    .fortune-item-wrapper {
        width: 80px;
        height: 80px;
    }
    
    .fortune-item-wrapper img {
        width: 60px;
        height: 60px;
    }
    
    .fortune-item-name {
        font-size: 1.25rem;
    }
    
    .fortune-text {
        font-size: 1rem;
    }
    
    .fortune-desc {
        font-size: 0.9rem;
    }
}

/* ========================================
   神恩重抽動畫
   ======================================== */

/* 籤紙發光（神明介入） */
.fortune-result.divine-intervention {
    animation: divine-glow 0.5s ease-in-out infinite alternate;
}

@keyframes divine-glow {
    0% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8))
                drop-shadow(0 0 40px rgba(255, 193, 7, 0.6));
    }
    100% {
        filter: drop-shadow(0 0 40px rgba(255, 215, 0, 1))
                drop-shadow(0 0 80px rgba(255, 193, 7, 0.8));
    }
}

/* 籤紙消失（重抽） */
.fortune-result.reroll-fade {
    animation: reroll-vanish 0.8s ease-in-out forwards;
}

@keyframes reroll-vanish {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotate(5deg);
        filter: drop-shadow(0 0 60px rgba(255, 215, 0, 1));
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
        filter: drop-shadow(0 0 0 transparent);
    }
}
