html {
    /* 补偿滚动条宽度防止内容偏移 */
  margin-left: calc(100vw - 100%);
  overflow-y: scroll; /* 强制显示滚动条防止跳动 */
}


:root {
    /*--primary-color: #07c160;*/
    --primary: #2D2D2D;    /* 主文本色 */
    --secondary: #7F7F7F;  /* 辅助文本色 */
    --accent: #5BCB7D;     /* 强调色 */
    --bg: #FFFFFF;         /* 背景色 */
    --gap: 2rem;           /* 通用间距 */
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 动画曲线 */
    --border: 1px solid rgba(45, 45, 45, 0.1);
    --draft: #FF9500;
    --pending: #007AFF;
    --published: #5BCB7D;

    --primary-color: #eff6ff;
    --bg-color: rgb(105 105 105 / 5%);
    --border-color: #e5e5e5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    /*border-left: 1px solid var(--border-color);*/
    /*border-right: 1px solid var(--border-color);*/
}

.messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    scroll-behavior: smooth;
}

/* 修改消息框默认的滚动条*/
/* 适用于WebKit内核浏览器 */
.messages::-webkit-scrollbar {
  width: 6px;  /* 纵向滚动条宽度 */
  height: 6px; /* 横向滚动条高度 */
}
.messages::-webkit-scrollbar-thumb {
  background: rgb(105 105 105 / 5%);
  border-radius: 3px; /* 椭圆点效果 */
  transition: background 0.2s;
}
.messages::-webkit-scrollbar-thumb:hover {
  background: #666; /* 悬停反馈 */
}
/* Firefox兼容方案 */
@supports (scrollbar-color: rgb(105 105 105 / 5%) transparent) {
  .messages {
    scrollbar-color: rgb(105 105 105 / 5%) transparent;
    scrollbar-width: thin;
  }
}

.message {
    display: flex;
    margin-bottom: 30px;
    transition: opacity 0.3s;
}

.message.self {
    flex-direction: row-reverse;
}

.bubble {
    max-width: 100%;
    padding: 16px 16px;
    border-radius: 14px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}
/* 新增Markdown样式 */
.bubble :is(h1, h2, h3) {
    font-size: 1.2em;
    margin: 8px 0;
}

.bubble pre {
    background: rgba(0,0,0,0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
}

.bubble code {
    font-family: Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.bubble a {
    color: var(--primary-color);
    text-decoration: underline;
}

.bubble ul {
    padding-left: 20px;
}

.bubble img {
    max-width: 100%;
    border-radius: 8px;
}

/* 消息操作按钮 */
.message-action {
    position: absolute;
    left: 0px;
    bottom: 2px;
    display: flex;
    gap: 8px;
    transform: translateY(50%); /* 关键定位技巧 */
    align-items: center;
}
.message-action .copy-btn {
    background: rgba(255,255,255,0);
    border: none;
    cursor: pointer;
    font-size: 12px;
}
.message-action .copy-btn svg{
    width: 20px;
    height: 20px;
    color: #909090
}
.message-action .time {
    font-size:12px;
    opacity:0.8;
}

/* 刷新按钮定位 */
.fixed-container {
    position: fixed;
    top: 29px;
    right: 16px;
}
.fixed-container a {
    padding: 12px 12px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: opacity 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-decoration: none;
    color: black;
}
.fixed-container a:hover {
    background: rgb(77, 107, 254);
    color: white;
}

.message.other .bubble {
    background: var(--bg-color);
}

.message.self .bubble {
    background: var(--primary-color);
    /*color: white;*/
}

.input-area {
    display: flex;
    padding: 16px;
    /*border-top: 1px solid var(--border-color);*/
    /*background: var(--bg-color);*/
    width: 100%;
    max-height: calc(12* 28px);
    margin: 0 4px;
    position: relative;
    align-items: end;
}

.input {
    resize: none;
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    margin-right: 12px;
    outline: none;
    transition: border-color 0.3s;
    min-height: 58px;
    max-height: 300px;
    overflow: hidden;
}

.input:focus {
    border-color: var(--primary-color);
}

.btn {
    height: 60px;
    padding: 17px 15px;
    /*background: var(--primary-color);*/
    background: rgb(214 222 232);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: opacity 0.3s;
}
.btn svg {
    width: 26px;
    height: 26px;
}

.btn:active {
    opacity: 0.8;
}

@media (max-width: 480px) {
    .chat-container {
        border: none;
    }

    .bubble {
        max-width: 80%;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}