/* calls.css — 第 12 步：通话页（来电 / 去电 / 通话中 / 群语音格子）、收起后的小胶囊、对话页头的电话按钮和「加入」条。
   语音：纸色底调进对话颜色，楷书字居中，对方说话时字外一圈柔光；视频：对方画面铺满，自己的小窗在右上；
   按钮是圆角方块（不用圆形，和头像规矩一致）。可爱 / 极简的差异放在 skin.css 后面几行。 */

.cl-layer { position: absolute; inset: 0; z-index: 96; display: flex; flex-direction: column; overflow: hidden; color: var(--ink);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px calc(env(safe-area-inset-bottom, 0px) + 26px); -webkit-user-select: none; user-select: none; }
.cl-layer[hidden] { display: none; }
.cl-bg { position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(120% 70% at 50% 28%, color-mix(in srgb, var(--c-soft) 70%, var(--surface)), var(--bg) 72%); }
.cl-bg::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 31px, var(--rule, transparent) 31px 32px); opacity: .7; }

/* 画面 */
.cl-stage { position: absolute; inset: 0; z-index: 1; }
.cl-remote { position: absolute; inset: 0; background: #0E0D0C; opacity: 0; transition: opacity .4s; }
.cl-layer.has-remote-video .cl-remote { opacity: 1; }
.cl-remote .cl-video { width: 100%; height: 100%; object-fit: cover; }
.cl-remote .cl-video + .cl-video { display: none; }
.cl-self { position: absolute; right: 14px; top: calc(env(safe-area-inset-top, 0px) + 58px); width: 98px; height: 140px; border-radius: 16px; overflow: hidden;
  background: #1A1816; box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .18); z-index: 3; }
.cl-self[hidden] { display: none; }
.cl-self .cl-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

/* 顶部：收起 + 加密标记 */
.cl-top { position: relative; z-index: 4; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.cl-min { position: absolute; left: -6px; color: var(--ink-2); }
.cl-min[hidden] { display: none; }
.cl-lock { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; letter-spacing: .5px;
  color: var(--ink-2); background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: inset 0 0 0 1px var(--line); }

/* 中间：楷书字 + 名字 + 状态 */
.cl-who { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding-bottom: 40px;
  transition: transform .4s var(--ease-out), opacity .3s; }
.cl-avatar { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin-bottom: 14px; }
.cl-avatar .ui-char { position: relative; z-index: 1; font-size: 84px; line-height: 1; color: var(--c-deep); }
.cl-avatar .ui-colorbar { position: absolute; bottom: 4px; left: 50%; width: 26px; height: 4px; margin-left: -13px; border-radius: 2px; background: var(--c-soft); }
.cl-ring { position: absolute; inset: -6px; border-radius: 34px; background: radial-gradient(closest-side, color-mix(in srgb, var(--c-soft) 85%, transparent), transparent); opacity: 0; }
.cl-layer.is-in .cl-ring, .cl-layer.is-talking .cl-ring { animation: cl-breathe 1.8s ease-in-out infinite; }
@keyframes cl-breathe { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }
.cl-name { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: 1px; text-align: center; }
.cl-status { margin: 0; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-height: 20px; }
.cl-layer.is-ended .cl-status { color: var(--muted); }

/* 视频通话：画面铺满后，名字挪到顶部、字变白 */
.cl-layer.has-remote-video { color: #fff; }
.cl-layer.has-remote-video .cl-who { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 56px); left: 0; right: 0; flex: none; padding: 0; gap: 2px; }
.cl-layer.has-remote-video .cl-avatar { display: none; }
.cl-layer.has-remote-video .cl-name { font-size: 18px; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.cl-layer.has-remote-video .cl-status { color: rgba(255, 255, 255, .85); text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.cl-layer.has-remote-video .cl-lock, .cl-layer.has-remote-video .cl-min { color: #fff; background: rgba(0, 0, 0, .3); box-shadow: none; }

/* 群语音：每人一格 */
.cl-grid { position: absolute; left: 18px; right: 18px; top: calc(env(safe-area-inset-top, 0px) + 300px); bottom: 150px; z-index: 2;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; align-content: start; overflow-y: auto; }
.cl-grid[hidden] { display: none; }
.cl-layer.is-group .cl-who { flex: none; padding: 26px 0 0; }
.cl-layer.is-group .cl-avatar { width: 86px; height: 86px; margin-bottom: 4px; }
.cl-layer.is-group .cl-avatar .ui-char { font-size: 54px; }
.cl-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 10px; border-radius: 18px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line); transition: box-shadow .25s, transform .25s; }
.cl-tile.is-speaking { box-shadow: 0 0 0 2px var(--c-deep, var(--clay)), 0 8px 20px color-mix(in srgb, var(--clay) 18%, transparent); transform: translateY(-2px); }
.cl-tile-av .ui-char { font-size: 38px; line-height: 1; color: var(--c-deep); }
.cl-tile-n { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-tile-n .ui-ico { flex: none; color: var(--muted); }

/* 底部按钮：圆角方块 */
.cl-ctrls { position: relative; z-index: 4; display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.cl-layer.has-remote-video .cl-ctrls, .cl-layer.is-group .cl-ctrls { margin-top: auto; }
.cl-btn { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 64px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.cl-btn-ic { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgba(60, 40, 20, .08); color: var(--ink); transition: transform .15s var(--ease-out), background-color .2s; }
.cl-btn:active .cl-btn-ic { transform: scale(.93); }
.cl-btn-t { font-size: 12px; color: var(--ink-2); }
.cl-layer.has-remote-video .cl-btn-t { color: rgba(255, 255, 255, .9); }
.cl-layer.has-remote-video .cl-btn.is-soft .cl-btn-ic { background: rgba(0, 0, 0, .35); color: #fff; box-shadow: none; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cl-btn.is-on .cl-btn-ic { background: var(--ink); color: var(--bg); }
.cl-btn.is-red .cl-btn-ic { background: #D9534F; color: #fff; box-shadow: 0 8px 20px rgba(217, 83, 79, .35); }
.cl-btn.is-green .cl-btn-ic { background: #3F9D6B; color: #fff; box-shadow: 0 8px 20px rgba(63, 157, 107, .35); }
.cl-layer.is-in .cl-btn.is-green .cl-btn-ic { animation: cl-nudge 1.6s ease-in-out infinite; }
@keyframes cl-nudge { 0%, 70%, 100% { transform: none; } 78% { transform: rotate(-10deg); } 86% { transform: rotate(9deg); } 94% { transform: rotate(-4deg); } }
.cl-layer.is-ended { pointer-events: none; }   /* 「通话结束」那一秒不挡页面 */
.cl-layer.is-ended .cl-ctrls { opacity: .4; }
.cl-tap { position: absolute; left: 50%; bottom: 140px; z-index: 5; transform: translateX(-50%); padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--bg); font: inherit; font-size: 14px; box-shadow: var(--shadow-2); }
.cl-audio { display: none; }

/* 收起后的小胶囊 */
.cl-pill { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; z-index: 97; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: #3F9D6B; color: #fff; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 20px rgba(63, 157, 107, .35); cursor: pointer; animation: cl-pill-in .35s var(--ease-out); }
@keyframes cl-pill-in { from { opacity: 0; transform: translate(-50%, -12px); } }

/* 对话页头：电话 / 视频按钮，群里有人在语音时的「加入」条 */
.ct-calls { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; margin-right: 6px; pointer-events: auto; }   /* 页头这一栏默认点击穿透（chat.css），这里要能点 */
.ct-calls > button, .ct-callbar { pointer-events: auto; }
.ct-call { color: var(--ink-2); }
.ct-callbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; margin: 2px 20px 8px; padding: 7px 12px; border: 0; border-radius: 12px;
  background: color-mix(in srgb, #3F9D6B 14%, var(--surface)); color: #2F7A52; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ct-callbar[hidden] { display: none; }
.ct-callbar span { flex: 1; }
.ct-callbar b { padding: 3px 10px; border-radius: 8px; background: #3F9D6B; color: #fff; font-weight: 600; }

/* 深色 */
:root[data-theme="dark"] .cl-btn-ic { box-shadow: 0 0 0 1px var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cl-btn-ic { box-shadow: 0 0 0 1px var(--line); } }
@media (prefers-reduced-motion: reduce) { .cl-ring, .cl-btn-ic { animation: none !important; } }

/* 可爱：按钮描边 + 错位投影；极简：平的黑白 */
:root[data-skin="cute"] .cl-btn-ic { border-radius: 20px 23px 19px 24px; box-shadow: 0 0 0 2px var(--sk-out), 3px 4px 0 2px var(--sk-fill); }
:root[data-skin="cute"] .cl-btn.is-red .cl-btn-ic, :root[data-skin="cute"] .cl-btn.is-green .cl-btn-ic { box-shadow: 0 0 0 2px var(--sk-out), 3px 4px 0 2px var(--sk-out); }
:root[data-skin="cute"] .cl-tile { border-radius: var(--wob); box-shadow: 0 0 0 2px var(--sk-out); }
:root[data-skin="cute"] .cl-tile.is-speaking { box-shadow: 0 0 0 2px var(--sk-out), 4px 5px 0 2px var(--sk-fill); }
:root[data-skin="cute"] .cl-bg { background: var(--bg) radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 10%, transparent) 1.1px, transparent 1.5px) 0 0 / 20px 20px; }
:root[data-skin="minimal"] .cl-bg { background: var(--bg); }
:root[data-skin="minimal"] .cl-bg::after { display: none; }
:root[data-skin="minimal"] .cl-btn-ic { border-radius: 18px; box-shadow: none; }
:root[data-skin="minimal"] .cl-btn:not(.is-red):not(.is-green) .cl-btn-ic { background: var(--surface-2); }
:root[data-skin="minimal"] .cl-tile { border-radius: 14px; }
:root[data-skin="minimal"] .cl-name { font-weight: 700; letter-spacing: 0; }
