/* 
 * game.css
 * 包含游戏容器、工具栏、控制面板等游戏相关样式
 */

/* 游戏容器样式 */
.game-container {
    width: 100%;
    height: 65vh; /* 游戏容器高度 - 从72vh改回到65vh */
    min-height: 480px; /* 最小高度 - 适当调整 */
    max-height: 580px; /* 最大高度 - 适当调整 */
    display: flex;
    flex-direction: column;
    background-color: var(--game-container-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 游戏标题栏 */
.game-title {
    height: 50px;
    background-color: var(--game-title-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 游戏框架容器 */
.game-frame-container {
    flex-grow: 1;
    position: relative;
    background-color: #1f2937;
}

/* 游戏工具栏 */
.game-toolbar {
    height: 66px;
    background-color: var(--game-container-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 15; /* 确保工具栏在loading层之上 */
    position: relative; /* 确保z-index生效 */
    pointer-events: auto; /* 确保工具栏始终可点击 */
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px; /* 增加按钮之间的间距 */
    height: 100%;
}

/* 评分、点赞和不喜欢按钮 */
.rating, .like-btn, .dislike-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.like-btn, .dislike-btn, .controller-btn, .fullscreen-btn {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    z-index: 20; /* 确保按钮在loading层之上 */
    pointer-events: auto; /* 确保按钮始终可点击 */
}

.like-btn:hover, .controller-btn:hover, .fullscreen-btn:hover, .dislike-btn:hover {
    color: var(--game-title-bg); /* H1标题栏的背景色 */
}

.like-btn.active, .controller-btn.active, .fullscreen-btn.active, .dislike-btn.active {
    color: var(--accent-color); /* 星级的黄色 */
}

.thumb-icon {
    font-size: 20px;
}

.controller-icon, .fullscreen-icon {
    font-size: 22px;
}

.rating {
    color: var(--accent-color);
}

/* 按钮点击时的数字计数器样式 */
.like-btn .count, .dislike-btn .count {
    transition: transform 0.2s;
}

.like-btn.active .count, .dislike-btn.active .count {
    transform: scale(1.1);
    color: var(--accent-color);
}

/* 调整游戏手柄按钮的提示，避免被遮挡 */
.controller-btn {
    position: relative;
}

/* 提示框样式 */
.tooltip {
    position: absolute;
    top: -50px; /* 增加距离，避免遮挡 */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 9999; /* 提高层级 */
    pointer-events: none;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.8);
}

/* 调整最右侧按钮的提示，避免被裁剪 */
.fullscreen-btn .tooltip {
    transform: translateX(-80%);
}

.fullscreen-btn .tooltip::after {
    left: 80%;
}

/* 特别调整控制器按钮的提示 */
.controller-btn .tooltip {
    top: -40px;
    transform: translateX(-80%); /* 向左偏移，避免右侧被遮挡 */
}

.controller-btn .tooltip::after {
    left: 80%; /* 调整箭头位置对应提示框偏移 */
}

.like-btn:hover .tooltip,
.dislike-btn:hover .tooltip,
.controller-btn:hover .tooltip,
.fullscreen-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* 游戏控制弹出框样式 */
.controls-modal {
    position: absolute;
    bottom: 10px; /* 使用固定像素值而不是百分比，更精确 */
    right: 10px; /* 与底部边距完全相同 */
    width: 400px; /* 使用固定宽度，避免计算错误 */
    height: 80%; /* 增加高度，以适应更大的游戏区域 */
    background-color: var(--game-container-bg);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-color);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
    opacity: 0;
    transform: translateY(10px); /* 初始状态下略微下移 */
    transition: opacity 0.3s, transform 0.3s;
    box-sizing: border-box; /* 确保padding包含在width内 */
}

.controls-modal.show {
    opacity: 1;
    transform: translateY(0);
}

/* 固定关闭按钮在右上角 */
.controls-modal .header {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    padding: 0;
    margin: 0;
    z-index: 1001;
    display: flex;
    justify-content: flex-end;
}

.controls-modal .close-btn {
    background: none;
    border: none;
    color: transparent; /* 将原内容颜色设为透明 */
    font-size: 0; /* 将原内容字体大小设为0 */
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    background-color: rgba(33, 39, 50, 0.8); /* 更深的背景色 */
    position: relative; /* 添加相对定位 */
    overflow: hidden; /* 隐藏任何溢出内容 */
}

.controls-modal .close-btn::before {
    content: "×"; /* 使用乘号字符，比 X 更适合表示关闭按钮 */
    position: absolute;
    top: 46%; /* 稍微上移位置 */
    left: 50%;
    transform: translate(-50%, -50%); /* 确保水平居中 */
    font-size: 32px; /* 保持字体大小 */
    font-weight: normal; /* 移除加粗效果 */
    line-height: 0.8; /* 保持行高调整 */
    color: white; /* 确保文本颜色为白色 */
}

/* 移除原先尝试隐藏内容的CSS规则，因为可能没有效果 */
.controls-modal .close-btn span,
.controls-modal .close-btn i,
.controls-modal .close-btn * {
    display: none;
}

.controls-modal .close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 取消指向工具栏的箭头 */
.controls-modal::after {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* 控制模态框内部样式 */
.controls-modal h2 {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    letter-spacing: 0.5px;
    font-family: 'Russo One', sans-serif;
    font-weight: 600;
}

.controls-modal h3 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
    color: #6366f1;
    font-family: 'Russo One', sans-serif;
    font-weight: 600;
}

.controls-modal ul {
    list-style-type: disc;
    padding-left: 1.25rem; /* 与how-to-play区域一致 */
    margin-bottom: 1rem; /* 与how-to-play区域一致 */
}

.controls-modal li {
    margin-bottom: 0.25rem; /* 减小项目间距，与how-to-play区域一致 */
    font-size: 1rem; /* 减小文字大小，与how-to-play区域一致 */
    line-height: 1.5; /* 调整行高，与how-to-play区域一致 */
    color: #a0aec0; /* 与how-to-play区域文本颜色一致 */
}

.controls-modal li::marker {
    color: #6366f1; /* 列表标记点使用标题栏的背景色 */
}

.controls-modal p {
    margin-bottom: 1rem; /* 与how-to-play区域一致 */
    color: #a0aec0; /* 与how-to-play区域文本颜色一致 */
    line-height: 1.5; /* 与how-to-play区域一致 */
    font-size: 1rem; /* 与how-to-play区域一致 */
}

/* 自定义滚动条 */
.controls-modal::-webkit-scrollbar {
    width: 8px;
}

.controls-modal::-webkit-scrollbar-track {
    background: #2d3748;
    border-radius: 4px;
}

.controls-modal::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.controls-modal::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* 自定义控制器和全屏图标 */
.custom-controller-icon {
    width: 28px;
    height: 28px;
    display: inline-block;
    position: relative;
    vertical-align: middle;
}

.custom-fullscreen-icon {
    width: 22px;
    height: 22px;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

/* 全屏模式特定样式 */
.fullscreen-mode {
    background-color: #000;
    padding: 0;
    border-radius: 0;
}

.fullscreen-mode .game-frame-container {
    height: 100vh;
}

.fullscreen-mode .game-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(31, 41, 55, 0.8);
    z-index: 15; /* 确保在全屏模式下工具栏也在loading层之上 */
}

.controls-modal::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 游戏加载遮罩层样式调整 */
#loading {
    z-index: 10;
    pointer-events: none; /* 允许点击穿透到下方元素 */
}

#game-frame {
    z-index: 0; /* 默认在loading层下方 */
    transition: opacity 0.3s ease-out;
}

#game-frame.loaded {
    z-index: 11; /* 加载完成后提升到loading层之上 */
}

#loading > div {
    pointer-events: auto; /* 恢复内部元素的点击事件 */
}

/* 进度条容器样式 */
.progress-container {
    width: 16rem; /* 256px */
    height: 0.5rem; /* 8px */
    background-color: rgba(55, 65, 81, 0.8); /* bg-gray-700 with opacity */
    border-radius: 9999px; /* rounded-full */
    overflow: hidden;
}

/* 进度条样式 */
.loading-progress-bar {
    height: 100%;
    background-color: white;
    transition: width 0.3s ease-out;
}

/* 加载文本样式 */
.loading-text {
    font-size: 1.25rem; /* text-xl */
    line-height: 1.75rem;
    color: white;
    letter-spacing: 0.05em; /* tracking-wide */
    margin-top: 0.5rem; /* mt-2 */
    font-family: 'VT323', monospace;
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    .controls-modal {
        bottom: 10px; /* 与非移动端保持一致 */
        right: 10px; /* 与底部间距保持一致 */
        left: 10px; /* 左侧也使用固定边距 */
        width: auto; /* 宽度自适应 */
        height: 70%; /* 在小屏幕上稍微减小高度 */
    }
    
    .toolbar-left, .toolbar-right {
        gap: 8px; /* 更紧凑的布局 */
    }
    
    .game-container {
        height: 62vh; /* 相比桌面版略低 */
        min-height: 450px; /* 与桌面版保持比例 */
    }
} 