/**
 * 训练游戏插件样式
 */

/* 游戏列表样式 */
.training-games-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.training-games-title {
    text-align: center;
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
}

.training-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.training-game-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.training-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

.game-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.game-card-title {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.game-card-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.game-card-link {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s ease;
}

.game-card-link:hover {
    background: #005177;
    color: #fff;
}

.game-card-link.loading {
    background: #ccc;
    cursor: not-allowed;
}

/* 游戏容器样式 */
.training-game-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* 桌面端默认宽度 */
@media (min-width: 769px) {
    .training-game-container {
        max-width: 1200px;
        padding: 20px;
    }
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.game-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.game-iframe-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.training-game-iframe {
    border: none;
    width: 100%;
    min-height: 1100px;
}

/* 排行榜样式 */
.game-leaderboard {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.leaderboard-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.training-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
}

.training-leaderboard-table th,
.training-leaderboard-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.training-leaderboard-table th {
    background: #f5f5f5;
    font-weight: bold;
    color: #333;
}

.training-leaderboard-table tr:hover {
    background: #f9f9f9;
}

.rank-col {
    width: 10%;
}

.name-col {
    width: 30%;
}

.score-col {
    width: 25%;
}

.time-col {
    width: 25%;
}

.rank-number {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    margin-right: 5px;
}

.rank-medal {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    vertical-align: middle;
}

.rank-medal.medal-1 {
    background: #ffd700;
    box-shadow: 0 0 5px #ffd700;
}

.rank-medal.medal-2 {
    background: #c0c0c0;
    box-shadow: 0 0 5px #c0c0c0;
}

.rank-medal.medal-3 {
    background: #cd7f32;
    box-shadow: 0 0 5px #cd7f32;
}

/* 消息样式 */
.training-games-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    font-family: Arial, sans-serif;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.training-games-message.message-success {
    background-color: #4CAF50;
    color: white;
}

.training-games-message.message-error {
    background-color: #f44336;
    color: white;
}

/* 加载样式 */
.training-games-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 错误样式 */
.training-games-error {
    text-align: center;
    padding: 20px;
    color: #f44336;
    background: #fff3f3;
    border: 1px solid #ffcccc;
    border-radius: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .training-games-grid {
        grid-template-columns: 1fr;
    }

    /* 让容器在手机端全宽 */
    .training-game-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* iframe wrapper 去掉圆角和阴影，节省空间 */
    .game-iframe-wrapper {
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .training-game-iframe {
        min-height: 1000px;
    }

    .training-leaderboard-table {
        font-size: 14px;
    }

    .training-leaderboard-table th,
    .training-leaderboard-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    /* 进一步优化小屏幕 */
    .training-game-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .training-game-iframe {
        min-height: 950px;
    }
}
