/* ============================================
   蓝色基调 · 云纹 · 深蓝色80%透明气泡
   适配手机端和电脑端
   ============================================ */

/* ===== 全局基础样式 ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "Arial", sans-serif;
  margin: 0;
  padding: 0;
}

p {
  font-family: "Microsoft YaHei", "Arial", sans-serif;
  font-size: 14.5px;
  line-height: 24px;
  margin-top: 20px;
  margin-bottom: 16px;
  margin-left: 17px;
  margin-right: 13px;
  letter-spacing: 0.5px;
}

h1 {
  font-family: "Microsoft YaHei", "Arial", sans-serif;
  font-size: largest;
  border-top: 0.5em solid #4a8ab5;
  margin-top: 0;
  padding-top: 0.5em;
}

font {
  font-family: "Microsoft YaHei", "Arial", sans-serif;
  font-weight: bold;
}

li {
  font-family: "Microsoft YaHei", "Arial", sans-serif;
  font-weight: bold;
  list-style-type: disc;
}

/* ===== 全局文字强制规则 ===== */
*#ai-chat-main,
*#ai-chat-main *,
*#customized-answer-content,
*#customized-answer-content *,
*#customized-question-content,
*#customized-question-content * {
    color: #e8edf2 !important;
}

/* ===== 主聊天背景 ===== */
*#ai-chat-main {
    background: linear-gradient(180deg, #0a1622 0%, #0f1c2e 40%, #0d1828 100%) !important;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(80, 140, 200, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(60, 120, 180, 0.05) 0%, transparent 50%) !important;
    position: relative !important;
}

/* ===== 回答卡片（深蓝色 · 80%不透明度） ===== */
*#customized-answer-content {
    background: rgba(20, 40, 70, 0.80) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: 
        inset 0 0 0 2px rgba(120, 160, 200, 0.4),
        0 0 20px rgba(80, 140, 200, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.15) !important;
    color: #e8edf2 !important;
    padding: 20px !important;
    position: relative !important;
    overflow: visible !important;
}

/* 云纹装饰 - 左上角 */
*#customized-answer-content::before {
    content: "☁";
    position: absolute;
    top: -8px;
    left: 10px;
    font-size: 22px;
    color: rgba(120, 170, 210, 0.6);
    pointer-events: none;
    text-shadow: 0 0 10px rgba(100, 150, 200, 0.4);
    z-index: 1;
}

/* 问题卡片（深蓝色 · 80%不透明度） */
*#customized-question-content {
    background: rgba(20, 40, 70, 0.80) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 
        inset 0 0 0 2px rgba(120, 160, 200, 0.35),
        0 0 12px rgba(80, 140, 200, 0.15),
        0 3px 12px rgba(0, 0, 0, 0.1) !important;
    color: #e8edf2 !important;
}

/* ===== 输入框 ===== */
*#ai-chat-input {
    background: rgba(15, 25, 40, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(100, 150, 200, 0.35) !important;
    border-radius: 10px !important;
    color: #e8edf2 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
    padding: 12px 18px !important;
    font-size: 15px !important;
}

*#ai-chat-input:focus {
    border-color: rgba(120, 180, 220, 0.7) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 18px rgba(80, 140, 200, 0.2) !important;
    outline: none !important;
}

*#ai-chat-bottom-input {
    background: transparent !important;
    backdrop-filter: none !important;
}

/* ===== 发送按钮 ===== */
*#ai-send-button {
    background: linear-gradient(180deg, rgba(80, 140, 200, 0.8) 0%, rgba(50, 100, 160, 0.8) 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(120, 180, 220, 0.5) !important;
    font-weight: bold !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}

*#ai-send-button:hover {
    background: linear-gradient(180deg, rgba(100, 160, 220, 0.9) 0%, rgba(70, 120, 180, 0.9) 100%) !important;
    box-shadow: 0 0 15px rgba(80, 140, 200, 0.4) !important;
}

/* ===== 功能按钮（MOD、流式等） ===== */
*#ai-mod-button2 button {
    background: rgba(30, 40, 60, 0.55) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    color: #a0c4e0 !important;
    border: 1px solid rgba(100, 150, 200, 0.35) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
    font-weight: 500 !important;
    padding: 6px 18px !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
}

*#ai-mod-button2 button:hover {
    background: rgba(50, 60, 80, 0.65) !important;
    color: #c8e0f8 !important;
    border-color: rgba(120, 180, 220, 0.6) !important;
    box-shadow: 0 0 16px rgba(80, 140, 200, 0.25) !important;
}

/* ===== 滚动条 ===== */
*::-webkit-scrollbar {
    width: 5px !important;
}
*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03) !important;
}
*::-webkit-scrollbar-thumb {
    background: rgba(80, 140, 200, 0.3) !important;
    border-radius: 10px !important;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 160, 220, 0.5) !important;
}

/* ===== 底部操作按钮 ===== */
*#customized-reload-button,
*#customized-edit-button,
*#customized-resend-button,
*#customized-delete-button {
    background: rgba(30, 40, 60, 0.55) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    color: #a0c4e0 !important;
    border: 1px solid rgba(100, 150, 200, 0.35) !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
}

*#customized-reload-button:hover,
*#customized-edit-button:hover,
*#customized-resend-button:hover,
*#customized-delete-button:hover {
    background: rgba(50, 60, 80, 0.7) !important;
    color: #c8e0f8 !important;
    border-color: rgba(120, 180, 220, 0.6) !important;
    box-shadow: 0 0 14px rgba(80, 140, 200, 0.25) !important;
}

/* ===== 折叠面板通用样式（普通折叠，非侧边栏） ===== */
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { display: none; }

details {
    background: rgba(30, 40, 60, 0.55) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(100, 150, 200, 0.3) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    margin: 10px 0 !important;
}

details summary {
    padding: 12px 16px !important;
    background: rgba(40, 55, 80, 0.7) !important;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 500;
    color: #a0c4e0 !important;
    border-radius: 8px 8px 0 0 !important;
}

details summary:hover {
    background: rgba(50, 70, 100, 0.8) !important;
}

details summary::after {
    content: '▶';
    float: right;
    font-size: 12px;
    color: #a0c4e0;
}

details[open] summary::after {
    transform: rotate(90deg);
}

details[open] {
    background: rgba(20, 30, 50, 0.9) !important;
    border-radius: 8px !important;
}

details[open] summary {
    border-bottom: 1px solid rgba(100, 150, 200, 0.3) !important;
}

/* ===== 记忆区表格样式（修复白色遮罩） ===== */
details table,
details table *,
details thead,
details tbody,
details tr,
details th,
details td,
details table[style],
details td[style],
details th[style] {
    background: transparent !important;
    background-color: transparent !important;
    color: #e8edf2 !important;
}

details th {
    border-bottom: 1px solid rgba(100, 150, 200, 0.25) !important;
    padding: 8px 12px !important;
    text-align: left !important;
}

details td {
    border-bottom: 1px solid rgba(100, 150, 200, 0.15) !important;
    padding: 8px 12px !important;
}

details tr:last-child td {
    border-bottom: none !important;
}

details tr:hover td,
details tr:hover th {
    background: rgba(50, 70, 100, 0.4) !important;
}

/* ===== 互动按钮基础样式 ===== */
.flex.items-center.gap-2.pb-2 {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 12px 15px !important;
  margin: 0 -5px !important;
  gap: 10px !important;
}

.flex.items-center.gap-2.pb-2 > button {
  flex: 0 0 auto !important;
  min-width: 80px !important;
  max-width: 120px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

/* ============================================
   手机端适配
   ============================================ */

@media screen and (max-width: 768px) {
  *#customized-answer-content {
    padding: 16px !important;
    border-radius: 12px !important;
  }

  .flex.items-center.gap-2.pb-2 {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 8px 12px !important;
    margin: 0 -6px 6px -6px !important;
    gap: 6px !important;
    scrollbar-width: none !important;
  }

  .flex.items-center.gap-2.pb-2::-webkit-scrollbar {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
  }

  .flex.items-center.gap-2.pb-2 > button {
    flex: 0 0 auto !important;
    min-width: 60px !important;
    max-width: 90px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    margin: 0 1px !important;
    height: 36px !important;
  }

  #ai-chat-input {
    padding: 8px 12px !important;
    font-size: 14px !important;
    min-height: 40px !important;
  }

  #ai-chat-bottom-input {
    padding: 10px 12px !important;
  }

  details {
    margin: 6px 4px !important;
  }

  details summary {
    padding: 8px 10px !important;
    font-size: 13px !important;
    min-height: 36px !important;
  }

  p {
    font-size: 13.5px;
    line-height: 1.5;
    margin-top: 12px;
    margin-bottom: 10px;
    margin-left: 10px;
    margin-right: 10px;
  }
}

@media screen and (max-width: 480px) {
  *#customized-answer-content {
    padding: 12px !important;
  }

  .flex.items-center.gap-2.pb-2 {
    padding: 6px 10px !important;
    gap: 5px !important;
    margin: 0 -5px 5px -5px !important;
  }

  .flex.items-center.gap-2.pb-2 > button {
    min-width: 55px !important;
    max-width: 80px !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    height: 34px !important;
  }
}

@media screen and (max-width: 768px) and (orientation: landscape) {
  .flex.items-center.gap-2.pb-2 {
    padding: 8px 20px !important;
  }
  .flex.items-center.gap-2.pb-2 > button {
    min-width: 70px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
  }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .flex.items-center.gap-2.pb-2 {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 10px !important;
    padding: 12px 20px !important;
  }
  .flex.items-center.gap-2.pb-2 > button {
    flex: 0 0 auto !important;
    min-width: 100px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
}

/* ============================================
   平台CG图片 · 金边相框包装
   直接对平台自动生成的底部图片进行美化
   ============================================ */

/* 回答卡片内所有直属img（平台追加的CG图） */
*#customized-answer-content > img {
  display: block !important;
  width: 201px !important;
  height: 300px !important;
  margin: 20px auto 10px auto !important;
  padding: 0 !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 2px solid #e5c17e !important;
  outline: 1px solid #b8860b !important;
  outline-offset: 3px !important;
  box-shadow:
    0 0 8px rgba(229, 193, 126, 0.3),
    0 4px 15px rgba(0, 0, 0, 0.5) !important;
  background-color: #1A1A1A !important;
}

/* 如果平台是用div包裹img */
*#customized-answer-content > div > img {
  display: block !important;
  width: 201px !important;
  height: 300px !important;
  margin: 20px auto 10px auto !important;
  padding: 0 !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 2px solid #e5c17e !important;
  outline: 1px solid #b8860b !important;
  outline-offset: 3px !important;
  box-shadow:
    0 0 8px rgba(229, 193, 126, 0.3),
    0 4px 15px rgba(0, 0, 0, 0.5) !important;
  background-color: #1A1A1A !important;
}

/* 如果平台用带cg类名的容器包裹 */
*#customized-answer-content [class*="cg"] img {
  display: block !important;
  width: 201px !important;
  height: 300px !important;
  margin: 20px auto 10px auto !important;
  padding: 0 !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 2px solid #e5c17e !important;
  outline: 1px solid #b8860b !important;
  outline-offset: 3px !important;
  box-shadow:
    0 0 8px rgba(229, 193, 126, 0.3),
    0 4px 15px rgba(0, 0, 0, 0.5) !important;
  background-color: #1A1A1A !important;
}

/* 包裹图片的父容器居中处理 */
*#customized-answer-content > div:has(> img) {
  display: flex !important;
  justify-content: center !important;
  background: transparent !important;
}

*#customized-answer-content [class*="cg"] {
  display: flex !important;
  justify-content: center !important;
  background: transparent !important;
}