/* 游戏页面样式 - 固定画布比例 3840x785 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: white;
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
}

/* 固定比例画布容器 */
#screen-container {
    position: relative;
    background-color: #000;
    aspect-ratio: 3840 / 785;
    width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

@media (min-aspect-ratio: 3840/785) {
    #screen-container {
        width: auto;
        height: 100vh;
    }
}

/* 游戏阶段 - 使用固定尺寸 */
.game-phase {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.game-phase.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 内容容器 - 固定宽高，由 JS 动态缩放 */
.phase-content {
    /* 设计基准：3840x785 */
    width: 3840px;
    height: 785px;
    min-width: 3840px;
    min-height: 785px;
    max-width: 3840px;
    max-height: 785px;
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 60px;
    overflow: hidden;
    /* transform 由 JS 动态设置 */
}

/* 标题 - 固定像素大小 */
.game-title {
    font-size: 80px;
    font-weight: bold;
    color: #ff0033;
    text-shadow: 0 0 40px rgba(255, 0, 51, 0.5);
    margin-bottom: 10px;
    letter-spacing: 10px;
}

.game-subtitle {
    font-size: 36px;
    color: #888;
    margin-bottom: 15px;
}

/* 二维码 - 固定大小 */
.qr-container {
    margin: 15px 0;
}

.game-qr {
    width: 280px;
    height: 280px;
    border: 3px solid #ff0033;
    border-radius: 12px;
}

/* 玩家统计 */
.player-count {
    font-size: 36px;
    color: #fff;
    margin: 10px 0;
}

.player-count span {
    color: #ff0033;
    font-weight: bold;
    font-size: 56px;
}

/* 玩家头像列表 */
.player-avatars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 3200px;
    margin: 15px 0;
    max-height: 180px;
    overflow-y: auto;
}

.player-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ff0033;
    object-fit: cover;
}

.player-avatar .placeholder-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ff0033;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    font-weight: bold;
    color: white;
}

.player-avatar .player-name {
    font-size: 20px;
    color: #aaa;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 小号占位头像 (用于记分板) */
.placeholder-avatar-small {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #ff0033;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

/* 开始按钮 */
.start-btn, .restart-btn {
    margin-top: 20px;
    padding: 20px 60px;
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(135deg, #ff0033, #cc0029);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 40px rgba(255, 0, 51, 0.5);
    transition: all 0.3s;
}

.start-btn:hover, .restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 60px rgba(255, 0, 51, 0.8);
}

/* 分组容器 */
.groups-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    max-width: 3500px;
    margin: 0 auto;
}

.group-card {
    background: rgba(255, 0, 51, 0.1);
    border: 3px solid #ff0033;
    border-radius: 20px;
    padding: 30px;
    min-width: 300px;
}

.group-header {
    font-size: 40px;
    font-weight: bold;
    color: #ff0033;
    margin-bottom: 20px;
    text-align: center;
}

.group-members {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.member-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.member-avatar img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #ff0033;
    object-fit: cover;
}

.member-avatar span {
    font-size: 18px;
    color: #aaa;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 游戏头部 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 80px;
    margin-bottom: 20px;
}

.game-header .game-title {
    font-size: 60px;
    margin: 0;
}

/* 倒计时 */
.countdown-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 0, 51, 0.2);
    border: 3px solid #ff0033;
    border-radius: 15px;
    padding: 15px 40px;
}

.countdown-label {
    font-size: 22px;
    color: #888;
}

.countdown-time {
    font-size: 70px;
    font-weight: bold;
    color: #ff0033;
    font-family: 'Consolas', monospace;
}

/* 记分板 */
.groups-scoreboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 35px;
    max-width: 3600px;
    margin: 0 auto;
}

.scoreboard-group {
    background: rgba(255, 0, 51, 0.1);
    border: 3px solid #ff0033;
    border-radius: 20px;
    padding: 25px;
    min-width: 320px;
    max-width: 400px;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 0, 51, 0.3);
}

.group-name {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
}

.group-score {
    font-size: 48px;
    font-weight: bold;
    color: #ff0033;
}

.scoreboard-members {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.scoreboard-member {
    position: relative;
    width: 60px;
    height: 60px;
}

.scoreboard-member img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #333;
    object-fit: cover;
    opacity: 0.5;
}

.scoreboard-member.finished img {
    border-color: #ff0033;
    opacity: 1;
}

.scoreboard-member .check-mark {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 24px;
    height: 24px;
    background: #ff0033;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scoreboard-member .check-mark::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 3px solid white;
    border-bottom: 3px solid white;
    transform: rotate(-45deg);
    margin-bottom: 3px;
}

.scoreboard-progress {
    font-size: 22px;
    color: #666;
    text-align: center;
}

/* 获奖者 */
.winners-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 50px;
    margin: 20px auto;
}

.winner-card {
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid #666;
    border-radius: 20px;
    padding: 25px;
    min-width: 320px;
    text-align: center;
}

.winner-card.gold {
    border-color: #ffd700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.4);
    transform: scale(1.1);
    order: 0;
}

.winner-card.silver {
    border-color: #c0c0c0;
    box-shadow: 0 0 30px rgba(192, 192, 192, 0.3);
    order: -1;
}

.winner-card.bronze {
    border-color: #cd7f32;
    box-shadow: 0 0 30px rgba(205, 127, 50, 0.3);
    order: 1;
}

.winner-rank {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 10px;
}

.winner-card.gold .winner-rank { color: #ffd700; }
.winner-card.silver .winner-rank { color: #c0c0c0; }
.winner-card.bronze .winner-rank { color: #cd7f32; }

.winner-group {
    font-size: 32px;
    color: #fff;
    margin-bottom: 10px;
}

.winner-score {
    font-size: 56px;
    font-weight: bold;
    color: #ff0033;
    margin-bottom: 15px;
}

.winner-members {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.winner-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.winner-member img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #ff0033;
    object-fit: cover;
}

.winner-member span {
    font-size: 18px;
    color: #aaa;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 顶部控制栏 */
.top-control-bar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    padding: 15px;
}

.settings-trigger {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    border: 1px solid #444;
}

.settings-panel {
    display: none;
    position: absolute;
    top: 55px;
    right: 15px;
    background: #111;
    border: 1px solid #444;
    padding: 25px;
    border-radius: 15px;
    min-width: 250px;
}

.top-control-bar:hover .settings-panel {
    display: block;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    color: #ddd;
    font-size: 16px;
}

.setting-item input[type="number"] {
    width: 100px;
    padding: 8px;
    background: #222;
    border: 1px solid #555;
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
}

.setting-divider {
    height: 1px;
    background: #444;
    margin: 20px 0;
}

.back-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
}

.back-btn:hover {
    background: #555;
}
