/*
 * Call presentation inspired by the interaction hierarchy in InternalBeyond:
 * one stage, lightweight captions, and controls layered over video.
 * No source code or visual assets from that project are included here.
 */

#callscr {
  box-sizing: border-box;
  padding: max(12px, env(safe-area-inset-top, 0px)) 18px max(14px, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 50% 31%, rgba(221, 216, 237, .42), transparent 31%),
    linear-gradient(180deg, #fbfafe 0%, #f3f0f8 100%);
}

#callscr .call-head {
  position: relative;
  z-index: 8;
  display: grid;
  flex: 0 0 48px;
  grid-template-columns: 48px 1fr 48px;
  width: 100%;
  max-width: 520px;
  height: 48px;
  margin: 0 auto;
  align-items: center;
}

#callscr .call-head button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(100, 88, 128, .09);
  border-radius: 50%;
  background: rgba(255, 255, 255, .68);
  color: var(--ink-soft);
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#callscr .call-head button:focus-visible,
#callscr summary:focus-visible,
#callscr button:focus-visible,
#callscr select:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

#callscr #call-min {
  font-size: 31px;
  font-weight: 300;
  line-height: 1;
}

#callscr .call-head-action { justify-self: end; }
#callscr .call-head-action svg { width: 21px; height: 21px; }
#callscr .call-head-action[aria-pressed="true"] {
  background: var(--accent-deep);
  color: #fff;
}

#callscr .call-timer {
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .12em;
  text-align: center;
}

#callscr .call-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  width: min(100%, 440px);
  min-height: 0;
  margin: 0 auto;
  padding: 0 6px;
  overflow: hidden;
  align-items: center;
  justify-content: flex-start;
}

#callscr .call-avatar-wrap,
#callscr .call-avatar {
  width: 112px;
  height: 112px;
}

#callscr .call-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  margin-top: clamp(44px, 10vh, 98px);
}

#callscr .call-avatar {
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 16px 40px rgba(65, 55, 92, .13), 0 0 0 7px rgba(255, 255, 255, .62);
}

#callscr .call-avatar-wrap::before {
  inset: -13px;
  border-color: rgba(139, 121, 177, .12);
}

#callscr .call-avatar-wrap::after { display: none; }

#callscr .call-name {
  margin-top: 28px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 650;
  letter-spacing: .04em;
  line-height: 1.25;
}

#callscr .call-status {
  min-height: 26px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
}

#callscr .call-status-dot {
  width: 7px;
  height: 7px;
  box-shadow: 0 0 0 4px rgba(128, 107, 164, .1);
}

#callscr .call-live {
  width: min(88%, 350px);
  min-height: 56px;
  margin-top: clamp(28px, 6vh, 54px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

#callscr .call-live-label {
  display: flex;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0;
}

#callscr .call-live-label > span:first-child { display: none; }

#callscr .call-live-text {
  display: -webkit-box;
  max-height: 58px;
  margin-top: 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  line-height: 28px;
  text-wrap: pretty;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#callscr .call-live-text.empty {
  color: var(--ink-soft);
  font-weight: 400;
}

#callscr .call-quote {
  display: -webkit-box;
  width: min(88%, 350px);
  min-height: 24px;
  max-height: 50px;
  margin-top: 13px;
  padding: 0;
  overflow: hidden;
  color: var(--accent-deep);
  font-size: 14px;
  line-height: 23px;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#callscr .call-quote:empty::before { content: ""; }

#callscr .call-bottom {
  position: relative;
  z-index: 9;
  flex: 0 0 auto;
  width: min(100%, 420px);
  margin: 0 auto;
}

#callscr .call-utility {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

#callscr details { color: var(--ink-soft); }
#callscr .call-transcript-sheet,
#callscr .call-options-sheet { width: auto; margin: 0; flex: 0 0 auto; }
#callscr details > summary {
  min-height: 36px;
  padding: 8px 6px;
  list-style: none;
  border-radius: 10px;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#callscr details > summary::-webkit-details-marker { display: none; }
#callscr details[open] > summary { color: var(--accent-deep); }

#callscr .call-sheet-card {
  position: fixed;
  right: 14px;
  bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 108px);
  left: 14px;
  z-index: 12;
  max-width: 430px;
  max-height: min(58dvh, 430px);
  margin: 0 auto;
  padding: 16px;
  overflow: auto;
  border: 1px solid rgba(105, 91, 139, .12);
  border-radius: 22px;
  background: rgba(254, 253, 255, .98);
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(43, 37, 58, .2);
}

#callscr .call-sheet-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
}

#call-transcript {
  display: flex;
  max-height: min(40dvh, 300px);
  padding: 0;
  overflow-y: auto;
  flex-direction: column;
  gap: 7px;
  background: transparent;
}

#call-transcript:empty::before {
  content: "说过的话会出现在这里";
  padding: 22px 0;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

#call-transcript .bub {
  max-width: 86%;
  padding: 8px 11px;
  border: 0;
  border-radius: 14px;
  background: #f3f0f8;
  font-size: 13px;
  line-height: 20px;
  box-shadow: none;
}

#call-transcript .log-row.him .bub { background: #f7f6f9; }

#callscr .call-pace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(105, 91, 139, .09);
  border-radius: 15px;
  background: #f3f0f8;
  box-shadow: none;
}

#callscr .call-pace button {
  min-height: 52px;
  padding: 7px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
}

#callscr .call-pace button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 9px rgba(50, 43, 67, .07);
}

#callscr .call-video-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

#callscr .call-video-tools button,
#callscr .call-video-mode-label {
  box-sizing: border-box;
  min-height: 46px;
  border: 1px solid rgba(105, 91, 139, .1);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

#callscr .call-video-tools button { padding: 9px 10px; }
#callscr .call-video-mode-label {
  display: flex;
  padding: 0 8px 0 11px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
}

#callscr #call-video-mode {
  min-width: 55px;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

#callscr .call-secondary {
  display: flex;
  min-height: 0;
  margin-top: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

#callscr .call-secondary button {
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: #f3f0f8;
  color: var(--ink-soft);
}

#callscr #call-ptt { display: none; }
#callscr[data-stt="fallback"] #call-ptt,
#callscr[data-stt="manual"] #call-ptt { display: inline-flex; align-items: center; }

#callscr .call-ctrls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 3px;
  padding: 0 12px;
  align-items: end;
}

#callscr .call-action {
  display: flex;
  min-width: 0;
  min-height: 82px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 16px;
  align-items: center;
  flex-direction: column;
  gap: 7px;
}

#callscr .call-action .call-action-ico {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(105, 91, 139, .1);
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
  box-shadow: 0 5px 18px rgba(50, 43, 67, .07);
}

#callscr .call-action .call-action-ico svg { width: 22px; height: 22px; }
#callscr .call-action .call-action-ico .text-ico { display: none; }
#callscr #call-mode.text-mode .voice-ico { display: none; }
#callscr #call-mode.text-mode .text-ico { display: block; }
#callscr .call-action.muted .call-action-ico { background: var(--ink); color: #fff; }

#callscr #call-hangup .call-action-ico {
  width: 64px;
  height: 64px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 7px 22px rgba(183, 101, 116, .24);
}

/* Camera-on mode becomes a single full-bleed stage. */
#callscr.video-on {
  padding-right: 0;
  padding-left: 0;
  background: #101014;
  color: #fff;
}

#callscr.video-on .call-head {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: 14px;
  left: 14px;
  width: auto;
  max-width: none;
}

#callscr.video-on .call-head button {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(15, 15, 19, .48);
  color: #fff;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

#callscr.video-on .call-head-action[aria-pressed="true"] {
  background: rgba(255, 255, 255, .9);
  color: #24222b;
}

#callscr.video-on .call-timer {
  justify-self: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(15, 15, 19, .42);
  color: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

#callscr.video-on .call-stage {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
}

#callscr #call-video-stage:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  overflow: hidden;
  background: #17171c;
}

#callscr #call-video-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #17171c;
  transform: scaleX(-1);
}

#callscr #call-video-stage[data-facing="environment"] #call-video-preview { transform: none; }

#callscr #call-video-note {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top, 0px)) + 58px);
  right: 16px;
  z-index: 2;
  max-width: calc(100% - 32px);
  overflow: hidden;
  color: rgba(255, 255, 255, .78);
  font-size: 11px;
  line-height: 18px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .55);
  white-space: nowrap;
}

#callscr.video-on .call-avatar-wrap { display: none; }

#callscr.video-on .call-name {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top, 0px)) + 61px);
  left: 16px;
  z-index: 3;
  margin: 0;
  color: #fff;
  font-size: 18px;
  text-shadow: 0 1px 7px rgba(0, 0, 0, .55);
}

#callscr.video-on .call-status {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top, 0px)) + 88px);
  left: 16px;
  z-index: 3;
  margin: 0;
  color: rgba(255, 255, 255, .78);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}

#callscr.video-on .call-status-dot {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .13);
}

#callscr.video-on .call-live {
  position: absolute;
  right: 18px;
  bottom: 184px;
  left: 18px;
  z-index: 3;
  width: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  color: #fff;
  text-align: center;
  pointer-events: none;
}

#callscr.video-on .call-live-label { color: rgba(255, 255, 255, .7); }
#callscr.video-on .call-live-text {
  display: inline;
  padding: 7px 11px;
  border-radius: 13px;
  background: rgba(11, 11, 14, .54);
  color: #fff;
  font-size: 15px;
  line-height: 27px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

#callscr.video-on .call-quote {
  position: absolute;
  right: 20px;
  bottom: 143px;
  left: 20px;
  z-index: 3;
  width: auto;
  margin: 0;
  color: rgba(255, 255, 255, .84);
  font-size: 13px;
  line-height: 21px;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .65);
}

#callscr.video-on .call-bottom {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: none;
  padding: 34px 18px max(14px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(9, 9, 12, .68) 37%, rgba(9, 9, 12, .86));
}

#callscr.video-on .call-utility { color: rgba(255, 255, 255, .82); }
#callscr.video-on details { color: rgba(255, 255, 255, .78); }
#callscr.video-on .call-action { color: rgba(255, 255, 255, .82); }
#callscr.video-on .call-action .call-action-ico {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(24, 24, 29, .58);
  color: #fff;
  box-shadow: none;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

#callscr.video-on .call-action.muted .call-action-ico { background: rgba(255, 255, 255, .9); color: #24222b; }
#callscr.video-on #call-hangup .call-action-ico { background: var(--danger); color: #fff; }
#callscr.video-on .call-sheet-card { color: var(--ink); }

@media (max-width: 340px) {
  #callscr { padding-right: 12px; padding-left: 12px; }
  #callscr .call-avatar-wrap,
  #callscr .call-avatar { width: 94px; height: 94px; }
  #callscr .call-name { margin-top: 23px; font-size: 24px; }
  #callscr .call-live { width: 94%; }
  #callscr .call-ctrls { padding: 0; }
  #callscr .call-action .call-action-ico { width: 54px; height: 54px; }
  #callscr #call-hangup .call-action-ico { width: 60px; height: 60px; }
}

@media (max-height: 700px) {
  #callscr .call-avatar-wrap,
  #callscr .call-avatar { width: 82px; height: 82px; }
  #callscr .call-avatar-wrap { margin-top: 10px; }
  #callscr .call-name { margin-top: 17px; font-size: 23px; }
  #callscr .call-live { margin-top: 18px; }
  #callscr .call-live-text { font-size: 16px; line-height: 25px; }
  #callscr .call-quote { margin-top: 7px; }
  #callscr .call-action { min-height: 72px; }
  #callscr .call-action .call-action-ico { width: 50px; height: 50px; }
  #callscr #call-hangup .call-action-ico { width: 56px; height: 56px; }
  #callscr.video-on .call-live { bottom: 168px; }
  #callscr.video-on .call-quote { bottom: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  #callscr .call-avatar-wrap::before,
  #callscr .call-live-text.interim::after { animation: none; }
}
