/* 留言。
   从 music.css 拆出来 —— 那个文件已经 1600 行，而且换行符是混的，
   在里面做精确替换踩过坑。

   这一层必须排在 sheet.css 之后：输入条和列表都长在面板里面，
   要盖得住 .sheet__* 的通用尺寸。 */

/* ================= 播放页的操作排 ================= */

/* 喜欢 / 留言 / 分享 / 详情。
   原来是四个小图标压在封面右上角：既看不清（压在画面上），也点不准（40px 挤一排），
   还跟「这是什么歌」抢同一块地方。放到进度条上面之后，
   上半屏只管认歌，下半屏只管做事。 */
.fpacts {
  position: relative; /* 详情菜单贴着这一排往上开，锚点就是它 */
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  /* 下面留 10：紧挨着进度条的话，这排图标看起来像是进度条的一部分，
     而它们跟播放毫无关系。 */
  margin: 6px 20px 10px;
}
.fpacts__gap { flex: 1 1 auto; }

.fpact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--kaki-size-touch-min);
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--sb-secondary, #b8b8c0);
  cursor: pointer;
  transition: color 160ms var(--ease, ease), background-color 160ms var(--ease, ease);
}
.fpact[hidden] { display: none; }
.fpact svg { width: 21px; height: 21px; }
/* 数字紧跟图标，不另起一行 —— 竖着摞会把这排撑高一截，
   而它下面就是进度条，撑高等于把播放键往下推。 */
.fpact em {
  font-style: normal;
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.fpact em:empty { display: none; }
.fpact:active { background: rgba(255, 255, 255, 0.07); }
.fpact:focus-visible { outline: 2px solid var(--accent-2, #ff9a3c); outline-offset: -2px; }
.fpact:disabled { opacity: 0.38; cursor: default; }
@media (hover: hover) {
  .fpact:not(:disabled):hover { color: var(--sb-text, #f7f7f8); }
}

/* 喜欢是这排里唯一有"状态"的：亮着表示已经收藏。
   其余三个都是"做一件事"，做完就回到原样，不该留下亮着的痕迹。

   用品牌橙，不用粉。这套界面从头到尾只有一个强调色（LED 灯效、进度条、
   主按钮、选中态全是 var(--accent)）—— 心单独用粉，它就成了整屏唯一一个
   不属于这套语言的颜色，看着像别的 app 掉进来的控件。 */
.fpact--fav[aria-pressed="true"] { color: var(--accent, var(--accent)); }
.fpact--fav[aria-pressed="true"] svg { fill: currentColor; }
.fpact--more { padding: 0 6px; }

@media (prefers-reduced-motion: reduce) {
  .fpact { transition: none; }
}

/* ================= 面板尺寸 ================= */

/* 比通用面板高：留言是「进来待一会儿」的地方，不是「点一下就走」的选单。
   矮了的话一屏只放得下两条，读者要在一个小窗口里滚很久。

   外层 .sheet__panel 的通用上限是 82%，装不下这个高度 —— 结果是面板自己滚，
   底部输入条被推到可视区外，要往下拖才看得见。而那条输入正是这个面板存在的理由。
   所以这里把外层一起放宽，并且明确：**面板不滚，滚的只有中间那段列表**。 */
.sheet__panel:has(.cmtpanel) {
  max-height: 86%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet__body--panel.cmtpanel {
  flex: 1 1 auto;
  min-height: 62vh;
  min-height: 62dvh;
  /* 左右各 22：通用面板的 20 是给选单用的（一行字顶天了），
     留言这里左边站着头像、右边站着点赞，两侧都紧贴边框会显得憋。 */
  padding: 14px 22px 0;
}
.cmtpanel .sheet__panelbody {
  /* 列表和输入条之间留一道呼吸，否则最后一条像是被压在输入条下面 */
  padding-bottom: 12px;
}
/* 标题和第一条之间要看得出是两层东西 */
.cmtpanel .sheet__panelhead { padding: 2px 0 14px; }
.cmtpanel .sheet__panelhead strong { font-size: 16px; letter-spacing: 0.01em; }

/* ================= 列表 ================= */

.cmtlist { display: flex; flex-direction: column; gap: 20px; }

/* 一条留言 = 主行 + 它下面的回复块。两者是兄弟，不是父子 ——
   回复块嵌在正文列里的话，它的右边界比顶层短一个心的宽度，
   一屏看下来右侧的心是锯齿状的。 */
.cmtitem { display: flex; flex-direction: column; }

.cmt { display: flex; gap: 12px; }

/* 真实头像（微信资料或上传的图）铺满圆角矩形——色块底和首字只属于没有图的人。
   留言和输入条用同一张 40px 身份卡；回复缩到 28px，但仍保留同一轮廓。 */
img.cmt__avatar,
img.cmtbar__me { object-fit: cover; object-position: 50% 42%; }

/* 头像：底色来自数据（每个身份一个固定色，行内设 background-color），
   这里只叠一层斜向的明暗，让它有个面的感觉而不是一块色卡。 */
.cmt__avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 600 14px/1 var(--font-body);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.cmt__main { flex: 1 1 auto; min-width: 0; }

.cmt__who { display: flex; align-items: baseline; gap: 8px; }
.cmt__who strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-secondary, #b8b8c0);
}
.cmt__who small {
  color: var(--kaki-color-text-tertiary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 「我」的那一枚：自己发的话在一屏里要一眼认出来。
   用描边不用填色 —— 填色会跟点赞的粉、强调的橙抢注意力。 */
.cmt__me {
  padding: 1px 5px;
  border: 1px solid rgba(255, 122, 26, 0.5);
  border-radius: 5px;
  color: var(--accent, var(--accent));
  font-size: 10px;
  letter-spacing: 0.04em;
}

.cmt__body {
  margin: 4px 0 0;
  color: var(--sb-text, #f7f7f8);
  font-size: 14.5px;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ================= 每条下面的操作 ================= */

/* 点赞单独挪到行的最右边，和头像分列两端。

   原来它跟「回复」「⋯」挤在正文下面一串，整行的内容全压在左半边，
   右边空着一条 —— 一屏十条就是十道空白，看起来像排版没做完。
   两端各放一个，中间是正文，宽度才用得满。
   这也是各家留言区的通行做法：赞在最右边，够得到，也不抢正文的位置。 */
.cmt__vote {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 30px;
  padding-top: 2px;
}

.cmt__bar {
  display: flex;
  align-items: center;
  /* 回复和更多的可见宽度不同，但两者都用 44px 透明命中区。
     10px 是两块命中区不相交的最小安全间距。 */
  gap: 10px;
  margin: 5px 0 0 -8px; /* 负边距让第一个按钮的文字和上面正文左对齐 */
}
.cmt__like,
.cmt__act {
  position: relative;
  border: 0;
  background: none;
  color: var(--kaki-color-text-tertiary);
  font: 500 12px/1 var(--font-body);
  cursor: pointer;
  transition: color 140ms var(--ease, ease), background-color 140ms var(--ease, ease);
}
.cmt__act { min-height: 28px; padding: 0 8px; border-radius: 8px; }
.cmt__like {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: var(--r-sm);
}
/* 行内操作保持轻巧的视觉尺寸，但触控范围统一扩到 44px。
   透明伪元素属于按钮本身，不改变列表密度，也不会制造新的可见圆框。 */
.cmt__like::before,
.cmt__act::before,
.cmtbar__cancel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--kaki-size-touch-min);
  height: var(--kaki-size-touch-min);
  transform: translate(-50%, -50%);
}
.cmt__like em {
  font-style: normal;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cmt__like em:empty { display: none; }
.cmt__like svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.cmt__like.is-on { color: var(--accent, var(--accent)); }
.cmt__like.is-on svg { fill: currentColor; stroke: currentColor; }
/* 点下去心跳一下。这是唯一会动的地方 —— 点赞是留言区最高频的动作，
   给它一个即时的身体反馈，其余按钮保持安静。 */
.cmt__like.is-on svg { animation: cmt-beat 320ms var(--ease, cubic-bezier(0.16, 1, 0.3, 1)); }
@keyframes cmt-beat {
  0% { transform: scale(1); }
  38% { transform: scale(1.32); }
  100% { transform: scale(1); }
}

.cmt__act--more { letter-spacing: 0.12em; }
.cmt__like:active,
.cmt__act:active { background: rgba(255, 255, 255, 0.07); }
.cmt__like:focus-visible,
.cmt__act:focus-visible { outline: 2px solid var(--accent-2, #ff9a3c); outline-offset: -2px; }
@media (hover: hover) {
  .cmt__like:hover,
  .cmt__act:hover { color: var(--sb-secondary, #b8b8c0); }
  .cmt__like.is-on:hover { color: var(--accent-2, var(--accent-2)); }
}

/* ================= 回复 ================= */

/* 那道竖线是结构，不是装饰：它说的是「这几条属于上面那条」。
   只靠缩进的话，滚动中途进入视野时看不出它挂在谁下面。

   左边缩进 52px = 头像 40 + 间距 12，正好接在父级正文的起点下面。
   右边不缩 —— 回复的心要和顶层的心落在同一条竖线上。 */
.cmt__replies {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 12px 0 0 52px;
  padding-left: 13px;
  border-left: 1px solid var(--sb-line, rgba(255, 255, 255, 0.08));
}
.cmt--reply { gap: 9px; }
.cmt--reply .cmt__avatar {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: 11px;
}
.cmt--reply .cmt__who strong { font-size: 12px; }
.cmt--reply .cmt__body { margin-top: 3px; font-size: 13.5px; }
/* 回复的 ⋯ 并进名字那一行（它没有「回复」按钮，单独一行只放它太空）。
   压扁一点，别把名字那行撑高。 */
.cmt--reply .cmt__who .cmt__act--more { min-height: 20px; padding: 0 6px; font-size: 13px; }

/* 回复多了先折起来。一条留言下面挂着七条回复时，
   下一条顶层留言会被推到屏幕外 —— 读者会以为这首歌只有一个人说过话。 */
.cmt__fold {
  align-self: flex-start;
  min-height: 26px;
  padding: 0 8px 0 0;
  border: 0;
  background: none;
  color: var(--sb-secondary, #b8b8c0);
  font: 500 12px/1 var(--font-body);
  cursor: pointer;
}
.cmt__fold:active { color: var(--accent, var(--accent)); }
.cmt__fold::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border: 1.4px solid currentColor;
  border-width: 0 1.4px 1.4px 0;
  transform: translateY(-2px) rotate(45deg);
}

/* ================= 空状态 ================= */

.cmt__empty {
  margin: 0;
  padding: 34px 8px 30px;
  color: var(--sb-muted, #686872);
  font-size: 13.5px;
  line-height: 1.7;
  text-align: center;
}
.cmt__empty b {
  display: block;
  margin-bottom: 4px;
  color: var(--sb-secondary, #b8b8c0);
  font-size: 15px;
  font-weight: 600;
}

/* ================= 底部输入条 ================= */

.sheet__panelfoot {
  flex: 0 0 auto;
  border-top: 1px solid var(--sb-line, rgba(255, 255, 255, 0.08));
  /* 面板本身是深色，输入条再深一档，读者一眼分得清「读的区」和「写的区」 */
  background: rgba(0, 0, 0, 0.22);
  padding: 10px 20px calc(12px + env(safe-area-inset-bottom, 0px));
}

.cmtbar { display: flex; flex-direction: column; gap: 8px; }

/* 匿名访客看到的不是输入框，是这一条：要登录这件事摆在打字之前，
   而不是等他写完一句再弹走。用次要按钮的分量——它是通往留言的门，
   不是这一页要人做的主要动作（那是「我也要写一首」）。 */
.cmtbar__login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 122, 26, 0.32);
  border-radius: var(--r-pill);
  background: rgba(255, 122, 26, 0.1);
  color: var(--accent, var(--accent));
  font: 600 14.5px/1 var(--font-body);
  cursor: pointer;
  transition: background-color 160ms var(--ease, ease);
}
.cmtbar__login svg { width: 17px; height: 17px; }
.cmtbar__login:active { background: rgba(255, 122, 26, 0.18); }
.cmtbar__login:focus-visible { outline: 2px solid var(--accent-2, #ff9a3c); outline-offset: 2px; }
@media (hover: hover) {
  .cmtbar__login:hover { background: rgba(255, 122, 26, 0.16); }
}
@media (prefers-reduced-motion: reduce) {
  .cmtbar__login { transition: none; }
}

/* 回复目标条。点了「回复」之后出现，告诉你这句话会落到谁下面 ——
   不显示的话，输入框看起来跟发新留言一模一样。 */
.cmtbar__target {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  color: var(--sb-secondary, #b8b8c0);
  font-size: 12px;
}
.cmtbar.is-replying .cmtbar__target { display: flex; }
.cmtbar__target span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmtbar__target b { color: var(--accent, var(--accent)); font-weight: 600; }
.cmtbar__cancel {
  flex: 0 0 auto;
  position: relative;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--sb-secondary, #b8b8c0);
  font: 500 13px/1 var(--font-body);
  cursor: pointer;
}
.cmtbar__cancel:active { background: rgba(255, 255, 255, 0.14); }

.cmtbar__row { display: flex; align-items: flex-end; gap: 10px; }

/* 自己的头像摆在输入框左边：虚拟身份是随机分的，
   不摆出来的话没人知道自己现在是谁，发完才发现名字不认识。 */
.cmtbar__me {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin-bottom: 2px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.3));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 600 13px/1 var(--font-body);
  user-select: none;
}

.cmtbar__field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: var(--kaki-size-touch-min);
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--sb-line, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms var(--ease, ease), background 160ms var(--ease, ease);
}
.cmtbar__field:focus-within {
  border-color: rgba(255, 122, 26, 0.42);
  background: rgba(255, 255, 255, 0.06);
}

.cmtbar__input {
  flex: 1 1 auto;
  min-width: 0;
  /* 高度跟着内容长：一行起步，写长后自行撑开；只在占用过多视口时内部滚动，
     避免窄屏换行后看不到草稿末尾。 */
  height: 30px;
  max-height: min(32dvh, 220px);
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--sb-text, #f7f7f8);
  font: 400 14.5px/1.45 var(--font-body);
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
}
.cmtbar__input::-webkit-scrollbar { display: none; }
.cmtbar__input:focus { outline: none; }
.cmtbar__input::placeholder { color: var(--sb-muted, #686872); }

/* 还剩几个字。只在快到头的时候才出现 —— 一直挂着等于一直在提醒
   「你写得太长了」，而绝大多数留言只有一两句。 */
.cmtbar__left {
  flex: 0 0 auto;
  align-self: center;
  color: var(--sb-muted, #686872);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.cmtbar__left[hidden] { display: none; }
.cmtbar__left.is-over { color: #ff6b6b; }

/* 发送键：没写字之前是灰的、按不动。
   一直亮着的话，空着点下去只能弹一个「不能为空」，那是自找的挫败。 */
/* 发送键：和对话页那颗完全一样。

   原来这里是 54×32 的文字胶囊「发送」，对话页那边是 48px 的橙色图标圆钮。
   同一个动作 ——「把我写的这段发出去」—— 在两处长成两个样子，
   这正是「打字模式在 AI 音乐是一个风格、在留言是另一个」的具体所指。

   两边现在都是 42px 正圆 + 向上箭头，没内容时中性、有内容时转橙。 */
.cmtbar__send {
  flex: 0 0 var(--kaki-size-touch-min);
  width: var(--kaki-size-touch-min);
  height: var(--kaki-size-touch-min);
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--sb-line, rgba(255, 255, 255, 0.08));
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.045);
  color: var(--sb-muted, #686872);
  cursor: not-allowed;
  transition: background-color 160ms var(--ease, ease), color 160ms var(--ease, ease),
    border-color 160ms var(--ease, ease);
}

/* 微信内置浏览器和软键盘会把可视高度压到 700px 甚至更低。
   这里跟随动态视口收紧列表最小高度，让标题、列表和输入条仍同时可达。 */
@media (max-height: 720px) {
  .sheet__panel:has(.cmtpanel) { max-height: 92dvh; }
  .sheet__body--panel.cmtpanel {
    min-height: min(62dvh, 420px);
    padding-top: 10px;
  }
  .cmtpanel .sheet__panelhead { padding-bottom: 10px; }
}
.cmtbar__send svg { width: 18px; height: 18px; }
.cmtbar__send.is-ready {
  border-color: transparent;
  background: var(--grad-brand, linear-gradient(90deg, var(--accent), var(--accent-2)));
  color: var(--on-brand, #191008);
  cursor: pointer;
}
.cmtbar__send.is-ready:active { filter: brightness(0.92); }
.cmtbar__send:focus-visible { outline: 2px solid var(--accent-2, #ff9a3c); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .cmt__like,
  .cmt__act,
  .cmtbar__field,
  .cmtbar__send { transition: none; }
  .cmt__like.is-on svg { animation: none; }
}
