/* ═══════════════════════════════════════════════════════════
   禁忌契约 · 薄暮微明
   主题：午后暖阳 · 克制 · 藏在日常里的暗涌
   适配原生 <details><summary>
   ═══════════════════════════════════════════════════════════ */

/* ==========================================================
   1. 全局基底 — 奶油亚麻，像共享的午后空间
   ========================================================== */
.bg-\[var\(--background\)\] {
  background: #f7f3ee !important;
}

/* ==========================================================
   2. 用户（儿子）气泡 — 琥珀暖调 · 自信 · 直接的体温
   ========================================================== */
.group.is-user > div:first-child {
  background: #fbf6f0 !important;
  border: 1px solid #d4b896 !important;
  box-shadow: 0 2px 12px rgba(180, 140, 100, .12) !important;
  color: #4a3030 !important;
  border-radius: 18px 6px 18px 18px !important;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.group.is-user > div:first-child .rili-markdown-renderer,
.group.is-user > div:first-child .rili-markdown-renderer * {
  color: #4a3030 !important;
  text-shadow: none !important;
}
/* 琥珀色的日光晕，像窗户投下的影子 */
.group.is-user > div:first-child::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 160%;
  height: 160%;
  background: radial-gradient(circle at 70% 30%, rgba(210, 170, 120, .10) 0%, transparent 55%);
  z-index: -1;
  pointer-events: none;
  animation: sunlight-drift 10s ease-in-out infinite;
}
@keyframes sunlight-drift {
  0%, 100% { opacity: .6; transform: translate(0, 0); }
  50%      { opacity: 1;  transform: translate(-3px, 2px); }
}

/* ==========================================================
   3. AI（母亲）气泡 — 旧纸 · 书香 · 理性下的柔软
   ========================================================== */
.group.is-assistant > div:first-child {
  background: #f8f3e8 !important;           /* 旧书页的米黄 */
  border: 1px solid #c8bfb0 !important;     /* 淡墨色边框，像褪色的字迹 */
  box-shadow: 0 2px 12px rgba(160, 140, 110, .08) !important;
  color: #4a3a2a !important;               /* 暖灰褐，像旧墨 */
  border-radius: 6px 18px 18px 18px !important;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.group.is-assistant > div:first-child .rili-markdown-renderer,
.group.is-assistant > div:first-child .rili-markdown-renderer * {
  color: #4a3a2a !important;
  text-shadow: none !important;
}
/* 像旧墨洇过纸背的暖褐光晕，极克制 */
.group.is-assistant > div:first-child::before {
  content: '';
  position: absolute;
  bottom: -15%;
  right: -15%;
  width: 130%;
  height: 130%;
  background: radial-gradient(circle at 80% 70%, rgba(180, 150, 110, .08) 0%, transparent 55%);
  z-index: -1;
  pointer-events: none;
  transition: opacity .6s ease;
}

/* ==========================================================
   4. 全局文字（暖灰褐，比纯黑更柔）
   ========================================================== */
.bg-\[var\(--background\)\] .rili-markdown-renderer,
.bg-\[var\(--background\)\] .rili-markdown-renderer * {
  color: #3e3530 !important;
}

/* ==========================================================
   5. <details> 折叠面板 — 温暖 · 半透明
   ========================================================== */
details.coser-panel,
details.coser-details,
.group details {
  background: #faf6f1;
  border: 1px solid #e5d9cc;
  border-radius: 10px;
  margin: 14px 0;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
  transition: box-shadow .3s ease, border-color .3s ease;
}
details.coser-panel[open],
details.coser-details[open],
.group details[open] {
  border-color: #d4b896;
  box-shadow: 0 3px 14px rgba(180, 140, 100, .10);
}

/* --- summary 头部 --- */
details.coser-panel > summary,
details.coser-details > summary,
.group details > summary {
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  color: #6b5a4e;
  background: rgba(255, 255, 255, .4);
  border-bottom: 1px solid rgba(0, 0, 0, .04);
  list-style: none;
  position: relative;
  transition: background .2s, color .2s;
  user-select: none;
}
details.coser-panel > summary::-webkit-details-marker,
details.coser-details > summary::-webkit-details-marker,
.group details > summary::-webkit-details-marker {
  display: none;
}
details.coser-panel > summary::after,
details.coser-details > summary::after,
.group details > summary::after {
  content: '▶';
  font-size: .7rem;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform .3s;
  color: #c4a88c;
}
details.coser-panel[open] > summary::after,
details.coser-details[open] > summary::after,
.group details[open] > summary::after {
  transform: translateY(-50%) rotate(90deg);
}
details.coser-panel > summary:hover,
details.coser-details > summary:hover,
.group details > summary:hover {
  background: rgba(255, 255, 255, .7);
  color: #4a3828;
}

/* --- 内容区 --- */
details.coser-panel > :not(summary),
details.coser-details > :not(summary),
.group details > :not(summary) {
  padding: 14px 18px;
  margin: 0;
  color: #3e3530;
  line-height: 1.6;
  font-size: 14px;
}

/* --- details 内表格 --- */
details.coser-panel table,
details.coser-details table,
.group details table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  background: rgba(255, 255, 255, .5);
  border-radius: 6px;
  overflow: hidden;
}
details.coser-panel th,
details.coser-details th,
.group details th {
  background: rgba(0, 0, 0, .02);
  font-weight: 600;
  padding: 9px 8px;
  border-bottom: 1px solid #e5d9cc;
  text-align: left;
  color: #6b5a4e;
}
details.coser-panel td,
details.coser-details td,
.group details td {
  padding: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, .04);
  color: #3e3530;
}
details.coser-panel tr:last-child td,
details.coser-details tr:last-child td,
.group details tr:last-child td {
  border-bottom: none;
}

/* --- details 内列表 --- */
details.coser-panel ul,
details.coser-panel ol,
details.coser-details ul,
details.coser-details ol,
.group details ul,
.group details ol {
  padding-left: 22px;
  margin: 8px 0;
}
details.coser-panel li,
details.coser-details li,
.group details li {
  margin: 3px 0;
  color: #3e3530;
}

/* --- details 内代码 --- */
details.coser-panel code,
details.coser-details code,
.group details code {
  background: rgba(0, 0, 0, .02);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .88em;
  color: #c4816e;
}

/* --- details 内强调 --- */
details.coser-panel strong,
details.coser-details strong,
.group details strong {
  color: #4a3828;
}

/* ==========================================================
   6. 底部Token信息
   ========================================================== */
.text-xs.font-mono.text-muted-foreground {
  color: rgba(120, 100, 80, .5) !important;
  background: transparent !important;
  text-shadow: none !important;
}

/* ==========================================================
   7. 操作按钮组 — 暖调
   ========================================================== */
.bg-muted.rounded.flex {
  background: rgba(255, 255, 255, .6) !important;
  border: 1px solid #e5d9cc !important;
  backdrop-filter: blur(4px) !important;
}
.bg-muted.rounded.flex button {
  color: #b8a090 !important;
  transition: all .2s ease !important;
}
.bg-muted.rounded.flex button:hover {
  color: #c4816e !important;            /* 赤陶色 — 唯一真正"热"的颜色 */
  background: rgba(200, 130, 110, .08) !important;
}
.bg-muted.rounded.flex button svg.lucide {
  stroke: #c4a88c !important;
  width: 18px !important;
  height: 18px !important;
  transition: stroke .2s !important;
}
.bg-muted.rounded.flex button:hover svg.lucide {
  stroke: #c4816e !important;           /* hover 时唯一亮起的红调 */
}
.group .md\:opacity-0 {
  opacity: 1 !important;
}

/* ==========================================================
   8. 加载动画 — 克制的心跳
   ========================================================== */
.flex.gap-2.w-full.h-full.items-center.justify-center {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  min-height: 80px !important;
  position: relative;
}
.flex.gap-2.w-full.h-full.items-center.justify-center > span {
  display: none !important;
}
.flex.gap-2.w-full.h-full.items-center.justify-center::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4a5a5' opacity='.7'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  animation: warm-heartbeat 2s ease-in-out infinite;
}
@keyframes warm-heartbeat {
  0%, 100% { transform: scale(1);    opacity: .5; }
  15%      { transform: scale(1.15); opacity: .85; }
  30%      { transform: scale(1);    opacity: .65; }
  45%      { transform: scale(1.1);  opacity: .75; }
  60%      { transform: scale(1);    opacity: .55; }
}

/* ==========================================================
   9. 滚动条
   ========================================================== */
::-webkit-scrollbar       { width: 4px !important; height: 4px !important; }
::-webkit-scrollbar-track { background: #f5f0eb !important; }
::-webkit-scrollbar-thumb { background: #d4c8b8 !important; border-radius: 10px !important; }

/* ==========================================================
   10. 小屏适配
   ========================================================== */
@media (max-width: 768px) {
  details.coser-panel > summary,
  details.coser-details > summary,
  .group details > summary,
  details.coser-panel > :not(summary),
  details.coser-details > :not(summary),
  .group details > :not(summary) {
    padding: 10px 14px;
  }
  details.coser-panel > summary::after,
  details.coser-details > summary::after,
  .group details > summary::after {
    right: 14px;
  }
}