/* ==========================================
   模态框和弹窗样式
   ========================================== */

/* 教学模态窗口样式 */
.tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    display: none;
    padding-top: 40px;
}

.tutorial-title {
    color: white;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.tutorial-image-container {
    position: relative;
    width: 80%;
    max-width: 800px;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.tutorial-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.tutorial-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tutorial-nav-button:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.4);
}

.tutorial-nav-button[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.tutorial-nav-button.prev {
    left: -60px;
}

.tutorial-nav-button.next {
    right: -60px;
}

.tutorial-close-button {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tutorial-close-button:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 教学选项卡样式 */
.tutorial-tabs {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 20px;
    width: 80%;
    max-width: 800px;
}

.tutorial-tab {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    flex: 1;
    max-width: 200px;
    position: relative;
    border-bottom: 3px solid transparent;
}

.tutorial-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.tutorial-tab.active {
    background: rgba(106, 17, 203, 0.4);
    border-bottom: 3px solid #6a11cb;
    font-weight: bold;
}

/* 词库管理器样式 */
.word-library-manager {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(to bottom, rgba(40, 40, 60, 0.95), rgba(20, 20, 40, 0.95));
    border-radius: 15px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 100px rgba(51, 204, 51, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(70, 230, 70, 0.3);
}

.word-library-manager.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.library-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    background: linear-gradient(to right, rgba(20, 80, 20, 0.5), rgba(10, 40, 10, 0.7));
    border-bottom: 1px solid rgba(51, 204, 51, 0.3);
}

.library-manager-header h2 {
    color: #eeffee;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.library-manager-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.library-manager-close:hover {
    color: white;
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.library-manager-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* 词库列表样式 */
.library-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.library-list::-webkit-scrollbar {
    width: 8px;
}

.library-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb {
    background: rgba(51, 204, 51, 0.4);
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb:hover {
    background: rgba(51, 204, 51, 0.6);
}

.library-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    background: rgba(40, 40, 60, 0.4);
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid rgba(80, 80, 120, 0.3);
    overflow: hidden;
}

.library-item:hover {
    background: rgba(60, 60, 100, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(51, 204, 51, 0.4);
}

.library-item-content {
    flex: 1;
    padding: 14px 18px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.library-item-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(51, 204, 51, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.library-item-content:hover::after {
    opacity: 1;
}

.library-item.active {
    background: linear-gradient(to right, rgba(20, 60, 20, 0.7), rgba(30, 90, 30, 0.5));
    border-left: 4px solid #33cc33;
    box-shadow: 0 4px 12px rgba(0, 100, 0, 0.3);
}

.library-name {
    flex: 1;
    font-weight: bold;
    color: white;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.library-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-left: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
}

.library-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-right: 15px;
}

.library-current-tag {
    background: #33cc33;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.library-delete {
    background: transparent;
    color: rgba(255, 100, 100, 0.8);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.library-delete:hover {
    background: rgba(255, 50, 50, 0.2);
    color: rgba(255, 120, 120, 1);
    border-color: rgba(255, 100, 100, 0.5);
}

/* 上传区域样式 */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid rgba(100, 200, 100, 0.2);
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.library-name-input {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(100, 200, 100, 0.3);
    background: rgba(40, 40, 60, 0.4);
    color: white;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
}

.library-name-input:focus {
    border-color: #33cc33;
    background: rgba(40, 60, 40, 0.5);
    box-shadow: 0 0 10px rgba(51, 204, 51, 0.3);
}

.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-upload-button {
    padding: 10px 18px;
    background: linear-gradient(to bottom, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.file-upload-button:hover {
    background: linear-gradient(to bottom, #1E88E5, #1565C0);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.file-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* 导入/导出区域 */
.import-export-section {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid rgba(100, 200, 100, 0.2);
}

.export-button, .import-button {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.export-button {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: white;
}

.export-button:hover {
    background: linear-gradient(135deg, #AB47BC, #8E24AA);
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.import-button {
    background: linear-gradient(135deg, #3F51B5, #303F9F);
    color: white;
}

.import-button:hover {
    background: linear-gradient(135deg, #5C6BC0, #3949AB);
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

/* 按钮容器 */
.button-container {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.ai-convert-button {
    padding: 12px 22px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.25s ease;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.ai-convert-button:hover {
    background: linear-gradient(135deg, #FF8A50, #FFA726);
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.upload-button {
    padding: 12px 22px;
    background: linear-gradient(135deg, #33cc33, #1a991a);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.25s ease;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.upload-button:hover:not([disabled]) {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4);
}

.upload-button[disabled] {
    background: linear-gradient(135deg, #999, #777);
    color: #ddd;
    cursor: not-allowed;
    box-shadow: none;
}

/* 游戏结束界面样式 - 绿色主题 */
.time-game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500; /* 游戏结束界面层级 */
}

.time-game-over-content {
    background: linear-gradient(to bottom, rgba(30, 50, 30, 0.95), rgba(15, 35, 15, 0.95)); /* 深绿色渐变背景 */
    border-radius: 20px;
    padding: 40px; /* 增加内边距 */
    text-align: center;
    width: 70%; /* 使用具体宽度百分比 */
    max-width: 800px; /* 设定一个最大像素宽度 */
    min-width: 500px; /* 设定一个最小像素宽度，防止过窄 */
    max-height: 85vh; /* 略微增加最大高度 */
    backdrop-filter: blur(5px); /* 轻微模糊效果 */
    box-shadow: 0 0 20px rgba(51, 204, 51, 0.7); /* 绿色阴影 */
    border: 1px solid rgba(51, 204, 51, 0.3); /* 绿色边框 */
    margin: 0 auto; /* 居中显示 */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important; /* 防止外层容器滚动 */
}

/* 大屏幕设备进一步优化 */
@media screen and (min-width: 1200px) {
    .time-game-over-content {
        width: 60%;
        max-width: 900px;
    }
}

.time-game-over h1 {
    color: #eeffee; /* 词库管理器标题颜色 */
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(51, 204, 51, 0.4); /* 绿色文字阴影 */
}

.time-final-score-container {
    font-size: 24px;
    margin: 20px 0;
    color: white;
}

.time-final-score-value {
    color: #FFD700;
    font-weight: bold;
    font-size: 48px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-left: 10px;
}

.time-wrong-words {
    padding: 20px 0 0 0; /* 移除顶部padding，因为标题现在在外面 */
    margin: 0; /* 减少margin，因为标题现在单独管理间距 */
    max-height: 200px;
    overflow-y: auto !important;
    flex-shrink: 1 !important; /* 允许错词容器被压缩 */
}

/* 独立的错词标题样式 - 不再是 .time-wrong-words 的子元素 */
.time-game-over-content > h3 {
    color: #FFD700;
    margin-bottom: 15px;
    margin-top: 20px; /* 与上方元素的间距 */
    font-size: 20px;
    text-align: left; /* 标题左对齐 */
    padding: 0 20px; /* 添加左右padding与内容对齐 */
    flex-shrink: 0 !important; /* 防止标题被压缩 */
}

.time-wrong-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-wrong-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.time-wrong-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 215, 0, 0.3);
}

.time-wrong-item.marked-wrong {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.5);
}

/* 游戏结束界面的按钮容器 */
.game-over-buttons-container {
    display: flex;
    justify-content: center; /* 居中按钮 */
    align-items: center; /* 垂直对齐，如果按钮高度不一 */
    flex-wrap: wrap; /* 允许按钮在空间不足时换行 */
    gap: 15px; /* 按钮之间的间距，略微减小以适应三个按钮 */
    margin-top: 30px; /* 与上方元素的间距 */
}

.time-restart-btn {
    background: linear-gradient(135deg, #33cc33, #1a991a); /* 词库管理器按钮绿色渐变 */
    border: none;
    color: white;
    padding: 15px 45px; /* 增加按钮的padding使其更大一些 */
    border-radius: 30px;
    font-size: 20px; /* 增大字体 */
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px; /* 给按钮一个最小宽度 */
    box-shadow: 0 0 15px rgba(51, 204, 51, 0.7); /* 悬停时更亮的绿色阴影 */
    font-weight: bold;
}

.time-restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(51, 204, 51, 0.7); /* 悬停时更亮的绿色阴影 */
}

/* 排行榜按钮样式 - 与重启按钮类似 */
.time-leaderboard-btn {
    background: linear-gradient(135deg, #ffc107, #ff9800); /* 橙色渐变 */
    border: none;
    color: white;
    padding: 15px 45px;
    border-radius: 30px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    font-weight: bold;
}

.time-leaderboard-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.7);
}

.time-submit-score-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 15px 45px;
    border: none;
    border-radius: 30px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    font-weight: bold;
}

.time-submit-score-btn:hover:not([disabled]) {
    background: linear-gradient(135deg, #FFB74D, #FB8C00);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.time-submit-score-btn[disabled] {
    background: linear-gradient(135deg, #999, #777);
    color: #ddd;
    cursor: not-allowed;
    opacity: 0.5;
}

/* 新增：游戏结束界面提示文本样式 - 固定在底部 */
.time-game-over-hint {
    font-size: 0.85em;
    color: #c0c0c0; /* 浅灰色，不那么突出 */
    text-align: center;
    margin: 15px 10px 20px 10px; /* 与错词容器和按钮的间距 */
    padding: 10px; /* 增加内边距使其更容易看到 */
    font-style: italic;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* 添加顶部分隔线 */
    background: rgba(0, 0, 0, 0.2); /* 轻微背景，使其更明显 */
    border-radius: 8px;
    position: relative; /* 确保不会被其他元素覆盖 */
    flex-shrink: 0; /* 防止提示文本被压缩 */
}