body {
    margin: 0;
    padding: 0;
    background: transparent;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#card-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px;
    box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: transparent !important; /* 确保背景透明 */
}

#card-container::-webkit-scrollbar {
    display: none;
}

.knowledge-card {
    position: relative;
    flex: 0 0 auto;
    min-width: calc(100vh * 0.618); /* 最小宽度为黄金比例 */
    max-width: calc((100vh - 40px) / 0.618); /* 最大宽度为高度的黄金比例 */
    width: min-content; /* 使用最小内容宽度 */
    height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95); /* 提高卡片整体背景透明度 */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    margin-right: 20px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性动画 */
    overflow: hidden;
}

/* 渐变条样式 */
.knowledge-card .gradient-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(255, 107, 107, 0.9), rgba(78, 205, 196, 0.9));
    border-radius: 16px 16px 0 0;
    z-index: 3;
    width: calc(100% - 2px);
    margin: 0 1px;
}

/* 内容区域容器 */
.knowledge-card .content-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

/* 背景图片容器 */
.knowledge-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%; /* 图片高度占卡片的40% */
    background-image: var(--card-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1; /* 初始完全不透明 */
    z-index: 0;
    transition: opacity 3s ease; /* 添加过渡效果 */
}

/* 渐变遮罩 */
.knowledge-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 100%); /* 降低渐变遮罩的透明度 */
    z-index: 1;
    pointer-events: none;
}

/* 内容容器 */
.card-header, .card-content {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95); /* 提高内容区域背景透明度 */
}

.knowledge-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    width: min-content; /* 显示时使用最小内容宽度 */
}

.knowledge-card.fade-out {
    opacity: 0.3;
    transition: opacity 6s cubic-bezier(0.4, 0, 0.2, 1);
}

.knowledge-card.hide {
    opacity: 0;
    transform: translateY(-20px);
}

.knowledge-card.fade-out::before {
    opacity: 0.3 !important; /* 淡出时降低图片透明度 */
}

.card-header {
    padding: 12px 20px;
    font-size: clamp(18px, 3vh, 24px);
    font-weight: 600;
    color: rgba(51, 51, 51, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性动画 */
    margin-top: 4px; /* 为渐变条留出空间 */
}

.card-header.show {
    opacity: 1;
    transform: translateY(0);
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性动画 */
    transition-delay: 0.8s; /* 等待内容显示后再显示分割线 */
}

.card-header.show-divider::after {
    width: 100%;
    left: 0;
}

.card-content {
    padding: 12px 20px;
    font-size: clamp(14px, 2.5vh, 18px);
    line-height: 1.6;
    color: rgba(102, 102, 102, 0.95);
    overflow-y: auto;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 15;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性动画 */
    transition-delay: 0.3s;
    word-break: break-word;
    hyphens: auto;
    width: calc(100% - 40px); /* 减去左右padding的宽度 */
    min-width: 260px; /* 设置最小内容宽度，考虑padding */
    max-width: 560px; /* 设置最大内容宽度，考虑padding */
    box-sizing: border-box; /* 确保padding不会增加总宽度 */
}

.card-content.show {
    opacity: 1;
    transform: translateY(0);
}

.card-content::-webkit-scrollbar {
    width: 6px;
}

.card-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.card-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* 打字机效果 */
.card-content .typing-content {
    display: block;
    overflow: hidden;
    white-space: pre-wrap;
    width: 100%;
    box-sizing: border-box; /* 确保padding不会增加总宽度 */
}

.card-content.show .typing-content {
    width: 100%;
}