/* ==========================================================
   themes/common.css — 四套界面风格共用的件：设置页风格缩略图、「风格默认」背景格、气泡尾巴的画法
   各风格只给 token（css/themes/<id>.css）；<html data-skin="<id>"> 由 js/settings.js 写
   ========================================================== */

/* 界面风格缩略：底色 + 一个对方气泡 + 一个自己气泡（颜色在 css/themes/<id>.css 的 .skin-sw[data-sw] 里） */
.skin-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.skin-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; font-size: 12px; color: var(--text-2); cursor: pointer; text-align: center; }
.skin-sw {
  width: 64px; height: 64px; padding: 10px 8px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: var(--sw-bg, var(--chat-bg));
}
.skin-sw i { display: block; height: 12px; border-radius: var(--sw-r, 6px); }
.skin-sw i:first-child { width: 70%; background: var(--sw-in, #fff); }
.skin-sw i:last-child { width: 70%; margin-left: auto; background: var(--sw-out, var(--accent)); }
.skin-tile.active .skin-sw { border-color: var(--accent); }
.skin-tile.active { color: var(--accent); font-weight: 600; }
.bg-tile .sw.p-skin { background-image: var(--chat-pattern); }

/* —— 气泡尾巴：whatsapp / wechat / line 打开；形状、位置由各风格的 --tail-* 给；列表式布局不画 ——
   用 background: inherit 取气泡自己的底色，深浅色自动跟着走；图片 / 贴纸气泡不画 */
html:is([data-skin="whatsapp"], [data-skin="wechat"], [data-skin="line"]):not([data-layout="list"]) .msg .bubble:not(.media)::before {
  content: ""; position: absolute; top: var(--tail-top, 0);
  width: var(--tail-w, 8px); height: var(--tail-h, 13px);
  background: inherit;
}
html:is([data-skin="whatsapp"], [data-skin="wechat"], [data-skin="line"]):not([data-layout="list"]) .msg.out .bubble:not(.media)::before {
  right: calc(-1 * var(--tail-w, 8px) + 1px); clip-path: var(--tail-out, polygon(0 0, 100% 0, 0 100%));
}
html:is([data-skin="whatsapp"], [data-skin="wechat"], [data-skin="line"]):not([data-layout="list"]) .msg.in .bubble:not(.media)::before {
  left: calc(-1 * var(--tail-w, 8px) + 1px); clip-path: var(--tail-in, polygon(0 0, 100% 0, 100% 100%));
}
/* 只有一串里的第一条带尾巴的风格（whatsapp / line）；选择器要比上面画尾巴的更具体 */
html:is([data-skin="whatsapp"], [data-skin="line"]):not([data-layout="list"]) .msg.cont:is(.in, .out) .bubble:not(.media)::before { content: none; }

/* —— 整条输入栏底色铺满对话区（输入栏本身限宽 860）：wechat / line 用 —— */
html:is([data-skin="wechat"], [data-skin="line"]) .composer {
  box-shadow: 0 0 0 100vmax var(--composer-bg); clip-path: inset(0 -100vmax);
  border-top: 0; border-image: linear-gradient(var(--border) 0 0) 1 / 1px 0 0 0 / 0 100vmax;
}
html:is([data-skin="wechat"], [data-skin="line"]) .chat { overflow: clip; }   /* 铺满只到对话区边上，不渗到左栏 */

/* —— 会话列表分隔线：从文字起点画到右边（--list-sep，telegram 透明 = 没有） —— */
.ci-wrap + .ci-wrap .chat-item::after {
  content: ""; position: absolute; top: 0; right: 0; height: 1px;
  left: calc(8px + var(--item-avatar) + 12px);
  background: var(--list-sep); pointer-events: none;
}
