/* stream-style.css - Stream API 动画样式 */

/* 通用动画样式 */
.animation-controls {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    flex-direction: row;
}

.animation-controls button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.animation-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.animation-controls button:active {
    transform: translateY(0);
}

.animation-scene {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    min-height: 300px;
}

/* 遍历动画样式 */
#forEach-animation .student-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

#forEach-animation .console-output {
    background: #1e1e1e;
    color: #00ff00;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    margin-top: 15px;
    font-size: 12px;
}

#forEach-animation .console-line {
    margin: 3px 0;
    animation: typewriter 0.5s ease-out;
}

/* 学生卡片基础样式 */
.student-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    margin: 5px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

/* forEach动画中的学生卡片样式 */
#forEach-animation .student-card {
    padding: 8px;
    margin: 0;
}

.student-card.highlighted {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.student-card.processed {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a74515, #20c99715);
    opacity: 0.8;
}

.console-line.complete {
    color: #28a745;
    font-weight: bold;
    animation: pulse 1s ease-in-out;
}

.student-name {
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.student-age {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 3px;
}

.student-score {
    font-size: 12px;
    color: #28a745;
    font-weight: bold;
    margin-bottom: 3px;
}

.student-major {
    font-size: 10px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

/* forEach动画中的特殊样式 */
#forEach-animation .student-name {
    font-size: 13px;
    margin-bottom: 3px;
}

#forEach-animation .student-age {
    font-size: 11px;
    margin-bottom: 2px;
}

#forEach-animation .student-score {
    font-size: 11px;
    margin-bottom: 2px;
}

#forEach-animation .student-major {
    font-size: 9px;
    padding: 1px 4px;
}

/* 筛选动画样式 */
.process-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin: 20px 0;
}

.stage {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    min-height: 200px;
}

.stage h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 18px;
}

.arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 优化箭头动效：去除强烈的脉冲，改为轻微的呼吸渐变 */
.arrow.active {
    animation: none;
}

.arrow-body {
    width: 3px;
    height: 60px;
    background: linear-gradient(180deg, #94a3b8, #6366f1);
    position: relative;
}

.arrow-head {
    background: #6366f1;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    margin-top: -10px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.student-card.pass {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a74515, #20c99715);
}

.student-card.fail {
    border-color: #dc3545;
    background: linear-gradient(135deg, #dc354515, #c8233315);
    opacity: 0.6;
}

.student-card.duplicate {
    animation: shake 0.5s ease-in-out;
}

.student-card.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.student-card.filtered {
    border-color: #28a745;
    transform: scale(0.85);
    padding: 6px 8px;
    margin: 2px 0;
}

.student-card.unique {
    border-color: #28a745;
    transform: scale(0.85);
    padding: 6px 8px;
    margin: 2px 0;
    /* 继承上面定义的120px宽度和布局 */
}


/* 让筛选结果区域可以并排显示多个unique卡片 */
#filter-result {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    align-items: flex-start;
}

/* 让原始数据区域也变为紧凑布局 */
#filter-students,
#map-students,
#sort-students,
#sort-result {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    align-items: flex-start;
}

#filter-students .student-card,
#map-students .student-card,
#sort-students .student-card,
#sort-result .student-card,
#skip-students .student-card,
#skip-result-list .student-card,
#maxmin-students .student-card {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    flex-shrink: 0;
    display: inline-block;
}

#filter-students .student-card .student-name,
#map-students .student-card .student-name,
#sort-students .student-card .student-name,
#sort-result .student-card .student-name,
#skip-students .student-card .student-name,
#skip-result-list .student-card .student-name,
#maxmin-students .student-card .student-name {
    font-size: 11px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#filter-students .student-card .student-age,
#filter-students .student-card .student-score,
#map-students .student-card .student-age,
#map-students .student-card .student-score,
#maxmin-students .student-card .student-age,
#maxmin-students .student-card .student-score {
    font-size: 9px;
    margin-bottom: 1px;
    display: inline-block;
    margin-right: 8px;
}

#filter-students .student-card .student-major,
#map-students .student-card .student-major,
#maxmin-students .student-card .student-major {
    font-size: 7px;
    padding: 1px 3px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    margin-top: 2px;
}

/* 特殊处理map动画中的带课程学生卡片 */
#map-students .student-card.with-courses {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    min-height: 100px;
}

#map-students .student-card.with-courses .student-name {
    font-size: 10px;
    margin-bottom: 4px;
    text-align: center;
    font-weight: bold;
}

#map-students .student-card.with-courses .student-courses {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#map-students .student-card.with-courses .course-item {
    background: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 8px;
    color: #495057;
    text-align: center;
    border: 1px solid #dee2e6;
}

#map-students .student-card.flattening {
    animation: flatten 0.8s ease-in-out;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #2196f3;
}

#map-students .student-card.flattened {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-color: #4caf50;
}

/* Sorted动画特定样式 */
#sort-result .student-card.sorting {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: #ff9800;
    transform: rotate(5deg);
}

#sort-result .student-card.processing {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #2196f3;
    animation: pulse 1s infinite;
}

#sort-result .student-card.current {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-color: #ffc107;
    transform: scale(1.1) rotate(0deg);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
    z-index: 10;
}

#sort-result .student-card.sorted {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-color: #4caf50;
    transform: scale(1) rotate(0deg);
}

/* 排序信息区域 */
.sort-info {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.sort-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #495057;
}

.sort-info strong {
    color: #007bff;
}

/* SkipLimit动画特定样式 */
#skip-students .student-card.skipped {
    background: linear-gradient(135deg, #ffcdd2, #ef9a9a);
    border-color: #f44336;
    /* 移除动画，只改变颜色和边框 */
}

#skip-students .student-card.selected {
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    border-color: #4caf50;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
}

#skip-students .student-card.excluded {
    background: #f8f9fa;
    border-color: #dee2e6;
    opacity: 0.4;
    transform: scale(0.95);
}

#skip-students .student-card.current {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-color: #ffc107;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
    z-index: 10;
}

#skip-result-list .student-card {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-color: #4caf50;
    border-width: 2px;
}

/* 分页操作状态样式 */
.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.pagination-info .operation {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    min-width: 100px;
    text-align: center;
    transition: all 0.3s ease;
}

.pagination-info .operation.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.pagination-info .operation.completed {
    background: linear-gradient(135deg, #28a745, #20c997);
    transform: scale(1);
}

.pagination-info .arrow.down {
    font-size: 24px;
    color: #667eea;
    animation: bounce 2s infinite;
}

/* 分页状态区域 */
.pagination-status {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.pagination-status p {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
    line-height: 1.4;
}

.pagination-status strong {
    color: #007bff;
}


/* 映射动画样式 */
.string-list {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    min-height: 200px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    justify-content: flex-start;
}

.string-item {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.string-item.course-name {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    font-size: 11px;
}

.student-card.transforming {
    animation: transform 0.8s ease-in-out;
}

.student-card.transformed {
    background: linear-gradient(135deg, #17a2b8, #343a40);
    border-color: #17a2b8;
}

.student-card.with-courses {
    min-height: 120px;
}

.student-courses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.course-item {
    background: #e9ecef;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #495057;
}

.student-card.flattening {
    animation: flatten 0.8s ease-in-out;
}

/* 排序动画样式 */
.sort-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: start;
    margin: 20px 0;
}

.sort-stage {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    min-height: 300px;
}

.student-card.sorting {
    animation: shuffle 1s ease-in-out;
}

.student-card.sorted {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a74515, #20c99715);
}

.rank-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
    border: 2px solid white;
    z-index: 15;
}

/* 排序容器布局优化 */
.sort-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
    margin: 20px 0;
}

.sort-stage {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    min-height: 200px;
}

.sort-stage h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 16px;
}

/* 分页动画样式 */
.pagination-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin: 20px 0;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.operation {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
}

.arrow.down {
    font-size: 24px;
    color: #667eea;
}

.student-card.selected {
    border-color: #28a745;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.2);
}

.student-card.skipped {
    border-color: #ffc107;
    animation: skipSlide 0.5s ease-out forwards;
}

.student-card.excluded {
    opacity: 0.3;
    border-color: #dee2e6;
}

/* 最值查找动画样式 */
.tournament-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin: 20px 0;
}

.winner-card {
    background: linear-gradient(135deg, #ffc107, #ff6b6b);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    animation: winnerGlow 1s ease-in-out infinite alternate;
}

.trophy {
    font-size: 48px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.winner-info h4 {
    margin: 0;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.winner-info p {
    margin: 5px 0 0;
    font-size: 18px;
    opacity: 0.9;
}

/* 规约动画样式 */
.reduce-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: stretch;
    margin: 20px 0;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-item {
    background: #e9ecef;
    color: #495057;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.score-item.highlighted {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.1);
}

.reduce-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.accumulator {
    background: #2c3e50;
    color: #00ff00;
    padding: 15px 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.reduce-step {
    background: #495057;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.reduce-operation {
    color: #ffc107;
    font-size: 16px;
    margin: 5px 0;
}

.final-result {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.result-value {
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 收集动画样式 */
.collect-container {
    display: grid;
    grid-template-columns: 0.8fr auto 1.2fr; /* 左窄右宽，缓解右侧局促 */
    gap: 30px;
    align-items: stretch;
    margin: 20px 0;
}

.stream-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    min-height: 200px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 12px;
}

.stream-item {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    animation: streamFloat 2s ease-in-out infinite;
}

.stream-item:nth-child(odd) {
    animation-delay: 0.5s;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background: white;
    border: 2px solid #28a745;
    padding: 12px 15px;
    border-radius: 6px;
    font-weight: bold;
    color: #495057;
}

.stream-item.flying {
    animation: flyToList 1s ease-in-out forwards;
}

.stream-item.collected {
    opacity: 0.5;
    transform: scale(0.8);
}

/* 分组动画样式 */
.group-container {
    margin: 10px 0;
}

.group-container h5 {
    background: linear-gradient(135deg, #e83e8c, #9b59b6);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-align: center;
}

.group-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 并行动画样式 */
.parallel-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 20px 0;
}

.comparison-side {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
}

.comparison-side h4 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

.processing-timeline {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    min-height: 200px;
    position: relative;
}

.timeline-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    color: #495057;
    margin: 5px 0;
}

.task-item.sequential {
    animation: sequentialProcess 1s ease-in-out;
}

.task-item.parallel {
    animation: parallelProcess 1s ease-in-out;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.time-display {
    text-align: center;
    font-weight: bold;
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    background: #f8f9fa;
}

/* 完整Stream链动画样式 */
.pipeline-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 20px 0;
}

.pipeline-stage {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
}

.pipeline-stage h4 {
    color: #495057;
    margin-bottom: 15px;
}

.pipeline-stage.highlighted {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a74515, #20c99715);
}

.pipeline-arrow {
    display: flex;
    justify-content: center;
    margin: -10px 0;
}

.pipeline-arrow.active {
    animation: arrowGlow 1s infinite;
}

.mini-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 100px;
    align-items: center;
    justify-content: center;
}

.mini-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #495057;
}

.mini-string {
    background: linear-gradient(135deg, #17a2b8, #343a40);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.final-stage {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
}

.final-result-display {
    text-align: center;
    color: white;
    padding: 30px;
}

.result-type {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.result-count {
    font-size: 36px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 通用动画关键帧 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes fadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

@keyframes fade-in {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes transform {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

@keyframes flatten {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shuffle {
    0% { transform: translateX(0); }
    25% { transform: translateX(-20px); }
    50% { transform: translateX(20px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

@keyframes skipSlide {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-100px); opacity: 0.3; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes winnerGlow {
    0% { box-shadow: 0 0 20px rgba(255, 193, 7, 0.3); }
    100% { box-shadow: 0 0 40px rgba(255, 193, 7, 0.6); }
}

@keyframes streamFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(10px) rotate(-5deg); }
}

@keyframes flyToList {
    0% { transform: translateY(0) translateX(0) scale(1); }
    50% { transform: translateY(-50px) translateX(50px) scale(1.2); }
    100% { transform: translateY(0) translateX(0) scale(0); opacity: 0; }
}

@keyframes sequentialProcess {
    0% { background: #e9ecef; }
    100% { background: #ffc107; }
}

@keyframes parallelProcess {
    0% { background: #e9ecef; transform: scale(1); }
    50% { background: #28a745; transform: scale(1.1); }
    100% { background: #20c997; transform: scale(1); }
}

@keyframes arrowGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.6); }
}

@keyframes typewriter {
    0% { opacity: 0; transform: translateX(10px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* 表格样式 */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.comparison-table th,
.comparison-table td {
    border: 1px solid #ddd;
    padding: 0.8rem;
    text-align: left;
}

.comparison-table th {
    background: #f8f9fa;
}

.operations-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.operations-table th,
.operations-table td {
    border: 1px solid #ddd;
    padding: 0.6rem;
    text-align: left;
    font-size: 0.9rem;
}

.operations-table th {
    background: #f8f9fa;
}

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

    .comparison-table,
    .operations-table {
        font-size: 0.8rem;
    }

    .comparison-table th,
    .comparison-table td,
    .operations-table th,
    .operations-table td {
        padding: 0.4rem;
    }

    .operations-table th,
    .operations-table td {
        font-size: 0.8rem;
    }

    .sort-container {
        grid-template-columns: 1fr;
    }

    #sort-result .student-card.current {
        transform: scale(1.05);
    }

    .pagination-container {
        grid-template-columns: 1fr;
    }

    .tournament-container {
        grid-template-columns: 1fr;
    }

    .reduce-container {
        grid-template-columns: 1fr;
    }

    .collect-container {
        grid-template-columns: 1fr;
    }

    .parallel-comparison {
        grid-template-columns: 1fr;
    }

    .pipeline-container {
        gap: 20px;
    }

    .student-list {
        grid-template-columns: 1fr;
    }

    .animation-controls {
        justify-content: center;
    }

    .animation-scene {
        padding: 15px;
        min-height: 250px;
    }
}

/* MaxMin 动画样式 */
.tournament-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px 0;
}

.comparison-info {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.comparison-info .operation {
    font-size: 16px;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 20px;
    background: #6c757d;
    color: white;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    display: inline-block;
}

.comparison-info .operation.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    animation: pulse 1.5s infinite;
}

.comparison-info .operation.completed {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.comparison-info .current-status {
    background: white;
    padding: 15px 12px;
    border-radius: 12px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.comparison-info .current-status p {
    margin: 6px 0;
    line-height: 1.4;
    font-size: 13px;
}

.result-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.max-container, .min-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.max-container {
    border: 2px solid #ffc107;
    background: linear-gradient(135deg, #fff9e6, #fffbf0);
}

.min-container {
    border: 2px solid #17a2b8;
    background: linear-gradient(135deg, #e6f7ff, #f0fbff);
}

.max-container h5, .min-container h5 {
    margin: 0 0 15px 0;
    font-weight: bold;
    color: #495057;
}

.result-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: center;
}

.result-card.max-card {
    border: 2px solid #ffc107;
    background: linear-gradient(135deg, #ffffff, #fffef0);
}

.result-card.min-card {
    border: 2px solid #17a2b8;
    background: linear-gradient(135deg, #ffffff, #f0fcff);
}

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

.result-icon {
    font-size: 36px;
    margin-bottom: 15px;
    display: block;
}

.result-info h5 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #495057;
    font-weight: 600;
}

.result-info .score {
    font-size: 20px;
    font-weight: bold;
    margin: 0;
}

.result-card.max-card .score {
    color: #ff6b35;
}

.result-card.min-card .score {
    color: #0891b2;
}

.result-container .placeholder {
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    text-align: center;
    background: white;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* MaxMin 特殊状态样式 */
#maxmin-students .student-card.current {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 3px solid #2196f3;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.4);
    z-index: 10;
}

#maxmin-students .student-card.max {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border: 3px solid #ffc107;
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
    position: relative;
}

#maxmin-students .student-card.max::after {
    content: '👑';
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 28px;
    z-index: 20;
}

#maxmin-students .student-card.min {
    background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
    border: 3px solid #00acc1;
    box-shadow: 0 6px 20px rgba(0, 172, 193, 0.3);
    position: relative;
}

#maxmin-students .student-card.min::after {
    content: '🎯';
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 24px;
    z-index: 20;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tournament-container {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }

    .result-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .comparison-info {
        padding: 15px 12px;
    }

    .comparison-info .operation {
        font-size: 14px;
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .comparison-info .current-status {
        padding: 12px 10px;
        margin-top: 10px;
    }

    .comparison-info .current-status p {
        font-size: 12px;
        margin: 4px 0;
        line-height: 1.3;
    }

    .result-card {
        padding: 12px;
    }

    .result-icon {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .result-info h5 {
        font-size: 14px;
    }

    .result-info .score {
        font-size: 16px;
    }

    .max-container, .min-container {
        padding: 15px;
    }

    .max-container h5, .min-container h5 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .result-container .placeholder {
        padding: 30px 15px;
        font-size: 12px;
    }
}

/* Reduce 动画样式 */
.reduce-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 25px;
    align-items: start;
    padding: 20px 0;
}

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

.score-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #495057;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.score-item.current {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 3px solid #2196f3;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.4);
    z-index: 10;
}

.score-item.processed {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border: 2px solid #4caf50;
    opacity: 0.9;
}

.reduce-flow {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.process-info {
    margin-bottom: 20px;
}

.process-info .operation {
    font-size: 18px;
    font-weight: bold;
    padding: 12px 20px;
    border-radius: 25px;
    background: #6c757d;
    color: white;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    display: inline-block;
}

.process-info .operation.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    animation: pulse 1.5s infinite;
}

.process-info .operation.completed {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.accumulator-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 16px;
    color: #495057;
}

.accumulator-display .label {
    font-weight: bold;
}

.accumulator-display .value {
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: #007bff;
    border: 2px solid #007bff;
    min-width: 60px;
    text-align: center;
}

.reduce-step {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-info p {
    margin: 8px 0;
    line-height: 1.5;
}

.step-info strong {
    color: #007bff;
}

.operation-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.operation-display .old-value {
    color: #6c757d;
    text-decoration: line-through;
}

.operation-display .current-value {
    color: #007bff;
    background: #e3f2fd;
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #007bff;
}

.operation-display .new-value {
    color: #28a745;
    background: #e8f5e8;
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #28a745;
}

.operation-display .operator,
.operation-display .equals {
    color: #495057;
    font-size: 24px;
}

.step-description {
    font-style: italic;
    color: #6c757d;
    margin-top: 10px !important;
}

.result-display .placeholder {
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    text-align: center;
    background: white;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.final-result {
    background: linear-gradient(135deg, #fff8e1, #fffbf0);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.2);
}

.result-title {
    font-size: 20px;
    font-weight: bold;
    color: #ff6b35;
    margin-bottom: 15px;
}

.result-operation {
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background: white;
    color: #212529;
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #dee2e6;
}

.result-value {
    font-size: 24px;
    font-weight: bold;
    color: #ff6b35;
    margin: 15px 0;
}

.result-value strong {
    color: #dc3545;
    font-size: 28px;
}

.stream-equivalent {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

/* Reduce 响应式设计 */
@media (max-width: 768px) {
    .reduce-container {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }

    .score-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .score-item {
        padding: 10px;
        font-size: 14px;
        min-width: 50px;
    }

    .reduce-flow {
        padding: 20px 15px;
    }

    .process-info .operation {
        font-size: 16px;
        padding: 8px 15px;
        margin-bottom: 12px;
    }

    .accumulator-display {
        font-size: 14px;
        margin: 10px 0;
    }

    .accumulator-display .value {
        padding: 6px 12px;
        min-width: 50px;
    }

    .reduce-step {
        padding: 15px 12px;
        min-height: 100px;
    }

    .operation-display {
        font-size: 16px;
        gap: 8px;
    }

    .operation-display .operator,
    .operation-display .equals {
        font-size: 20px;
    }

    .final-result {
        padding: 20px 15px;
    }

    .result-title {
        font-size: 18px;
    }

    .result-operation {
        font-size: 14px;
        padding: 8px;
    }

    .result-value {
        font-size: 20px;
    }

    .result-value strong {
        font-size: 24px;
    }
}

/* Collect 动画样式 */
.animation-controls {
    margin-bottom: 20px;
}

.animation-controls > button {
    margin: 0 8px;
    order: 0;
    flex: 0 0 auto;
}

.animation-controls > .current-mode-display {
    margin-top: 20px;
    flex: 1 1 100%;
    order: 1; /* 强制在按钮组下方换行显示 */
}

.current-mode-display {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    width: 100%;
    margin: 1px;
}

.current-mode-display h5 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: bold;
    color: #495057;
}

.mode-code {
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: left;
    overflow-x: auto;
    border: 2px solid #21252b;
}

.mode-code code {
    color: #e06c75;
    font-weight: bold;
    white-space: nowrap;
    display: block;
}

.collect-container {
    display: grid;
    grid-template-columns: 0.8fr auto 1.2fr; /* 左窄右宽 */
    gap: 25px;
    align-items: start;
    padding: 20px 0;
}

/* 限制左侧输入区域宽度，避免过宽导致右侧拥挤 */
.collect-container #collect-input {
    justify-self: start;
    max-width: 420px;
}

.stream-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stream-item {
    /* 更柔和的配色与卡片化样式 */
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
    position: relative;
    overflow: hidden;
}

.stream-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.stream-item.current {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    z-index: 10;
}

.stream-item.current::before {
    left: 100%;
}

.stream-item.collected {
    opacity: 0.4;
    transform: scale(0.9);
    background: linear-gradient(135deg, #6c757d, #495057);
}

.collect-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    width: fit-content;
}

.collect-arrow .arrow-body {
    width: 3px;
    height: 40px;
    background: #dee2e6;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.collect-arrow .arrow-head {
    background: #6c757d;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.collect-arrow.active .arrow-body {
    background: linear-gradient(180deg, #007bff, #0056b3);
    height: 50px;
}

.collect-arrow.active .arrow-head {
    background: linear-gradient(135deg, #007bff, #0056b3);
    animation: pulse 1.5s infinite;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

.collect-arrow.completed .arrow-body {
    background: linear-gradient(180deg, #28a745, #1e7e34);
}

.collect-arrow.completed .arrow-head {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    animation: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.collect-info {
    margin-bottom: 15px;
}

/* 高亮代码中的不同部分 */
.mode-code code::before {
    content: "collect(";
    color: #61afef;
}

.mode-code code::after {
    content: attr(data-suffix);
    color: #98c379;
}

.result-container {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    min-height: 200px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.result-container .placeholder {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* List 收集样式 */
.list-result {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
    height: 100%;
}

.list-item {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    animation: fadeInRight 0.5s ease-out;
}

/* 分组收集样式 */
.group-result {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    height: 100%;
}

.group-card {
    background-color: #fff;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.group-container h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #ff6b35;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #ffc107;
}

.group-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.group-members .student-card {
    transform: scale(0.7);
    margin: 0;
    min-width: 80px;
    font-size: 10px;
}

/* 最终结果样式 */
.final-result {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.result-title {
    font-size: 18px;
    font-weight: bold;
    color: #155724;
    margin-bottom: 15px;
}

.result-info {
    margin: 15px 0;
}

.result-info p {
    margin: 8px 0;
    color: #155724;
    font-size: 14px;
}

.result-info strong {
    color: #0f5132;
    font-size: 16px;
}

.stream-equivalent {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #c3e6cb;
    background: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 6px;
}

.completion-message {
    background: linear-gradient(135deg, #e0f2fe, #e9d5ff);
    border: 1px solid #93c5fd;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    color: #1e3a8a;
}

/* Collect 响应式设计 */
@media (max-width: 768px) {
    .collect-container {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }

    .stream-items {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .stream-item {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 60px;
    }

    .collect-arrow {
        padding: 15px 10px;
    }

    .collect-arrow .arrow-body {
        height: 30px;
    }

    .collect-arrow .arrow-head {
        font-size: 11px;
        padding: 6px 10px;
    }

    .collect-info {
        margin-bottom: 12px;
    }

    .animation-controls {
        gap: 15px;
    }

    .current-mode-display {
        padding: 15px 12px;
        max-width: 100%;
    }

    .current-mode-display h5 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .mode-code {
        padding: 12px 10px;
        font-size: 12px;
    }

    .result-container {
        min-height: 150px;
        padding: 15px;
    }

    .group-container {
        padding: 12px;
    }

    .group-container h5 {
        font-size: 14px;
    }

    .group-members .student-card {
        transform: scale(0.6);
        min-width: 70px;
        font-size: 9px;
    }

    .final-result {
        padding: 15px;
    }

    .result-title {
        font-size: 16px;
    }

    .result-info p {
        font-size: 12px;
    }

    .result-info strong {
        font-size: 14px;
    }

    .stream-equivalent {
        font-size: 10px;
        padding: 8px;
    }

    /* 移动端下左侧输入区域取消宽度限制，避免溢出 */
    .collect-container #collect-input {
        max-width: 100%;
    }
}

/* Collect 动画关键帧 */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 补充：淡入上移效果（本页未引入 animation.css 时独立生效） */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes streamFlow {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* 更温和的呼吸动画，仅在未收集元素上缓慢进行 */
.stream-item:not(.collected) {
    animation: streamFlow 4.5s ease-in-out infinite;
}

.stream-item.current {
    animation: none;
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
    outline: 2px solid rgba(99,102,241,0.35);
}

/* 收集场景下，彻底移除旧的旋转动画 */
.collect-container .stream-item,
.stream-item.collected {
    animation: none;
}

/* 入场淡入效果，供新增列表项和分组成员使用 */
.fade-in {
    animation: fadeInUp 0.35s ease-out both;
}

/* 进度信息样式优化 */
.collect-info {
    color: #334155;
    font-size: 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

/* Parallel 动画样式 */
.parallel-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.comparison-side {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.comparison-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.comparison-side h4 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: bold;
    color: #1e293b;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.processing-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.status {
    font-size: 14px;
    font-weight: bold;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f1f5f9;
    transition: all 0.3s ease;
}

.status.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    animation: pulse 1.5s infinite;
}

.status.completed {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.task-counter {
    font-size: 14px;
    font-weight: bold;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f1f5f9;
}

.processing-timeline {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 120px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timeline-track {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    min-height: 60px;
}

.task-item {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.task-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.8s ease;
}

.task-item.sequential {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: 2px solid #1d4ed8;
}

.task-item.sequential::before {
    animation: streamFlow 3s ease-in-out infinite;
    animation-delay: 0.2s;
}

.task-item.parallel {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: 2px solid #7c3aed;
    animation: fadeInUp 0.3s ease-out;
}

.task-item.parallel::before {
    left: 100%;
    animation: none;
}

.time-display {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.performance-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.info-label {
    font-size: 14px;
    font-weight: bold;
    color: #92400e;
}

.info-value {
    font-size: 18px;
    font-weight: bold;
    color: #dc2626;
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comparison-result {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid #3b82f6;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.completion-summary h4 {
    margin: 0 0 25px 0;
    font-size: 22px;
    font-weight: bold;
    color: #1e293b;
}

.performance-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.comparison-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.comparison-item.sequential-result {
    border-left: 4px solid #3b82f6;
}

.comparison-item.parallel-result {
    border-left: 4px solid #8b5cf6;
}

.comparison-item h5 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
}

.comparison-item p {
    margin: 8px 0;
    color: #64748b;
    font-size: 14px;
}

.comparison-item strong {
    color: #1e293b;
    font-size: 16px;
}

.efficiency-gain {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.efficiency-gain p {
    margin: 0;
    font-size: 18px;
    color: #064e3b;
    font-weight: bold;
}

.efficiency-gain strong {
    color: #dc2626;
    font-size: 24px;
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 10px;
}

.stream-equivalent {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Parallel 响应式设计 */
@media (max-width: 768px) {
    .parallel-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .comparison-side {
        padding: 20px 15px;
    }

    .comparison-side h4 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .processing-info {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .status, .task-counter {
        font-size: 12px;
        padding: 4px 8px;
        text-align: center;
    }

    .processing-timeline {
        padding: 15px 10px;
        min-height: 100px;
    }

    .timeline-track {
        gap: 6px;
    }

    .task-item {
        padding: 8px 12px;
        font-size: 12px;
    }

    .time-display {
        font-size: 16px;
        padding: 10px;
    }

    .performance-info {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .info-label, .info-value {
        font-size: 14px;
        text-align: center;
    }

    .performance-comparison {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .comparison-item {
        padding: 15px;
    }

    .comparison-item h5 {
        font-size: 16px;
    }

    .efficiency-gain {
        padding: 15px;
    }

    .efficiency-gain p {
        font-size: 16px;
    }

    .efficiency-gain strong {
        font-size: 20px;
        display: block;
        margin: 10px 0 0 0;
    }

    .stream-equivalent {
        font-size: 11px;
        padding: 12px;
    }
}

/* API 参数说明样式 */
.api-specification {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.api-specification h4 {
    color: #495057;
    margin: 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.api-specification h4:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

.api-specification h4::after {
    content: "▼";
    font-size: 0.8em;
    color: #6c757d;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.api-specification.collapsed h4::after {
    transform: rotate(-90deg);
}

.api-specification .spec-content {
    padding: 20px;
    display: block;
    transition: all 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

.api-specification.collapsed .spec-content {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
    overflow: hidden;
}

.api-specification h5 {
    color: #6c757d;
    margin: 15px 0 8px 0;
    font-size: 0.95em;
}

.method-signature {
    background: #2d3748;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    overflow-x: auto;
}

.method-signature code {
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.parameters-list ul.params {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.parameters-list ul.params li {
    background: white;
    border-left: 3px solid #007bff;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 4px;
    font-size: 0.9em;
}

.param-type {
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
    margin-right: 8px;
}

.param-name {
    background: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    margin-right: 8px;
}

.return-type {
    background: white;
    border-left: 3px solid #28a745;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-size: 0.9em;
}

.return-type .type {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
    margin-right: 8px;
}

.usage-tip {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-size: 0.9em;
    color: #856404;
}

/* API 参数说明响应式设计 */
@media (max-width: 768px) {
    .api-specification {
        margin: 10px 0;
    }

    .api-specification h4 {
        padding: 12px 15px;
        font-size: 1em;
    }

    .api-specification .spec-content {
        padding: 15px;
    }

    .api-specification.collapsed .spec-content {
        padding: 0 15px;
    }

    .method-signature {
        padding: 10px;
    }

    .method-signature code {
        font-size: 0.8em;
    }

    .parameters-list ul.params li,
    .return-type,
    .usage-tip {
        font-size: 0.8em;
    }

    .param-type,
    .param-name,
    .return-type .type {
        font-size: 0.8em;
        padding: 1px 4px;
    }
}