/**
 * 游戏集成样式
 * 包含iframe容器、加载状态、覆盖层等样式
 */

/* 游戏iframe容器 */
.game-iframe-container {
    position: relative;
    width: 100%;
    max-width: 960px;
    height: 0;
    padding-bottom: 62.5%; /* 16:10 比例 */
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* 游戏iframe */
.game-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 15px;
    background: #000;
    z-index: 1;
}

/* 游戏状态显示 */
.game-status {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 1.1em;
    color: #ff8c42;
    border: 1px solid rgba(255, 140, 66, 0.2);
}

/* 覆盖层基础样式 */
.overlay-base {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 15px;
    z-index: 10;
}

/* 播放覆盖层 */
.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 15px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9), rgba(22, 33, 62, 0.9));
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.play-overlay:hover {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(22, 33, 62, 0.95));
}

/* 播放按钮 */
.play-button {
    background: linear-gradient(45deg, #ff6b35, #ff8c42);
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 1.4em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: inherit;
}

.play-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6);
}

.play-button:active {
    transform: translateY(-1px) scale(1.02);
}

.play-button::before {
    content: '▶';
    font-size: 1.2em;
}

/* 加载覆盖层 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 15px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(255, 154, 86, 0.9));
    backdrop-filter: blur(15px);
    display: none;
    color: white;
    font-size: 1.2em;
    transition: all 0.5s ease;
}

/* 火焰图标动画 */
.flame-icon {
    font-size: 3em;
    margin-bottom: 10px;
    animation: flicker 1.5s ease-in-out infinite alternate;
}

@keyframes flicker {
    0% { transform: scale(1) rotate(-2deg); opacity: 0.8; }
    100% { transform: scale(1.1) rotate(2deg); opacity: 1; }
}

/* 加载动画 */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载文本 */
.loading-text {
    font-size: 1.3em;
    font-weight: 600;
    color: #ff8c42;
    margin-bottom: 15px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 加载进度条容器 */
.loading-progress {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

/* 加载进度条 */
#loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

#loading-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 加载百分比 */
#loading-percentage {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* 错误覆盖层 */
.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 15px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.9), rgba(178, 34, 34, 0.9));
    backdrop-filter: blur(10px);
    display: none;
}

/* 错误消息容器 */
.error-message {
    text-align: center;
    max-width: 400px;
    padding: 30px;
}

.error-message h3 {
    color: #ff6b6b;
    font-size: 1.5em;
    margin-bottom: 15px;
    font-weight: 600;
}

.error-message p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* 重试按钮 */
.retry-button {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 600;
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .game-iframe-container {
        padding-bottom: 75%; /* 4:3 比例，更适合移动端 */
        margin: 0 10px;
    }

    .play-button {
        padding: 15px 30px;
        font-size: 1.2em;
    }

    .loading-text {
        font-size: 1.1em;
    }

    .loading-progress {
        width: 250px;
    }

    .error-message {
        max-width: 300px;
        padding: 20px;
    }

    .error-message h3 {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .game-iframe-container {
        padding-bottom: 80%; /* 更紧凑的比例 */
    }

    .play-button {
        padding: 12px 25px;
        font-size: 1.1em;
        gap: 10px;
    }

    .loading-progress {
        width: 200px;
    }
}

/* 全屏模式支持 */
.game-iframe-container:-webkit-full-screen {
    padding-bottom: 0;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

.game-iframe-container:-moz-full-screen {
    padding-bottom: 0;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

.game-iframe-container:fullscreen {
    padding-bottom: 0;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.control-button {
    background: rgba(255, 255, 255, 0.1);
    color: #ff8c42;
    border: 1px solid rgba(255, 140, 66, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.control-button:hover {
    background: rgba(255, 140, 66, 0.2);
    border-color: #ff8c42;
    transform: translateY(-1px);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 无障碍改进 */
.play-button:focus,
.retry-button:focus,
.control-button:focus {
    outline: 2px solid #ff8c42;
    outline-offset: 2px;
}

/* 全屏按钮 */
.fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 107, 107, 0.8);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 20;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-family: inherit;
}

.fullscreen-btn:hover {
    background: rgba(255, 107, 107, 1);
    transform: scale(1.05);
}

.fullscreen-btn:focus {
    outline: 2px solid #ff8c42;
    outline-offset: 2px;
}

/* 减少动画 (为有动画敏感需求的用户) */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }

    .loading-text {
        animation: none;
    }

    #loading-progress-bar::after {
        animation: none;
    }

    .play-button,
    .retry-button,
    .control-button {
        transition: none;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .game-status {
        border: 2px solid #ff8c42;
        background: rgba(0, 0, 0, 0.8);
    }

    .play-button,
    .retry-button {
        border: 2px solid currentColor;
    }
}