/**
 * ============================================
 * 結局報告畫面樣式 - 橫向模式修正版
 * ============================================
 */

/* 全屏遮罩，置中 */
.ending-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.ending-screen.is-visible {
    opacity: 1;
}

/* 主容器 - 確保置中且不超出 */
.ending-screen__card {
    width: 85%;
    height: 80%;
    max-width: 1100px;
    max-height: 650px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transform: scale(0.95);
    opacity: 0;
    animation: cardFadeIn 0.6s ease-out 0.2s forwards;
    /* 🔥 確保沒有多餘的邊框或輪廓 */
    outline: none;
    position: relative;
}

@keyframes cardFadeIn {
    to { 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* 左側：圖片容器（正方形，基於容器高度） */
.ending-screen__image-container {
    width: auto;
    height: 100%;
    aspect-ratio: 1 / 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ending-screen__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 右側：文字容器（自動填滿剩餘空間） */
.ending-screen__content-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 25px;
    color: #fff;
    text-align: center;
    overflow-y: auto;
    /* 🔥 修正右下角白點問題 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* 隱藏 Webkit 瀏覽器的捲軸 */
.ending-screen__content-container::-webkit-scrollbar {
    display: none;
}

.ending-screen__title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 0 0 15px;
    font-family: 'Microsoft JhengHei', sans-serif;
}

.ending-screen__quote {
    font-size: 0.85rem;
    font-style: italic;
    margin: 0 0 25px;
    opacity: 0.85;
    line-height: 1.5;
}

.ending-screen__score {
    margin: 0 0 30px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.ending-screen__buttons {
    display: flex;
    gap: 15px;
}

.ending-screen__icon-button {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    /* 🔥 防止 focus/outline 造成白點 */
    outline: none;
}

.ending-screen__icon-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.ending-screen__icon-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.ending-screen__icon-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.ending-screen__icon-button::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ending-screen__icon-button:hover::before {
    opacity: 1;
}

.toast-notification {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast-notification.is-visible {
    opacity: 1;
}

/* 手機直向模式 */
@media (max-width: 768px) and (orientation: portrait) {
    .ending-screen__card {
        flex-direction: column;
        width: 95%;
        height: 90%;
    }
    
    .ending-screen__image-container {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    
    .ending-screen__content-container {
        padding: 20px 15px;
    }
    
    .ending-screen__title {
        font-size: 1.3rem;
    }
    
    .ending-screen__quote {
        font-size: 0.75rem;
    }
}