/* 自定义字体定义 */
@font-face {
    font-family: 'PingFang Regular';
    src: url('./PingFang Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* 优化字体加载性能 */
}

/* 原有基础样式 */
body {
    font-family: 'Microsoft YaHei', 'SimHei', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 0;
}

/* 中文和混合练习专用字体类 */
.chinese-font {
    font-family: 'PingFang Regular', 'Microsoft YaHei', 'SimHei', Arial, sans-serif !important;
}

/* 中文练习模式下的文本元素 */
.chinese-mode #promptText,
.chinese-mode #textInput,
.chinese-mode .prompt-text,
.chinese-mode .typing-input {
    font-family: 'PingFang Regular', 'Microsoft YaHei', 'SimHei', Arial, sans-serif !important;
}

/* 混合练习模式下的文本元素 */
.mixed-mode #promptText,
.mixed-mode #textInput,
.mixed-mode .prompt-text,
.mixed-mode .typing-input {
    font-family: 'PingFang Regular', 'Microsoft YaHei', 'SimHei', Arial, sans-serif !important;
}

/* 修改: 容器添加过渡效果 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative; /* 添加相对定位 */
    transition: opacity 0.3s ease; /* 添加过渡效果 */
}

/* header样式 - 确保绝对定位的子元素正确定位 */
header {
    position: relative;
    margin-bottom: 30px;
}

/* 标题样式 */
h1 {
    font-size: 2rem;
    color: #555;
    text-align: center;
    font-weight: bold;
    margin: 0;
}

/* 登录区域 */
.login-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

#nameInput, #realNameInput {
    font-size: 1rem;
    padding: 10px;
    width: 100px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin-right: 10px;
}

/* 登录提示样式 */
#loginAlert {
    width: 200px;
    margin: 20px auto 0 auto;
    text-align: center;
    padding: 10px;
    border-radius: 4px;
}

/* 按钮样式 
.btn {
    display: inline-block;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #0056b3;
}
*/

/* 修改: 打字区域样式添加过渡效果 */
#typingArea {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 30px;
    transition: opacity 0.3s ease, transform 0.3s ease; /* 添加过渡效果 */
}

#promptContainer {
    height: 245px;
    overflow-y: hidden;
    position: relative;
    margin-bottom: 20px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 15px;
    background-color: #f8f9fa;
}

#promptText {
    font-size: 60px;
    line-height: 1.2;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    padding: 0;
    user-select: none;
}

/* 在后面添加这些新的样式规则 */
#promptText.content-chinese{
    font-size: 35px;  /* 调整这个值以设置中文类型的大小 */
    line-height: 1.5;
}

#promptText.content-mixed {
    font-size: 45px;  /* 调整这个值以设置混合类型的大小 */
}

#textInput {
    font-size: 60px;
    width: 100%;
    color: #495057;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 20px;
}

.space-character {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-color: #ced4da;
}

.correct {
    background-color: rgba(40, 167, 69, 0.2);
}

.incorrect {
    background-color: rgba(220, 53, 69, 0.2);
}

.current-line {
    background-color: rgba(0, 123, 255, 0.1);
}

#testStatus {
    font-size: 18px;
    margin: 20px 0;
    text-align: center;
    color: #007bff;
}

#countdown {
    font-size: 24px;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
    color: #ff6600;
}

#submitBtn {
    display: block;
    margin: 20px auto;
}

/* 修改: 结果区域样式添加过渡效果 */
#results {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    transition: opacity 0.3s ease, transform 0.3s ease; /* 添加过渡效果 */
}

#results h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 20px;
}

#testDetails {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

#resultsSummary, #detailedStats {
    margin-bottom: 20px;
}

#screenshotButton {
    display: block;
    margin: 20px auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #promptText, #textInput {
        font-size: 40px;
    }
    
    .container {
        padding: 10px;
    }
}

/* 动画效果 */
.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* 新增样式 */
.last-char {
    font-weight: bold;
    text-decoration: underline;
}

.last-char.correct {
    background-color: rgba(40, 167, 69, 0.4);
}

.last-char.incorrect {
    background-color: rgba(220, 53, 69, 0.4);
}

/* 修改: 课程列表添加过渡效果 */
#courseExerciseList {
    margin-bottom: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease; /* 添加过渡效果 */
}

#courseExerciseList .table {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#courseExerciseList .list-group-item {
    border: none;
    padding: 10px 15px;
}

#courseExerciseList .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 移除可能影响文字颜色的样式 */
#courseExerciseList .badge {
    /* 如果之前有设置color属性，请移除它 */
    /* color: initial; */
}
#courseExerciseList .table th:nth-child(1),
#courseExerciseList .table td:nth-child(1) {
    width: 25%;
}

/* 为不同背景色的badge设置白色文字 */
#courseExerciseList .badge.bg-success,
#courseExerciseList .badge.bg-danger,
#courseExerciseList .badge.bg-info,
#courseExerciseList .badge.bg-warning,
#courseExerciseList .badge.bg-secondary {
    color: white;
}

/* 如果某些特定badge需要深色文字，可以单独设置 */
#courseExerciseList .badge.bg-light,
#courseExerciseList .badge.bg-warning {
    color: #212529;  /* Bootstrap的深色文字颜色 */
    margin-right: 5px;
}

/* 确保badge样式正确应用 */
#courseExerciseList .badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

/* 新增图表容器样式 */
.chart-container {
    width: 100%;
    max-width: 600px;
    height: 300px;
    margin: 20px auto;
}

#results {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 30px;
}

#results h4 {
    color: #007bff;
    text-align: center;
    margin-bottom: 20px;
}

#testDetails {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

#resultsSummary, #detailedStats {
    margin-bottom: 20px;
}

#detailedStats h3 {
    color: #333;
    margin-top: 20px;
}

#detailedStats ol {
    padding-left: 20px;
}

#screenshotButton {
    display: block;
    margin: 20px auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .chart-container {
        height: 200px;
    }
}

/* 修改: 登录状态样式添加过渡效果 */
.login-status {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    opacity: 1; /* 修改默认不透明度 */
    transition: opacity 0.3s ease; /* 添加过渡效果 */
    z-index: 10; /* 确保在其他元素之上 */
}

.login-status #userInfo {
    margin-right: 10px;
}

/* 返回按钮样式 - 与登录状态对称 */
.return-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 10; /* 确保在其他元素之上 */
}

#logoutBtn, #adminBtn{
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
}
#homeLink {
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    background: linear-gradient(to right, #c05d5d, #5e99ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* background-size: 200% 100%; */
    background-position: 100% 0;
}

#homeLink:hover {
    background-position: 0 0;
    text-shadow: 2px 2px 4px rgba(42, 82, 152, 0.2); /* 添加轻微阴影 */
}

#progress {
  margin-top: 10px;
  margin-bottom: 10px;
}

#progress .progress-bar {
  transition: width 0.3s ease;
}
.pinyin-analysis-report {
    margin-top: 20px;
}

.pinyin-analysis-report .segment-item {
    padding: 5px;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.pinyin-analysis-report .segment-item:hover {
    background-color: #e9ecef;
}
/* 在文件末尾添加 */
.typing-segments {
    margin-bottom: 2rem;
}

.char-grid {
    display: grid;
    grid-auto-flow: column;
    gap: 2rem;
    align-items: center;
    justify-content: start;
}

.char-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3rem;
}

.pinyin-code {
    font-family: monospace;
    font-size: 0.875rem;
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: #4b5563;
}

.error-marker {
    color: #ef4444;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.analysis-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.stat-badge {
    padding: 0.5rem;
    border-radius: 0.375rem;
    text-align: center;
}
/* 中文输入分析样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: bold;
    color: #0d6efd;
    margin-bottom: 0.5rem;
}

.stat-card .label {
    color: #6c757d;
    font-size: 0.9rem;
}
/* 输入法跟踪分析相关样式 - 添加到style.css文件末尾 */

/* 序列分析容器 */
.sequence-flow-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.char-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

.char-group.deleted {
    text-decoration: line-through;
    opacity: 0.6;
    background-color: #fee2e2;
}

.char-group.replaced {
    border: 2px solid #3b82f6;
    background-color: #e0f2fe;
}

.char-content {
    font-size: 1.25rem;
    color: #495057;
    margin-top: 0.25rem;
}

.pinyin-content {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.pinyin-code {
    display: inline-block;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    color: #495057;
    white-space: nowrap;
}
.selection-method {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    background-color: #4f46e5;
    color: white;
    padding: 2px 4px;
    border-radius: 10px;
}

/* 选择方式标签颜色差异化 */
.selection-method-space {
    background-color: #10b981; /* 绿色 */
}

.selection-method-number {
    background-color: #3b82f6; /* 蓝色 */
}

.selection-method-page {
    background-color: #f59e0b; /* 橙色 */
}
.deletion-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    font-size: 10px;
    background-color: #ef4444;
    color: white;
    padding: 2px 4px;
    border-radius: 10px;
}

.replaced-info {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #ef4444;
    background-color: #fee2e2;
    padding: 1px 3px;
    border-radius: 3px;
    white-space: nowrap;
}

/* 输入法标签样式 */
.input-method-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 10px;
    color: white;
}

.input-method-badge.direct {
    background-color: #ef4444;
}

.input-method-badge.composition {
    background-color: #10b981;
}

.input-method-badge.unknown {
    background-color: #94a3b8;
}

/* 替换历史样式 */
.replacement-list {
    margin-top: 10px;
}

.replacement-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #f1f5f9;
    border-radius: 6px;
}

.replacement-arrow {
    margin: 0 8px;
    color: #ef4444;
    font-weight: bold;
}

.original-char {
    text-decoration: line-through;
    color: #ef4444;
    background-color: #fee2e2;
    padding: 2px 6px;
    border-radius: 4px;
}

.new-char {
    color: #10b981;
    background-color: #d1fae5;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 针对不同屏幕尺寸优化间距 */
@media (max-width: 768px) {
    .sequence-flow-container {
        padding: 1rem;
        gap: 0.75rem;
    }

    .char-group {
        padding: 0.5rem;
    }

    .pinyin-code {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
}
/* 添加到style.css文件中 */
.composing {
    color: #888888; /* 灰色文本 */
    background-color: rgba(200, 200, 200, 0.2); /* 浅灰背景 */
    border-bottom: 1px dotted #aaa; /* 虚线下划线 */
}

/* ====== 新增会话管理相关样式 ====== */

/* 加载指示器样式 */
#session-loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
    min-width: 200px;
}

#session-loading-indicator p {
    margin-top: 10px;
    color: #555;
    font-size: 16px;
}

/* 主要UI容器过渡效果 */
#userInput, 
#courseExerciseList, 
#typingArea, 
#results {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 隐藏状态的样式 */
.session-hidden {
    opacity: 0 !important;
    transform: translateY(10px) !important;
    pointer-events: none !important;
}

/* 可见状态的样式 */
.session-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* 淡入效果 */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 确保加载指示器中的spinner正确显示 */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* 屏幕阅读器友好的隐藏元素 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}