* {
    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;
}

/* ================= 屏幕控制 ================= */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}
.screen.active {
    display: block;
    overflow-y: auto;
}

/* 实验界面：左右并排布局 */
.experiment-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 80px); /* 减去底部按钮栏的高度 */
    overflow: hidden;
}
.experiment-layout .experiment-panel {
    flex-shrink: 0;
    height: 100%;
}
.experiment-layout .main-container {
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ================= 无障碍条 ================= */
.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;
    flex-shrink: 0;
    height: 100vh;
}
.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;
    height: 100vh;
}
.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;
}

/* ================= 聊天核心区 ================= */
.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;
}

/* ================= 序号按钮 ================= */
.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);
}
.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;
}

/* ================= 问卷 & 复述 & 致谢 ================= */
.survey-wrap {
    max-width: 860px;
    width: calc(100% - 80px);
    margin: 40px auto;
    padding: 32px 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(200, 16, 46, 0.08);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.survey-wrap-wide {
    max-width: 1180px;
}
.survey-wrap::-webkit-scrollbar { width: 8px; }
.survey-wrap::-webkit-scrollbar-thumb {
    background: #e0c5c8;
    border-radius: 4px;
}
.survey-wrap::-webkit-scrollbar-thumb:hover { background: #c8102e; }

.survey-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}
.survey-col { min-width: 0; }

.brand-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0e7dc;
}
.brand-logo { width: 40px; height: 40px; }
.brand-bar h1 {
    font-size: 20px;
    color: #c8102e;
    font-weight: bold;
}

.survey-wrap h2 {
    color: #c8102e;
    font-size: 22px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0e7dc;
}
.survey-wrap h3 {
    margin: 28px 0 10px;
    font-size: 16px;
    color: #333;
    border-left: 4px solid #c8102e;
    padding-left: 10px;
}
.survey-hint {
    font-size: 13px;
    color: #888;
    margin-bottom: 20px;
}
.survey-item { margin-bottom: 18px; }
.survey-item p {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.likert {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.likert label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 38px;
    padding: 0 8px;
    font-size: 13px;
    border: 1px solid #e2dbcf;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    color: #555;
}
.likert label:hover {
    border-color: #c8102e;
    color: #c8102e;
    background: #fff7f0;
}
.likert input[type="radio"] { display: none; }
.likert label:has(input[type="radio"]:checked) {
    background: #c8102e;
    color: #fff;
    border-color: #c8102e;
}

.survey-wrap select,
.survey-wrap input[type="text"] {
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid #e2dbcf;
    border-radius: 8px;
    font-size: 14px;
    background: #fefcf8;
    transition: border 0.2s;
}
.survey-wrap select:focus,
.survey-wrap input[type="text"]:focus {
    outline: none;
    border-color: #c8102e;
}

.consent-text {
    font-size: 14px;
    line-height: 1.9;
    color: #444;
    background: #fefcf8;
    padding: 18px;
    border-radius: 10px;
    border-left: 4px solid #c8102e;
}
.consent-text p { margin-bottom: 10px; }

.consent-check {
    display: block;
    margin: 22px 0;
    font-size: 14px;
    color: #333;
}

.nav-btns {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.nav-btns button {
    padding: 11px 26px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(90deg, #c8102e, #e85d04);
    color: #fff;
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(200, 16, 46, 0.35);
}
.btn-secondary { background: #f5f5f5; color: #555; }
.btn-secondary:hover { background: #eee; }

.recall-question {
    background: #fff7f0;
    border: 1px dashed #c8102e;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 15px;
    color: #c8102e;
    font-weight: bold;
    margin-bottom: 16px;
    text-align: center;
}
.recall-textarea {
    width: 100%;
    min-height: 140px;
    padding: 14px;
    border: 1px solid #e2dbcf;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    background: #fefcf8;
}
.recall-textarea:focus { outline: none; border-color: #c8102e; }

.recall-result {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    background: #f0f9f0;
    border-left: 5px solid #52c41a;
}
.recall-result strong { color: #c8102e; }
.recall-score {
    font-size: 28px;
    font-weight: bold;
    color: #52c41a;
    text-align: center;
    margin: 8px 0;
}
.recall-detail {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    margin-top: 8px;
}

.done-wrap {
    text-align: center;
    padding: 60px 36px;
}
.done-wrap h2 {
    border: none;
    padding: 0;
    font-size: 24px;
    margin-bottom: 24px;
}
.done-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.8;
}

/* ================= 响应式 ================= */
@media screen and (max-width: 900px) {
    .survey-grid { grid-template-columns: 1fr; gap: 20px; }
    .survey-wrap, .survey-wrap-wide {
        width: calc(100% - 32px);
        margin: 16px auto;
        padding: 20px;
        max-height: none;
    }
    .survey-wrap h2 { font-size: 18px; }
    .likert label { min-width: 38px; height: 34px; font-size: 12px; }
    .nav-btns { flex-direction: column-reverse; }
    .nav-btns button { width: 100%; }
}

@media screen and (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
        display: block;
    }
    .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; }
    .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%; height: auto; }
    .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-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; }
}