/* ========================================
   繪馬進化論 Onboarding Modal
   首次登入後顯示的新手導引
   🔥 巨大化版本 - 視覺衝擊力 MAX
   ======================================== */

/* Modal 遮罩 */
.ema-onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 1rem;
}

.ema-onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 卷軸容器 - 精簡版 */
.ema-onboarding-scroll {
    position: relative;
    background: linear-gradient(180deg, #fdfbf7 0%, #f5f0e6 100%);
    border-top: 8px solid #451a03;
    border-bottom: 8px solid #451a03;
    border-radius: 12px;
    padding: 1.5rem 2rem 1.5rem;
    max-width: 580px;
    width: 100%;
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(69, 26, 3, 0.03);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ema-onboarding-overlay.active .ema-onboarding-scroll {
    transform: scale(1) translateY(0);
}

/* 貓咪容器 - 電腦版不顯示（用絕對定位） */
.ema-onboarding-mascots {
    display: contents; /* 電腦版讓子元素脫離容器 */
}

/* 朵朵巫女 - 左上角 */
.ema-onboarding-duoduo {
    position: absolute;
    top: -70px;
    left: -50px;
    width: 150px;
    height: 150px;
    transform: rotate(-10deg);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    z-index: 10;
    pointer-events: none;
}

.ema-onboarding-duoduo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Q北老師 - 右上角 */
.ema-onboarding-qbei {
    position: absolute;
    top: -60px;
    right: -40px;
    width: 120px;
    height: 120px;
    transform: rotate(10deg);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    z-index: 10;
    pointer-events: none;
}

.ema-onboarding-qbei img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 標題 */
.ema-onboarding-title {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.8rem;
    color: #451a03;
    text-align: center;
    margin-bottom: 0.3rem;
    letter-spacing: 0.1em;
}

.ema-onboarding-subtitle {
    font-size: 1rem;
    color: #78350f;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* 進化流程圖 */
.ema-evolution-chart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

/* 背景連接線 - 更粗 */
.ema-evolution-chart::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 6px;
    background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 25%, #9ca3af 50%, #fbbf24 100%);
    transform: translateY(-50%);
    z-index: 0;
    border-radius: 3px;
}

/* 單個繪馬階段 - 放大，透明背景 */
.ema-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
    background: transparent;
    padding: 0.5rem 1rem;
    transition: transform 0.2s ease;
}

.ema-stage:hover {
    transform: scale(1.08);
}

.ema-stage-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ema-stage-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s ease;
}

/* 空繪馬（使用圖片 + 灰階處理） */
.ema-stage-empty {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.3;
    filter: grayscale(100%) brightness(0.5) contrast(1.2);
}

/* 繪馬資訊區塊 - 名稱在上、條件在下 */
.ema-stage-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.ema-stage-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #451a03;
    text-align: center;
}

.ema-stage-streak {
    font-size: 0.85rem;
    color: #78350f;
    font-weight: 500;
    text-align: center;
}

/* 銀色繪馬 */
.ema-stage.silver .ema-stage-icon {
    width: 58px;
    height: 58px;
}

.ema-stage.silver .ema-stage-icon img {
    filter: drop-shadow(0 4px 12px rgba(192, 192, 192, 0.5)) brightness(1.1);
}

/* 黑金繪馬 - 發光特效 */
.ema-stage.blackgold .ema-stage-icon {
    width: 64px;
    height: 64px;
    animation: ema-glow 2s ease-in-out infinite;
}

.ema-stage.blackgold .ema-stage-label {
    font-size: 1rem;
    color: #b45309;
}

.ema-stage.blackgold .ema-stage-streak {
    font-size: 0.9rem;
    font-weight: 700;
}

@keyframes ema-glow {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.7)); }
    50% { filter: drop-shadow(0 0 24px rgba(251, 191, 36, 1)); }
}

/* 修煉守則提示條 */
.ema-rule-banner {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 0.625rem 1rem;
    margin: 1rem auto 1.25rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ema-rule-text {
    font-size: 0.95rem;
    color: #7c2d12;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
}

.ema-rule-bad {
    font-weight: 700;
    color: #dc2626;
}

.ema-rule-good {
    font-weight: 700;
    color: #059669;
}

.ema-rule-gold {
    font-weight: 700;
    color: #b45309;
}

/* 電腦版隱藏換行 */
.ema-rule-break {
    display: none;
}

/* 箭頭 */
.ema-arrow {
    color: #a3a3a3;
    font-size: 1.5rem;
    font-weight: 900;
    z-index: 1;
}

/* 確認按鈕 */
.ema-onboarding-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
    color: #fef3c7;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.875rem 1.25rem;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ema-onboarding-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 30px rgba(139, 0, 0, 0.5);
    background: linear-gradient(135deg, #a50000 0%, #8B0000 100%);
}

.ema-onboarding-btn:active {
    transform: scale(0.98);
}

/* 按鈕區域 */
.ema-onboarding-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

/* 不再顯示按鈕 */
.ema-onboarding-skip {
    display: block;
    width: 100%;
    background: #6b7280;
    color: #ffffff;
    font-family: inherit;
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
    border: 2px solid #9ca3af;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ema-onboarding-skip:hover {
    background: #5b6370;
    border-color: #6b7280;
}

/* ========================================
   響應式設計 - 手機版
   ======================================== */

@media (max-width: 768px) {
    .ema-onboarding-scroll {
        padding: 1.25rem 1rem 1rem;
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
        border-width: 6px;
    }
    
    /* 手機版：貓咪容器不顯示（用絕對定位） */
    .ema-onboarding-mascots {
        display: contents;
    }
    
    /* 手機版：Q北 右上角 */
    .ema-onboarding-qbei {
        position: absolute;
        top: -50px;
        right: -30px;
        width: 100px;
        height: 100px;
        transform: rotate(10deg);
        filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
    }
    
    /* 手機版：朵朵 左上角 */
    .ema-onboarding-duoduo {
        position: absolute;
        top: -60px;
        left: -35px;
        width: 120px;
        height: 120px;
        transform: rotate(-10deg);
        filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
    }
    
    /* 手機版：內容置中 */
    .ema-onboarding-scroll {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .ema-onboarding-title {
        font-size: 1.4rem;
    }
    
    .ema-onboarding-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    /* 手機版：垂直排列置中 */
    .ema-evolution-chart {
        flex-direction: column;
        align-items: center;
        gap: 0.35rem;
        padding: 0.5rem 0;
        width: 100%;
    }
    
    .ema-evolution-chart::before {
        display: none;
    }
    
    .ema-stage {
        flex-direction: row;
        gap: 0.75rem;
        width: 100%;
        max-width: 200px;
        justify-content: center;
        padding: 0.5rem 0.75rem;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 10px;
    }
    
    .ema-stage-icon {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    
    .ema-stage-empty {
        width: 100%;
        height: 100%;
    }
    
    .ema-stage.silver .ema-stage-icon,
    .ema-stage.blackgold .ema-stage-icon {
        width: 48px;
        height: 48px;
    }
    
    .ema-stage-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .ema-stage-label {
        font-size: 0.85rem;
    }
    
    .ema-stage-streak {
        font-size: 0.75rem;
    }
    
    .ema-stage.blackgold .ema-stage-label {
        font-size: 0.9rem;
    }
    
    .ema-arrow {
        font-size: 1.2rem;
        transform: rotate(90deg);
        color: #d1d5db;
    }
    
    .ema-rule-banner {
        padding: 0.5rem 0.75rem;
        margin: 0.5rem auto 0.75rem;
        max-width: calc(100% - 1rem);
    }
    
    .ema-rule-text {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .ema-rule-break {
        display: block;
    }
    
    .ema-onboarding-btn {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .ema-onboarding-skip {
        font-size: 0.9rem;
        padding: 0.65rem 1rem;
    }
}

/* 深色模式 */
[data-theme="dark"] .ema-onboarding-scroll {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-color: #78350f;
}

[data-theme="dark"] .ema-onboarding-title {
    color: #fef3c7;
}

[data-theme="dark"] .ema-onboarding-subtitle {
    color: #fcd34d;
}

[data-theme="dark"] .ema-stage {
    background: #1e293b;
}

[data-theme="dark"] .ema-stage-label {
    color: #fef3c7;
}

[data-theme="dark"] .ema-stage-streak {
    color: #fcd34d;
}

[data-theme="dark"] .ema-rule-banner {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: #92400e;
}

[data-theme="dark"] .ema-rule-text {
    color: #fef3c7;
}

[data-theme="dark"] .ema-rule-bad {
    color: #fca5a5;
}

[data-theme="dark"] .ema-rule-good {
    color: #6ee7b7;
}

[data-theme="dark"] .ema-rule-gold {
    color: #fcd34d;
}
