/* 侧边栏样式 */
.chat-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 2000;
}

.chat-sidebar.open {
    transform: translateX(300px);
}

.content-wrapper {
    transition: margin-left 0.3s ease;
    margin-left: 0;
}

.content-wrapper.sidebar-open {
    margin-left: 400px;
}

.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.sidebar-toggle.open {
    left: 420px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
}

.chat-history.hidden {
    display: none;
}

.chat-entry {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease forwards;
}

.chat-entry:last-child {
    margin-bottom: 0;
}

.chat-entry:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.chat-entry .timestamp {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
}

.chat-entry .question {
    color: #fff;
    font-weight: bold;
    margin-bottom: 10px;
}

.chat-entry .cards {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.chat-entry .card-mini {
    width: 40px;
    height: 60px;
    background-size: cover;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chat-detail {
    display: none;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-top: 10px;
}

.chat-detail.active {
    display: block;
}

/* 聊天输入框样式 */
.chat-input-container {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    position: relative;
    z-index: 2;
    margin-top: auto;
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    resize: none;
    height: 45px;
    min-height: 45px;
    max-height: 45px;
    line-height: 1.5;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.send-button {
    min-width: 45px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(45deg, #4a1c7c, #7c1c4a);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.1);
    background: linear-gradient(45deg, #5a2c8c, #8c2c5a);
}

/* 自定义滚动条 */
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 聊天记录中的卡牌展示 */
.history-cards-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.history-card {
    width: 80px;
    height: 120px;
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.history-card:hover {
    transform: translateY(-5px);
}

/* AI解读内容样式 */
.history-interpretation {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
    line-height: 1.6;
}

/* 继续对话部分样式 */
.continue-chat {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.continue-chat .messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

/* 消息样式 */
.message {
    padding: 15px;
    margin: 10px 0;
    border-radius: 15px;
    max-width: 85%;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.message.user {
    background: linear-gradient(45deg, #4a1c7c, #6b2a99);
    margin-left: auto;
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.ai {
    background: rgba(255, 255, 255, 0.15);
    margin-right: auto;
    margin-left: 10px;
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.message.error {
    background: rgba(255, 107, 107, 0.3);
    color: #fff;
    text-align: center;
    margin: 10px auto;
    border: 1px solid rgba(255, 107, 107, 0.5);
}

/* 聊天室视图样式 */
.chat-room {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 0, 51, 0.95);
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
}

.chat-room.active {
    display: flex;
}

.chat-room-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    position: relative;
    z-index: 3;
    min-height: 60px;
    background: rgba(26, 0, 51, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-room-question {
    color: white;
    font-size: 16px;
    margin: 0;
    text-align: center;
    padding: 0 50px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 100px);
    position: relative;
    z-index: 2;
}

.chat-room .back-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.chat-room .back-button:hover {
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.chat-sidebar.open .chat-room .back-button {
    right: 20px;
}

.chat-room-cards {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    margin-top: 20px;
}

.chat-room-card {
    width: 80px;
    height: 120px;
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.card-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: white;
    font-size: 12px;
    text-align: center;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.chat-room-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    margin-top: 40px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-room-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-room-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chat-room-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.chat-room-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message.ai .ai-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #ffd700;
    font-weight: bold;
    font-size: 0.9em;
}

.message.ai .ai-message-header i {
    font-size: 1.1em;
}

.message.ai .ai-message-content {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
}

/* 历史记录标题栏 */
.chat-history-header {
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(45deg, #0a0022, #1a0044, #150033, #220044, #0a0022);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 3;
}

.chat-history-title {
    font-family: 'Dancing Script', cursive;
    color: white;
    font-size: 32px;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* 动画效果 */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
} 

.chat-history-content {
    padding: 20px;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.history-item .question {
    color: #fff;
    font-size: 16px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.history-item .cards {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.history-item .card-mini {
    width: 45px;
    height: 68px;
    background-size: cover;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.history-item .card-mini:hover {
    transform: scale(1.1);
}

.history-item .date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 10px;
}

.history-item .delete-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(255, 107, 107, 0.4);
    transform: scale(1.1);
}

.delete-btn::before,
.delete-btn::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.delete-btn::before {
    transform: rotate(45deg);
}

.delete-btn::after {
    transform: rotate(-45deg);
}

/* 🗑️ 已删除重复的 delete-confirm-dialog 样式定义 */

/* 历史记录侧栏 - 极简冷淡设计 */
.history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60000; /* 🔧 提高到60000，确保在所有元素之上（包括 user-corner 50000） */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.history-sidebar.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* 背景遮罩 */
.sidebar-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* 侧栏主体内容 */
.sidebar-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 100%;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.history-sidebar.active .sidebar-content {
    transform: translateX(0);
}

/* 侧栏头部 */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    position: relative; /* 🔧 确保z-index生效 */
    z-index: 60001; /* 🔧 确保header在所有元素之上，包括user-corner (50000) */
}

.sidebar-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

.sidebar-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* 历史记录切换按钮 - 使用超强制定位 */
.history-toggle {
    position: fixed;
    inset: 20px auto auto 20px; /* 🔧 使用inset强制定位：top right bottom left */
    margin: 0; /* 🔧 清除所有margin */
    padding: 0; /* 🔧 清除所有padding（内部元素自己控制） */
    z-index: 4999; /* 🔧 高于 UI 覆盖层 (1000)，低于 User Corner (50000) */
    background: rgba(15, 15, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 44px;
    max-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    contain: layout; /* 🔧 隔离布局上下文 */
    will-change: auto; /* 🔧 优化渲染 */
}

.history-toggle:hover {
    background: rgba(25, 25, 25, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

/* 历史列表视图 */
.history-list-view {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 80px);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 20px;
    box-sizing: border-box;
}

.history-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.history-empty-state p {
    font-size: 16px;
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.7);
}

.history-empty-state span {
    font-size: 14px;
    opacity: 0.6;
}

/* 历史记录项容器 */
.history-items-container {
    padding: 16px 0;
}

/* 历史记录项 */
.history-item {
    position: relative;
    margin: 0 16px 12px 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.history-item:last-child {
    margin-bottom: 16px;
}

/* 问题标题 */
/* 🎯 元信息容器（塔罗师和牌阵） */
.history-meta-info {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* 🎯 塔罗师信息（缩略栏） */
.history-tarot-master {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    width: fit-content;
}

.history-master-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.history-master-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* 🎯 牌阵信息（缩略栏） */
.history-spread-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(123, 97, 255, 0.1);
    border-radius: 20px;
    width: fit-content;
}

.history-spread-info i {
    color: rgba(123, 97, 255, 0.8);
    font-size: 12px;
}

.history-spread-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.history-spread-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.history-question {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 12px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
}

/* 卡牌显示区域 */
.history-cards-container {
    margin-bottom: 12px;
}

.history-main-cards {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: flex-start;
}

.history-guidance-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.guidance-section-label {
    font-size: 0.75em;
    color: rgba(255, 165, 0, 0.8);
    margin-bottom: 4px;
    font-weight: 500;
}

.history-guidance-cards {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
}

.history-card-mini {
    position: relative;
    width: 32px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    transition: all 0.3s ease;
    overflow: hidden;
}

.history-card-mini:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 10;
}

/* 指引卡样式 */
.history-guidance-card-mini {
    position: relative;
    width: 28px;
    height: 42px;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    border: 1px solid rgba(255, 165, 0, 0.4);
    transition: all 0.3s ease;
    opacity: 0.9;
    margin-left: 4px;
}

.history-guidance-card-mini:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.4);
    opacity: 1;
    z-index: 10;
}

.guidance-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    background: rgba(255, 165, 0, 0.9);
    color: white;
    font-size: 8px;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 6px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 165, 0, 1);
}

/* 卡牌遮罩层 */
.history-card-mini::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
}

/* 卡牌名称 */
.history-card-name {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    font-size: 8px;
    color: white;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 时间戳 */
.history-timestamp {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 删除按钮 */
.history-delete {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: auto; /* 🔧 确保按钮始终可点击 */
    position: relative;
    z-index: 10; /* 🔧 确保按钮在最上层 */
}

.history-item:hover .history-delete {
    opacity: 1;
}

.history-delete:hover {
    background: rgba(231, 76, 60, 0.2);
    color: rgba(231, 76, 60, 0.9);
}

/* 🔧 移动端：删除按钮始终显示 */
@media (max-width: 768px) {
    .history-delete {
        opacity: 0.6;
    }
}

/* 详情视图 */
.history-detail-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.detail-back {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.detail-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

/* 详情内容 */
.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 🎯 详情页塔罗师信息 */
/* 🎯 塔罗师和牌阵信息容器 - 横向排列 */
.detail-meta-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* 移动端允许换行 */
}

.detail-tarot-master {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px; /* 确保不会太窄 */
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(79, 70, 229, 0.1));
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
}

.detail-master-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(147, 51, 234, 0.3);
}

.detail-master-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* 🎯 详情页牌阵信息 */
.detail-spread-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px; /* 确保不会太窄 */
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.1), rgba(88, 166, 255, 0.1));
    border: 1px solid rgba(123, 97, 255, 0.2);
    border-radius: 12px;
}

.detail-spread-info i {
    color: rgba(123, 97, 255, 0.8);
    font-size: 16px;
}

.detail-spread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(123, 97, 255, 0.3);
}

.detail-spread-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* 🎯 详情页卡牌布局预览 */
.detail-spread-preview {
    margin-bottom: 24px;
}

.detail-question {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
}

.detail-question::before {
    content: attr(data-label);
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* 🎯 命运抉择AB选项样式 */
.detail-choice-options {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
}

.choice-option-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.choice-option-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.choice-option-value {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.4;
    flex: 1;
}

/* 详情卡牌部分 */
.detail-cards-section h4,
.detail-interpretation-section h4,
.detail-chat-section h4,
.detail-guidance-section h4 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    text-transform: uppercase;
}

.detail-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.detail-card {
    position: relative;
    width: 60px;
    height: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.detail-card:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.8) 100%);
}

.detail-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 4px 4px 4px;
    text-align: center;
}

.detail-card-name {
    color: white;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.detail-card-position {
    color: rgba(255, 255, 255, 0.8);
    font-size: 7px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 详情解读部分 */
.detail-interpretation {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.8;
    max-height: 500px;
    overflow-y: auto;
}

/* 🎯 解读内容段落样式 */
.detail-interpretation p {
    margin: 0 0 12px 0;
    text-indent: 0;
    color: rgba(255, 255, 255, 0.85);
}

.detail-interpretation p:last-child {
    margin-bottom: 0;
}

/* 🎯 Markdown 格式支持 */
.detail-interpretation strong {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}

.detail-interpretation em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

/* 聊天记录部分 */
.detail-chat-messages {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 24px;
    max-height: 200px;
    overflow-y: auto;
}

.detail-chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.detail-chat-message.user {
    background: rgba(100, 150, 255, 0.1);
    border: 1px solid rgba(100, 150, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.detail-chat-message.ai {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

/* 🔧 对话记录段落样式 */
.detail-chat-message p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.detail-chat-message p:last-child {
    margin-bottom: 0;
}

/* 指引卡部分 */
.detail-guidance-cards {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 24px;
}

.detail-guidance-item {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-guidance-question {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
}

.detail-guidance-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-guidance-card-image {
    width: 24px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    background-size: cover;
    background-position: center;
}

.detail-guidance-card-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 500;
}

.detail-guidance-interpretation {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    line-height: 1.4;
}

/* 🔧 指引卡解读段落样式 */
.detail-guidance-interpretation p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.detail-guidance-interpretation p:last-child {
    margin-bottom: 0;
}

/* 自定义滚动条 */
.history-list-view::-webkit-scrollbar,
.detail-content::-webkit-scrollbar,
.detail-interpretation::-webkit-scrollbar,
.detail-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.history-list-view::-webkit-scrollbar-track,
.detail-content::-webkit-scrollbar-track,
.detail-interpretation::-webkit-scrollbar-track,
.detail-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.history-list-view::-webkit-scrollbar-thumb,
.detail-content::-webkit-scrollbar-thumb,
.detail-interpretation::-webkit-scrollbar-thumb,
.detail-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.history-list-view::-webkit-scrollbar-thumb:hover,
.detail-content::-webkit-scrollbar-thumb:hover,
.detail-interpretation::-webkit-scrollbar-thumb:hover,
.detail-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar-content {
        width: 100%;
    }
    
    .history-main-cards {
        gap: 6px;
    }
    
    .history-card-mini {
        width: 28px;
        height: 42px;
    }
    
    .history-guidance-cards {
        gap: 4px;
    }
    
    .history-guidance-card-mini {
        width: 22px;
        height: 33px;
    }
    
    .guidance-indicator {
        font-size: 7px;
        padding: 1px 2px;
    }
    
    .guidance-section-label {
        font-size: 0.7em;
    }
    
    .detail-cards {
        gap: 8px;
    }
    
    .detail-card {
        width: 50px;
        height: 75px;
    }
    
    .history-toggle {
        /* 🔧 使用超强制定位，确保完全不受其他元素影响 */
        position: fixed !important;
        inset: 20px auto auto 20px !important; /* 🔧 强制定位 */
        top: 20px !important; /* 🔧 双重保险 */
        left: 20px !important; /* 🔧 双重保险 */
        right: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
    }
}

/* 🎯 480px以下确保水平对齐 */
@media (max-width: 480px) {
    .history-toggle {
        top: 20px !important; /* 🔧 确保与塔罗师选择器和牌阵选择器水平对齐 */
        left: 20px !important;
    }
}

/* 动画效果 */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.history-item {
    animation: fadeIn 0.3s ease forwards;
}

.history-item:nth-child(n) {
    animation-delay: calc(0.05s * var(--index, 0));
}

/* 确认删除对话框 */
.delete-confirm-dialog {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 60100 !important; /* 🔧 必须高于侧栏的 z-index: 60000 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px;
    transform: none !important; /* 🔧 防止被其他样式覆盖 */
}

.delete-confirm-content {
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(20px);
}

.delete-confirm-content h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.delete-confirm-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.delete-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.delete-confirm-btn,
.delete-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.delete-confirm-btn {
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: 1px solid rgba(231, 76, 60, 0.5);
}

.delete-confirm-btn:hover {
    background: rgba(231, 76, 60, 1);
    transform: translateY(-1px);
}

.delete-cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.delete-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 1);
} 