* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Roboto, sans-serif;
}
:root {
    --chat-font: 15px;
}
body {
    background: #f5f5f5;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 无障碍条 */
.access-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #eee;
    padding: 8px 24px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}
.access-bar.show {
    display: flex;
}
.access-btn {
    padding: 5px 12px;
    border: 1px solid #c8102e;
    background: #fff;
    color: #c8102e;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* 左侧实验栏 */
.experiment-panel {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e5e0d5;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow-y: auto;
    z-index: 20;
}
.experiment-panel.collapsed {
    width: 55px;
    padding: 20px 0;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0e7dc;
}
.panel-title {
    font-size: 16px;
    font-weight: bold;
    color: #c8102e;
}
.collapse-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f5f0;
    border: 1px solid #e5e0d5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #c8102e;
}
.experiment-panel.collapsed .panel-content,
.experiment-panel.collapsed .event-log,
.experiment-panel.collapsed .panel-title {
    display: none;
}
.experiment-panel.collapsed .collapse-btn {
    margin: 0 auto;
}
.control-item {
    margin-bottom: 18px;
}
.control-item label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}
.control-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2dbcf;
    border-radius: 6px;
    background: white;
}
.event-log {
    margin-top: 20px;
    background: #fef9f0;
    border-radius: 10px;
    padding: 10px;
    font-size: 11px;
    border: 1px solid #f0e2cf;
}
.log-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #c8102e;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.log-list {
    max-height: 250px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 10px;
    color: #2c3e4e;
}
.log-item {
    border-bottom: 1px dotted #efdbc4;
    padding: 4px 0;
}
.export-log-btn {
    background: none;
    border: none;
    color: #c8102e;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.export-log-btn:hover {
    background: #f0e2cf;
}

/* 主区域 */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.container {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}
.header {
    background: linear-gradient(90deg, #c8102e 0%, #e85d04 50%, #ffba08 100%);
    padding: 18px 24px;
    color: white;
    transition: background 0.3s ease;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.title-text h1 {
    font-size: 22px;
}
.top-links {
    display: flex;
    gap: 24px;
    font-size: 14px;
    cursor: pointer;
}

/* 聊天核心区 flex布局 */
.main-chat-area {
    flex: 1;
    display: flex;
    padding: 24px;
    gap: 20px;
    overflow: hidden;
    position: relative;
}
.chat-left {
    flex: 2.5;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* 侧边栏样式 */
.source-sidebar {
    width: 170px;
    background: #e8e8e8;
    border-left: 1px solid #d0d0d0;
    border-right: 1px solid #d0d0d0;
    padding: 20px 16px;
    display: none;
    overflow-y: auto;
    border-radius: 0px;
}
.source-sidebar.show {
    display: block;
}
.source-sidebar > div:first-child {
    font-weight: bold;
    font-size: 16px;
    color: #c8102e;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #cccccc;
    text-align: left;
}
.source-item {
    font-size: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #cccccc;
}
.source-item .ref-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #c8102e;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 11px;
    line-height: 20px;
    margin-right: 8px;
}
.source-item a {
    color: #c8102e;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
}
.source-item a:hover {
    text-decoration: underline;
}
.source-item .source-code {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}
.source-item .source-department {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.chat-right {
    flex: 0.6;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 智能弹窗（悬停） */
.custom-tooltip {
    position: fixed;
    background: white;
    border: 2px solid #c8102e;
    border-radius: 16px;
    padding: 14px;
    width: 300px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 10000;
    display: none;
    font-size: 13px;
    line-height: 1.5;
    backdrop-filter: blur(2px);
}
.tooltip-title {
    font-weight: bold;
    font-size: 16px;
    color: #c8102e;
    text-align: center;
    margin-bottom: 6px;
}
.tooltip-url {
    font-size: 11px;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 8px;
    word-break: break-all;
    background: #f7f2ea;
    padding: 4px;
    border-radius: 6px;
}
.tooltip-desc {
    font-size: 12px;
    color: #333;
    text-align: center;
}
.click-hint {
    font-size: 10px;
    color: #a55;
    text-align: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #f0e7dc;
}

/* 序号按钮样式 - 可交互版本（hover模式） */
.ref-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #c8102e;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 2px;
    text-decoration: none;
    transition: 0.1s;
    vertical-align: middle;
}
.ref-number:hover {
    background-color: #8a0b1f;
    transform: scale(1.05);
}

/* 序号按钮样式 - 仅展示版本（fixed模式） */
.ref-number-static {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background-color: #c8102e;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    margin: 0 2px;
    vertical-align: middle;
    pointer-events: none;
    cursor: default;
}

.bubble {
    max-width: 80%;
    background: #f5f0e6;
    padding: 12px 18px;
    border-radius: 20px;
    line-height: 1.6;
    font-size: var(--chat-font);
    white-space: pre-wrap;
}
.chat-header h2 {
    border-bottom: 2px solid #f0e7dc;
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.message {
    display: flex;
    gap: 10px;
}
.message.user {
    justify-content: flex-end;
}
.msg-avatar {
    width: 36px;
    height: 36px;
    background: #c8102e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}
.msg-avatar.user {
    background: #607d8b;
}
.input-area {
    border: 1px solid #e2dbcf;
    border-radius: 20px;
    padding: 16px;
    background: #fff;
}
.hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.tag {
    background: #ffeef0;
    color: #c8102e;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}
.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 30px;
    padding: 8px 15px;
}
.input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}
.send-btn {
    margin-top: 12px;
    background: #c8102e;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 32px;
    cursor: pointer;
    float: right;
}
.common-q, .history-q {
    background: #fefcf8;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #f2ebe0;
}
.section-title {
    font-size: 16px;
    font-weight: bold;
    color: #c8102e;
    border-left: 4px solid #c8102e;
    padding-left: 12px;
    margin-bottom: 14px;
}
.list-item {
    padding: 8px 0 8px 8px;
    border-bottom: 1px dashed #eee;
    cursor: pointer;
    font-size: 13px;
}
.clear-btn {
    font-size: 12px;
    border: none;
    background: none;
    cursor: pointer;
    color: #a00;
    float: right;
}

/* 思考动画样式 */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}
.thinking-text {
    font-size: 14px;
    color: #666;
}
.thinking-dot {
    font-size: 18px;
    font-weight: bold;
    color: #c8102e;
    transition: opacity 0.2s ease;
}

/* 按钮样式 */
.apply-btn {
    width: 100%;
    padding: 10px;
    background: #c8102e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin-top: 10px;
    transition: background 0.2s ease;
}
.apply-btn:hover {
    background: #a00b28;
}
.send-btn.stop-mode {
    background-color: #f5a623 !important;
}
.send-btn.stop-mode:hover {
    background-color: #e09515 !important;
}

/* 防止图片被下载/拖拽/右键保存 */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.msg-avatar {
    width: 36px;
    height: 36px;
    background: transparent !important;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msg-avatar.user {
    background: transparent !important;
}
.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.emblem {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
}
.emblem img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ==================== 响应式设计（手机窄屏） ==================== */
@media screen and (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }
    
    /* 左侧实验栏默认折叠，可展开 */
    .experiment-panel {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
    }
    .experiment-panel.open {
        transform: translateX(0);
    }
    .experiment-panel.collapsed {
        width: 260px;
    }
    
    /* 添加一个展开按钮（通过JS动态添加） */
    .menu-toggle {
        position: fixed;
        left: 10px;
        top: 10px;
        z-index: 101;
        background: #c8102e;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    .main-container {
        width: 100%;
    }
    
    .header {
        padding: 12px 16px;
    }
    .title-text h1 {
        font-size: 18px;
    }
    .top-links span {
        font-size: 12px;
    }
    
    .main-chat-area {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
        overflow: visible;
    }
    
    .chat-left {
        flex: auto;
        min-height: 400px;
    }
    
    .source-sidebar {
        width: 100%;
        order: 2;
        margin-top: 12px;
    }
    
    .chat-right {
        flex: auto;
        order: 3;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .chat-right .common-q,
    .chat-right .history-q {
        margin: 0;
    }
    
    .bubble {
        max-width: 90%;
        font-size: 14px;
    }
    
    .hot-tags {
        gap: 6px;
    }
    .tag {
        font-size: 11px;
        padding: 3px 10px;
    }
    
    .input-wrapper input {
        font-size: 13px;
    }
    
    .send-btn {
        padding: 6px 20px;
    }
    
    /* 弹窗适配 */
    .custom-tooltip {
        width: 280px;
        padding: 10px;
    }
    .tooltip-logo {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .tooltip-title {
        font-size: 14px;
    }
    
    /* 序号按钮在手机上的大小 */
    .ref-number, .ref-number-static {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

@media screen and (max-width: 480px) {
    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .main-chat-area {
        padding: 8px;
    }
    
    .chat-right {
        grid-template-columns: 1fr;
    }
    
    .bubble {
        max-width: 95%;
        padding: 8px 12px;
    }
    
    .msg-avatar {
        width: 30px;
        height: 30px;
    }
    
    .msg-avatar img {
        width: 30px;
        height: 30px;
    }
    
    .input-area {
        padding: 12px;
    }
    
    .hot-tags {
        gap: 5px;
    }
    .tag {
        font-size: 10px;
        padding: 2px 8px;
    }
    
    .send-btn {
        padding: 5px 16px;
        font-size: 13px;
    }
}