/* 打电话是单独的通话画面。麦克风转文字仍留在输入框，不进这个画面。 */
.call-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #08080a;
  color: #f4f1ea;
  padding: 0;
  box-sizing: border-box;
}
.cs-stage {
  position: relative;
  flex: 1 1 50%;
  min-height: 0;
  width: 100%;
  z-index: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 8px;
  box-sizing: border-box;
}
/* 3D 脸留在首页。就算被搬进来，通话层也不显示。 */
.call-screen #holoStage,
.call-screen #avatarStage,
.call-screen #cyberScene,
.call-screen .holo-stage,
.call-screen .avatar-roster {
  display: none !important;
}
/* 通话层自己的能量核：慢转、核呼吸。尺寸跟在上半截里，不压下半截的字。 */
.call-screen .call-orb {
  position: relative;
  flex: 0 0 auto;
  width: min(300px, 38vh, 62vw);
  height: min(300px, 38vh, 62vw);
  margin: 0;
}
.call-screen .call-orb .orb-ring {
  -webkit-mask: radial-gradient(circle, transparent 68%, #000 69%, #000 72%, transparent 73%);
  mask: radial-gradient(circle, transparent 68%, #000 69%, #000 72%, transparent 73%);
}
.call-screen .call-orb .orb-ring.r2 { inset: 9%; }
.call-screen .call-orb .orb-ring.r3 {
  inset: 18%;
  background: conic-gradient(from 90deg, rgba(200, 16, 46, 0) 0deg, rgba(200, 16, 46, .72) 120deg, rgba(200, 16, 46, 0) 240deg);
}
.call-screen .call-orb .orb-core {
  width: 46%;
  height: 46%;
  border-color: rgba(200, 16, 46, .5);
  box-shadow: 0 0 18px rgba(200, 16, 46, .26), inset 0 0 12px rgba(200, 16, 46, .16);
  animation: orbBreath 3.6s ease-in-out infinite;
}
.call-screen .call-orb .orb-mark {
  position: relative;
  z-index: 1;
  font-size: clamp(18px, 4.6vw, 26px);
  letter-spacing: .06em;
}
.call-screen .call-orb .orb-mark span { color: var(--eng-red, #C8102E); }
.call-screen .call-orb .orb-core::before,
.call-screen .call-orb .orb-core::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(200, 16, 46, .5);
  opacity: 0;
  pointer-events: none;
}
.call-screen.is-speaking .call-orb .orb-ring,
.call-screen.is-speaking .call-orb .orb-ring.r2,
.call-screen.is-speaking .call-orb .orb-ring.r3 { animation-duration: 2.4s; }
.call-screen.is-speaking .call-orb .orb-core::before { animation: orbPulse 1.4s ease-out infinite; }
.call-screen.is-speaking .call-orb .orb-core::after { animation: orbPulse 1.4s ease-out .5s infinite; }
.call-screen.is-thinking .call-orb .orb-ring,
.call-screen.is-thinking .call-orb .orb-ring.r2,
.call-screen.is-thinking .call-orb .orb-ring.r3 { animation-duration: 1.2s; }
.call-screen[hidden] .call-orb,
.call-screen[hidden] .call-orb .orb-ring,
.call-screen[hidden] .call-orb .orb-core,
.call-screen[hidden] .call-orb .orb-core::before,
.call-screen[hidden] .call-orb .orb-core::after { animation: none !important; }
.call-screen[hidden] { display: none !important; }
.cs-card {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  margin: 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  pointer-events: none;
  background: #08080a;
  border-top: 1px solid rgba(244, 241, 234, .12);
}
.cs-card .cs-hang { pointer-events: auto; }
.cs-face {
  width: 148px;
  height: 148px;
  border-radius: 36px;
  object-fit: cover;
  border: 1px solid rgba(200, 16, 46, .45);
}
.cs-name, .cs-state, .cs-wave, .cs-hang { flex: 0 0 auto; }
.cs-name { font-size: 22px; letter-spacing: .12em; }
.cs-state { font-size: 15px; color: rgba(244, 241, 234, .72); }
.cs-wave { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 48px; }
.cs-wave i {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: #c8102e;
  opacity: .8;
}
.cs-heard, .cs-reply {
  width: 100%;
  min-height: 1.4em;
  max-height: 4.5em;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(244, 241, 234, .72);
  pointer-events: auto;
}
.cs-reply { color: #f4f1ea; font-size: 16px; }
.cs-hang {
  margin-top: 8px;
  width: 72px;
  height: 72px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(200, 16, 46, .55);
  background: linear-gradient(180deg, rgba(200, 16, 46, .22), rgba(138, 11, 32, .14));
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
html[data-m="1"] .call-screen {
  z-index: 1200;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
/* 通话层在 .stage 里面。手机底栏和顶栏比 .stage 更高，通话时把这一层抬到它们上面，并放开裁切。 */
body:has(#callScreen:not([hidden])) .stage,
body:has(#callScreen:not([hidden])) #panel-total {
  z-index: 10000;
  overflow: visible !important;
}

/* 全屏通话时，收起对话里的通话条、输入栏和手机底栏，避免和通话层叠在一起；缩小成浮条时照常露出来。 */
body:has(#callScreen:not([hidden]):not(.cs-mini)) #callBar,
body:has(#callScreen:not([hidden]):not(.cs-mini)) .total-composer,
body:has(#callScreen:not([hidden]):not(.cs-mini)) .total-foot,
body:has(#callScreen:not([hidden]):not(.cs-mini)) #mTabbar,
html[data-m="1"] body:has(#callScreen:not([hidden]):not(.cs-mini)) #mTabbar {
  display: none !important;
}
html[data-m="1"] .call-screen {
  z-index: 10000;
}

/* ---- 缩小通话（像 Grok）：通话不断，变成顶部小浮条，底下的对话框、上传、按钮照常能点 ---- */
.cs-min {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, .22);
  background: rgba(244, 241, 234, .06);
  color: #f4f1ea;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cs-min:hover { background: rgba(244, 241, 234, .12); }
.cs-timer { font-size: 13px; color: rgba(244, 241, 234, .6); font-variant-numeric: tabular-nums; }
.cs-timer:empty { display: none; }
.cs-mini-dot { display: none; }
.call-screen.cs-mini {
  inset: auto;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: calc(100vw - 32px);
  height: auto;
  border-radius: 999px;
  background: rgba(8, 8, 10, .94);
  border: 1px solid rgba(200, 16, 46, .45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  cursor: pointer;
  padding: 0 !important;
}
.call-screen.cs-mini .cs-stage,
.call-screen.cs-mini .cs-heard,
.call-screen.cs-mini .cs-reply,
.call-screen.cs-mini .cs-min { display: none !important; }
.call-screen.cs-mini .cs-card {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: auto;
  padding: 6px 6px 6px 14px;
  background: transparent;
  border-top: 0;
  pointer-events: auto;
}
.call-screen.cs-mini .cs-mini-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, .18);
}
.call-screen.cs-mini .cs-name { font-size: 14px; letter-spacing: .06em; white-space: nowrap; }
.call-screen.cs-mini .cs-state { font-size: 13px; white-space: nowrap; }
.call-screen.cs-mini .cs-wave { height: 20px; gap: 2px; }
.call-screen.cs-mini .cs-wave i { width: 2px; }
.call-screen.cs-mini .cs-hang {
  margin: 0;
  width: 44px;
  height: 44px;
  font-size: 12px;
  background: #c8102e;
  border-color: #c8102e;
}
@media (max-width: 420px) {
  .call-screen.cs-mini .cs-wave { display: none; }
}
